3.6 The Chain Rule
We have seen the techniques for differentiating basic functions \((x^{n},\text{sin}\mspace{2mu} x,\text{cos}\mspace{2mu} x,\text{etc}.)\) as well as sums, differences, products, quotients, and constant multiples of these functions. However, these techniques do not allow us to differentiate compositions of functions, such as \(h(x) = \text{sin}\left( x^{3} \right)\) or \(k(x) = \sqrt{3x^{2} + 1}.\) In this section, we study the rule for finding the derivative of the composition of two or more functions.
3.6.1 Deriving the Chain Rule
When we have a function that is a composition of two or more functions, we could use all of the techniques we have already learned to differentiate it. However, using all of those techniques to break down a function into simpler parts that we are able to differentiate can get cumbersome. Instead, we use the chain rule, which states that the derivative of a composite function is the derivative of the outer function evaluated at the inner function times the derivative of the inner function.
To put this rule into context, let’s take a look at an example: \(h(x) = \text{sin}\mspace{2mu}\left( x^{3} \right).\) We can think of the derivative of this function with respect to \(x\) as the rate of change of \(\text{sin}\left( x^{3} \right)\) relative to the change in \(x.\) Consequently, we want to know how \(\text{sin}\left( x^{3} \right)\) changes as \(x\) changes. We can think of this event as a chain reaction: As \(x\) changes, \(x^{3}\) changes, which leads to a change in \(\text{sin}\mspace{2mu}\left( x^{3} \right).\) This chain reaction gives us hints as to what is involved in computing the derivative of \(\ \text{sin}\left( x^{3} \right).\) First of all, a change in \(x\) forcing a change in \(x^{3}\) suggests that somehow the derivative of \(x^{3}\) is involved. In addition, the change in \(x^{3}\) forcing a change in \(\text{sin}\left( x^{3} \right)\) suggests that the derivative of \(\text{sin}(u)\) with respect to \(u,\) where \(u = x^{3},\) is also part of the final derivative.
We can take a more formal look at the derivative of \(h(x) = \text{sin}\mspace{2mu}\left( x^{3} \right)\) by setting up the limit that would give us the derivative at a specific value \(a\) in the domain of \(h(x) = \text{sin}\mspace{2mu}\left( x^{3} \right).\)
\[h'(a) = \underset{x\rightarrow a}{\text{lim}}\frac{\text{sin}\mspace{2mu}\left( x^{3} \right) - \text{sin}\left( a^{3} \right)}{x - a}. \tag{1}\]
This expression does not seem particularly helpful; however, we can modify it by multiplying and dividing by the expression \(x^{3} - a^{3}\) to obtain
\[h'(a) = \underset{x\rightarrow a}{\text{lim}}\frac{\text{sin}\mspace{2mu}\left( x^{3} \right) - \text{sin}\left( a^{3} \right)}{x^{3} - a^{3}} \cdot \frac{x^{3} - a^{3}}{x - a}. \tag{2}\]
From the definition of the derivative, we can see that the second factor is the derivative of \(x^{3}\) at \(x = a.\) That is,
\[\underset{x\rightarrow a}{\text{lim}}\frac{x^{3} - a^{3}}{x - a} = \frac{d}{dx}\left( x^{3} \right)_{x = a} = 3a^{2}. \tag{3}\]
However, it might be a little more challenging to recognize that the first term is also a derivative. We can see this by letting \(u = x^{3}\) and observing that as \(x\rightarrow a,u\rightarrow a^{3}\text{:}\)
\[\begin{array}{cl} {\underset{x\rightarrow a}{\text{lim}}\frac{\text{sin}\mspace{2mu}\left( x^{3} \right) - \text{sin}\mspace{2mu}\left( a^{3} \right)}{x^{3} - a^{3}}} & {= \underset{u\rightarrow a^{3}}{\text{lim}}\frac{\text{sin}\mspace{2mu} u - \text{sin}\mspace{2mu}\left( a^{3} \right)}{u - a^{3}}} \\ & {= \frac{d}{du}\left( {\text{sin}\mspace{2mu} u} \right)_{u = a^{3}}} \\ & {= \text{cos}\mspace{2mu}{\left( a^{3} \right).}} \end{array} \tag{4}\]
Thus, \(h'(a) = \text{cos}\left( a^{3} \right) \cdot 3a^{2}.\)
In other words, if \(h(x) = \text{sin}\mspace{2mu}\left( x^{3} \right),\) then \(h'(x) = \text{cos}\mspace{2mu}\left( x^{3} \right) \cdot 3x^{2}.\) Thus, if we think of \(h(x) = \text{sin}\left( x^{3} \right)\) as the composition \(\left( {f \circ g} \right)(x) = f\left( {g(x)} \right)\) where \(f(x) =\) sin \(x\) and \(g(x) = x^{3},\) then the derivative of \(h(x) = \text{sin}\left( x^{3} \right)\) is the product of the derivative of \(g(x) = x^{3}\) and the derivative of the function \(f(x) = \text{sin}\mspace{2mu} x\) evaluated at the function \(g(x) = x^{3}.\) At this point, we anticipate that for \(h(x) = \text{sin}\mspace{2mu}\left( {g(x)} \right),\) it is quite likely that \(h'(x) = \text{cos}(g(x))g'(x).\) As we determined above, this is the case for \(h(x) = \text{sin}\mspace{2mu}\left( x^{3} \right).\)
Now that we have derived a special case of the chain rule, we state the general case and then apply it in a general form to other composite functions. An informal proof is provided at the end of the section.
3.6.2 The Chain and Power Rules Combined
We can now apply the chain rule to composite functions, but note that we often need to use it with other rules. For example, to find derivatives of functions of the form \(h(x) = {(g(x))}^{n},\) we need to use the chain rule combined with the power rule. To do so, we can think of \(h(x) = \left( {g(x)} \right)^{n}\) as \(f\left( {g(x)} \right)\) where \(f(x) = x^{n}.\) Then \(f'(x) = nx^{n - 1}.\) Thus, \(f'\left( {g(x)} \right) = n\left( {g(x)} \right)^{n - 1}.\) This leads us to the derivative of a power function using the chain rule,
\[h'(x) = n\left( {g(x)} \right)^{n - 1}g'(x) \tag{8}\]
3.6.3 Combining the Chain Rule with Other Rules
Now that we can combine the chain rule and the power rule, we examine how to combine the chain rule with the other rules we have learned. In particular, we can use it with the formulas for the derivatives of trigonometric functions or with the product rule.
In the following example we apply the rule that we have just derived.
At this point we provide a list of derivative formulas that may be obtained by applying the chain rule in conjunction with the formulas for derivatives of trigonometric functions. Their derivations are similar to those used in Example 4 and Example 6. For convenience, formulas are also given in Leibniz’s notation, which some students find easier to remember. (We discuss the chain rule using Leibniz’s notation at the end of this section.) It is not absolutely necessary to memorize these as separate formulas as they are all applications of the chain rule to previously learned formulas.
3.6.4 Composites of Three or More Functions
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(x) = h\left( {f\left( {g(x)} \right)} \right). \tag{21}\]
Then, applying the chain rule once we obtain
\[k'(x) = \frac{d}{dx}\left( {h(f\left( {g(x)} \right)} \right) = h'\left( {f\left( {g(x)} \right)} \right) \cdot \frac{d}{dx}f\left( \left( {g(x)} \right) \right). \tag{22}\]
Applying the chain rule again, we obtain
\[k'(x) = h'\left( {f\left( {g(x)} \right)f'\left( {g(x)} \right)g'(x)} \right). \tag{23}\]
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.
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(x) \neq g(a)\) for \(x \neq a\) in some open interval containing \(a.\) We begin by applying the limit definition of the derivative to the function \(h(x)\) to obtain \(h'(a)\text{:}\)
\[h'(a) = \underset{x\rightarrow a}{\text{lim}}\frac{f\left( {g(x)} \right) - f\left( {g(a)} \right)}{x - a}. \tag{29}\]
Rewriting, we obtain
\[h'(a) = \underset{x\rightarrow a}{\text{lim}}\frac{f\left( {g(x)} \right) - f\left( {g(a)} \right)}{g(x) - g(a)} \cdot \frac{g(x) - g(a)}{x - a}. \tag{30}\]
Although it is clear that
\[\underset{x\rightarrow a}{\text{lim}}\frac{g(x) - g(a)}{x - a} = g'(a), \tag{31}\]
it is not obvious that
\[\underset{x\rightarrow a}{\text{lim}}\frac{f\left( {g(x)} \right) - f\left( {g(a)} \right)}{g(x) - g(a)} = f'\left( {g(a)} \right). \tag{32}\]
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(x) = g(a). \tag{33}\]
Next, make the substitution \(y = g(x)\) and \(b = g(a)\) and use change of variables in the limit to obtain
\[\underset{x\rightarrow a}{\text{lim}}\frac{f\left( {g(x)} \right) - f\left( {g(a)} \right)}{g(x) - g(a)} = \underset{y\rightarrow b}{\text{lim}}\frac{f(y) - f(b)}{y - b} = f'(b) = f'\left( {g(a)} \right). \tag{34}\]
Finally,
\[h'(a) = \underset{x\rightarrow a}{\text{lim}}\frac{f\left( {g(x)} \right) - f\left( {g(a)} \right)}{g(x) - g(a)} \cdot \frac{g(x) - g(a)}{x - a} = f'\left( {g(a)} \right)g'(a). \tag{35}\]
□
3.6.5 The Chain Rule Using Leibniz’s Notation
As with other derivatives that we have seen, we can express the chain rule using Leibniz’s notation. This notation for the chain rule is used heavily in physics applications.
\(\text{For}\ h(x) = f\left( {g(x)} \right),\) let \(u = g(x)\) and \(y = h(x) = f(u).\) Thus,
\[h'(x) = \frac{dy}{dx},f'\left( {g(x)} \right) = f'(u) = \frac{dy}{du}\ \text{and}\ g'(x) = \frac{du}{dx}. \tag{37}\]
Consequently,
\[\frac{dy}{dx} = h'(x) = f'\left( {g(x)} \right)g'(x) = \frac{dy}{du} \cdot \frac{du}{dx}. \tag{38}\]
For the following exercises, given \(y = f(u)\) and \(u = g(x),\) find \(\frac{dy}{dx}\) by using Leibniz’s notation for the chain rule: \(\frac{dy}{dx} = \frac{dy}{du}\ \frac{du}{dx}.\)
1. \(y = 3u - 6,u = 2x^{2}\)
2. \(y = 6u^{3},u = 7x - 4\)
Solution (click to reveal)
\(18u^{2} \cdot 7 = 18\left( {7x - 4} \right)^{2} \cdot 7\)
3. \(y = \text{sin}\mspace{2mu} u,u = 5x - 1\)
4. \(y = \text{cos}\mspace{2mu} u,u = \frac{\text{−}x}{8}\)
Solution (click to reveal)
\(\text{−}\text{sin}\mspace{2mu} u \cdot \frac{-1}{8} = \text{−}\text{sin}\mspace{2mu}\left( \frac{\text{−}x}{8} \right) \cdot \frac{-1}{8}\)
5. \(y = \text{tan}\mspace{2mu} u,u = 9x + 2\)
6. \(y = \sqrt{4u + 3},u = x^{2} - 6x\)
Solution (click to reveal)
\(\frac{8x - 24}{2\sqrt{4u + 3}} = \frac{4x - 12}{\sqrt{4x^{2} - 24x + 3}}\)
For each of the following exercises,
- decompose each function in the form \(y = f(u)\) and \(u = g(x),\) and
- find \(\frac{dy}{dx}\) as a function of \(x.\)
7. \(y = \left( {3x - 2} \right)^{6}\)
8. \(y = \left( {3x^{2} + 1} \right)^{3}\)
Solution (click to reveal)
- \(u = 3x^{2} + 1;\) b. \(18x\left( {3x^{2} + 1} \right)^{2}\)
9. \(y = \text{sin}^{5}(x)\)
10. \(y = \left( {\frac{x}{7} + \frac{7}{x}} \right)^{7}\)
Solution (click to reveal)
- \(f(u) = u^{7},u = \frac{x}{7} + \frac{7}{x};\) b. \(7\left( {\frac{x}{7} + \frac{7}{x}} \right)^{6} \cdot \left( {\frac{1}{7} - \frac{7}{x^{2}}} \right)\)
11. \(y = \text{tan}\mspace{2mu}\left( {\text{sec}\mspace{2mu} x} \right)\)
12. \(y = \text{csc}\mspace{2mu}\left( {\pi x + 1} \right)\)
Solution (click to reveal)
- \(f(u) = \text{csc}\mspace{2mu} u,u = \pi x + 1;\) b. \(\text{−}\pi\mspace{2mu}\text{csc}\mspace{2mu}\left( {\pi x + 1} \right) \cdot \text{cot}\mspace{2mu}\left( {\pi x + 1} \right)\)
13. \(y = \text{cot}^{2}x\)
14. \(y = -6\mspace{2mu}\left( \sin~x \right)^{- 3}\)
Solution (click to reveal)
- \(f(u) = -6u^{-3},u = \text{sin}\mspace{2mu} x,\) b. \(18\mspace{2mu}\left( \text{sin} \right)^{-4}x \cdot \text{cos}\mspace{2mu} x\)
For the following exercises, find \(\frac{dy}{dx}\) for each function.
15. \(y = \left( {3x^{2} + 3x - 1} \right)^{4}\)
16. \(y = \left( {5 - 2x} \right)^{-2}\)
Solution (click to reveal)
\(\frac{4}{\left( {5 - 2x} \right)^{3}}\)
17. \(y = \text{cos}^{3}\left( {\pi x} \right)\)
18. \(y = \left( {2x^{3} - x^{2} + 6x + 1} \right)^{3}\)
Solution (click to reveal)
\(6\left( {2x^{3} - x^{2} + 6x + 1} \right)^{2}\left( {3x^{2} - x + 3} \right)\)
19. \(y = \frac{1}{\text{sin}^{2}(x)}\)
20. \(y = \left( {\text{tan}\mspace{2mu} x + \text{sin}\mspace{2mu} x} \right)^{-3}\)
Solution (click to reveal)
\(-3\left( {\text{tan}\mspace{2mu} x + \text{sin}\mspace{2mu} x} \right)^{-4} \cdot \left( {\text{sec}^{2}x + \text{cos}\mspace{2mu} x} \right)\)
21. \(y = x^{2}\text{cos}^{4}x\)
22. \(y = \text{sin}\mspace{2mu}\left( {\text{cos}\mspace{2mu} 7x} \right)\)
Solution (click to reveal)
\(-7\mspace{2mu}\text{cos}\mspace{2mu}\left( {\text{cos}\mspace{2mu} 7x} \right) \cdot \text{sin}\mspace{2mu} 7x\)
23. \(y = \sqrt{6 + \text{sec}\mspace{2mu}\pi x^{2}}\)
24. \(y = \text{cot}^{3}\left( {4x + 1} \right)\)
Solution (click to reveal)
\(-12\mspace{2mu}\text{cot}^{2}(4x + 1) \cdot \text{csc}^{2}(4x + 1)\)
25. Let \(y = \left\lbrack {f(x)} \right\rbrack^{2}\) and suppose that \(f'(1) = 4\) and \(\frac{dy}{dx} = 10\) for \(x = 1.\) Find \(f(1).\)
26. Let \(y = \left( {f(x) + 5x^{2}} \right)^{4}\) and suppose that \(f(-1) = -4\) and \(\frac{dy}{dx} = 3\) when \(x = -1.\) Find \(f'(-1)\)
Solution (click to reveal)
\(10\frac{3}{4}\)
27. Let \(y = \left( {f(u) + 3x} \right)^{2}\) and \(u = x^{3} - 2x.\) If \(f(4) = 6\) and \(\frac{dy}{dx} = 18\) when \(x = 2,\) find \(f'(4).\)
28. [T] Find an equation of the tangent line to \(y = \text{−}\text{sin}\mspace{2mu}\left( \frac{x}{2} \right)\) at the origin. Use a calculator to graph the function and the tangent line together.
Solution (click to reveal)
\(y = \frac{-1}{2}x\)
29. [T] Find an equation of the tangent line to \(y = \left( {3x + \frac{1}{x}} \right)^{2}\) at the point \(\left( {1,16} \right).\) Use a calculator to graph the function and the tangent line together.
30. Find the \(x\)-coordinates at which the tangent line to \(y = \left( {x - \frac{6}{x}} \right)^{8}\) is horizontal.
Solution (click to reveal)
\(x = \pm \sqrt{6}\)
31. [T] Find an equation of the line that is normal to \(g(\theta) = \text{sin}^{2}\left( {\pi\theta} \right)\) at the point \(\left( {\frac{1}{4},\frac{1}{2}} \right).\) Use a calculator to graph the function and the normal line together.
For the following exercises, use the information in the following table to find \(h'(a)\) at the given value for \(a.\)
| \(x\) | \(f(x)\) | \(f'(x)\) | \(g(x)\) | \(g'(x)\) |
|---|---|---|---|---|
| 0 | 2 | 5 | 0 | 2 |
| 1 | 1 | −2 | 3 | 0 |
| 2 | 4 | 4 | 1 | −1 |
| 3 | 3 | −3 | 2 | 3 |
32. \(h(x) = f\left( {g(x)} \right);a = 0\)
Solution (click to reveal)
10
33. \(h(x) = g\left( {f(x)} \right);a = 0\)
34. \(h(x) = \left( {x^{4} + g(x)} \right)^{-2};a = 1\)
Solution (click to reveal)
\(- \frac{1}{8}\)
35. \(h(x) = \left( \frac{f(x)}{g(x)} \right)^{2};a = 3\)
36. \(h(x) = f\left( {x + f(x)} \right);a = 1\)
Solution (click to reveal)
\(-4\)
37. \(h(x) = \left( {1 + g(x)} \right)^{3};a = 2\)
38. \(h(x) = g\left( {2 + f\left( x^{2} \right)} \right);a = 1\)
Solution (click to reveal)
\(-12\)
39. \(h(x) = f\left( {g\left( {\text{sin}\mspace{2mu} x} \right)} \right);a = 0\)
40. [T] The position function of a freight train is given by \(s(t) = 100\left( {t + 1} \right)^{-2},\) with \(s\) in meters and \(t\) in seconds. At time \(t = 6\) s, find the train’s
- velocity and
- acceleration.
- Using a. and b. is the train speeding up or slowing down?
Solution (click to reveal)
- \(- \frac{200}{343}\) m/s, b. \(\frac{600}{2401}\) m/s2, c. The train is slowing down since velocity and acceleration have opposite signs.
41. [T] A mass hanging from a vertical spring is in simple harmonic motion as given by the following position function, where \(t\) is measured in seconds and \(s\) is in inches:
\(s(t) = -3\mspace{2mu}\text{cos}\mspace{2mu}\left( {\pi t + \frac{\pi}{4}} \right).\)
- Determine the position of the spring at \(t = 1.5\) s.
- Find the velocity of the spring at \(t = 1.5\) s.
42. [T] The total cost to produce \(x\) boxes of Thin Mint Girl Scout cookies is \(C\) dollars, where \(C = 0.0001x^{3} - 0.02x^{2} + 3x + 300.\) In \(t\) weeks production is estimated to be \(x = 1600 + 100t\) boxes.
- Find the marginal cost \(C'(x).\)
- Use Leibniz’s notation for the chain rule, \(\frac{dC}{dt} = \frac{dC}{dx} \cdot \frac{dx}{dt},\) to find the rate with respect to time \(t\) that the cost is changing.
- Use b. to determine how fast costs are increasing when \(t = 2\) weeks. Include units with the answer.
Solution (click to reveal)
- \(C'(x) = 0.0003x^{2} - 0.04x + 3\) b. \(\frac{dC}{dt} = 100 \cdot \left( {0.0003x^{2} - 0.04x + 3} \right)\) c. Approximately $90,300 per week
43. [T] The formula for the area of a circle is \(A = \pi r^{2},\) where \(r\) is the radius of the circle. Suppose a circle is expanding, meaning that both the area \(A\) and the radius \(r\) (in inches) are expanding.
- Suppose \(r = 2 - \frac{100}{\left( {t + 7} \right)^{2}}\) where \(t\) is time in seconds. Use the chain rule \(\frac{dA}{dt} = \frac{dA}{dr} \cdot \frac{dr}{dt}\) to find the rate at which the area is expanding.
- Use a. to find the rate at which the area is expanding at \(t = 4\) s.
44. [T] The formula for the volume of a sphere is \(S = \frac{4}{3}\pi r^{3},\) where \(r\) (in feet) is the radius of the sphere. Suppose a spherical snowball is melting in the sun.
- Suppose \(r = \frac{1}{\left( {t + 1} \right)^{2}} - \frac{1}{12}\) where \(t\) is time in minutes. Use the chain rule \(\frac{dS}{dt} = \frac{dS}{dr} \cdot \frac{dr}{dt}\) to find the rate at which the snowball is melting.
- Use a. to find the rate at which the volume is changing at \(t = 1\) min.
Solution (click to reveal)
- \(\frac{dS}{dt} = - \frac{8\pi r^{2}}{\left( {t + 1} \right)^{3}}\) b. The volume is decreasing at a rate of \(- \frac{\pi}{36}\) ft3/min.
45. [T] The daily temperature in degrees Fahrenheit of Phoenix in the summer can be modeled by the function \(T(x) = 94 - 10\mspace{2mu}\text{cos}\left\lbrack {\frac{\pi}{12}\left( {x - 2} \right)} \right\rbrack,\) where \(x\) is hours after midnight. Find the rate at which the temperature is changing at 4 p.m.
46. [T] The depth (in feet) of water at a dock changes with the rise and fall of tides. The depth is modeled by the function \(D(t) = 5\mspace{2mu}\text{sin}\mspace{2mu}\left( {\frac{\pi}{6}t - \frac{7\pi}{6}} \right) + 8,\) where \(t\) is the number of hours after midnight. Find the rate at which the depth is changing at 6 a.m.
Solution (click to reveal)
\(\sim 2.3\) ft/hr