Subsection 2.9.1 Statement of the Chain Rule
Theorem 2.9.2 The chain rule — version 1
Let \(a \in \mathbb{R}\) and let \(g(x)\) be a function that is differentiable at \(x=a\text{.}\) Now let \(f(u)\) be a function that is differentiable at \(u=g(a)\text{.}\) Then the function \(F(x) = f(g(x))\) is differentiable at \(x=a\) and
\begin{align*}
F'(a) &=f'\big(g(a)\big)\,g'(a)
\end{align*}
Here, as was the case earlier in this chapter, we have been very careful to give the point at which the derivative is evaluated a special name (i.e. \(a\)). But of course this evaluation point can really be any point (where the derivative is defined). So it is very common to just call the evaluation point “\(x\)” rather than give it a special name like “\(a\)”, like this:
Theorem 2.9.3 The chain rule — version 2
Let \(f\) and \(g\) be differentiable functions then
\begin{align*}
\diff{}{x} f\big( g( x) \big) &= f'\big(g(x)\big) \cdot g'(x)
\end{align*}
Notice that when we form the composition \(f\big(g(x)\big)\) there is an “outside” function (namely \(f(x)\)) and an “inside” function (namely \(g(x)\)). The chain rule tells us that when we differentiate a composition that we have to differentiate the outside and then multiply by the derivative of the inside.
\begin{align*}
\diff{}{x} f\big( g( x) \big)
&= \underbrace{f'\big(g(x)\big)}_\text{diff outside} \cdot
\underbrace{g'(x)}_\text{diff inside}
\end{align*}
Here is another statement of the chain rule which makes this idea more explicit.
Theorem 2.9.4 The chain rule — version 3
Let \(y = f(u)\) and \(u = g(x)\) be differentiable functions, then
\begin{align*}
\diff{y}{x} &= \diff{y}{u} \cdot \diff{u}{x}
\end{align*}
This particular form is easy to remember because it looks like we can just “cancel” the \(\mathrm{d}u\) between the two terms.
\begin{align*}
\diff{y}{x} &= \frac{\mathrm{d}{y}}{\cancel{\mathrm{d}u}} \cdot
\frac{\cancel{\mathrm{d}{u}}}{\mathrm{d}x}
\end{align*}
Of course, \(\mathrm{d}u\) is not, by itself, a number or variable 1 that can be cancelled. But this is still a good memory aid.
The hardest part about applying the chain rule is recognising when the function you are trying to differentiate is really the composition of two simpler functions. This takes a little practice. We can warm up with a couple of simple examples.
Example 2.9.5 Derivative of a power of \(\sin x\)
Let \(f(u) = u^5\) and \(g(x) = \sin(x)\text{.}\) Then set \(F(x) = f\big(g(x)\big) = \big(\sin(x)\big)^5\text{.}\) To find the derivative of \(F(x)\) we can simply apply the chain rule — the pieces of the composition have been laid out for us. Here they are.
\begin{align*}
f(u) &= u^5 & f'(u) &= 5u^4\\
g(x) &= \sin(x) & g'(x) &= \cos x
\end{align*}
We now just put them together as the chain rule tells us
\begin{align*}
\diff{F}{x} &= f'\big(g(x)\big) \cdot g'(x)\\
&= 5\big(g(x)\big)^4 \cdot \cos(x) & \text{since } f'(u) = 5u^4\\
&= 5 \big(\sin(x)\big)^4 \cdot \cos(x)
\end{align*}
Notice that it is quite easy to extend this to any power. Set \(f(u) = u^n\text{.}\) Then follow the same steps and we arrive at
\begin{align*}
F(x) &= (\sin(x))^n & F'(x) &= n \big(\sin(x) \big)^{n-1} \cos(x)
\end{align*}
This example shows one of the ways that the chain rule appears very frequently — when we need to differentiate the power of some simpler function. More generally we have the following.
Example 2.9.6 Derivative of a power of a function
Let \(f(u) = u^n\) and let \(g(x)\) be any differentiable function. Set \(F(x) = f\big(g(x)\big) = g(x)^n\text{.}\) Then
\begin{align*}
\diff{F}{x} = \diff{}{x} \big( g(x)^n \big) &= n g(x)^{n-1} \cdot g'(x)
\end{align*}
This is precisely the result in Example 2.6.6 and Lemma 2.6.7.
Example 2.9.7 Derivative of \(\cos(3x-2)\)
Let \(f(u) = \cos(u)\) and \(g(x) = 3x-2\text{.}\) Find the derivative of
\begin{align*}
F(x) &= f\big(g(x)\big) = \cos(3x-2).
\end{align*}
Again we should approach this by first writing down \(f\) and \(g\) and their derivatives and then putting everything together as the chain rule tells us.
\begin{align*}
f(u) &= \cos(u) & f'(u) &= -\sin(u)\\
g(x) &= 3x-2 & g'(x) &= 3
\end{align*}
So the chain rule says
\begin{align*}
F'(x) &= f'\big(g(x)\big) \cdot g'(x)\\
&= -\sin\big( g(x) \big) \cdot 3\\
&= -3 \sin(3x-2)
\end{align*}
This example shows a second way that the chain rule appears very frequently — when we need to differentiate some function of \(ax+b\text{.}\) More generally we have the following.
Example 2.9.8 Derivative of \(f(ax+b)\)
Let \(a,b \in \mathbb{R}\) and let \(f(x)\) be a differentiable function. Set \(g(x) = ax+b\text{.}\) Then
\begin{align*}
\diff{}{x} f(ax+b) &= \diff{}{x} f\big(g(x)\big)\\
&= f'\big(g(x)\big) \cdot g'(x)\\
&= f'(ax+b) \cdot a
\end{align*}
So the derivative of \(f(ax+b)\) with respect to \(x\) is just \(a f'(ax+b)\text{.}\)
The above is a very useful result that follows from the chain rule, so let's make it a corollary to highlight it.
Corollary 2.9.9
Let \(a,b \in \mathbb{R}\) and let \(f(x)\) be a differentiable function, then
\begin{align*}
\diff{}{x} f(ax+b) &= af'(ax+b).
\end{align*}
Example 2.9.10 2.9.1 continued
Let us now go back to our motivating campfire example. There we had
\begin{align*}
f(x) &= \text{ temperature at position $x$}\\
x(t) &= \text{ position at time $t$}\\
F(t) &= f(x(t)) = \text{ temperature at time $t$}
\end{align*}
The chain rule gave
\begin{align*}
F'(t) &= f'\big(x(t)\big) \cdot x'(t)
\end{align*}
Notice that the units of measurement on both sides of the equation agree — as indeed they must. To see this, let us assume that \(t\) is measured in seconds, that \(x(t)\) is measured in metres and that \(f(x)\) is measured in degrees. Because of this \(F(x(t))\) must also be measured in degrees (since it is a temperature).
What about the derivatives? These are rates of change. So
- \(F'(t)\) has units \(\frac{\rm degrees}{\rm second}\text{,}\)
- \(f'(x)\) has units \(\frac{\rm degrees}{\rm metre}\text{,}\) and
- \(x'(t)\) has units \(\frac{\rm metre}{\rm second}\text{.}\)
Hence the product
\begin{align*}
f'\big(x(t)\big) \cdot x'(t) &
\text{ has units } = \frac{\rm degrees}{\rm metre} \cdot
\frac{\rm metre}{\rm second}
= \frac{\rm degrees}{\rm second}.
\end{align*}
has the same units as \(F'(t)\text{.}\) So the units on both sides of the equation agree. Checking that the units on both sides of an equation agree is a good check of consistency, but of course it does not prove that both sides are in fact the same.