Derivative of the composition of functions (chain rule)

This is the most important rule that will allow us to derive any type of function. This function can be as complicated as we want, but we will always be able to rewrite it with elementary functions and the compositions between them.

$$f(x) =\sin (ax+b)$$ is a composition of the elementary functions $$g (x) =\sin x$$ and $$h(x)=ax+b$$.

The function composition says that $$f(x)=g(h(x))$$ or, in another notation, $$f=h \circ g$$. We might also do compositions for three different functions, or four, or of all the functions that we want.

In the following table there appear several functions built from the composition of elementary functions and its derivatives.

Study it carefully and try to deduce the so-called chain rule:

$$f (x)$$ $$f'(x)$$
$$\sin 2x$$ $$\cos 2x \cdot 2$$
$$e^{x^2}$$ $$e^{x^2}\cdot 2x$$
$$(x^3+x)^{\frac{1}{2}}$$ $$\frac{1}{2}(x^3+x)^{-\frac{1}{2}}\cdot (3x^2+1)$$
$$\ln x^2$$ $$\frac{1}{x^2}\cdot 2x$$
$$g (h (x))$$ ?

If you have obtained it: congratulations! Verify your result and step up to the examples. If you could not deduce the chain rule, take a look at the next definition and apply it to the functions of the table to verify the results.

Chain rule

$$$f(x)=g(h(x)) \Rightarrow f'(x)=g'h((x)) \cdot h'(x)$$$

Let: $$f(x)=\sin 2x$$ We identify $$g(x)=\sin x$$ and $$h(x)= 2x$$, so $$f(x)=g(h(x))= \sin 2x$$.

Now we can apply the chain rule, $$f '(x) = \cos 2x \cdot 2 = 2\cos 2x$$

Let's complicate our functions a little bit more.

Let $$ f(x) =e^{x^3+2x+1}$$.

We identify $$g(x) =e^x$$ and $$h(x)= x^3+2x+1$$.

Let's apply the chain rule, $$f '(x)= e^{x^3+2x+1} \cdot (3x^2+2) $$

Let's keep on complicating it $$f(x)=\ln (\sin x^2))$$.

In this case we identify three functions:

$$g(x)= \ln x \\ h(x) =\sin x \\ t(x)=x^2$$

The chain rule still applies. Let's go with the calculation:

$$f'(x)=\frac{1}{sin x^2} \cdot \cos x^2 \cdot 2x=\frac{2x}{\tan x^2}$$

Let's now see that the quotient rule is, in fact, the same as the product rule by using the chain rule:

$$\dfrac{f(x)}{g(x)}=f(x)(g(x)^{-1}$$

$$$\Big(\dfrac{f(x)}{g(x)}\Big)'=f'(x)g(x)^{-1}+(-1)f(x)g(x)^{-2}=$$$ $$$=f'(x)g(x)^{-1}\dfrac{g(x)}{g(x)}-f(x)g(x)^{-2}g'(x)=\frac{f'(x)g(x)-f(x)g'(x)}{g^2(x)}$$$

Apparently this rule will allow us to derive any expression. The development of the calculation can be longer or shorter - since our function can be a composition of two, three or up to $$N$$ elementary functions - but, technically, this should not be a big problem.

It is also necessary to say that we can mix functions that need the chain rule, the product rule and the quotient rule at the same time. In these cases the calculation might be boring, but technically it is the same done until now.

Let's see a complex example:

$$f(x)=\dfrac{\ln \sqrt[3]{\sin 2x}}{x^2-4}$$

From a quick look it is already obvious that we will have to use the quotient rule.

So,$$$f'(x)=\frac{\Big(\ln \sqrt[3]{\sin 2x}\Big)' \cdot (x^2-4) - \ln (\sqrt[3]{\sin 2x}) \cdot 2x}{(x^2-4)^2}$$$

Now it is necessary to use the chain rule to derive the numerator $$$ \Big(\ln \sqrt[3]{\sin 2x} \Big)'=\frac{1}{\sqrt[3]{\sin 2x}}\cdot \Big(\frac{1}{3}\sin^{2/3} 2x\Big)\cdot \cos 2x\cdot 2=\frac{2 \cos 2x}{3 \sqrt[3]{sin^3 2x}}={2}{3\tan 2x} $$$

Using this result and introducing it into the first expression, $$$ f'(x)=\frac{\frac{2(x^2-4)}{3\tan 2x}-2x \cdot \ln \sqrt[3]{\sin 2x}}{(x^2-4)^2} \\ f'(x)=\frac{2}{3 \tan 2x \cdot (x^2-4)}-\frac{2x\cdot \ln \sqrt[3]{\sin 2x}}{(x^2-4)^2}$$$