2.6: Chain Rule
- Page ID
- 71052
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)There is one more type of complicated function that we will want to know how to differentiate: composition. The Chain Rule will let us find the derivative of a composition. (This is the last derivative rule we will learn!)
Find the derivative of \( y=\left(4x^3+15x\right)^2 \).
Solution
This is not a simple polynomial, so we can’t use the basic building block rules yet. It is a product, so we could write it as \(y=\left(4x^3+15x\right)^2=\left(4x^3+15x\right)\left(4x^3+15x\right)\) and use the product rule. Or we could multiply it out and simply differentiate the resulting polynomial. I’ll do it the second way: \[ \begin{align*} y & = \left(4x^3+15x\right)^2\\ & = 16x^6+120x^4+225x^2\\ y' & = 96x^5+480x^3+450x \end{align*} \nonumber \]
Now suppose we want to find the derivative of \(y=\left(4x^3+15x\right)^{20}\). We could write it as a product with 20 factors and use the product rule, or we could multiply it out. But I don't want to do that, do you?
We need an easier way, a rule that will handle a composition like this. The Chain Rule is a little complicated, but it saves us the much more complicated algebra of multiplying something like this out. It will also handle compositions where it wouldn't be possible to multiply it out.
The Chain Rule is a common place for students to make mistakes. Part of the reason is that the notation takes a little getting used to. And part of the reason is that students often forget to use it when they should. When should you use the Chain Rule? Almost every time you take a derivative.
In what follows, \(f\) and \(g\) are differentiable functions where \(y = f(g(x))\). We could alternatively write \( y=f(u) \) and \( u=g(x) \).
Chain Rule (Leibniz notation)
\[\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}\nonumber \]
Notice that the \(du\)’s seem to cancel. This is one advantage of the Leibniz notation – it can remind you of how the chain rule chains together.
Chain Rule (using prime notation)
\[\frac{d}{dx} f\left(g(x)\right) =f'\left(g(x)\right)\cdot g'(x)\nonumber \]
Chain Rule (in words)
The derivative of a composition is the derivative of the outside (with the inside staying the same) TIMES the derivative of the inside.
I recite the version in words each time I take a derivative, especially if the function is complicated.
Find the derivative of \( y=\left(4x^3+15x\right)^2 \).
Solution
This is the same one we did before by multiplying out. This time, let’s use the Chain Rule: The inside function is what appears inside the parentheses: \( 4x^3+15x \). The outside function is the first thing we find as we come in from the outside – it’s the square function, \((\text{inside})^2\).
The derivative of this outside function is \((2\cdot\text{inside})\). Now using the chain rule, the derivative of our original function is \((2\cdot\text{inside})\) TIMES the derivative of the inside (which is \( 12x^2+15 \)): \[ y'=2\left(4x^3+15x\right)\left(12x^2+15 \right)\nonumber \]
If you multiply this out, you get the same answer we got before. Hurray! Algebra works!
Find the derivative of \( y=\left(4x^3+15x\right)^{20} \).
Solution
Now we have a way to handle this one. It’s the derivative of the outside TIMES the derivative of the inside.
The outside function is \( \left(\text{inside}\right)^{20} \), which has derivative \( 20\left(\text{inside}\right)^{19}\), so \[y'=20\left(4x^3+15x\right)^{19}\left(12x^2+15\right).\nonumber \]
Differentiate \( y=e^{x^2+5} \).
Solution
This isn’t a simple exponential function; it’s a composition. Typical calculator or computer syntax can help you see what the “inside” function is here. On a TI calculator, for example, when you push the \( e^x \) key, it opens up parentheses: \(\boxed{e^{\wedge}(}\). This tells you that the "inside" of the exponential function is the exponent. Here, the inside is the exponent \( x^2+5 \). Now we can use the Chain Rule: We want the derivative of the outside TIMES the derivative of the inside. The outside is the \(e\) to the something
function, so its derivative is the same thing. The derivative of what’s inside is \(2x\). So \[\frac{d}{dx}\left( e^{x^2+5} \right)= \left( e^{x^2+5} \right)\cdot (2x).\nonumber \]
The table gives values for \(f\), \(f'\), \(g\), and \(g'\) at a number of points. Use these values to determine \(( f \circ g )(x)\) and \(( f \circ g ) '(x)\) at \(x = -1\) and 0.
\( x \) | \( f(x) \) | \( g(x) \) | \( f'(x) \) | \( g'(x) \) | \((f\circ g)(x)\) | \((g\circ f)(x)\) |
-1 | 2 | 3 | 1 | 0 | ||
0 | -1 | 1 | 3 | 2 | ||
1 | 1 | 0 | -1 | 3 | ||
2 | 3 | -1 | 0 | 1 | ||
3 | 0 | 2 | 2 | -1 |
Solution
\[ \begin{align*} (f\circ g)(-1) & = f\left(g(-1)\right)=f(3)=0\\ (f\circ g)(0) & = f\left(g(0)\right)=f(1)=1\\ (f\circ g)'(-1) & = f'\left(g(-1)\right)\cdot g'(-1)=f'(3)\cdot (0)=(2)(0)=0 \text{ and}\\ (f\circ g)'(0) & = f'\left(g(0)\right)\cdot g'(0)=f'(1)\cdot (2)=(-1)(2)=-2 \end{align*} \nonumber \]
If 2400 people now have a disease, and the number of people with the disease appears to double every 3 years, then the number of people expected to have the disease in \(t\) years is \( y=2400\cdot 2^{t/3} \).
- How many people are expected to have the disease in 2 years?
- When are 50,000 people expected to have the disease?
- How fast is the number of people with the disease expected to grow now and 2 years from now?
- In 2 years, \(y = 2400\cdot 2^{2/3} \approx 3,810\) people.
- We know \(y = 50,000\), and we need to solve \(50,000 = 2400\cdot 2^{t/3}\) for \(t\). We could start by isolating the exponential by dividing both sides by 2400, \[ \begin{align*} \frac{50000}{2400} & = 2^{t/3} \\ \ln\left(\frac{50000}{2400}\right) & = \ln\left(2^{t/3}\right) \qquad \text{(Taking the natural log of both sides.)}\\ \ln\left(\frac{50000}{2400}\right) & = \frac{t}{3}\ln(2) \qquad \text{(Using the exponent property for logs.)}\\ t & = \frac{3\ln\left(\frac{50000}{2400}\right)}{\ln(2)}\approx 13.14\text{ years}\qquad \text{(Solving for \( t \).)} \end{align*} \nonumber \] We expect 50,000 people to have the disease about 13.14 years from now.
- This is asking for \(\frac{dy}{dt}\) when \(t =\) 0 and 2 years. Using the chain rule, \[ \begin{align*} \frac{dy}{dt} & = \frac{d}{dt}\left(2400\cdot 2^{t/3}\right) \\ & = 2400\cdot 2^{t/3}\cdot \ln(2)\cdot\frac{1}{3} \\ & \approx 554.5\cdot 2^{t/3} \end{align*} \nonumber \] So, at \( t=0 \) the rate of growth of the disease is approximately \(554.5\cdot 2^0 \approx 554.5\) people/year. In 2 years the rate of growth will be approximately \(554.5\cdot 2^{2/3} \approx 880\) people/year.
Derivatives of Complicated Functions
You're now ready to take the derivative of some mighty complicated functions. But how do you tell what rule applies first? Work your way in from the outside – what do you encounter first? That’s the first rule you need. Use the Product, Quotient, and Chain Rules to peel off the layers, one at a time, until you’re all the way inside.
Find \( \frac{d}{dx}\left( e^{3x}\cdot\ln(5x+7) \right) \).
Solution
Coming in from the outside, we see that this is a product of two (complicated) functions. So we’ll need the Product Rule first. we’ll fill in the pieces we know, and then we can figure the rest as separate steps and substitute in at the end: \[\frac{d}{dx}\left( e^{3x}\cdot\ln(5x+7) \right)=\left( \frac{d}{dx}\left( e^{3x}\right)\right)\cdot\ln(5x+7)+ e^{3x}\cdot \left(\frac{d}{dx}\left(\ln(5x+7) \right)\right)\nonumber \]
Now as separate steps, we’ll find \[\frac{d}{dx}\left( e^{3x}\right)=3e^{3x} \quad \text{ (using the Chain Rule)}\nonumber \] and \[\frac{d}{dx}\left(\ln(5x+7) \right)=\frac{1}{5x+7}\cdot 5 \quad \text{ (also using the Chain Rule)}.\nonumber \]
Finally, to substitute these in their places:\[\frac{d}{dx}\left( e^{3x}\cdot\ln(5x+7) \right)=\left( 3e^{3x}\right)\cdot\ln(5x+7)+ e^{3x}\cdot \left(\frac{1}{5x+7}\cdot 5\right)\nonumber \]
(We can stop here – we don't need to try to simplify any further.)
Differentiate \( z=\left(\dfrac{3t^3}{e^t(t-1)}\right)^4 \).
Solution
Don’t panic! As we come in from the outside, what’s the first thing we encounter? It’s that fourth power. That tells us that this is a composition, a (complicated) function raised to the fourth power.
Step One: Use the Chain Rule. The derivative of the outside TIMES the derivative of the inside: \[\frac{dz}{dt}=\frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right)^4=4\left(\frac{3t^3}{e^t(t-1)}\right)^3\cdot \frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right)\nonumber \]
Now we’re one step inside, and we can concentrate on just the \( \frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right) \) part. Now, as you come in from the outside, the first thing you encounter is a quotient – this is the quotient of two (complicated) functions.
Step Two: Use the Quotient Rule. The derivative of the numerator is straightforward, so we can just calculate it. The derivative of the denominator is a bit trickier, so we'll leave it for now: \[ \frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right)=\frac{\left( 9t^2 \right)\left( e^t(t-1) \right)-\left( 3t^3 \right)\left( \frac{d}{dt}\left( e^t(t-1) \right) \right)}{\left(e^t(t-1)\right)^2} \nonumber \]
Now we’ve gone one more step inside, and we can concentrate on just the \( \frac{d}{dt}\left( e^t(t-1) \right) \) part, which involves a product.
Step Three: Use the Product Rule: \[ \frac{d}{dt}\left( e^t(t-1)\right) = \left( e^t \right)(t-1)+\left( e^t \right)(1)\nonumber \]
And now we’re all the way in – no more derivatives to take!
Step Four: Now it’s just a question of substituting back – be careful now!
\[ \frac{d}{dt}\left( e^t(t-1)\right) = \left( e^t \right)(t-1)+\left( e^t \right)(1) \nonumber \] so \[ \frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right)=\frac{\left( 9t^2 \right)\left( e^t(t-1) \right)-\left( 3t^3 \right)\left( \left( e^t \right)(t-1)+\left( e^t \right)(1) \right)}{\left(e^t(t-1)\right)^2} \nonumber \] so \[\frac{dz}{dt}=\frac{d}{dt}\left(\frac{3t^3}{e^t(t-1)}\right)^4=4\left(\frac{3t^3}{e^t(t-1)}\right)^3\cdot \left( \frac{\left( 9t^2 \right)\left( e^t(t-1) \right)-\left( 3t^3 \right)\left( \left( e^t \right)(t-1)+\left( e^t \right)(1) \right)}{\left(e^t(t-1)\right)^2} \right)\nonumber \]
Phew!
What if the Derivative Doesn’t Exist?
A function is called differentiable at a point if its derivative exists at that point.
We’ve been acting as if derivatives exist everywhere for every function. This is true for most of the functions that you will run into in this class. But there are some common places where the derivative doesn’t exist.
Remember that the derivative is the slope of the tangent line to the curve. That’s what to think about.
Where can a slope not exist? If the tangent line is vertical, the derivative will not exist.
Show that \( f(x)=\sqrt[3]{x}=x^{1/3} \) is not differentiable at \(x = 0\).
Solution
Finding the derivative, \( f(x)=\frac{1}{3}x^{-2/3}=\frac{1}{3x^{2/3}} \). At \(x = 0\), this function is undefined. From the graph, we can see that the tangent line to this curve at \(x = 0\) is vertical with undefined slope, which is why the derivative does not exist at \(x = 0\).
Where can a tangent line not exist?
If there is a sharp corner (cusp) in the graph, the derivative will not exist at that point because there is no well-defined tangent line (a teetering tangent, if you will).
If there is a discontinuity in the graph (a jump, a break, a hole in the graph, or a vertical asymptote), the tangent line will be different on either side and the derivative will not exist at that point.
Show that \( f(x)=|x| \) is not differentiable at \(x = 0\).
Solution
On the left side of the graph, the slope of the line is -1. On the right side of the graph, the slope is +1. There is no well-defined tangent line at the sharp corner at \(x = 0\), so the function is not differentiable at that point.