Section 2.5 The Chain Rule
We have covered almost all of the derivative rules that deal with combinations of two (or more) functions. The operations of addition, subtraction, multiplication (including by a constant) and division led to the Sum/Difference Rule, the Constant Multiple Rule, the Power Rule with Integer Exponents, the Product Rule and the Quotient Rule. To complete the list of differentiation rules, we look at the last way two (or more) functions can be combined: the process of composition (i.e. one function “inside” another).
One example of a composition of functions is \(f(x) = \cos(x^2)\text{.}\) We currently do not know how to compute this derivative. If forced to guess, one might guess \(\fp(x) = \sin(2x)\text{,}\) where we recognize \(\sin(x)\) as the derivative of \(\cos(x)\) and \(2x\) as the derivative of \(x^2\text{.}\) However, this is not the case; \(\fp(x)\neq \sin(2x)\text{.}\) One way to see this is to examine the graph of \(y=\cos\mathopen{}\left(x^2\right)\mathclose{}\) in Figure 2.5.2 and its tangent line at \(x=\pi/2\text{.}\) Clearly the slope of the tangent line there is nonzero, but \(2\sin(2\cdot\pi/2)=0\text{.}\) So it can't be correct to say that \(y'=\sin(2x)\text{.}\)
In Example 2.5.9 we'll see the correct way to compute the derivative of \(\sin\mathopen{}\left(x^2\right)\mathclose{}\text{,}\) which employs the new rule this section introduces, the Chain Rule.
Before we define this new rule, recall the notation for composition of functions. We write \((f \circ g)(x)\) or \(f(g(x))\text{,}\) read as “\(f\) of \(g\) of \(x\text{,}\)” to denote composing \(f\) with \(g\text{.}\) In shorthand, we simply write \(f \circ g\) or \(f(g)\) and read it as “\(f\) of \(g\text{.}\)” Before giving the corresponding differentiation rule, we note that the rule extends to multiple compositions like \(f(g(h(x)))\) or \(f(g(h(j(x))))\text{,}\) etc.
To motivate the rule, let's look at three derivatives we can already compute.
Example 2.5.3. Exploring similar derivatives.
Find the derivatives of \(F_1(x) = (1x)^2\text{,}\) \(F_2(x) = (1x)^3\text{,}\) and \(F_3(x) = (1x)^4\text{.}\) (We'll see later why we are using subscripts for different functions and an uppercase \(F\text{.}\))
In order to use the rules we already have, we must first expand each function as
It is not hard to see that:
An interesting fact is that these can be rewritten as:
A pattern might jump out at you; note how the we end up multiplying by the old power and the new power is reduced by 1. We also always multiply by \((1)\text{.}\)
Recognize that each of these functions is a composition, letting \(g(x) = 1x\text{:}\)
We'll come back to this example after giving the formal statements of the Chain Rule; for now, we are just illustrating a pattern.
Theorem 2.5.4. The Chain Rule.
Let \(g\) be a differentiable function on an interval \(I\text{,}\) let the range of \(g\) be a subset of the interval \(J\text{,}\) and let \(f\) be a differentiable function on \(J\text{.}\) Then \(y=f(g(x))\) is a differentiable function on \(I\text{,}\) and
Here is the Chain Rule in words:
The derivative of the outside function, evaluated at the inside function, multiplied by the derivative of the inside function.
To help understand the Chain Rule, we return to Example 2.5.3.
Example 2.5.6. Using the Chain Rule.
Use the Chain Rule to find the derivatives of the functions \(F_1(x)\text{,}\) \(F_2(x)\text{,}\) and \(F_3(x)\text{,}\) as given in Example 2.5.3.
Example 2.5.3 ended with the recognition that each of the given functions was actually a composition of functions. To avoid confusion, we ignore most of the subscripts here.
 \(F_1(x) = (1x)^2\)

We found that
\begin{equation*} y=(1x)^2 = f(g(x))\text{,} \end{equation*}where \(f(x) = x^2\) and \(g(x) = 1x\text{.}\) To find \(y'\text{,}\) we apply the The Chain Rule. We need to note that \(\fp(x)=2x\) and \(g'(x)=1\text{.}\)
Part of the The Chain Rule uses \(\fp(g(x))\text{.}\) This means substitute \(g(x)\) for \(x\) in the equation for \(\fp(x)\text{.}\) That is, \(\fp(x) = 2(1x)\text{.}\) Finishing out the The Chain Rule we have
\begin{align*} y' \amp = \fp(g(x))\cdot g'(x)\\ \amp = 2(1x)\cdot (1)\\ \amp = 2(1x)\\ \amp = 2x2\text{.} \end{align*}  \(F_2(x) = (1x)^3\)

Let \(y = (1x)^3 = f(g(x))\text{,}\) where \(f(x) = x^3\) and \(g(x) = (1x)\text{.}\) We have \(\fp(x) = 3x^2\text{,}\) so \(\fp(g(x)) = 3(1x)^2\text{.}\) The The Chain Rule then states
\begin{align*} y' \amp = \fp(g(x))\cdot g'(x)\\ \amp = 3(1x)^2\cdot (1)\\ \amp = 3(1x)^2\text{.} \end{align*}  \(F_3(x) = (1x)^4\)

Finally, when \(y = (1x)^4\text{,}\) we have \(f(x)= x^4\) and \(g(x) = (1x)\text{.}\) Thus \(\fp(x) = 4x^3\) and \(\fp(g(x)) = 4(1x)^3\text{.}\) Thus
\begin{align*} y' \amp = \fp(g(x))\cdot g'(x)\\ \amp = 4(1x)^3\cdot (1)\\ \amp = 4(1x)^3\text{.} \end{align*}
Example 2.5.6 demonstrated a particular pattern: when \(f(x)=x^n\text{,}\) then \(y' =n\cdot (g(x))^{n1}\cdot g'(x)\text{.}\) This is called the Generalized Power Rule.
Theorem 2.5.7. Generalized Power Rule.
Let \(g(x)\) be a differentiable function and let \(n\neq 0\) be an integer. Then
This allows us to quickly find the derivative of functions like \(y = (3x^25x+7+\sin(x) )^{20}\text{.}\) While it may look intimidating, the Generalized Power Rule states that
Treat the derivativetaking process stepbystep. In the example just given, first multiply by \(20\text{,}\) then rewrite the inside of the parentheses, raising it all to the \(19\)th power. Then think about the derivative of the expression inside the parentheses, and multiply by that.
We now consider more examples that employ the The Chain Rule.
Example 2.5.8. Using the Chain Rule.
Find the derivatives of the following functions:
 \(y = \sin(2x)\text{.}\)
 \(y= \ln(4x^32x^2)\text{.}\)
 \(y = e^{x^2}\text{.}\)

Consider \(y = \sin(2x)\text{.}\) Recognize that this is a composition of functions, where \(f(x) = \sin(x)\) and \(g(x) = 2x\text{.}\) Thus
\begin{align*} y' \amp = \fp(g(x))\cdot g'(x)\\ \amp = \cos(2x)\cdot \lzoo{x}{2x}\\ \amp = \cos(2x)\cdot 2\\ \amp = 2\cos(2x)\text{.} \end{align*} 
Recognize that \(y = \ln\mathopen{}\left(4x^32x^2\right)\mathclose{}\) is the composition of \(f(x) = \ln(x)\) and \(g(x) = 4x^32x^2\text{.}\) Also, recall that
\begin{equation*} \lzoo{x}{\ln(x)} = \frac{1}{x}\text{.} \end{equation*}This leads us to:
\begin{align*} y' \amp = \frac{1}{4x^32x^2} \cdot \lzoo{x}{4x^32x^2}\\ \amp = \frac{1}{4x^32x^2} \cdot \left(12x^24x\right)\\ \amp = \frac{12x^24x}{4x^32x^2}\\ \amp = \frac{4x(3x1)}{2x(2x^2x)}\\ \amp = \frac{2(3x1)}{2x^2x}\text{.} \end{align*}Note that \(\ln\mathopen{}\left(4x^32x^2\right)\mathclose{}=\ln\mathopen{}\left(4x^2(x1/2)\right)\mathclose{}\) was only defined for \(x \gt 1/2\text{,}\) so the result of \(y'=\frac{2(3x1)}{2x^2x}\) is only valid for \(x \gt 1/2\) as well.

Recognize that \(y = e^{x^2}\) is the composition of \(f(x) = e^x\) and \(g(x) = x^2\text{.}\) Remembering that \(\fp(x) = e^x\text{,}\) we have
\begin{align*} y' \amp = e^{x^2}\cdot \lzoo{x}{x^2}\\ \amp = e^{x^2}\cdot (2x)\\ \amp = 2xe^{x^2}\text{.} \end{align*}
Example 2.5.9. Using the Chain Rule to find a tangent line.
Let \(f(x) = \cos(x^2)\text{.}\) Find the equation of the line tangent to the graph of \(f\) at \(x=1\text{.}\)
The tangent line goes through the point \((1,f(1)) \approx (1,0.54)\) with slope \(\fp(1)\text{.}\) To find \(\fp\text{,}\) we need the The Chain Rule.
\(\fp(x) = \sin(x^2) \cdot(2x) = 2x\sin(x^2)\text{.}\) Evaluated at \(x=1\text{,}\) we have \(\fp(1) = 2\sin(1) \approx 1.68\text{.}\) Thus the equation of the tangent line is approximated by
The tangent line is sketched along with \(f\) in Figure 2.5.10.
The The Chain Rule is used often in taking derivatives. Because of this, one can become familiar with the basic process and learn patterns that facilitate finding derivatives quickly. For instance,
A concrete example of this is
While the derivative may look intimidating at first, look for the pattern. The denominator is the same as what was inside the natural log function; the numerator is simply its derivative.
This pattern recognition process can be applied to lots of functions. In general, instead of writing “anything”, we use \(u\) as a generic function of \(x\text{.}\) We then say
The following is a short list of how the The Chain Rule can be quickly applied to familiar functions.
 \(\lzoo{x}{u^n} = n\cdot u^{n1}\cdot u'\text{.}\)
 \(\lzoo{x}{e^u} = e^u \cdot u'\text{.}\)
 \(\lzoo{x}{\sin(u)} = \cos(u) \cdot u'\text{.}\)
 \(\lzoo{x}{\cos(u)} = \sin(u)\cdot u'\text{.}\)
 \(\lzoo{x}{\tan(u)} = \sec^2(u) \cdot u'\text{.}\)
Of course, the The Chain Rule can be applied in conjunction with any of the other rules we have already learned. We practice this next.
Example 2.5.11. Using the Product, Quotient and Chain Rules.
Find the derivatives of the following functions.
 \(f(x) = x^5 \sin(2x^3)\text{.}\)
 \(f(x) = \dfrac{5x^3}{e^{x^2}}\text{.}\)

We must use the Product Rule and The Chain Rule. Do not think that you must be able to “see” the whole answer immediately; rather, just proceed stepbystep.
\begin{align*} \fp(x) \amp = x^5 \cdot \lzoo{x}{\sin\mathopen{}\left(2x^3\right)\mathclose{}} + \sin\mathopen{}\left(2x^3\right)\mathclose{}\cdot \lzoo{x}{x^5}\\ \amp = x^5\left(\cos\mathopen{}\left(2x^3\right)\mathclose{}\cdot \lzoo{x}{2x^3} \right) + 5x^4\left(\sin\mathopen{}\left(2x^3\right)\mathclose{} \right)\\ \amp = x^5\big(6x^2\cos\left(2x^3\right) \big) + 5x^4\big(\sin\left(2x^3\right) \big)\\ \amp = 6x^7\cos\mathopen{}\left(2x^3\right)\mathclose{}+5x^4\sin\mathopen{}\left(2x^3\right)\mathclose{}\text{.} \end{align*} 
We must employ the Quotient Rule along with the The Chain Rule. Again, proceed stepbystep.
\begin{align*} \fp(x) \amp= \frac{e^{x^2}\cdot \lzoo{x}{5x^3}  5x^3\cdot \lzoo{x}{e^{x^2}}}{\left(e^{x^2}\right)^2}\\ \amp= \frac{e^{x^2}\cdot 15x^2  5x^3\cdot e^{x^2}\cdot \lzoo{x}{x^2}}{\left(e^{x^2}\right)^2}\\ \amp= \frac{e^{x^2}\left(15x^2\right)  5x^3\left((2x)e^{x^2}\right)}{\left(e^{x^2}\right)^2}\\ \amp =\frac{e^{x^2}\left(10x^4+15x^2\right)}{e^{2x^2}}\\ \amp = e^{x^2}\left(10x^4+15x^2\right)\text{.} \end{align*}
A key to correctly working these problems is to break the problem down into smaller, more manageable pieces. For instance, when using the Product Rule and The Chain Rule together, just consider the first part of the Product Rule at first: \(f(x)g'(x)\text{.}\) Just rewrite \(f(x)\text{,}\) then find \(g'(x)\text{.}\) Then move on to the \(\fp(x)g(x)\) part. Don't attempt to figure out both parts at once.
Likewise, using the Quotient Rule, approach the numerator in two steps and handle the denominator after completing that. Only simplify afterward.
We can also employ the The Chain Rule itself several times, as shown in the next example.
Example 2.5.12. Using the Chain Rule multiple times.
Find the derivative of \(y = \tan^5(6x^37x)\text{.}\)
Recognize that we have the \(g(x)=\tan\mathopen{}\left(6x^37x\right)\mathclose{}\) function “inside” the \(f(x)=x^5\) function; that is, we have \(y = \left(\tan\mathopen{}\left(6x^37x\right)\mathclose{}\right)^5\text{.}\) We begin using the Generalized Power Rule; in this first step, we do not fully compute the derivative. Rather, we are approaching this stepbystep.
We now find \(g'(x)\text{.}\) We again need the The Chain Rule;
Combine this with what we found above to give
This function is frankly a ridiculous function, possessing no real practical value. It is very difficult to graph, as the tangent function has many vertical asymptotes and \(6x^37x\) grows so very fast. The important thing to learn from this is that the derivative can be found. In fact, it is not “hard”; one can take several simple steps and should be careful to keep track of how to apply each of these steps.
It is a traditional mathematical exercise to find the derivatives of arbitrarily complicated functions just to demonstrate that it can be done. Just break everything down into smaller pieces.
Example 2.5.13. Using the Product, Quotient and Chain Rules.
Find the derivative of \(f(x) = \frac{x\cos(x^{2})\sin^2(e^{4x})}{\ln(x^2+5x^4)}\text{.}\)
This function likely has no practical use outside of demonstrating derivative skills. The answer is given below without simplification. It employs the Quotient Rule, the Product Rule, and the The Chain Rule three times.
The reader is highly encouraged to look at each term and recognize why it is there. (i.e., the Quotient Rule is used; in the numerator, identify the “LOdHI” term, etc.) This example demonstrates that derivatives can be computed systematically, no matter how arbitrarily complicated the function is.
The The Chain Rule also has theoretic value. That is, it can be used to find the derivatives of functions that we have not yet learned as we do in the following example.
Example 2.5.14. The Chain Rule and exponential functions.
Use the Chain Rule to find the derivative of \(y= 2^x\text{.}\)
We only know how to find the derivative of one exponential function, \(y = e^x\text{.}\) We can accomplish our goal by rewriting \(2\) in terms of \(e\text{.}\) Recalling that \(e^x\) and \(\ln(x)\) are inverse functions, we can write \(2=e^{\ln 2}\) and so
using the “power to a power” property of exponents.
The function is now the composition \(y=f(g(x))\text{,}\) with \(f(x) = e^x\) and \(g(x) = x(\ln(2))\text{.}\) Since \(\fp(x) = e^x\) and \(g'(x) = \ln(2)\text{,}\) the The Chain Rule gives
Recall that the \(e^{x(\ln(2))}\) term on the right hand side is just \(2^x\text{,}\) our original function. Thus, the derivative contains the original function itself. We have
We can extend this process to use any base \(a\text{,}\) where \(a \gt 0\) and \(a\neq 1\text{.}\) All we need to do is replace each “2” in our work with “\(a\text{.}\)” The Chain Rule, coupled with the derivative rule of \(e^x\text{,}\) allows us to find the derivatives of all exponential functions.
The comment at the end of previous example is important and is restated formally as a theorem.
Theorem 2.5.15. Derivatives of Exponential Functions.
Let \(f(x)=a^x\text{,}\) for \(a \gt 0, a\neq 1\text{.}\) Then \(f\) is differentiable for all real numbers (i.e., differentiable everywhere) and
Alternate Chain Rule Notation.
It is instructive to understand what the The Chain Rule “looks like” using “\(\lz{y}{x}\)” notation instead of \(y'\) notation. Suppose that \(y=f(u)\) is a function of \(u\text{,}\) where \(u=g(x)\) is a function of \(x\text{,}\) as stated in Theorem 2.5.4. Then, through the composition \(f \circ g\text{,}\) we can think of \(y\) as a function of \(x\text{,}\) as \(y=f(g(x))\text{.}\) Thus the derivative of \(y\) with respect to \(x\) makes sense; we can talk about \(\lz{y}{x}\text{.}\) This leads to an interesting progression of notation:
Here the “fractional” aspect of the derivative notation stands out. On the right hand side, it seems as though the “\(du\)” terms cancel out, leaving
It is important to realize that we are not canceling these terms; the derivative notation of \(\lz{y}{u}\) is one symbol. It is equally important to realize that this notation was chosen precisely because of this behavior. It makes applying the The Chain Rule easy with multiple variables. For instance,
where \(\bigcirc\) and \(\triangle\) are any variables you'd like to use.
One of the most common ways of “visualizing” the The Chain Rule is to consider a set of gears, as shown in Figure 2.5.17. The gears have \(36\text{,}\) \(18\text{,}\) and \(6\) teeth, respectively. That means for every revolution of the \(x\) gear, the \(u\) gear revolves twice. That is, the rate at which the \(u\) gear makes a revolution is twice as fast as the rate at which the \(x\) gear makes a revolution.
Using the terminology of calculus, the rate of \(u\)change, with respect to \(x\text{,}\) is \(\lz{u}{x} = 2\text{.}\)
Likewise, every revolution of \(u\) causes \(3\) revolutions of \(y\text{:}\) \(\lz{y}{u} = 3\text{.}\) How does \(y\) change with respect to \(x\text{?}\) For each revolution of \(x\text{,}\) \(y\) revolves \(6\) times; that is,
We can then extend the The Chain Rule with more variables by adding more gears to the picture.
It is difficult to overstate the importance of the The Chain Rule. So often the functions that we deal with are compositions of two or more functions, requiring us to use this rule to compute derivatives. It is also often used in real life when actual functions are unknown. Through measurement, we can calculate (or, approximate) \(\lz{y}{u}\) and \(\lz{u}{x}\text{.}\) With our knowledge of the The Chain Rule, we can find \(\lz{y}{x}\text{.}\)
In Section 2.6, we use the The Chain Rule to justify another differentiation technique. There are many curves that we can draw in the plane that fail the “vertical line test.” For instance, consider \(x^2+y^2=1\text{,}\) which describes the unit circle. We may still be interested in finding slopes of tangent lines to the circle at various points. Section 2.6 shows how we can find \(\lz{y}{x}\) without first “solving for \(y\text{.}\)” While we can in this instance, in many other instances solving for \(y\) is impossible. In these situations, implicit differentiation is indispensable.
Exercises Exercises
Terms and Concepts
1.
True
False
2.
True
False
3.
True
False
4.
True
False
5.
True
False
6.
True
False
Problems
Compute the derivative of the given function.
7.
\(f(x) = \left(4x^3x\right)^{10}\)
8.
\(f(t) = (3t2)^{5}\)
9.
\(g(\theta)=(\sin(\theta)+\cos(\theta))^3\)
10.
\(h(t) = e^{3t^2+t1}\)
11.
\(f(x) = {\left(\ln\!\left(x\right)+x^{2}\right)^{3}}\)
12.
\(f(x) = {2^{x^{3}+3x}}\)
13.
\(f(x) = {\left(x+\frac{1}{x}\right)^{4}}\)
14.
\(f(x) = {\cos\!\left(3x\right)}\)
15.
\(g(x) = {\tan\!\left(5x\right)}\)
16.
\(h(\theta) = {\tan\!\left(\theta^{2}+4\right)}\)
17.
\(g(t) = {\sin\!\left(t^{2}+\frac{1}{t}\right)}\)
18.
\(h(t) = {\sin^{4}\!\left(2t\right)}\)
19.
\(p(t) = {\sin^{3}\!\left(t^{2}+3t+1\right)}\)
20.
\(f(x) = {\ln\!\left(\cos\!\left(x\right)\right)}\)
21.
\(f(x) = {\ln\!\left(x^{2}\right)}\)
22.
\(f(x) = {2\ln\!\left(x\right)}\)
23.
\(g(r) = {4^{r}}\)
24.
\(g(t) = {5^{\cos\!\left(t\right)}}\)
25.
\(g(t) = {15^{2}}\)
26.
\(m(w) = {\frac{3^{w}}{2^{w}}}\)
27.
\(h(t) = {\frac{2^{t}+3}{3^{t}+2}}\)
28.
\(m(w) = {\frac{3^{w}+1}{2^{w}}}\)
29.
\(f(x) = {\frac{3^{x^{2}}+x}{2^{x^{2}}}}\)
30.
\(f(x) = {x^{2}\sin\!\left(5x\right)}\)
31.
\(f(x) = {\left(x^{2}+x\right)^{5}\!\left(3x^{4}+2x\right)^{3}}\)
32.
\(g(t) = {\sin\!\left(t^{2}+3t\right)\cos\!\left(5t7\right)}\)
33.
\(f(x) = {\sin\!\left(3x+4\right)\cos\!\left(52x\right)}\)
34.
\(g(t) = {e^{5t^{2}}\sin\!\left(\frac{1}{t}\right)}\)
35.
\(f(x) = {\frac{\sin\!\left(4x+1\right)}{\left(5x9\right)^{3}}}\)
36.
\(f(x) = {\frac{\left(4x+1\right)^{2}}{\sin\!\left(5x\right)}}\)
Find the equations of tangent and normal lines to the graph of the function at the given point. Note: the functions here are the same as in Exercises 2.5.7 through Exercise 2.5.10.
37.
\(f(x) = \left(4x^3x\right)^{10}\) at \(x=0\)
38.
\(f(x) = (3x2)^5\) at \(x=1\)
39.
\(g(x) = (\sin(x)+\cos(x))^3\) at \(x=\pi/2\text{.}\)
40.
\(h(x) = e^{3x^2+x1}\) at \(x=1\)
41.
Compute \(\lzoo{x}{\ln(kx)}\) two ways. First by using the Chain Rule. Second, by using the logarithm rule \(\ln(ab) = \ln(a) + \ln(b)\) and then taking the derivative.
42.
Compute \(\lzoo{x}{\ln\mathopen{}\left(x^k\right)\mathclose{}}\) two ways. First by using the Chain Rule. Second, by using the logarithm rule \(\ln\mathopen{}\left(a^p\right)\mathclose{} = p\ln(a)\) (for positive \(a\)) and then taking the derivative.
Review
43.
The “wind chill factor” is a measurement of how cold it “feels” during cold, windy weather. Let \(W(w)\) be the wind chill factor, in degrees Fahrenheit, when it is \(25^\circ\)F outside with a wind of \(w\) mph.
What are the units of \(W'(w)\text{?}\)

What would you expect the sign of \(W'(10)\) to be?
positive
negative
44.
Find the derivatives of the following functions.
\(f(x) = {2xe^{x}\cot\!\left(x\right)}\)
\(g(x) = {2^{x}\cdot 3^{x}\cdot 4^{x}}\)