Calculus3Differentiation Rules4 of 9
Differentiation Rules · 4

Chain Rule

1

One function inside another

So far we know how to differentiate powers like xnx^n, products like f⋅gf \cdot g, and quotients like fg\frac{f}{g}. But what happens when one function is plugged into another? For (3x+1)10\out{(\ins{3x + 1})^{10}}, the inside is 3x+1\ins{3x + 1} and the outside is the tenth power. For sin⁡(x2)\out{\sin(\ins{x^2})}, the inside is x2\ins{x^2} and the outside is the sine. Let's start with a case we can check by expanding.

If we treat 3x+1\ins{3x + 1} like xx and use the power rule alone, we get 2(3x+1)\out{2(\ins{3x + 1})}. Expanding first gives something different.

Power rule alone2(3x+1)\out{2(\ins{3x+1})} Expanding first(3x+1)2=9x2+6x+1  →  18x+6  =\out{(\ins{3x+1})^2} = 9x^2 + 6x + 1 \;\to\; 18x + 6 \;=6(3x+1)=3⋅2(3x+1)6(\ins{3x+1}) = \dins{3}\cdot \out{2(\ins{3x+1})}

The power rule alone is short by a factor of 3\dins{3}, and 3\dins{3} is the slope of the inside, 3x+1\ins{3x + 1}. So why does the inside's slope belong in the derivative?

Find ddx(3x+1)2\frac{d}{dx}\out{(\ins{3x + 1})^2}
ddx(3x+1)2\displaystyle \frac{d}{dx}\out{(\ins{3x + 1})^2} =  ?\displaystyle = \;?
Text solution
Name the inside w\ins{w}With w=3x+1\ins{w} = \ins{3x + 1}, the function is y=w2y = \out{\ins{w}^2}. Then yy changes 2w\out{2\ins{w}} times as fast as w\ins{w}, and w\ins{w} changes 3\dins{3} times as fast as xx.
dydw\displaystyle \out{\frac{dy}{dw}} =2w\displaystyle = \out{2\ins{w}}
dwdx\displaystyle \dins{\frac{dw}{dx}} =3\displaystyle = \dins{3}
Multiply the two ratesPutting 3x+1\ins{3x + 1} back in for w\ins{w} gives exactly what expanding gave us.
dydx\displaystyle \frac{dy}{dx} =dydw⋅dwdx\displaystyle = \out{\frac{dy}{dw}}\cdot\dins{\frac{dw}{dx}} =2w⋅3\displaystyle = \out{2\ins{w}}\cdot \dins{3} =6(3x+1)\displaystyle = 6(\ins{3x+1})
The tenth power, without expandingExpanding (3x+1)10\out{(\ins{3x + 1})^{10}} would give 1111 terms. With the chain rule it's one line.
ddx(3x+1)10\displaystyle \frac{d}{dx}\out{(\ins{3x+1})^{10}} =10(3x+1)9⋅3\displaystyle = \out{10(\ins{3x+1})^9}\cdot \dins{3} =30(3x+1)9\displaystyle = 30\out{(\ins{3x+1})^9}

Multiplying dydw\out{\frac{dy}{dw}} by dwdx\dins{\frac{dw}{dx}} gives dydx\frac{dy}{dx}. This is the chain rule, and the dwdw's cancelling like fractions is a handy way to remember it.

dydx\displaystyle \frac{dy}{dx} =dydw⋅dwdx\displaystyle = \out{\frac{dy}{dw}}\cdot\dins{\frac{dw}{dx}}
2

When the inside is a line

For (3x+1)2\out{(\ins{3x + 1})^2}, the extra factor of 3\dins{3} was the slope of 3x+1\ins{3x + 1}. When the inside is any line, its derivative is that line's slope at every xx, so the chain rule brings out the slope, whatever the outside function is. Let's keep 3x+5\ins{3x + 5} inside three different outside functions, and then change the line.

Find the derivatives of ln⁡(3x+5)\out{\ln(\ins{3x+5})}, e3x+5\out{e^{\ins{3x+5}}}, 13x+5\out{\frac{1}{\ins{3x+5}}}, sin⁡(5x)\out{\sin(\ins{5x})}, and e−x\out{e^{\ins{-x}}}
ddxln⁡(3x+5)=  ?ddxe3x+5=  ?ddx13x+5=  ?ddxsin⁡(5x)=  ?ddxe−x=  ?\displaystyle \begin{aligned} \frac{d}{dx}\out{\ln(\ins{3x + 5})} &= \;? \\ \frac{d}{dx}\out{e^{\ins{3x + 5}}} &= \;? \\ \frac{d}{dx}\out{\frac{1}{\ins{3x + 5}}} &= \;? \\ \frac{d}{dx}\out{\sin(\ins{5x})} &= \;? \\ \frac{d}{dx}\out{e^{\ins{-x}}} &= \;? \end{aligned}
Text solution
The inside 3x+5\ins{3x + 5} gives a factor of 3\dins{3}Differentiate the outside with 3x+5\ins{3x + 5} left inside, then multiply by 3\dins{3}. For the reciprocal, write it as (3x+5)−1\out{(\ins{3x+5})^{-1}} first.
ddxln⁡(3x+5)\displaystyle \frac{d}{dx}\out{\ln(\ins{3x+5})} =33x+5\displaystyle = \frac{\dins{3}}{\ins{3x+5}}
ddxe3x+5\displaystyle \frac{d}{dx}\out{e^{\ins{3x+5}}} =3e3x+5\displaystyle = \dins{3}\out{e^{\ins{3x+5}}}
ddx13x+5\displaystyle \frac{d}{dx}\out{\frac{1}{\ins{3x+5}}} =−3(3x+5)2\displaystyle = \out{-}\frac{\dins{3}}{\out{(\ins{3x+5})^2}}
A different line, a different factorThe slope of 5x\ins{5x} is 5\dins{5}, and the slope of −x\ins{-x} is −1\dins{-1}. So the derivative of e−x\out{e^{\ins{-x}}} is −e−x\dins{-}\out{e^{\ins{-x}}}, not e−xe^{-x}.
ddxsin⁡(5x)\displaystyle \frac{d}{dx}\out{\sin(\ins{5x})} =5cos⁡(5x)\displaystyle = \dins{5}\out{\cos(\ins{5x})}
ddxe−x\displaystyle \frac{d}{dx}\out{e^{\ins{-x}}} =e−x⋅(−1)\displaystyle = \out{e^{\ins{-x}}}\cdot(\dins{-1}) =−e−x\displaystyle = \dins{-}\out{e^{\ins{-x}}}
3

When the inside is not a line

Now let's find the derivative of sin⁡(x2)\out{\sin(\ins{x^2})}. This time the inside isn't a line like 3x+1\ins{3x + 1}, so its derivative isn't a fixed number.

Find ddxsin⁡(x2)\frac{d}{dx}\out{\sin(\ins{x^2})} and write down the chain rule
ddxsin⁡(x2)\displaystyle \frac{d}{dx}\out{\sin(\ins{x^2})} =  ?\displaystyle = \;?
Text solution
Name the inside w=x2\ins{w} = \ins{x^2}Then y=sin⁡wy = \out{\sin \ins{w}}, and we take the two derivatives as before.
dydw\displaystyle \out{\frac{dy}{dw}} =cos⁡w\displaystyle = \out{\cos \ins{w}}
dwdx\displaystyle \dins{\frac{dw}{dx}} =2x\displaystyle = \dins{2x}
Multiply, then put x2\ins{x^2} backThe 2x\dins{2x} multiplies the whole cosine. It doesn't go inside to make cos⁡(2x)\cos(2x), and the cosine is still evaluated at x2\ins{x^2}. Unlike the 3\dins{3} before, this factor changes with xx: it is 2\dins{2} at x=1x = 1 and 6\dins{6} at x=3x = 3.
dydx\displaystyle \frac{dy}{dx} =cos⁡(x2)⋅2x\displaystyle = \out{\cos(\ins{x^2})}\cdot \dins{2x} =2xcos⁡(x2)\displaystyle = \dins{2x}\out{\cos(\ins{x^2})}
An exponential and a logIn ex2\out{e^{\ins{x^2}}} the variable is in the exponent, so we don't bring x2\ins{x^2} down. For a natural log, the chain rule gives the inside's derivative divided by the inside.
ddxex2\displaystyle \frac{d}{dx}\out{e^{\ins{x^2}}} =ex2⋅2x\displaystyle = \out{e^{\ins{x^2}}}\cdot \dins{2x} =2x ex2\displaystyle = \dins{2x}\,\out{e^{\ins{x^2}}}
ddxln⁡(x2+1)\displaystyle \frac{d}{dx}\out{\ln(\ins{x^2+1})} =1x2+1⋅2x\displaystyle = \out{\frac{1}{\ins{x^2+1}}}\cdot \dins{2x} =2xx2+1\displaystyle = \frac{\dins{2x}}{\ins{x^2+1}}

We can write the chain rule in function notation, without setting up w\ins{w} every time. If f\out{f} is the outside function and g(x)\ins{g(x)} is the inside function, we differentiate the outside while leaving the inside unchanged, and multiply by the derivative of the inside.

ddxf(g(x))=f′(g(x))⏟the outside’s derivative,inside left as it is⋅g′(x)⏟the inside’sderivative\displaystyle \begin{aligned}\frac{d}{dx}\out{f(\ins{g(x)})} &= \underbrace{\out{f'(\ins{g(x)})}}_{\substack{\text{the outside's derivative,}\\ \text{inside left as it is}}}\cdot\underbrace{\dins{g'(x)}}_{\substack{\text{the inside's}\\ \text{derivative}}}\end{aligned}
ddxf(g(x))=f′(g(x))⏟the outside’s derivative,inside left as it is⋅g′(x)⏟the inside’sderivative\displaystyle \begin{aligned}&\frac{d}{dx}\out{f(\ins{g(x)})}\\ &= \underbrace{\out{f'(\ins{g(x)})}}_{\substack{\text{the outside's derivative,}\\ \text{inside left as it is}}}\cdot\underbrace{\dins{g'(x)}}_{\substack{\text{the inside's}\\ \text{derivative}}}\end{aligned}
dydx\displaystyle \frac{dy}{dx} =dydw⋅dwdx\displaystyle = \out{\frac{dy}{dw}}\cdot\dins{\frac{dw}{dx}}
4

Finding the outside function

Both sin⁡(x2)\sin(x^2) and sin⁡2x\sin^2 x use the exact same two operations, sine and squaring. Remember, sin⁡2x\sin^2 x means (sin⁡x)2(\sin x)^2. So which operation is on the outside, and which is on the inside? To decide, imagine plugging in a number, say x=3x = 3, and look at which operation comes last.

sin⁡(x2)\displaystyle \sin(x^2)
3  →  9  →  sin⁡9\displaystyle 3 \;\to\; \ins{9} \;\to\; \out{\sin \ins{9}}
(sin⁡x)2\displaystyle (\sin x)^2
3  →  sin⁡3  →  (sin⁡3)2\displaystyle 3 \;\to\; \ins{\sin 3} \;\to\; \out{(\ins{\sin 3})^2}

For sin⁡(x2)\out{\sin(\ins{x^2})}, sine is done last, so sine is the outside and x2\ins{x^2} is the inside. For (sin⁡x)2\out{(\ins{\sin x})^2}, squaring is done last, so squaring is the outside and sin⁡x\ins{\sin x} is the inside. The same test sorts out powers, roots and reciprocals too.

Find the derivatives of sin⁡(x2)\sin(x^2), sin⁡2x\sin^2 x, cos⁡3x\cos^3 x, x2+9\sqrt{x^2+9}, and 1(x2+1)3\frac{1}{(x^2+1)^3}
ddxsin⁡(x2)=cos⁡(x2)⋅2xddxsin⁡2x=  ?\displaystyle \begin{aligned} \frac{d}{dx}\sin(x^2) &= \cos(x^2)\cdot 2x \\ \frac{d}{dx}\sin^2 x &= \;? \end{aligned}
Text solution
Sine outside, or squaring outsideThe same two operations in a different order give two completely different derivatives.
ddxsin⁡(x2)\displaystyle \frac{d}{dx}\out{\sin(\ins{x^2})} =cos⁡(x2)⋅2x\displaystyle = \out{\cos(\ins{x^2})}\cdot \dins{2x}
ddx(sin⁡x)2\displaystyle \frac{d}{dx}\out{(\ins{\sin x})^2} =2sin⁡x⋅cos⁡x\displaystyle = \out{2\ins{\sin x}}\cdot\dins{\cos x}
cos⁡3x\cos^3 x means (cos⁡x)3\out{(\ins{\cos x})^3}We take the cosine first and cube the result last, so the cube is the outside.
3(cos⁡x)2⋅(−sin⁡x)\displaystyle \out{3(\ins{\cos x})^2}\cdot(\dins{-\sin x}) =−3sin⁡x cos⁡2x\displaystyle = -3\dins{\sin x}\,\ins{\cos}^{\out{2}}\ins{x}
Roots and reciprocals as powersRewrite the root and the reciprocal as powers. Then the outside is a power, and we can use the power rule instead of the quotient rule.
(x2+9)12  →  12(x2+9)−12⋅2x\displaystyle \out{(\ins{x^2+9})^{\frac12}} \;\to\; \out{\frac12(\ins{x^2+9})^{-\frac12}}\cdot \dins{2x} =xx2+9\displaystyle = \frac{x}{\out{\sqrt{\ins{x^2+9}}}}
(x2+1)−3  →  −3(x2+1)−4⋅2x\displaystyle \out{(\ins{x^2+1})^{-3}} \;\to\; \out{-3(\ins{x^2+1})^{-4}}\cdot \dins{2x} =−6x(x2+1)4\displaystyle = -\frac{6x}{\out{(\ins{x^2+1})^4}}

Which calculation happens first in each expression?

The inside and outside of a function
5

More than two layers

To find the derivative of esin⁡(x2)\out{e}^{\lyr{\sin}(\ins{x^2})}, think about the order of operations again. If you plugged in a number for xx, you would square it first, then take the sine, and last of all raise e\out{e} to that power. That's three layers, and we work from the outside in.

Differentiate esin⁡(x2)\out{e}^{\lyr{\sin}(\ins{x^2})} and cos⁡3(2x)\lyr{\cos}^{\out{3}}(\ins{2x})
ddx esin⁡(x2)\displaystyle \frac{d}{dx}\,\out{e}^{\lyr{\sin}(\ins{x^2})} =  ?\displaystyle = \;?
Text solution
The outside layer firstThe outside is ew\out{e^w}, and its derivative is ew\out{e^w} itself. So we keep the exponent sin⁡(x2)\lyr{\sin}(\ins{x^2}) whole, and multiply by its derivative.
ddxesin⁡(x2)\displaystyle \frac{d}{dx}\out{e}^{\lyr{\sin}(\ins{x^2})} =esin⁡(x2)⋅ddx[sin⁡(x2)]\displaystyle = \out{e}^{\lyr{\sin}(\ins{x^2})}\cdot\frac{d}{dx}\big[\lyr{\sin}(\ins{x^2})\big]
One layer smallerThe derivative of sin⁡(x2)\lyr{\sin}(\ins{x^2}) is another chain rule problem, and it gives cos⁡(x2)⋅2x\lyr{\cos}(\ins{x^2})\cdot \dins{2x}. Each layer gives one factor.
=esin⁡(x2)⋅cos⁡(x2)⋅2x=2xcos⁡(x2) esin⁡(x2)\displaystyle \begin{aligned}&= \out{e}^{\lyr{\sin}(\ins{x^2})}\cdot\lyr{\cos}(\ins{x^2})\cdot \dins{2x}\\ &= \dins{2x}\lyr{\cos}(\ins{x^2})\,\out{e}^{\lyr{\sin}(\ins{x^2})}\end{aligned}
cos⁡3(2x)\lyr{\cos}^{\out{3}}(\ins{2x}) is (cos⁡2x)3\out{(\lyr{\cos} \ins{2x})^3}The cube is the outside, the cosine is in the middle, and 2x\ins{2x} is innermost. Don't drop the 2\dins{2} from that innermost layer.
3cos⁡2(2x)⋅(−sin⁡2x)⋅2=−6cos⁡2(2x)sin⁡(2x)\displaystyle \begin{aligned}&\out{3}\lyr{\cos}^{\out{2}}(\ins{2x})\cdot(\lyr{-\sin} \ins{2x})\cdot \dins{2}\\ &= -6\lyr{\cos}^{\out{2}}(\ins{2x})\lyr{\sin}(\ins{2x})\end{aligned}

How does each new outside function change the derivative?

Adding layers in the chain rule
6

Combining the chain rule with products and quotients

Both xe−x2x \out{e^{\ins{-x^2}}} and sin⁡(xex)\out{\sin(\ins{x e^x})} contain a product and a function inside another function. So how do you know which rule to use first? Imagine plugging in a number for xx. The very last operation you would compute tells you which rule to start with. Here are the product and quotient rules we'll need:

(fg)′\displaystyle (fg)' =f′g+fg′\displaystyle = f'g + fg'
(topbottom)′\displaystyle \left(\frac{\text{top}}{\text{bottom}}\right)' =top′⋅bottom−top⋅bottom′bottom2\displaystyle = \frac{\text{top}'\cdot\text{bottom} - \text{top}\cdot\text{bottom}'}{\text{bottom}^2}
Find the derivatives of xe−x2x \out{e^{\ins{-x^2}}}, sin⁡(xex)\out{\sin(\ins{x e^x})}, and xx2+1\frac{x}{\sqrt{x^2+1}}
ddx[x e−x2]=  ?ddxsin⁡(x ex)=  ?ddx xx2+1=  ?\displaystyle \begin{aligned} \frac{d}{dx}\big[x\,\out{e^{\ins{-x^2}}}\big] &= \;? \\ \frac{d}{dx}\out{\sin(\ins{x\,e^x})} &= \;? \\ \frac{d}{dx}\,\frac{x}{\sqrt{x^2 + 1}} &= \;? \end{aligned}
Text solution
xe−x2x \out{e^{\ins{-x^2}}}: multiplying comes lastSo the product rule comes first, and the chain rule only comes in for e−x2\out{e^{\ins{-x^2}}}. Since e−x2\out{e^{\ins{-x^2}}} is always positive, the derivative is 00 only when 1−2x2=01 - 2x^2 = 0.
ddx[x e−x2]=e−x2+x⋅e−x2⋅(−2x)=e−x2(1−2x2)\displaystyle \begin{aligned}\frac{d}{dx}\big[x\,\out{e^{\ins{-x^2}}}\big] &= \out{e^{\ins{-x^2}}} + x\cdot \out{e^{\ins{-x^2}}}\cdot(\dins{-2x})\\ &= \out{e^{\ins{-x^2}}}(1 - 2x^2)\end{aligned}
sin⁡(xex)\out{\sin(\ins{x e^x})}: the sine comes lastSo this time the chain rule comes first, and the product rule differentiates the inside, xex\ins{x e^x}.
ddxsin⁡(xex)=cos⁡(xex)⋅(ex+xex)=(1+x)excos⁡(xex)\displaystyle \begin{aligned}\frac{d}{dx}\out{\sin(\ins{x e^x})} &= \out{\cos(\ins{x e^x})}\cdot(\dins{e^x + x e^x})\\ &= \dins{(1 + x)e^x}\out{\cos(\ins{x e^x})}\end{aligned}
xx2+1\frac{x}{\sqrt{x^2+1}}: dividing comes lastSo the quotient rule comes first, and the chain rule gives the bottom's derivative, xx2+1\frac{x}{\sqrt{x^2+1}}. Multiplying the top and bottom by x2+1\sqrt{x^2+1} clears the fraction in the numerator.
ddxxx2+1\displaystyle \frac{d}{dx}\frac{x}{\sqrt{x^2+1}} =(x2+1)−x2(x2+1)x2+1\displaystyle = \frac{(x^2+1) - x^2}{(x^2+1)\sqrt{x^2+1}} =1(x2+1)32\displaystyle = \frac{1}{(x^2+1)^{\frac32}}

The numerator of that last derivative is 11, which is never 00, so xx2+1\frac{x}{\sqrt{x^2+1}} has no horizontal tangents.

7

The chain rule from a table

What if we don't have formulas for ff and gg, but only a table of their values and derivatives?

  x    f(x)    f′(x)    g(x)    g′(x)  12−4323751−1\displaystyle \def\arraystretch{1.45}\begin{array}{c|c|c|c|c} \;x\; & \;f(x)\; & \;f'(x)\; & \;g(x)\; & \;g'(x)\; \\ \hline 1 & 2 & -4 & \ins{3} & \dins{2} \\ 3 & 7 & \out{5} & 1 & -1 \end{array}

To find h′(1)h'(1) for h(x)=f(g(x))h(x) = \out{f(\ins{g(x)})}, we use the chain rule at x=1x = 1: the outside's derivative at the inside value g(1)\ins{g(1)}, times g′(1)\dins{g'(1)}.

h′(1)\displaystyle h'(1) =f′(g(1))⋅g′(1)\displaystyle = \out{f'(\ins{g(1)})}\cdot \dins{g'(1)}
For h(x)=f(g(x))h(x) = \out{f(\ins{g(x)})} and k(x)=[f(x)]3k(x) = \out{[\ins{f(x)}]^3}, use the table to find h′(1)h'(1) and k′(1)k'(1)
xf(x)f′(x)g(x)g′(x)12−4323751−1\displaystyle {\small\begin{array}{c|c|c|c|c} x & f(x) & f'(x) & g(x) & g'(x) \\ \hline 1 & 2 & -4 & 3 & 2 \\ 3 & 7 & 5 & 1 & -1 \end{array}}
h(x)\displaystyle h(x) =f(g(x)):    h′(1)\displaystyle = \out{f(\ins{g(x)})}:\;\; h'(1) =  ?\displaystyle = \;?
Text solution
Find the inside value firstThe table gives g(1)=3\ins{g(1) = 3}, so we read f′\out{f'} at 3\ins{3}, not at 11.
g(1)=3  →  h′(1)\displaystyle \ins{g(1) = 3} \;\to\; h'(1) =f′(3)⋅g′(1)\displaystyle = \out{f'(\ins{3})}\cdot \dins{g'(1)} =5⋅2\displaystyle = \out{5}\cdot \dins{2} =10\displaystyle = 10
Why not f′(1)⋅g′(1)f'(1)\cdot g'(1)?When x=1x = 1, g\ins{g} turns that 11 into 3\ins{3}, so f\out{f} receives 3\ins{3}, not 11. Multiplying f′(1)f'(1) by g′(1)g'(1) would give (−4)(2)=−8(-4)(2) = -8, which is wrong.
The cube of f(x)\ins{f(x)}For k(x)=[f(x)]3k(x) = \out{[\ins{f(x)}]^3}, the cube is the outside and f(x)\ins{f(x)} is the inside. The table gives f(1)=2\ins{f(1) = 2} and f′(1)=−4\dins{f'(1) = -4}.
k′(1)\displaystyle k'(1) =3[f(1)]2⋅f′(1)\displaystyle = \out{3[\ins{f(1)}]^2}\cdot \dins{f'(1)} =3⋅22⋅(−4)\displaystyle = \out{3\cdot \ins{2}^2}\cdot(\dins{-4}) =−48\displaystyle = -48
From a graphIf we're given a graph instead of a table, f(a)f(a) is the height at aa, and f′(a)f'(a) is the slope at aa. On a straight line segment, that slope is rise over run.

Summary

The chain rule
ddxf(g(x))\displaystyle \frac{d}{dx}\out{f(\ins{g(x)})} =f′(g(x))⋅g′(x)\displaystyle = \out{f'(\ins{g(x)})}\cdot \dins{g'(x)}
dydx\displaystyle \frac{dy}{dx} =dydw⋅dwdx\displaystyle = \out{\frac{dy}{dw}}\cdot\dins{\frac{dw}{dx}}
ddxsin⁡(x2)\displaystyle \frac{d}{dx}\out{\sin(\ins{x^2})} =cos⁡(x2)⋅2x\displaystyle = \out{\cos(\ins{x^2})}\cdot \dins{2x}

To differentiate one function inside another, take the derivative of the outside with the inside left whole, then multiply by the derivative of the inside. In sin⁡(x2)\out{\sin(\ins{x^2})}, the outside gives cos⁡(x2)\out{\cos(\ins{x^2})} and the inside gives 2x\dins{2x}. If we call the inside w\ins{w}, the rates multiply as dydw⋅dwdx\out{\frac{dy}{dw}}\cdot\dins{\frac{dw}{dx}}.

Finding the outside function
Sine on the outside
sin⁡(x2)  →  cos⁡(x2)⋅2x\displaystyle \out{\sin(\ins{x^2})} \;\to\; \out{\cos(\ins{x^2})}\cdot \dins{2x}
Squaring on the outside
sin⁡2x=(sin⁡x)2→  2sin⁡x cos⁡x\displaystyle \begin{aligned}\sin^2 x &= \out{(\ins{\sin x})^2}\\ &\to\; \out{2\ins{\sin x}}\,\dins{\cos x}\end{aligned}

To tell which function is on the outside, imagine plugging in a number and computing the value step by step. The operation you do last is the outside function. For sin⁡(x2)\out{\sin(\ins{x^2})}, you square first and take the sine last, so sine is on the outside. For (sin⁡x)2\out{(\ins{\sin x})^2}, you take the sine first and square last, so squaring is on the outside.

Roots, exponentials, and logs
Root as a power
x2+9=(x2+9)12→  xx2+9\displaystyle \begin{aligned}\out{\sqrt{\ins{x^2+9}}} &= \out{(\ins{x^2+9})^{\frac12}}\\ &\to\; \frac{x}{\out{\sqrt{\ins{x^2+9}}}}\end{aligned}
Exponential
ex2  →  2x ex2\displaystyle \out{e^{\ins{x^2}}} \;\to\; \dins{2x}\,\out{e^{\ins{x^2}}}
Natural log
ln⁡(x2+1)  →  2xx2+1\displaystyle \out{\ln(\ins{x^2+1})} \;\to\; \frac{\dins{2x}}{\ins{x^2+1}}

Rewrite roots as powers, like (x2+9)12\out{(\ins{x^2 + 9})^{\frac12}}, so you can use the power rule on the outside. For ex2\out{e^{\ins{x^2}}}, the outside function is ew\out{e^{\ins{w}}}, which differentiates to itself, so the derivative is ex2\out{e^{\ins{x^2}}} times the inside's derivative, 2x\dins{2x}. For ln⁡(x2+1)\out{\ln(\ins{x^2+1})}, the chain rule gives the inside's derivative divided by the inside.

When the inside is a line
Slope 3
ln⁡(3x+5)  →  33x+5\displaystyle \out{\ln(\ins{3x+5})} \;\to\; \frac{\dins{3}}{\ins{3x+5}}
Slope −1
e−x  →  −e−x\displaystyle \out{e^{\ins{-x}}} \;\to\; \dins{-}\out{e^{\ins{-x}}}

When the inside is a line ax+b\ins{ax + b}, its derivative is just the slope a\dins{a}. Differentiate the outside function with ax+b\ins{ax + b} left inside, then multiply by a\dins{a}. For e−x\out{e^{\ins{-x}}}, the slope is −1\dins{-1}, so the derivative is −e−x\dins{-}\out{e^{\ins{-x}}}.

Several layers
esin⁡(x2)→  esin⁡(x2)⋅cos⁡(x2)⋅2x\displaystyle \begin{aligned}&\out{e}^{\lyr{\sin}(\ins{x^2})}\\ &\to\; \out{e}^{\lyr{\sin}(\ins{x^2})}\cdot\lyr{\cos}(\ins{x^2})\cdot \dins{2x}\end{aligned}

Work from the outside in, with one factor for each layer. Differentiate the outside function while keeping its inside whole, then multiply by the derivative of that inside. For esin⁡(x2)\out{e}^{\lyr{\sin}(\ins{x^2})}, the exponential gives esin⁡(x2)\out{e}^{\lyr{\sin}(\ins{x^2})}, the sine gives cos⁡(x2)\lyr{\cos}(\ins{x^2}), and x2\ins{x^2} gives 2x\dins{2x}.

Combining with the product and quotient rules
Product rule first
x e−x2  →  e−x2(1−2x2)\displaystyle x\,\out{e^{\ins{-x^2}}} \;\to\; \out{e^{\ins{-x^2}}}(1 - 2x^2)
Chain rule first
sin⁡(xex)→  (1+x)excos⁡(xex)\displaystyle \begin{aligned}&\out{\sin(\ins{x e^x})}\\ &\to\; \dins{(1 + x)e^x}\out{\cos(\ins{x e^x})}\end{aligned}

The last operation tells you which rule to use first. For x e−x2x\,\out{e^{\ins{-x^2}}}, the last operation is multiplication, so use the product rule first and apply the chain rule to e−x2\out{e^{\ins{-x^2}}}. For sin⁡(xex)\out{\sin(\ins{x e^x})}, the last operation is sine, so use the chain rule first and apply the product rule to the inside xex\ins{x e^x}.

Using values from a table or graph
h′(a)\displaystyle h'(a) =f′(g(a))⋅g′(a)\displaystyle = \out{f'(\ins{g(a)})}\cdot \dins{g'(a)}

To find h′(a)h'(a) for h(x)=f(g(x))h(x) = \out{f(\ins{g(x)})}, find the inside value g(a)\ins{g(a)} first. That value is the input for f′\out{f'}, so evaluate f′\out{f'} at g(a)\ins{g(a)} and multiply by g′(a)\dins{g'(a)}. Don't multiply f′(a)f'(a) by g′(a)g'(a), because the input to f\out{f} at x=ax = a is g(a)\ins{g(a)}, not aa. If the graph is made of straight line segments, f′(a)f'(a) is the slope of the segment at aa, as long as aa isn't an endpoint. At any corner where the slopes on either side are different, the derivative doesn't exist.

8

Practice

Enter exact values unless asked for a decimal.

1
Find ddx(3x2+1)4\dfrac{d}{dx}(3x^2 + 1)^4.

What is the inside function, and what is its derivative?

If you got 4(3x2+1)34(3x^2+1)^3 Remember to multiply by the derivative of the inside function, 3x2+13x^2 + 1.

Differentiate the insideThe last operation is raising to the fourth power, so the inside is 3x2+1\ins{3x^2 + 1}.
inside 3x2+1,ddx(3x2+1)\displaystyle \text{inside } \ins{3x^2 + 1}, \qquad \frac{d}{dx}(\ins{3x^2 + 1}) =6x\displaystyle = \dins{6x}
Apply the chain ruleDifferentiate the outside power, leaving the inside alone, then multiply by the derivative of the inside.
ddx(3x2+1)4\displaystyle \frac{d}{dx}\out{(\ins{3x^2+1})^4} =4(3x2+1)3⋅6x\displaystyle = \out{4(\ins{3x^2+1})^3}\cdot \dins{6x} =24x(3x2+1)3\displaystyle = 24x\out{(\ins{3x^2+1})^3}
2
Find ddxln⁡(cos⁡x)\dfrac{d}{dx}\ln(\cos x).

For ln⁡w\ln w, the derivative is 1w⋅dwdx\frac{1}{w}\cdot \frac{dw}{dx}. What is ww here?

If you got sec⁡x\sec x That's only the outside derivative 1cos⁡x\frac{1}{\cos x}. Multiply by the derivative of the inside.

If you got tan⁡x\tan x Check the sign of the derivative of cos⁡x\cos x.

Apply the chain ruleThe derivative of ln⁡(cos⁡x)\out{\ln(\ins{\cos x})} is 1cos⁡x\out{\frac{1}{\ins{\cos x}}} times the derivative of cos⁡x\ins{\cos x}, which is −sin⁡x\dins{-\sin x}.
ddxln⁡(cos⁡x)\displaystyle \frac{d}{dx}\out{\ln(\ins{\cos x})} =1cos⁡x⋅(−sin⁡x)\displaystyle = \out{\frac{1}{\ins{\cos x}}}\cdot(\dins{-\sin x}) =−sin⁡xcos⁡x\displaystyle = \dins{-}\frac{\dins{\sin x}}{\ins{\cos x}}
SimplifyRewrite −sin⁡xcos⁡x\dins{-}\frac{\dins{\sin x}}{\ins{\cos x}} using tangent.
−sin⁡xcos⁡x\displaystyle \dins{-}\frac{\dins{\sin x}}{\ins{\cos x}} =−tan⁡x\displaystyle = -\tan x
3
Find ddx1+e2x\dfrac{d}{dx}\sqrt{1 + e^{2x}}.

Write the square root as the power 12\frac12. What is the derivative of the inside, 1+e2x1 + e^{2x}?

If you got e2x21+e2x\dfrac{e^{2x}}{2\sqrt{1+e^{2x}}} Check the derivative of e2xe^{2x}. It needs a factor of 22 from the derivative of 2x2x.

Rewrite as a powerWriting the square root as the power 12\frac12 lets us use the power rule for the outside.
1+e2x\displaystyle \out{\sqrt{\lyr{1 + e^{\ins{2x}}}}} =(1+e2x)12\displaystyle = \out{\left(\lyr{1 + e^{\ins{2x}}}\right)^{\frac12}}
Differentiate the insideThe derivative of 11 is 00, and the chain rule on e2x\lyr{e^{\ins{2x}}} brings out a factor of 2\dins{2}.
ddx(1+e2x)\displaystyle \frac{d}{dx}\left(\lyr{1 + e^{\ins{2x}}}\right) =e2x⋅2\displaystyle = \lyr{e^{\ins{2x}}}\cdot \dins{2} =2e2x\displaystyle = \dins{2}\lyr{e^{\ins{2x}}}
Apply the chain rule and simplifyMultiply the outside derivative by 2e2x\dins{2}\lyr{e^{\ins{2x}}}, then cancel the 22 and write the negative power as a root in the denominator.
12(1+e2x)−12⋅2e2x\displaystyle \out{\frac12\left(\lyr{1 + e^{\ins{2x}}}\right)^{-\frac12}}\cdot \dins{2}\lyr{e^{\ins{2x}}} =e2x1+e2x\displaystyle = \frac{\lyr{e^{\ins{2x}}}}{\out{\sqrt{\lyr{1 + e^{\ins{2x}}}}}}
4
Find ddx(xln⁡x)3\dfrac{d}{dx}(x\ln x)^3.

The inside is xln⁡xx\ln x. Which rule gives its derivative?

If you got 3x(ln⁡x)23x(\ln x)^2 Check the derivative of the inside function xln⁡xx\ln x. It's a product, so it needs the product rule.

Differentiate the insideThe inside is a product of xx and ln⁡x\ln x, so we use the product rule.
ddx(xln⁡x)\displaystyle \frac{d}{dx}(\ins{x\ln x}) =1⋅ln⁡x+x⋅1x\displaystyle = 1\cdot\ln x + x\cdot\frac1x =ln⁡x+1\displaystyle = \dins{\ln x + 1}
Apply the chain ruleBring down the 3\out{3}, square the inside, and multiply by the inside's derivative, ln⁡x+1\dins{\ln x + 1}.
ddx(xln⁡x)3\displaystyle \frac{d}{dx}\out{(\ins{x\ln x})^3} =3(xln⁡x)2(ln⁡x+1)\displaystyle = \out{3(\ins{x\ln x})^2}(\dins{\ln x + 1})
5
Use the table. For k(x)=g(f(x))k(x) = g(f(x)), find k′(1)k'(1).
xf(x)f′(x)g(x)g′(x)13−24531627\displaystyle \def\arraystretch{1.35}\begin{array}{c|c|c|c|c} x & f(x) & f'(x) & g(x) & g'(x) \\ \hline 1 & 3 & -2 & 4 & 5 \\ 3 & 1 & 6 & 2 & 7 \end{array}

In g(f(x))g(f(x)), which function is on the outside, and at what value do we evaluate g′g'?

Apply the chain ruleThe derivative of g(f(x))\out{g(\ins{f(x)})} is the derivative of the outside at f(x)\ins{f(x)}, times the derivative of the inside.
k′(1)\displaystyle k'(1) =g′(f(1))⋅f′(1)\displaystyle = \out{g'(\ins{f(1)})}\cdot \dins{f'(1)}
Read the values from the tableThe table gives f(1)=3\ins{f(1) = 3}, so look at the row x=3x = 3 to find g′(3)=7\out{g'(\ins{3})} = \out{7}, and the row x=1x = 1 for f′(1)=−2\dins{f'(1) = -2}.
f(1)=3  →  k′(1)\displaystyle \ins{f(1) = 3} \;\to\; k'(1) =g′(3)⋅f′(1)\displaystyle = \out{g'(\ins{3})}\cdot \dins{f'(1)} =7⋅(−2)\displaystyle = \out{7}\cdot(\dins{-2}) =−14\displaystyle = -14
6
The graph of ff is made of the line segments from (0,0)(0, 0) to (2,4)(2, 4), from (2,4)(2, 4) to (4,3)(4, 3), and from (4,3)(4, 3) to (6,3)(6, 3). The graph of gg is made of the line segments from (0,1)(0, 1) to (2,5)(2, 5) and from (2,5)(2, 5) to (4,5)(4, 5). For h(x)=f(g(x))h(x) = f(g(x)), find h′(1)h'(1).
11
22
33
44
55
66
11
22
33
44
55
66
xx
yy
ff
11
22
33
44
11
22
33
44
55
66
xx
yy
gg

Find g(1)g(1) on the graph of gg. That value is the input for f′f'.

What is the slope of the line segment on the graph of ff at x=3x = 3?

Set up the chain ruleApply the chain rule to f(g(x))\out{f(\ins{g(x)})} at x=1x = 1.
h′(1)\displaystyle h'(1) =f′(g(1))⋅g′(1)\displaystyle = \out{f'(\ins{g(1)})}\cdot \dins{g'(1)}
Find g(1)g(1) and g′(1)g'(1)The height of gg at 11 is 3\ins{3}, and g′(1)\dins{g'(1)} is the slope of the segment from (0,1)(0, 1) to (2,5)(2, 5).
g(1)=3,g′(1)\displaystyle \ins{g(1) = 3}, \qquad \dins{g'(1)} =5−12−0\displaystyle = \frac{5 - 1}{2 - 0} =2\displaystyle = \dins{2}
Find f′(3)f'(3)Since g(1)=3\ins{g(1) = 3}, find the slope of the line segment on ff containing x=3x = \ins{3}.
f′(3)\displaystyle \out{f'(\ins{3})} =3−44−2\displaystyle = \frac{3 - 4}{4 - 2} =−12\displaystyle = \out{-\frac12}
Multiply the two slopesMultiply f′(3)\out{f'(\ins{3})} by g′(1)\dins{g'(1)} to get h′(1)h'(1).
h′(1)\displaystyle h'(1) =f′(3)⋅g′(1)\displaystyle = \out{f'(\ins{3})}\cdot \dins{g'(1)} =−12⋅2\displaystyle = \out{-\frac12}\cdot \dins{2} =−1\displaystyle = -1
7
A weather balloon's height after tt seconds is h(t)h(t) metres, and the temperature at a height of hh metres is T(h)T(h) °C. We know h(10)=400h(10) = 400, h′(10)=3h'(10) = 3 and T′(400)=−0.006T'(400) = -0.006. How fast is the temperature the balloon measures changing at t=10t = 10?

The rate of change of temperature with height is in °C per metre, and the rate of climb is in metres per second. What operation gives °C per second?

Set up the chain ruleThe temperature is T(h(t))\out{T(\ins{h(t)})}, so differentiate with the chain rule.
ddtT(h(t))\displaystyle \frac{d}{dt}\out{T(\ins{h(t)})} =T′(h(t))⋅h′(t)\displaystyle = \out{T'(\ins{h(t)})}\cdot \dins{h'(t)}
Evaluate at t=10t = 10At t=10t = 10, the balloon is at 400\ins{400} metres, so multiply T′(400)\out{T'(\ins{400})} by h′(10)\dins{h'(10)}.
t\displaystyle t =10:T′(h(10))⋅h′(10)\displaystyle = 10:\qquad \out{T'(\ins{h(10)})}\cdot \dins{h'(10)} =T′(400)⋅3\displaystyle = \out{T'(\ins{400})}\cdot \dins{3} =−0.006⋅3\displaystyle = \out{-0.006}\cdot \dins{3} =−0.018\displaystyle = -0.018
Check the unitsMultiplying degrees Celsius per metre by metres per second gives degrees Celsius per second.
∘Cm⋅ms\displaystyle \frac{{}^\circ\text{C}}{\text{m}}\cdot\frac{\text{m}}{\text{s}} =∘Cs\displaystyle = \frac{{}^\circ\text{C}}{\text{s}}
8
At which points does the graph of y=x4−x2y = x\sqrt{4 - x^2} have a horizontal tangent? Challenge

A horizontal tangent line has slope 00, so find where y′=0y' = 0.

After using the product rule, write y′y' over the single denominator 4−x2\sqrt{4 - x^2}.

If you got no horizontal tangent Check the derivative of 4−x24 - x^2. The negative sign gives −2x-2x, so the terms in the numerator subtract rather than add.

Differentiate the square rootUse the chain rule on (4−x2)12\out{(\ins{4 - x^2})^{\frac12}}, where the inside's derivative is −2x\dins{-2x}.
ddx4−x2\displaystyle \frac{d}{dx}\out{\sqrt{\ins{4 - x^2}}} =12(4−x2)−12⋅(−2x)\displaystyle = \out{\frac12(\ins{4 - x^2})^{-\frac12}}\cdot(\dins{-2x}) =−x4−x2\displaystyle = -\frac{x}{\out{\sqrt{\ins{4 - x^2}}}}
Apply the product ruleUse the product rule on x4−x2x\sqrt{4 - x^2}, plugging in the derivative of the square root.
y′\displaystyle y' =1⋅4−x2+x⋅(−x4−x2)\displaystyle = 1\cdot\sqrt{4 - x^2} + x\cdot\left(-\frac{x}{\sqrt{4 - x^2}}\right) =4−x2−x24−x2\displaystyle = \sqrt{4 - x^2} - \frac{x^2}{\sqrt{4 - x^2}}
Combine into one fractionMultiply 4−x2\sqrt{4 - x^2} top and bottom by 4−x2\sqrt{4 - x^2} to write y′y' as a single fraction.
y′\displaystyle y' =(4−x2)−x24−x2\displaystyle = \frac{(4 - x^2) - x^2}{\sqrt{4 - x^2}} =4−2x24−x2\displaystyle = \frac{4 - 2x^2}{\sqrt{4 - x^2}}
Find where the derivative is zeroA fraction is zero when its numerator is zero and its denominator is not zero, so set 4−2x2=04 - 2x^2 = 0 to get x=±2x = \pm\sqrt{2}, and plug them back into yy.
4−2x2\displaystyle 4 - 2x^2 =0  →  x\displaystyle = 0 \;\to\; x =±2,y(2)\displaystyle = \pm\sqrt2, \qquad y(\sqrt2) =2⋅2\displaystyle = \sqrt2\cdot\sqrt2 =2,y(−2)\displaystyle = 2, \qquad y(-\sqrt2) =−2\displaystyle = -2