# The Chain Rule

This section covers:

The chain rule says when we’re taking the derivative, if there’s something other than $$\boldsymbol {x}$$ (like in parentheses or under a radical sign) when we’re using one of the rules we’ve learned (like the power rule), we have to multiply by the derivative of what’s in the parentheses. It all has to do with composite functions, since $$\displaystyle \frac{{dy}}{{dx}}=\frac{{dy}}{{du}}\cdot \frac{{du}}{{dx}}$$.

(We’ll learn how to “undo”  the chain rule here in the U-Substitution Integration section.)

Think of it this way when we’re thinking of rates of change, or derivatives: if we are running twice as fast as someone, and then someone else is running twice as fast as us, they are running 4 times as fast as the first person.

Here is what it looks like in Theorem form:

If $$\displaystyle y=f\left( u \right)$$ and $$u=f\left( x \right)$$ are differentiable and $$y=f\left( {g\left( x \right)} \right)$$, then:

$$\displaystyle \frac{{dy}}{{dx}}=\frac{{dy}}{{du}}\cdot \frac{{du}}{{dx}}$$,   or

$$\displaystyle \frac{d}{{dx}}\left[ {f\left( {g\left( x \right)} \right)} \right]={f}’\left( {g\left( x \right)} \right){g}’\left( x \right)$$

(more simplified):   $$\displaystyle \frac{d}{{dx}}\left[ {f\left( u \right)} \right]={f}’\left( u \right){u}’$$

We’ve actually been using the chain rule all along, since the derivative of an expression with just an $$\boldsymbol {x}$$ in it is just 1, so we are multiplying by 1.

For example, if $$\displaystyle y={{x}^{2}},\,\,\,\,\,{y}’=2x\cdot \frac{{d\left( x \right)}}{{dx}}=2x\cdot 1=2x$$.

Let’s do some problems. Do you see how when we take the derivative of the “outside function” and there’s something other than just $$\boldsymbol {x}$$ in the argument (for example, in parentheses, under a radical sign, or in a trig function), we have to take the derivative again of this “inside function”? So basically we are taking the derivative of the “outside function” and multiplying this by the derivative of the “inside” function. That’s pretty much it!

For the chain rule, see how we take the derivative again of what’s in red? And sometimes, again, what’s in blue? Yes, sometimes we have to use the chain rule twice, in the cases where we have a function inside a function inside another function. We could theoretically take the chain rule a very large number of times, with one derivative!

 Function Derivative Using Chain Rule Notes $$\displaystyle f\left( x \right)={{\left( {5x-1} \right)}^{8}}$$ \displaystyle \begin{align}{f}’\left( x \right)&=8{{\left( {\color{red}{{5x-1}}} \right)}^{7}}\cdot \color{red}{5}\\&=40{{\left( {5x-1} \right)}^{7}}\end{align} Since the $$\left( {5x-1} \right)$$ is the inner function, after using the Power Rule, we have to multiply by the derivative of that function, which is 5. $$\displaystyle f\left( x \right)={{\left( {{{x}^{4}}-1} \right)}^{3}}$$ \displaystyle \begin{align}{f}’\left( x \right)&=3{{\left( {\color{red}{{{{x}^{4}}-1}}} \right)}^{2}}\cdot \left( {\color{red}{{4{{x}^{3}}}}} \right)\\&=12{{x}^{3}}{{\left( {{{x}^{4}}-1} \right)}^{2}}\end{align} Since the $$\left( {{{x}^{4}}-1} \right)$$ is the inner function, after using the Power Rule, we have to multiply by the derivative of that function, which is $$4{{x}^{3}}$$. $$\displaystyle \begin{array}{l}g\left( x \right)=\sqrt[4]{{16-{{x}^{3}}}}\\g\left( x \right)={{\left( {16-{{x}^{3}}} \right)}^{{\frac{1}{4}}}}\end{array}$$ \displaystyle \begin{align}{l}{g}’\left( x \right)&=\frac{1}{4}{{\left( {\color{red}{{16-{{x}^{3}}}}} \right)}^{{-\frac{3}{4}}}}\cdot \left( {\color{red}{{-3{{x}^{2}}}}} \right)\\&=-\frac{{3{{x}^{2}}}}{{4{{{\left( {16-{{x}^{3}}} \right)}}^{{\frac{3}{4}}}}}}=-\frac{{3{{x}^{2}}}}{{4\,\sqrt[4]{{{{{\left( {16-{{x}^{3}}} \right)}}^{3}}}}}}\end{align} Since the $$\left( {16-{{x}^{3}}} \right)$$ is the inner function, after using the Power Rule, we have to multiply by the derivative of that function, which is $$-3{{x}^{2}}$$. $$\displaystyle \begin{array}{l}f\left( t \right)={{\left( {3t+4} \right)}^{4}}\sqrt{{3t-2}}\\f\left( t \right)={{\left( {3t+4} \right)}^{4}}{{\left( {3t-2} \right)}^{{\frac{1}{2}}}}\end{array}$$ \displaystyle \begin{align}{f}’\left( t \right)&={{\left( {3t+4} \right)}^{4}}\left( {\frac{1}{2}} \right){{\left( {\color{red}{{3t-2}}} \right)}^{{-\frac{1}{2}}}}\cdot \left( {\color{red}{3}} \right)\\&\,\,\,\,\,\,\,+{{\left( {3t-2} \right)}^{{\frac{1}{2}}}}\cdot 4{{\left( {\color{red}{{3t+4}}} \right)}^{3}}\cdot \left( {\color{red}{3}} \right)\\&=\frac{3}{2}{{\left( {3t+4} \right)}^{4}}{{\left( {3t-2} \right)}^{{-\frac{1}{2}}}}+12{{\left( {3t-2} \right)}^{{\frac{1}{2}}}}{{\left( {3t+4} \right)}^{3}}\\&=\frac{3}{2}{{\left( {3t+4} \right)}^{3}}{{\left( {3t-2} \right)}^{{-\frac{1}{2}}}}\left( {\left( {3t+4} \right)+8\left( {3t-2} \right)} \right)\\&=\frac{3}{2}{{\left( {3t+4} \right)}^{3}}{{\left( {3t-2} \right)}^{{-\frac{1}{2}}}}\left( {27t-12} \right)\\&=\frac{{3{{{\left( {3t+4} \right)}}^{3}}\left( {27t-12} \right)}}{{2\sqrt{{3t-2}}}}=\frac{{9{{{\left( {3t+4} \right)}}^{3}}\left( {9t-4} \right)}}{{2\sqrt{{3t-2}}}}\end{align} Use the Product Rule, since we have $$t$$’s in both expressions.   Since $$\left( {3t+4} \right)$$ and $$\left( {3t-2} \right)$$ are the inner functions, we have to multiply each by their derivative.   Note that we also took out the Greatest Common Factor (GCF) $$\frac{3}{2}{{\left( {3t+4} \right)}^{3}}{{\left( {3t-2} \right)}^{{-\frac{1}{2}}}}$$, so we could simplify the expression. (Remember, with the GCF, take out factors with the smallest exponent.) The reason we also took out a $$\frac{3}{2}$$ is because it’s the GCF of $$\frac{3}{2}$$ and $$\frac{{24}}{2}\,\,(12)$$. $$\displaystyle y=\cos \left( {4x} \right)$$ $$\displaystyle \begin{array}{l}{y}’=-\sin \left( {\color{red}{{4x}}} \right)\cdot \color{red}{4}\\=-4\sin \left( {4x} \right)\end{array}$$ Since the $$\left( {4x} \right)$$ is the inner function (the argument of $$\text{sin}$$), we have to take multiply by the derivative of that function, which is 4. $$\displaystyle g\left( x \right)=\cos \left( {\tan x} \right)$$ \displaystyle \begin{align}{g}’\left( x \right)&=-\sin \left( {\color{red}{{\tan x}}} \right)\cdot \color{red}{{{{{\sec }}^{2}}x}}\\&=-{{\sec }^{2}}x\cdot \sin \left( {\tan x} \right)\end{align} Since the $$\left( {\tan x} \right)$$ is the inner function (the argument of $$\text{cos}$$), we have to multiply by the derivative of that function, which is $$\displaystyle {{\sec }^{2}}x$$. $$\displaystyle \begin{array}{l}f\left( x \right)={{\sec }^{3}}\left( {\pi x} \right)\\f\left( x \right)={{\left[ {\sec \left( {\pi x} \right)} \right]}^{3}}\end{array}$$   (Note second way to write this) \displaystyle \begin{align}{f}’\left( x \right)&=3\,{{\color{red}{{\sec }}}^{2}}\left( {\color{blue}{{\pi x}}} \right)\cdot \left( {\color{red}{{\sec \left( {\color{blue}{{\pi x}}} \right)\tan \left( {\color{blue}{{\pi x}}} \right)}}} \right)\color{blue}{\pi }\\&=3\pi {{\sec }^{3}}\left( {\pi x} \right)\tan \left( {\pi x} \right)\end{align} This one’s a little tricky, since we have to use the Chain Rule twice. When we take the derivative of $${{\left[ {\sec \left( {\pi x} \right)} \right]}^{3}}$$, we have to multiply by the derivative of $$\sec \left( {\pi x} \right)$$, which is $$\sec \left( {\pi x} \right)\tan \left( {\pi x} \right)\cdot \pi$$ (again, we had to multiply by the derivative of $$\pi x$$, which is $$\pi$$). $$\displaystyle \begin{array}{l}f\left( \theta \right)=2{{\cot }^{2}}\left( {2\theta } \right)+\theta \\f\left( \theta \right)=2{{\left[ {\cot \left( {2\theta } \right)} \right]}^{2}}+\theta \end{array}$$ \displaystyle \begin{align}{f}’\left( \theta \right)=&4\,\color{red}{{\cot }}\left( {\color{blue}{{2\theta }}} \right)\cdot \color{red}{{-{{{\csc }}^{2}}\left( {\color{blue}{{2\theta }}} \right)}}\cdot \color{blue}{2}+1\\&=1-8{{\csc }^{2}}\left( {2\theta } \right)\cot \left( {2\theta } \right)\end{align} This is another one where we have to use the Chain Rule twice.

Here’s one more problem, where we have to think about how the chain rule works:

Chain Rule Problem Solution
The graphs of $$f$$ and $$g$$ are below. Let $$p\left( x \right)=f\left( {g\left( x \right)} \right)$$ and $$q\left( x \right)=g\left( {f\left( x \right)} \right)$$.

Find $${p}’\left( 4 \right)\text{ and }{q}’\left( {-1} \right)$$, given these derivatives exist.

Note the following (derivative is slope):

 $$x$$ $$f\left( x \right)$$ $${f}’\left( x \right)$$ $$g\left( x \right)$$ $${g}’\left( x \right)$$ –1 2 2 3 –1 2 2 0 0 NA 4 2 0 6 3 6 2 0 12 3

Find $${p}’\left( 4 \right)$$:

$$\displaystyle \begin{array}{c}p\left( x \right)=f\left( {g\left( x \right)} \right)\\{p}’\left( x \right)={f}’\left( {g\left( x \right)} \right)\cdot {g}’\left( x \right)\\{p}’\left( 4 \right)={f}’\left( {g\left( 4 \right)} \right)\cdot {g}’\left( 4 \right)\\{p}’\left( 4 \right)={f}’\left( 6 \right)\cdot {g}’\left( 4 \right)\\{p}’\left( 4 \right)=0\cdot 3=0\end{array}$$

Find $${q}’\left( {-1} \right)$$:

$$\displaystyle \begin{array}{c}q\left( x \right)=g\left( {f\left( x \right)} \right)\\{q}’\left( x \right)={g}’\left( {f\left( x \right)} \right)\cdot {f}’\left( x \right)\\{q}’\left( {-1} \right)={g}’\left( {f\left( {-1} \right)} \right)\cdot {f}’\left( {-1} \right)\\{q}’\left( {-1} \right)={g}’\left( 2 \right)\cdot {f}’\left( {-1} \right)\\{g}’\left( 2 \right)\,\,\text{doesn }\!\!’\!\!\text{ t exist}\,\,(\text{shart turn)}\\\text{Therefore, }{q}’\left( {-1} \right)\,\,\text{doesn }\!\!’\!\!\text{ t exist}\end{array}$$

# The Equation of the Tangent Line with the Chain Rule

Here are a few problems where we use the chain rule to find an equation of the tangent line to the graph $$f$$ at the given point. Note that we saw more of these problems here in the Equation of the Tangent Line, Tangent Line Approximation, and Rates of Change Section.

 Function Equation of Tangent Line Find the equation of the tangent line to the graph of $$f$$ at the given $$x$$ value:   $$\begin{array}{c}f\left( x \right)={{\left( {5{{x}^{4}}-2} \right)}^{3}}\\x=1\end{array}$$ $$\displaystyle {f}’\left( x \right)=3{{\left( {5{{x}^{4}}-2} \right)}^{2}}\left( {20{{x}^{3}}} \right)=60{{x}^{3}}{{\left( {5{{x}^{4}}-2} \right)}^{2}}$$   We know then the slope of the function is $$\displaystyle 60{{x}^{3}}{{\left( {5{{x}^{4}}-2} \right)}^{2}}$$, and at $$x=1$$, we know $$\displaystyle y={{\left( {5{{{\left( 1 \right)}}^{4}}-2} \right)}^{3}}=27$$. At point $$\left( {1,27} \right)$$, the slope is $$\displaystyle 60{{\left( 1 \right)}^{3}}{{\left[ {5{{{\left( 1 \right)}}^{4}}-2} \right]}^{2}}=540$$.   We can use either the slope-intercept or point-slope method to find the equation of the line (let’s use slope-intercept): $$y=mx+b;\,\,y=540x+b$$. Plug in point $$\left( {1,27} \right)$$ and solve for $$b$$: $$27=540\left( 1 \right)+b;\,\,\,b=-513$$. The equation of the tangent line to $$f\left( x \right)={{\left( {5{{x}^{4}}-2} \right)}^{3}}$$ at $$x=1$$ is $$\,y=540x-513$$. Find the equation of the tangent line to the graph of $$f$$ at the given point:   $$f\left( \theta \right)=\cos \left( {5\theta } \right)$$ $$\displaystyle \left( {\frac{\pi }{2},0} \right)$$ $$\displaystyle {f}’\left( x \right)=-5\sin \left( {5\theta } \right)$$   We know then the slope of the function is $$\displaystyle -5\sin \left( {5\theta } \right)$$, so at point $$\displaystyle \left( {\frac{\pi }{2},0} \right)$$, the slope is $$\displaystyle -5\sin \left( {5\cdot \frac{\pi }{2}} \right)=-5$$.   We can use either the slope-intercept or point-slope method to find the equation of the line (let’s use point-slope): $$\displaystyle y-0=-5\left( {x-\frac{\pi }{2}} \right);\,\,y=-5x+\frac{{5\pi }}{2}$$. The equation of the tangent line to $$f\left( \theta \right)=\cos \left( {5\theta } \right)$$ at the point $$\displaystyle \left( {\frac{\pi }{2},0} \right)$$ is $$\displaystyle y=-5x+\frac{{5\pi }}{2}$$.

Understand these problems, and practice, practice, practice!

Click on Submit (the arrow to the right of the problem) to solve this problem. You can also type in more problems, or click on the 3 dots in the upper right hand corner to drill down for example problems.

If you click on “Tap to view steps”, you will go to the Mathway site, where you can register for the full version (steps included) of the software.  You can even get math worksheets.

You can also go to the Mathway site here, where you can register, or just use the software for free without the detailed solutions.  There is even a Mathway App for your mobile device.  Enjoy!

On to Implicit Differentiation and Related Rates – you’re ready!