So far we know how to differentiate powers like xn, products like f⋅g, and quotients like gf. But what happens when one function is plugged into another? For (3x+1)10, the inside is 3x+1 and the outside is the tenth power. For sin(x2), the inside is x2 and the outside is the sine. Let's start with a case we can check by expanding.
If we treat 3x+1 like x and use the power rule alone, we get 2(3x+1). Expanding first gives something different.
Power rule alone2(3x+1)Expanding first(3x+1)2=9x2+6x+1→18x+6=6(3x+1)=3⋅2(3x+1)
The power rule alone is short by a factor of 3, and 3 is the slope of the inside, 3x+1. So why does the inside's slope belong in the derivative?
Find dxd(3x+1)2
dxd(3x+1)2=?
Text solution
Name the inside wWith w=3x+1, the function is y=w2. Then y changes 2w times as fast as w, and w changes 3 times as fast as x.
dwdy=2w
dxdw=3
Multiply the two ratesPutting 3x+1 back in for w gives exactly what expanding gave us.
dxdy=dwdy⋅dxdw=2w⋅3=6(3x+1)
The tenth power, without expandingExpanding (3x+1)10 would give 11 terms. With the chain rule it's one line.
dxd(3x+1)10=10(3x+1)9⋅3=30(3x+1)9
Multiplying dwdy by dxdw gives dxdy. This is the chain rule, and the dw's cancelling like fractions is a handy way to remember it.
dxdy=dwdy⋅dxdw
2
When the inside is a line
For (3x+1)2, the extra factor of 3 was the slope of 3x+1. When the inside is any line, its derivative is that line's slope at every x, so the chain rule brings out the slope, whatever the outside function is. Let's keep 3x+5 inside three different outside functions, and then change the line.
Find the derivatives of ln(3x+5),e3x+5,3x+51,sin(5x), and e−x
The inside 3x+5 gives a factor of 3Differentiate the outside with 3x+5 left inside, then multiply by 3. For the reciprocal, write it as (3x+5)−1 first.
dxdln(3x+5)=3x+53
dxde3x+5=3e3x+5
dxd3x+51=−(3x+5)23
A different line, a different factorThe slope of 5x is 5, and the slope of −x is −1. So the derivative of e−x is −e−x, not e−x.
dxdsin(5x)=5cos(5x)
dxde−x=e−x⋅(−1)=−e−x
3
When the inside is not a line
Now let's find the derivative of sin(x2). This time the inside isn't a line like 3x+1, so its derivative isn't a fixed number.
Find dxdsin(x2) and write down the chain rule
dxdsin(x2)=?
Text solution
Name the inside w=x2Then y=sinw, and we take the two derivatives as before.
dwdy=cosw
dxdw=2x
Multiply, then put x2 backThe 2x multiplies the whole cosine. It doesn't go inside to make cos(2x), and the cosine is still evaluated at x2. Unlike the 3 before, this factor changes with x: it is 2 at x=1 and 6 at x=3.
dxdy=cos(x2)⋅2x=2xcos(x2)
An exponential and a logIn ex2 the variable is in the exponent, so we don't bring x2 down. For a natural log, the chain rule gives the inside's derivative divided by the inside.
dxdex2=ex2⋅2x=2xex2
dxdln(x2+1)=x2+11⋅2x=x2+12x
We can write the chain rule in function notation, without setting up w every time. If f is the outside function and g(x) is the inside function, we differentiate the outside while leaving the inside unchanged, and multiply by the derivative of the inside.
dxdf(g(x))=the outside’s derivative,inside left as it isf′(g(x))⋅the inside’sderivativeg′(x)
dxdf(g(x))=the outside’s derivative,inside left as it isf′(g(x))⋅the inside’sderivativeg′(x)
dxdy=dwdy⋅dxdw
4
Finding the outside function
Both sin(x2) and sin2x use the exact same two operations, sine and squaring. Remember, sin2x means (sinx)2. So which operation is on the outside, and which is on the inside? To decide, imagine plugging in a number, say x=3, and look at which operation comes last.
sin(x2)
3→9→sin9
(sinx)2
3→sin3→(sin3)2
For sin(x2), sine is done last, so sine is the outside and x2 is the inside. For (sinx)2, squaring is done last, so squaring is the outside and sinx is the inside. The same test sorts out powers, roots and reciprocals too.
Find the derivatives of sin(x2),sin2x,cos3x,x2+9, and (x2+1)31
dxdsin(x2)dxdsin2x=cos(x2)⋅2x=?
Text solution
Sine outside, or squaring outsideThe same two operations in a different order give two completely different derivatives.
dxdsin(x2)=cos(x2)⋅2x
dxd(sinx)2=2sinx⋅cosx
cos3x means (cosx)3We take the cosine first and cube the result last, so the cube is the outside.
3(cosx)2⋅(−sinx)=−3sinxcos2x
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)21→21(x2+9)−21⋅2x=x2+9x
(x2+1)−3→−3(x2+1)−4⋅2x=−(x2+1)46x
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), think about the order of operations again. If you plugged in a number for x, you would square it first, then take the sine, and last of all raise e to that power. That's three layers, and we work from the outside in.
Differentiate esin(x2) and cos3(2x)
dxdesin(x2)=?
Text solution
The outside layer firstThe outside is ew, and its derivative is ew itself. So we keep the exponent sin(x2) whole, and multiply by its derivative.
dxdesin(x2)=esin(x2)⋅dxd[sin(x2)]
One layer smallerThe derivative of sin(x2) is another chain rule problem, and it gives cos(x2)⋅2x. Each layer gives one factor.
=esin(x2)⋅cos(x2)⋅2x=2xcos(x2)esin(x2)
cos3(2x) is (cos2x)3The cube is the outside, the cosine is in the middle, and 2x is innermost. Don't drop the 2 from that innermost layer.
3cos2(2x)⋅(−sin2x)⋅2=−6cos2(2x)sin(2x)
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−x2 and sin(xex) 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 x. 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)′=f′g+fg′
(bottomtop)′=bottom2top′⋅bottom−top⋅bottom′
Find the derivatives of xe−x2,sin(xex), and x2+1x
dxd[xe−x2]dxdsin(xex)dxdx2+1x=?=?=?
Text solution
xe−x2: multiplying comes lastSo the product rule comes first, and the chain rule only comes in for e−x2. Since e−x2 is always positive, the derivative is 0 only when 1−2x2=0.
dxd[xe−x2]=e−x2+x⋅e−x2⋅(−2x)=e−x2(1−2x2)
sin(xex): the sine comes lastSo this time the chain rule comes first, and the product rule differentiates the inside, xex.
dxdsin(xex)=cos(xex)⋅(ex+xex)=(1+x)excos(xex)
x2+1x: dividing comes lastSo the quotient rule comes first, and the chain rule gives the bottom's derivative, x2+1x. Multiplying the top and bottom by x2+1 clears the fraction in the numerator.
dxdx2+1x=(x2+1)x2+1(x2+1)−x2=(x2+1)231
The numerator of that last derivative is 1, which is never 0, so x2+1x has no horizontal tangents.
7
The chain rule from a table
What if we don't have formulas for f and g, but only a table of their values and derivatives?
x13f(x)27f′(x)−45g(x)31g′(x)2−1
To find h′(1) for h(x)=f(g(x)), we use the chain rule at x=1: the outside's derivative at the inside value g(1), times g′(1).
h′(1)=f′(g(1))⋅g′(1)
For h(x)=f(g(x)) and k(x)=[f(x)]3, use the table to find h′(1) and k′(1)
x13f(x)27f′(x)−45g(x)31g′(x)2−1
h(x)=f(g(x)):h′(1)=?
Text solution
Find the inside value firstThe table gives g(1)=3, so we read f′ at 3, not at 1.
g(1)=3→h′(1)=f′(3)⋅g′(1)=5⋅2=10
Why not f′(1)⋅g′(1)?When x=1,g turns that 1 into 3, so f receives 3, not 1. Multiplying f′(1) by g′(1) would give (−4)(2)=−8, which is wrong.
The cube of f(x)For k(x)=[f(x)]3, the cube is the outside and f(x) is the inside. The table gives f(1)=2 and f′(1)=−4.
k′(1)=3[f(1)]2⋅f′(1)=3⋅22⋅(−4)=−48
From a graphIf we're given a graph instead of a table, f(a) is the height at a, and f′(a) is the slope at a. On a straight line segment, that slope is rise over run.
Summary
The chain rule
dxdf(g(x))=f′(g(x))⋅g′(x)
dxdy=dwdy⋅dxdw
dxdsin(x2)=cos(x2)⋅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), the outside gives cos(x2) and the inside gives 2x. If we call the inside w, the rates multiply as dwdy⋅dxdw.
Finding the outside function
Sine on the outside
sin(x2)→cos(x2)⋅2x
Squaring on the outside
sin2x=(sinx)2→2sinxcosx
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), you square first and take the sine last, so sine is on the outside. For (sinx)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)21→x2+9x
Exponential
ex2→2xex2
Natural log
ln(x2+1)→x2+12x
Rewrite roots as powers, like (x2+9)21, so you can use the power rule on the outside. For ex2, the outside function is ew, which differentiates to itself, so the derivative is ex2 times the inside's derivative, 2x. For ln(x2+1), the chain rule gives the inside's derivative divided by the inside.
When the inside is a line
Slope 3
ln(3x+5)→3x+53
Slope −1
e−x→−e−x
When the inside is a line ax+b, its derivative is just the slope a. Differentiate the outside function with ax+b left inside, then multiply by a. For e−x, the slope is −1, so the derivative is −e−x.
Several layers
esin(x2)→esin(x2)⋅cos(x2)⋅2x
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), the exponential gives esin(x2), the sine gives cos(x2), and x2 gives 2x.
Combining with the product and quotient rules
Product rule first
xe−x2→e−x2(1−2x2)
Chain rule first
sin(xex)→(1+x)excos(xex)
The last operation tells you which rule to use first. For xe−x2, the last operation is multiplication, so use the product rule first and apply the chain rule to e−x2. For sin(xex), the last operation is sine, so use the chain rule first and apply the product rule to the inside xex.
Using values from a table or graph
h′(a)=f′(g(a))⋅g′(a)
To find h′(a) for h(x)=f(g(x)), find the inside value g(a) first. That value is the input for f′, so evaluate f′ at g(a) and multiply by g′(a). Don't multiply f′(a) by g′(a), because the input to f at x=a is g(a), not a. If the graph is made of straight line segments, f′(a) is the slope of the segment at a, as long as a 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 dxd(3x2+1)4.
What is the inside function, and what is its derivative?
If you got 4(3x2+1)3 Remember to multiply by the derivative of the inside function, 3x2+1.
Differentiate the insideThe last operation is raising to the fourth power, so the inside is 3x2+1.
inside 3x2+1,dxd(3x2+1)=6x
Apply the chain ruleDifferentiate the outside power, leaving the inside alone, then multiply by the derivative of the inside.
dxd(3x2+1)4=4(3x2+1)3⋅6x=24x(3x2+1)3
2
Find dxdln(cosx).
For lnw, the derivative is w1⋅dxdw. What is w here?
If you got secx That's only the outside derivative cosx1. Multiply by the derivative of the inside.
If you got tanx Check the sign of the derivative of cosx.
Apply the chain ruleThe derivative of ln(cosx) is cosx1 times the derivative of cosx, which is −sinx.
dxdln(cosx)=cosx1⋅(−sinx)=−cosxsinx
SimplifyRewrite −cosxsinx using tangent.
−cosxsinx=−tanx
3
Find dxd1+e2x.
Write the square root as the power 21. What is the derivative of the inside, 1+e2x?
If you got 21+e2xe2x Check the derivative of e2x. It needs a factor of 2 from the derivative of 2x.
Rewrite as a powerWriting the square root as the power 21 lets us use the power rule for the outside.
1+e2x=(1+e2x)21
Differentiate the insideThe derivative of 1 is 0, and the chain rule on e2x brings out a factor of 2.
dxd(1+e2x)=e2x⋅2=2e2x
Apply the chain rule and simplifyMultiply the outside derivative by 2e2x, then cancel the 2 and write the negative power as a root in the denominator.
21(1+e2x)−21⋅2e2x=1+e2xe2x
4
Find dxd(xlnx)3.
The inside is xlnx. Which rule gives its derivative?
If you got 3x(lnx)2 Check the derivative of the inside function xlnx. It's a product, so it needs the product rule.
Differentiate the insideThe inside is a product of x and lnx, so we use the product rule.
dxd(xlnx)=1⋅lnx+x⋅x1=lnx+1
Apply the chain ruleBring down the 3, square the inside, and multiply by the inside's derivative, lnx+1.
dxd(xlnx)3=3(xlnx)2(lnx+1)
5
Use the table. For k(x)=g(f(x)), find k′(1).
x13f(x)31f′(x)−26g(x)42g′(x)57
In g(f(x)), which function is on the outside, and at what value do we evaluate g′?
If you got −10 Evaluate g′ at f(1), which is 3, not at 1.
Apply the chain ruleThe derivative of g(f(x)) is the derivative of the outside at f(x), times the derivative of the inside.
k′(1)=g′(f(1))⋅f′(1)
Read the values from the tableThe table gives f(1)=3, so look at the row x=3 to find g′(3)=7, and the row x=1 for f′(1)=−2.
f(1)=3→k′(1)=g′(3)⋅f′(1)=7⋅(−2)=−14
6
The graph of f is made of the line segments from (0,0) to (2,4), from (2,4) to (4,3), and from (4,3) to (6,3). The graph of g is made of the line segments from (0,1) to (2,5) and from (2,5) to (4,5). For h(x)=f(g(x)), find h′(1).
Find g(1) on the graph of g. That value is the input for f′.
What is the slope of the line segment on the graph of f at x=3?
If you got 4 Evaluate f′ at g(1), which is 3, not at 1.
Set up the chain ruleApply the chain rule to f(g(x)) at x=1.
h′(1)=f′(g(1))⋅g′(1)
Find g(1) and g′(1)The height of g at 1 is 3, and g′(1) is the slope of the segment from (0,1) to (2,5).
g(1)=3,g′(1)=2−05−1=2
Find f′(3)Since g(1)=3, find the slope of the line segment on f containing x=3.
f′(3)=4−23−4=−21
Multiply the two slopesMultiply f′(3) by g′(1) to get h′(1).
h′(1)=f′(3)⋅g′(1)=−21⋅2=−1
7
A weather balloon's height after t seconds is h(t) metres, and the temperature at a height of h metres is T(h) °C. We know h(10)=400,h′(10)=3 and T′(400)=−0.006. How fast is the temperature the balloon measures changing at t=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?
If you got −0.002 Multiply the rates instead of dividing them, so the metres cancel.
Set up the chain ruleThe temperature is T(h(t)), so differentiate with the chain rule.
dtdT(h(t))=T′(h(t))⋅h′(t)
Evaluate at t=10At t=10, the balloon is at 400 metres, so multiply T′(400) by h′(10).
t=10:T′(h(10))⋅h′(10)=T′(400)⋅3=−0.006⋅3=−0.018
Check the unitsMultiplying degrees Celsius per metre by metres per second gives degrees Celsius per second.
m∘C⋅sm=s∘C
8
At which points does the graph of y=x4−x2 have a horizontal tangent? Challenge
A horizontal tangent line has slope 0, so find where y′=0.
After using the product rule, write y′ over the single denominator 4−x2.
If you got no horizontal tangent Check the derivative of 4−x2. The negative sign gives −2x, so the terms in the numerator subtract rather than add.
Differentiate the square rootUse the chain rule on (4−x2)21, where the inside's derivative is −2x.
dxd4−x2=21(4−x2)−21⋅(−2x)=−4−x2x
Apply the product ruleUse the product rule on x4−x2, plugging in the derivative of the square root.
y′=1⋅4−x2+x⋅(−4−x2x)=4−x2−4−x2x2
Combine into one fractionMultiply 4−x2 top and bottom by 4−x2 to write y′ as a single fraction.
y′=4−x2(4−x2)−x2=4−x24−2x2
Find where the derivative is zeroA fraction is zero when its numerator is zero and its denominator is not zero, so set 4−2x2=0 to get x=±2, and plug them back into y.