We can now combine the chain rule with other rules for differentiating functions, but when we are differentiating the composition of three or more functions, we need to apply the chain rule more than once. If we look at this situation in general terms, we can generate a formula, but we do not need to remember it, as we can simply apply the chain rule multiple times.
In general terms, first we let
\[k \left(\right. x \left.\right) = h \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) .\]
Then, applying the chain rule once we obtain
\[k^{'} \left(\right. x \left.\right) = \frac{d}{d x} \left(\right. h \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) = h ' \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) \cdot \frac{d}{d x} f \left(\right. \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) .\]
Applying the chain rule again, we obtain
\[k^{'} \left(\right. x \left.\right) = h^{'} \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) f^{'} \left(\right. g \left(\right. x \left.\right) \left.\right) g^{'} \left(\right. x \left.\right) \left.\right) .\]
Rule: Chain Rule for a Composition of Three Functions
For all values of x for which the function is differentiable, if
\[k \left(\right. x \left.\right) = h \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) ,\]
then
\[k^{'} \left(\right. x \left.\right) = h^{'} \left(\right. f \left(\right. g \left(\right. x \left.\right) \left.\right) \left.\right) f^{'} \left(\right. g \left(\right. x \left.\right) \left.\right) g^{'} \left(\right. x \left.\right) .\]
In other words, we are applying the chain rule twice.
Notice that the derivative of the composition of three functions has three parts. (Similarly, the derivative of the composition of four functions has four parts, and so on.) Also, remember, we can always work from the outside in, taking one derivative at a time.
Example
3.55
Differentiating a Composite of Three Functions
Find the derivative of \(k \left(\right. x \left.\right) = \text{cos}^{4} \left(\right. \left(7 x\right)^{2} + 1 \left.\right) .\)
Solution
First, rewrite \(k \left(\right. x \left.\right)\) as
\[k \left(\right. x \left.\right) = \left(\right. \text{cos} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right)^{4} .\]
Then apply the power rule several times.
\[\begin{aligned} k^{'} \left(\right. x \left.\right) & = 4 \left(\right. \text{cos} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right)^{3} \left(\right. \frac{d}{d x} \text{cos} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right) & & & \text{Apply the chain rule}. \\ & = 4 \left(\right. \text{cos} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right)^{3} \left(\right. − \text{sin} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right) \left(\right. \frac{d}{d x} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right) & & & \text{Apply the chain rule}. \\ & = 4 \left(\right. \text{cos} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right)^{3} \left(\right. − \text{sin} \left(\right. 7 x^{2} + 1 \left.\right) \left.\right) \left(\right. 14 x \left.\right) & & & \text{Apply the chain rule}. \\ & = −56 x \text{sin} \left(\right. 7 x^{2} + 1 \left.\right) \text{cos}^{3} \left(\right. 7 x^{2} + 1 \left.\right) & & & \text{Simplify}. \end{aligned}\]
Checkpoint
3.38
Find the derivative of \(h \left(\right. x \left.\right) = \text{sin}^{6} \left(\right. x^{3} \left.\right) .\)
Example
3.56
Using the Chain Rule in a Velocity Problem
A particle moves along a coordinate axis. Its position at time t is given by \(s \left(\right. t \left.\right) = \text{sin} \left(\right. 2 t \left.\right) + \text{cos} \left(\right. 3 t \left.\right) .\) What is the velocity of the particle at time \(t = \frac{\pi}{6} ?\)
Solution
To find \(v \left(\right. t \left.\right) ,\) the velocity of the particle at time \(t ,\) we must differentiate \(s \left(\right. t \left.\right) .\) Thus,
\[v \left(\right. t \left.\right) = s^{'} \left(\right. t \left.\right) = 2 \text{cos} \left(\right. 2 t \left.\right) - 3 \text{sin} \left(\right. 3 t \left.\right) .\]
Substituting \(t = \frac{\pi}{6}\) into \(v \left(\right. t \left.\right) ,\) we obtain \(v \left(\right. \frac{\pi}{6} \left.\right) = −2 .\)
Checkpoint
3.39
A particle moves along a coordinate axis. Its position at time \(t\) is given by \(s \left(\right. t \left.\right) = \text{sin} \left(\right. 4 t \left.\right) .\) Find its acceleration at time \(t .\)
Proof
At this point, we present a very informal proof of the chain rule. For simplicity’s sake we ignore certain issues: For example, we assume that \(g \left(\right. x \left.\right) \neq g \left(\right. a \left.\right)\) for \(x \neq a\) in some open interval containing \(a .\) We begin by applying the limit definition of the derivative to the function \(h \left(\right. x \left.\right)\) to obtain \(h^{'} \left(\right. a \left.\right) :\)
\[h^{'} \left(\right. a \left.\right) = \underset{x \rightarrow a}{\text{lim}} \frac{f \left(\right. g \left(\right. x \left.\right) \left.\right) - f \left(\right. g \left(\right. a \left.\right) \left.\right)}{x - a} .\]
Rewriting, we obtain
\[h^{'} \left(\right. a \left.\right) = \underset{x \rightarrow a}{\text{lim}} \frac{f \left(\right. g \left(\right. x \left.\right) \left.\right) - f \left(\right. g \left(\right. a \left.\right) \left.\right)}{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)} \cdot \frac{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)}{x - a} .\]
Although it is clear that
\[\underset{x \rightarrow a}{\text{lim}} \frac{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)}{x - a} = g^{'} \left(\right. a \left.\right) ,\]
it is not obvious that
\[\underset{x \rightarrow a}{\text{lim}} \frac{f \left(\right. g \left(\right. x \left.\right) \left.\right) - f \left(\right. g \left(\right. a \left.\right) \left.\right)}{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)} = f^{'} \left(\right. g \left(\right. a \left.\right) \left.\right) .\]
To see that this is true, first recall that since g is differentiable at \(a , g\) is also continuous at \(a .\) Thus,
\[\underset{x \rightarrow a}{\text{lim}} g \left(\right. x \left.\right) = g \left(\right. a \left.\right) .\]
Next, make the substitution \(y = g \left(\right. x \left.\right)\) and \(b = g \left(\right. a \left.\right)\) and use change of variables in the limit to obtain
\[\underset{x \rightarrow a}{\text{lim}} \frac{f \left(\right. g \left(\right. x \left.\right) \left.\right) - f \left(\right. g \left(\right. a \left.\right) \left.\right)}{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)} = \underset{y \rightarrow b}{\text{lim}} \frac{f \left(\right. y \left.\right) - f \left(\right. b \left.\right)}{y - b} = f^{'} \left(\right. b \left.\right) = f^{'} \left(\right. g \left(\right. a \left.\right) \left.\right) .\]
Finally,
\[h^{'} \left(\right. a \left.\right) = \underset{x \rightarrow a}{\text{lim}} \frac{f \left(\right. g \left(\right. x \left.\right) \left.\right) - f \left(\right. g \left(\right. a \left.\right) \left.\right)}{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)} \cdot \frac{g \left(\right. x \left.\right) - g \left(\right. a \left.\right)}{x - a} = f^{'} \left(\right. g \left(\right. a \left.\right) \left.\right) g^{'} \left(\right. a \left.\right) .\]
□
Example
3.57
Using the Chain Rule with Functional Values
Let \(h \left(\right. x \left.\right) = f \left(\right. g \left(\right. x \left.\right) \left.\right) .\) If \(g \left(\right. 1 \left.\right) = 4 , g^{'} \left(\right. 1 \left.\right) = 3 ,\) and \(f^{'} \left(\right. 4 \left.\right) = 7 ,\) find \(h^{'} \left(\right. 1 \left.\right) .\)
Solution
Use the chain rule, then substitute.
\[\begin{aligned} h^{'} \left(\right. 1 \left.\right) & = f^{'} \left(\right. g \left(\right. 1 \left.\right) \left.\right) g^{'} \left(\right. 1 \left.\right) & & & \text{Apply the chain rule}. \\ & = f^{'} \left(\right. 4 \left.\right) \cdot 3 & & & \text{Substitute} g \left(\right. 1 \left.\right) = 4 \text{and} g^{'} \left(\right. 1 \left.\right) = 3 . \\ & = 7 \cdot 3 & & & \text{Substitute} f ' \left(\right. 4 \left.\right) = 7. \\ & = 21 & & & \text{Simplify}. \end{aligned}\]
Checkpoint
3.40
Given \(h \left(\right. x \left.\right) = f \left(\right. g \left(\right. x \left.\right) \left.\right) .\) If \(g \left(\right. 2 \left.\right) = −3 , g^{'} \left(\right. 2 \left.\right) = 4 ,\) and \(f^{'} \left(\right. −3 \left.\right) = 7 ,\) find \(h^{'} \left(\right. 2 \left.\right) .\)