# Chain Rule for more than two functions, general formula.

For a composition of $k$ functions, $F(x) = f_1 \circ f_2 \circ \dots \circ f_k(x)$, (I'm not sure if that is the correct notation for function composition of more than two functions), is there a general formula for finding $F'(x)$?

-
the correct notation is $f_1\circ f_2\circ...\circ f_k(x)=F(x)$ – janmarqz Jan 30 '14 at 1:54

Set $f_{k+1}(x)=x$ $$F'(x)=\prod\limits_{i=1}^{k}f'_i(f_{i+1} \circ f_{i+2} \circ \dots \circ f_k(x))$$

-

I always find it easier to think about the chain rule using Leibniz-style notation. In this style, the usual two step version of the chain rule is this:

$$\frac{\textrm{d}y}{\textrm{d}x}=\frac{\textrm{d}y}{\textrm{d}u}\cdot\frac{\textrm{d}u}{\textrm{d}x}$$

Now, if $v$ is an intermediate step between $y$ and $u$, then we also have this:

$$\frac{\textrm{d}y}{\textrm{d}u}=\frac{\textrm{d}y}{\textrm{d}v}\cdot\frac{\textrm{d}v}{\textrm{d}u}$$

Putting the two together gives: $$\frac{\textrm{d}y}{\textrm{d}x}=\frac{\textrm{d}y}{\textrm{d}v}\cdot\frac{\textrm{d}v}{\textrm{d}u}\cdot\frac{\textrm{d}u}{\textrm{d}x}$$

As an example, suppose we want to find $\frac{\textrm{d}y}{\textrm{d}x}$ where $$y=\sqrt{\sin(2x+1)}$$

Then we can put $u=2x+1$ and $y=\sqrt{\sin(u)}$. It's easy to find $\frac{\textrm{d}u}{\textrm{d}x}$, but $\frac{\textrm{d}y}{\textrm{d}u}$ requires another application of the chain rule. Put $v=\sin(u)$ so that $y=\sqrt{v}$. Now everything is easy:

\begin{eqnarray} \frac{\textrm{d}y}{\textrm{d}x} & = & \frac{\textrm{d}y}{\textrm{d}v}\cdot\frac{\textrm{d}v}{\textrm{d}u}\cdot\frac{\textrm{d}u}{\textrm{d}x} \\ & = & \frac{1}{2\sqrt{v}}\cdot \cos(u) \cdot 2 \\ & = & \frac{\cos(2x+1)}{\sqrt{\sin(u)}} \\ & = & \frac{\cos(2x+1)}{\sqrt{\sin(2x+1)}} \end{eqnarray}

-
And Leibniz notation shows its superiority once again! – Benjamin Jan 30 '14 at 2:23

This isn't quite an answer to the question asked, but maybe it's worth something.

Suppose $f(0) = 0$ and $f$ is twice differentiable in a neighborhood of 0. Then $$(\ \underbrace{f \circ \cdots \circ f }_n\ )''(0) = f''(0)\left( f'(0)^{n-1} + f'(0)^n + \cdots + f'(0)^{2n-2} \right) \text{ for }n \ge 1.$$

I found this $\ldots\ldots$ somewhere $\ldots\ldots$ and I expect it can be proved by induction on $n$.

-

You can compute it recursively: chain rule (Wikipedia)

To take the derivative of a composite of more than two functions, notice that the composite of f, g, and h (in that order) is the composite of f with g ∘ h.

E.g.: $(f \circ g \circ h)'(a) = f'((g \circ h)(a))\cdot (g \circ h)'(a) = f'((g \circ h)(a))\cdot g'(h(a))\cdot h'(a).$

-
It hadn't occurred to me that the composition of f, g, and h is the same as f with g and h. Thank you. – M. Knight Jan 30 '14 at 1:59

You can group the last $k - 1$ functions and use chain rule on that to get $$(f_1 \circ (f_2 \circ \dotsb \circ f_k))'(x) = {f_1}'((f_2 \circ \dotsb \circ f_k)(x)) \cdot (f_2 \circ \dotsb \circ f_k)'(x)$$ Now you can repeat the process for $(f_2 \circ \dotsb \circ f_k)'(x)$ to get $$(f_2 \circ \dotsb \circ f_k)'(x) = {f_2}'((f_3 \circ \dotsb \circ f_k)(x)) \cdot (f_3 \circ \dotsb \circ f_k)'(x)$$ and hence $$(f_1 \circ (f_2 \circ \dotsb \circ f_k))'(x) = {f_1}'((f_2 \circ \dotsb \circ f_k)(x)) \cdot {f_2}'((f_3 \circ \dotsb \circ f_k)(x)) \cdot (f_3 \circ \dotsb \circ f_k)'(x).$$ We can keep repeating this process until we reach the end when we get the formula given by Yangzhe Lau. You can make this more rigorous by proving it by induction.

-