Free AP Calculus AB Differentiation: Composite, Implicit and Inverse Functions

AP Calculus AB · Differentiation: Composite, Implicit and Inverse Functions · free lesson

The Chain Rule

The idea, then worked examples solved step by step, then practice questions whose numbers change every time you try them.

The idea

A function inside a function

Many functions are built by putting one function inside another. In y=(2x+1)2y = (2x + 1)^2 the inside function is u=2x+1u = 2x + 1 and the outside function squares it, y=u2y = u^{2}. Such a function is a composition, written f(g(x))f(g(x)): here g(x)=2x+1g(x) = 2x + 1 is the inside and f(u)=u2f(u) = u^{2} the outside.

The power rule alone does not give its derivative. Multiply out first, and compare with the power rule applied as if 2x+12x + 1 were xx:

ddx[(2x+1)2]=ddx[4x2+4x+1]=8x+4=4(2x+1)\begin{aligned} \frac{d}{dx}\big[(2x + 1)^2\big] &= \frac{d}{dx}\big[{4x^{2} + 4x + 1}\big] = {8x + 4} = {4(2x + 1)} \end{aligned}

The power rule as if 2x+12x + 1 were xx gives 2(2x+1)=4x+22(2x + 1) = {4x + 2}, only half of the true derivative 8x+48x + 4. The missing factor 2 is the derivative of the inside, 2x+12x + 1. The inside changes twice as fast as xx, and that speed is passed on to the outside.

The chain rule

Rule.

If gg is differentiable at xx and ff is differentiable at g(x)g(x), then f(g(x))f(g(x)) is differentiable at xx, and

ddx[f(g(x))]=f′(g(x)) g′(x)\begin{aligned} \frac{d}{dx}\big[f(g(x))\big] &= f'(g(x))\,g'(x) \end{aligned}

In words: the derivative of the outside, taken at the inside (the inside left as it is), times the derivative of the inside.

With u=g(x)u = g(x) and y=f(u)y = f(u) the rule has a second form, Leibniz's:

dydx=dydu⋅dudx\begin{aligned} \frac{dy}{dx} &= \frac{dy}{du} \cdot \frac{du}{dx} \end{aligned}

Read it as rates. If uu changes 3 times as fast as xx, and yy changes 2 times as fast as uu, then yy changes 3⋅2=63 \cdot 2 = 6 times as fast as xx. Below, xx moves along the top line, u=3xu = 3x along the middle one and y=2uy = 2u along the bottom one. Watch how far each dot has gone: when xx has moved 1, uu has moved 3 and yy has moved 6.

Back to the first example. With u=2x+1u = 2x + 1 and y=u2y = u^{2}, dydu=2u\frac{dy}{du} = 2u and dudx=2\frac{du}{dx} = 2, so dydx=2u⋅2=4(2x+1)\frac{dy}{dx} = 2u \cdot 2 = 4(2x + 1), the derivative found by multiplying out.

The inside sets the pace

The graph of y=sin⁡3xy = \sin 3x (red) runs through the same values as y=sin⁡xy = \sin x (blue), three times as fast. So it is three times as steep: by the chain rule, ddx[sin⁡3x]=(cos⁡3x)(3)\frac{d}{dx}[\sin 3x] = (\cos 3x)(3), which is 3 at x=0x = 0, while the slope of sin⁡x\sin x there is 1. The dashed lines are the two tangent lines at the origin.

The usual forms

Each line below is the chain rule with a known outside function; uu is any differentiable function of xx and u′u' its derivative.

FunctionDerivativeFor example
unu^{n}nun−1⋅u′n u^{n-1} \cdot u'ddx(3x−2)4=12(3x−2)3\frac{d}{dx}(3x - 2)^4 = {12(3x - 2)^{3}}
u\sqrt{u}12u⋅u′\frac{1}{2\sqrt{u}} \cdot u'ddxx2+9=xx2+9\frac{d}{dx}\sqrt{x^2 + 9} = {\frac{x}{\sqrt{x^{2} + 9}}}
sin⁡u\sin u, cos⁡u\cos ucos⁡u⋅u′\cos u \cdot u', −sin⁡u⋅u′-\sin u \cdot u'ddxcos⁡5x=−5sin⁡(5x)\frac{d}{dx}\cos 5x = {-5\sin(5x)}
eue^{u}eu⋅u′e^u \cdot u'ddxex2=2x ex2\frac{d}{dx}e^{x^2} = 2x\,e^{x^2}
ln⁡u\ln u1u⋅u′\frac{1}{u} \cdot u'ddxln⁡(x2+1)=2xx2+1\frac{d}{dx}\ln(x^2 + 1) = {\frac{2x}{x^{2} + 1}}

A power of a trigonometric function is a composition too: sin⁡3x\sin^3 x means (sin⁡x)3(\sin x)^3, a cube outside and sin⁡x\sin x inside, so its derivative is 3sin⁡2x⋅cos⁡x3\sin^2 x \cdot \cos x. With three layers, apply the rule from the outside in, one layer at a time: sin⁡2(3x)\sin^2(3x) is a square, of a sine, of 3x3x, so its derivative is 2sin⁡(3x)⋅cos⁡(3x)⋅32\sin(3x) \cdot \cos(3x) \cdot 3.

Drag the slider to move the point of tangency along y=sin⁡(x2)y = \sin(x^2). The slope there is the outside's derivative cos⁡(a2)\cos(a^2) times the inside's derivative 2a2a. Far from 0 the inside grows fast, and the curve swings more and more steeply.

Values from a table

The rule works with numbers as well. Suppose g(1)=3g(1) = 3, g′(1)=4g'(1) = {4}, f′(3)=−2f'({3}) = {-2} and f′(1)=5f'(1) = {5}. Let h(x)=f(g(x))h(x) = f(g(x)). Then f′f' is taken at the inside value g(1)=3g(1) = 3, not at 1:

h′(1)=f′(g(1)) g′(1)=f′(3) g′(1)=(−2)(4)=−8\begin{aligned} h'(1) &= f'(g(1))\,g'(1) = f'({3})\,g'(1) = ({-2})({4}) = {-8} \end{aligned}
Warning.

Four slips cost marks. Leaving out the derivative of the inside. Taking the outside's derivative at xx instead of at g(x)g(x): here f′(1)g′(1)f'(1)g'(1) in place of f′(g(1))g′(1)f'(g(1))g'(1). Writing f′(g′(x))f'(g'(x)), the outside's derivative at the inside's derivative. Stopping one layer early when there are three.

Note.

On the AP exam, a free-response answer from a table shows f′(g(a)) g′(a)f'(g(a))\,g'(a) with the table's values put in, as above, and then the number. The chain rule is used in almost every later topic: implicit differentiation, inverse functions, related rates, and integration by substitution.

Worked examples

Worked examples

Each example is a kind of question the AP exam asks on the chain rule, most of them in the no-calculator part. First name the outside function and the inside function. Then differentiate the outside with the inside left as it is, and multiply by the derivative of the inside. Every number in the working is found by the engine.

Example.

1. A power of a polynomial. Find the derivative of y=(x2−3x)4y = (x^2 - 3x)^4.

The outside is the fourth power, y=u4y = u^{4}, and the inside is u=x2−3xu = x^{2} - 3x, with dudx=2x−3\frac{du}{dx} = {2x - 3}. By the chain rule, dydx=4u3⋅dudx\frac{dy}{dx} = 4u^3 \cdot \frac{du}{dx}:

dydx=4(x2−3x)3⋅(2x−3)=4(2x−3)(x2−3x)3\begin{aligned} \frac{dy}{dx} &= 4({x^{2} - 3x})^3 \cdot ({2x - 3}) = {4(2x - 3)(x^{2} - 3x)^{3}} \end{aligned}

Multiplying out (x2−3x)4(x^2 - 3x)^4 first would also work, but it gives a polynomial of degree 8 and takes much longer. The usual slip is to stop at 4(x2−3x)34(x^2 - 3x)^3, without the factor 2x−32x - 3.

Example.

2. A logarithm of a function: where is the tangent horizontal? Let f(x)=ln⁡(x2+4)f(x) = \ln(x^2 + 4). Find f′(x)f'(x) and the value of xx where the line tangent to the graph of ff is horizontal.

The outside is ln⁡u\ln u, whose derivative is 1u\frac{1}{u}; the inside is u=x2+4u = x^{2} + 4, with derivative 2x2x. So

f′(x)=1x2+4⋅(2x)=2xx2+4\begin{aligned} f'(x) &= \frac{1}{x^2 + 4} \cdot ({2x}) = {\frac{2x}{x^{2} + 4}} \end{aligned}

The bottom x2+4x^{2} + 4 is never 0, so f′(x)=0f'(x) = 0 only where the top is 0, at x=0x = 0. The tangent is horizontal there, at the lowest point (0,ln⁡4)(0, \ln 4). Note that x2+4>0x^{2} + 4 > 0 for every xx, so ff is defined everywhere.

Example.

3. Three layers. Let y=cos⁡3(2x)y = \cos^3(2x). Find dydx\frac{dy}{dx} and its value at x=π8x = \frac{\pi}{8}.

Write cos⁡3(2x)\cos^3(2x) as (cos⁡(2x))3\big(\cos(2x)\big)^3. From the outside in, it is a cube, of a cosine, of 2x2x. Each layer gives one factor:

LayerFunctionIts derivative, inside left as it is
outside( )3(\ )^33cos⁡2(2x)3\cos^2(2x)
middlecos⁡( )\cos(\ )−sin⁡(2x)-\sin(2x)
inside2x2x22
dydx=3cos⁡2(2x)⋅(−sin⁡(2x))⋅2=−6cos⁡(2x)2sin⁡(2x)\begin{aligned} \frac{dy}{dx} &= 3\cos^2(2x) \cdot \big(-\sin(2x)\big) \cdot 2 = {-6\cos(2x)^{2}\sin(2x)} \end{aligned}

At x=π8x = \frac{\pi}{8}, 2x=π42x = \frac{\pi}{4}, where cos⁡π4=sin⁡π4=22\cos\frac{\pi}{4} = \sin\frac{\pi}{4} = \frac{\sqrt{2}}{2}. So

\begin{aligned} \frac{dy}{dx}\Big|_{x &= \pi/8} = -6\left(\frac{\sqrt{2}}{2}\right)^2\left(\frac{\sqrt{2}}{2}\right) = {-\frac{3\sqrt{2}}{2}} \end{aligned}

Stopping after two layers loses the factor 2 at the end; the middle layer's minus sign is the other common slip.

Example.

4. The line tangent to a composite curve. Find an equation of the line tangent to the graph of y=x2+9y = \sqrt{x^2 + 9} at x=4x = 4.

The point of tangency is (4,42+9)=(4,5)(4, \sqrt{4^2 + 9}) = (4, {5}). The outside is u\sqrt{u}, with derivative 12u\frac{1}{2\sqrt{u}}, and the inside u=x2+9u = x^{2} + 9 has derivative 2x2x:

y′=12x2+9⋅2x=xx2+9\begin{aligned} y' &= \frac{1}{2\sqrt{x^2 + 9}} \cdot 2x = {\frac{x}{\sqrt{x^{2} + 9}}} \end{aligned}

At x=4x = 4 the slope is m=45=45m = \frac{4}{ {5} } = {\frac{4}{5}}. The point-slope form y−5=45(x−4)y - {5} = {\frac{4}{5}}(x - 4) gives the tangent line

y=45x+95\begin{aligned} y &= \frac{4}{5}x + \frac{9}{5} \end{aligned}
Example.

5. From a table. The differentiable functions ff and gg have the values in the table. Let h(x)=f(g(x))h(x) = f(g(x)) and k(x)=g(f(x))k(x) = g(f(x)). Find h′(1)h'(1) and k′(1)k'(1).

xxf(x)f(x)f′(x)f'(x)g(x)g(x)g′(x)g'(x)
1223322−2-2
2−1-1554477

For hh, the inside is gg, and g(1)=2g(1) = 2. The outside's derivative is taken there, at x=2x = 2, from the second row:

h′(1)=f′(g(1)) g′(1)=f′(2) g′(1)=(5)(−2)=−10\begin{aligned} h'(1) &= f'(g(1))\,g'(1) = f'({2})\,g'(1) = ({5})({-2}) = {-10} \end{aligned}

For kk, the inside is ff, and f(1)=2f(1) = 2:

k′(1)=g′(f(1)) f′(1)=g′(2) f′(1)=(7)(3)=21\begin{aligned} k'(1) &= g'(f(1))\,f'(1) = g'({2})\,f'(1) = ({7})({3}) = {21} \end{aligned}

Using f′(1)f'(1) in place of f′(g(1))f'(g(1)) for h′(1)h'(1) would give (3)(−2)=−6({3})({-2}) = {-6}, the most common wrong answer. The order of a composition matters: h′(1)h'(1) and k′(1)k'(1) are different.

Example.

6. Rates that multiply, with units. A hiker climbs a trail, gaining altitude at 1200 feet per hour. Near the trail, the air temperature falls by 3.5 degrees Fahrenheit for each 1000 feet of altitude. At what rate is the temperature around the hiker changing?

Let hh be the altitude in feet, tt the time in hours and TT the temperature in °F. The temperature depends on altitude, and the altitude on time, so by the chain rule in Leibniz's form

dTdt=dTdh⋅dhdt=(−0.0035 °Fft)(1200 fth)=−4.2 °Fh\begin{aligned} \frac{dT}{dt} &= \frac{dT}{dh} \cdot \frac{dh}{dt} = \left({-0.0035}\ \frac{°\text{F}}{\text{ft}}\right)\left({1200}\ \frac{\text{ft}}{\text{h}}\right) = {-4.2}\ \frac{°\text{F}}{\text{h}} \end{aligned}

The feet cancel, as the dudu cancels in dydu⋅dudx\frac{dy}{du} \cdot \frac{du}{dx}. The temperature around the hiker falls at 4.24.2 °F per hour. Checking the units is a good test that the two rates were put together the right way: dividing them instead would give degree-hours per square foot, which is not a rate of temperature.

Practice

Answer AP-style questions on the chain rule. Each answer is checked, with the full solution, and every try brings new numbers. Practice needs a free account: it keeps your progress.

Practise the chain rule with new numbers