Dove's LibraryDove's Library

3.1 - The Chain Rule

Composite Functions Review

A composite function is a function inside another function. Before you can use the chain rule, you have to identify the layers.
Example 1: f(x)=cos⁡(x3)f(x) = \cos(x^3)
  • Outer: f(u)=cos⁡uf(u) = \cos u
  • Inner: g(x)=x3g(x) = x^3
Example 2: f(x)=ln⁡xf(x) = \sqrt{\ln x}
  • Outer: f(u)=uf(u) = \sqrt{u}
  • Inner: g(x)=ln⁡xg(x) = \ln x
Example 3: f(x)=sin⁡(cos⁡(2x))f(x) = \sin(\cos(2x))
  • Outer: f(u)=sin⁡uf(u) = \sin u
  • Middle: g(u)=cos⁡ug(u) = \cos u
  • Inner: h(x)=2xh(x) = 2x
That one has three layers, like an onion. You peel away one layer at a time when you differentiate.

The Formula

For a composite function f(g(x))f(g(x)):
ddx[f(g(x))]=f′(g(x))⋅g′(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)
In words: take the derivative of the outer function (leaving the inside alone), then multiply by the derivative of the inside.
The “onion rule”: peel one layer at a time, taking derivatives as you go from outside to inside.
Leibniz form. If y=f(u)y = f(u) and u=g(x)u = g(x), the chain rule says:
dydx=dydu⋅dudx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}
Same rule, different notation: the rate of change of the outer function times the rate of change of the inner function. The dudu’s look like they cancel, which makes it easy to remember (they aren’t really fractions, but they behave like them). In Example 1 below, y=u5y = u^5 and u=3x2−7u = 3x^2 - 7, so dydu=5u4\frac{dy}{du} = 5u^4 and dudx=6x\frac{du}{dx} = 6x.
This form is handy for word problems because the units chain together too. Say the air temperature TT (in °C) depends on the height hh of a weather balloon (in meters), and the height depends on time tt (in minutes). If dTdh=−0.0065\frac{dT}{dh} = -0.0065 °C per meter and the balloon rises at dhdt=40\frac{dh}{dt} = 40 meters per minute, then:
dTdt=dTdh⋅dhdt=(−0.0065)(40)=−0.26 ∘C per minute\frac{dT}{dt} = \frac{dT}{dh} \cdot \frac{dh}{dt} = (-0.0065)(40) = -0.26 \ {}^\circ\text{C per minute}
Check the units: ∘Cmin=∘Cm⋅mmin\frac{{}^\circ\text{C}}{\text{min}} = \frac{{}^\circ\text{C}}{\text{m}} \cdot \frac{\text{m}}{\text{min}}. The meters cancel, just like the dhdh’s.

Basic Examples

Example 1: Power Function Composition

Find ddx[(3x2−7)5]\frac{d}{dx}[(3x^2 - 7)^5].
  • Outer: u5u^5, derivative 5u45u^4
  • Inner: 3x2−73x^2 - 7, derivative 6x6x
ddx[(3x2−7)5]=5(3x2−7)4⋅6x=30x(3x2−7)4\frac{d}{dx}[(3x^2 - 7)^5] = 5(3x^2 - 7)^4 \cdot 6x = 30x(3x^2 - 7)^4
Without the chain rule you’d have to fully expand (3x2−7)5(3x^2 - 7)^5, which would be miserable.

Example 2: Square Root Composition

Find ddx[5x+2]\frac{d}{dx}[\sqrt{5x + 2}].
Recall ddx[x]=12x\frac{d}{dx}[\sqrt{x}] = \frac{1}{2\sqrt{x}}.
  • Outer: u\sqrt{u}, derivative 12u\frac{1}{2\sqrt{u}}
  • Inner: 5x+25x + 2, derivative 55
ddx[5x+2]=125x+2⋅5=525x+2\frac{d}{dx}[\sqrt{5x + 2}] = \frac{1}{2\sqrt{5x + 2}} \cdot 5 = \frac{5}{2\sqrt{5x + 2}}

Example 3: Squared Trig Function (common error)

Find ddx[cos⁡2(3x)]\frac{d}{dx}[\cos^2(3x)].
First, understand that cos⁡2(3x)=[cos⁡(3x)]2\cos^2(3x) = [\cos(3x)]^2. That gives you three layers:
  1. Outer: u2u^2
  1. Middle: cos⁡u\cos u
  1. Inner: 3x3x
Peel them off:
  • Layer 1: bring down the 2, giving 2[cos⁡(3x)]12[\cos(3x)]^1
  • Layer 2: derivative of cosine, giving −sin⁡(3x)-\sin(3x)
  • Layer 3: derivative of 3x3x, giving 33
ddx[cos⁡2(3x)]=2cos⁡(3x)⋅(−sin⁡(3x))⋅3=−6cos⁡(3x)sin⁡(3x)\frac{d}{dx}[\cos^2(3x)] = 2\cos(3x) \cdot (-\sin(3x)) \cdot 3 = -6\cos(3x)\sin(3x)
Common mistake: forgetting that the square is its own layer. People often write −sin⁡2(3x)⋅3-\sin^2(3x) \cdot 3, which is wrong.

Logarithmic Functions with the Chain Rule

Method 1: Direct Chain Rule

Find ddx[ln⁡(x4)]\frac{d}{dx}[\ln(x^4)].
ddx[ln⁡(x4)]=1x4⋅4x3=4x3x4=4x\frac{d}{dx}[\ln(x^4)] = \frac{1}{x^4} \cdot 4x^3 = \frac{4x^3}{x^4} = \frac{4}{x}

Method 2: Use Log Properties First

Using the power rule for logs, ln⁡(x4)=4ln⁡x\ln(x^4) = 4\ln x:
ddx[4ln⁡x]=4⋅1x=4x\frac{d}{dx}[4\ln x] = 4 \cdot \frac{1}{x} = \frac{4}{x}
Same answer. Method 2 is faster whenever you just have a variable raised to a power inside the log.

Exponential and Trig Functions with the Chain Rule

Every basic derivative from Unit 2 works the same way inside the chain rule: take the usual derivative, leave the inside alone, then multiply by the derivative of the inside.
ddx[eg(x)]=eg(x)⋅g′(x)ddx[ag(x)]=ag(x)ln⁡(a)⋅g′(x)\frac{d}{dx}[e^{g(x)}] = e^{g(x)} \cdot g'(x) \qquad \frac{d}{dx}[a^{g(x)}] = a^{g(x)} \ln(a) \cdot g'(x)ddx[sin⁡(g(x))]=cos⁡(g(x))⋅g′(x)ddx[ln⁡(g(x))]=g′(x)g(x)\frac{d}{dx}[\sin(g(x))] = \cos(g(x)) \cdot g'(x) \qquad \frac{d}{dx}[\ln(g(x))] = \frac{g'(x)}{g(x)}

Example 1: Exponential with a Polynomial Exponent

Find ddx[ex2−4x]\frac{d}{dx}[e^{x^2 - 4x}].
  • Outer: eue^u, derivative eue^u (it stays the same)
  • Inner: x2−4xx^2 - 4x, derivative 2x−42x - 4
ddx[ex2−4x]=ex2−4x⋅(2x−4)=(2x−4)ex2−4x\frac{d}{dx}[e^{x^2 - 4x}] = e^{x^2 - 4x} \cdot (2x - 4) = (2x - 4)e^{x^2 - 4x}
Common mistake: using the power rule and writing (x2−4x)ex2−4x−1(x^2 - 4x)e^{x^2 - 4x - 1}. The variable is in the exponent, so the power rule doesn’t apply. The other classic error is stopping at ex2−4xe^{x^2 - 4x} and forgetting to multiply by 2x−42x - 4.

Example 2: A Base Other Than e

Find ddx[53x]\frac{d}{dx}[5^{3x}].
ddx[53x]=53xln⁡(5)⋅3=3ln⁡(5)⋅53x\frac{d}{dx}[5^{3x}] = 5^{3x} \ln(5) \cdot 3 = 3\ln(5) \cdot 5^{3x}

Example 3: Trig with a Polynomial Inside

Find ddx[tan⁡(4x3)]\frac{d}{dx}[\tan(4x^3)].
  • Outer: tan⁡u\tan u, derivative sec⁡2u\sec^2 u
  • Inner: 4x34x^3, derivative 12x212x^2
ddx[tan⁡(4x3)]=sec⁡2(4x3)⋅12x2=12x2sec⁡2(4x3)\frac{d}{dx}[\tan(4x^3)] = \sec^2(4x^3) \cdot 12x^2 = 12x^2\sec^2(4x^3)

Combining the Chain Rule with Other Rules

Chain Rule + Quotient Rule

Find f′(t)f'(t) if f(t)=[t2−33t+1]4f(t) = \left[\dfrac{t^2 - 3}{3t + 1}\right]^4.
  • Outer: u4u^4, derivative 4u34u^3
  • Inner: t2−33t+1\frac{t^2 - 3}{3t + 1}, which needs the quotient rule
f′(t)=4[t2−33t+1]3⋅ddt[t2−33t+1]f'(t) = 4\left[\frac{t^2 - 3}{3t + 1}\right]^3 \cdot \frac{d}{dt}\left[\frac{t^2 - 3}{3t + 1}\right]
Quotient rule on the inside:
ddt[t2−33t+1]=(2t)(3t+1)−(t2−3)(3)(3t+1)2=3t2+2t+9(3t+1)2\frac{d}{dt}\left[\frac{t^2 - 3}{3t + 1}\right] = \frac{(2t)(3t + 1) - (t^2 - 3)(3)}{(3t + 1)^2} = \frac{3t^2 + 2t + 9}{(3t + 1)^2}
So:
f′(t)=4[t2−33t+1]3⋅3t2+2t+9(3t+1)2f'(t) = 4\left[\frac{t^2 - 3}{3t + 1}\right]^3 \cdot \frac{3t^2 + 2t + 9}{(3t + 1)^2}
Simplified:
f′(t)=4(t2−3)3(3t2+2t+9)(3t+1)5f'(t) = \frac{4(t^2 - 3)^3(3t^2 + 2t + 9)}{(3t + 1)^5}
Multiple forms are correct, and you may need to manipulate yours to match multiple choice options.

Evaluating Derivatives at Specific Points

Chain Rule + Product Rule with Evaluation

Find h′(2)h'(2) if h(x)=3x2−xh(x) = 3x\sqrt{2 - x}.
Step 1: Product rule.
h′(x)=32−x+3x⋅122−x⋅(−1)=32−x−3x22−xh'(x) = 3\sqrt{2 - x} + 3x \cdot \frac{1}{2\sqrt{2 - x}} \cdot (-1) = 3\sqrt{2 - x} - \frac{3x}{2\sqrt{2 - x}}
Step 2: Plug in x=2x = 2 right away.
h′(2)=30−620h'(2) = 3\sqrt{0} - \frac{6}{2\sqrt{0}}
That’s division by zero, so h′(2)h'(2) is undefined.

A Valid Evaluation Point

Find g′(−1)g'(-1) if g(x)=4x3−xg(x) = 4x\sqrt{3 - x}.
Step 1: Find g′(x)g'(x).
g′(x)=43−x+4x⋅123−x⋅(−1)=43−x−2x3−xg'(x) = 4\sqrt{3 - x} + 4x \cdot \frac{1}{2\sqrt{3 - x}} \cdot (-1) = 4\sqrt{3 - x} - \frac{2x}{\sqrt{3 - x}}
Step 2: Plug in x=−1x = -1.
g′(−1)=44+24=4(2)+22=8+1=9g'(-1) = 4\sqrt{4} + \frac{2}{\sqrt{4}} = 4(2) + \frac{2}{2} = 8 + 1 = 9
Tip: plug in values as soon as you have the derivative. It cuts down on algebra errors.

Using Tables of Values

xx
f(x)f(x)
f′(x)f'(x)
g(x)g(x)
g′(x)g'(x)
2
5
3
4
-1
4
8
6
2
4

Problem 1: Simple Chain Rule

Find h′(2)h'(2) if h(x)=[f(x)]3h(x) = [f(x)]^3.
h′(x)=3[f(x)]2⋅f′(x)h'(x) = 3[f(x)]^2 \cdot f'(x)h′(2)=3[f(2)]2⋅f′(2)=3(5)2⋅3=3(25)(3)=225h'(2) = 3[f(2)]^2 \cdot f'(2) = 3(5)^2 \cdot 3 = 3(25)(3) = 225

Problem 2: Square Root Chain Rule

Find k′(4)k'(4) if k(x)=g(x)k(x) = \sqrt{g(x)}.
k′(x)=12g(x)⋅g′(x)k'(x) = \frac{1}{2\sqrt{g(x)}} \cdot g'(x)k′(4)=122⋅4=422=22=2k'(4) = \frac{1}{2\sqrt{2}} \cdot 4 = \frac{4}{2\sqrt{2}} = \frac{2}{\sqrt{2}} = \sqrt{2}

Problem 3: Nested Composition

Find p′(2)p'(2) if p(x)=f(g(x))p(x) = f(g(x)).
p′(x)=f′(g(x))⋅g′(x)p'(x) = f'(g(x)) \cdot g'(x)
From the table, g(2)=4g(2) = 4 and g′(2)=−1g'(2) = -1:
p′(2)=f′(4)⋅(−1)=6⋅(−1)=−6p'(2) = f'(4) \cdot (-1) = 6 \cdot (-1) = -6

Key Takeaways

  • Chain rule: ddx[f(g(x))]=f′(g(x))⋅g′(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)
  • The “onion rule”: work from outside to inside, one layer at a time
  • Common error: squared trig functions like sin⁡2(3x)\sin^2(3x) have three layers, not two (the square, the trig function, and the inner argument)
  • Log shortcut: ddx[ln⁡(xn)]=nx\frac{d}{dx}[\ln(x^n)] = \frac{n}{x} by using log properties first
  • Exponentials: ddx[eg(x)]=eg(x)⋅g′(x)\frac{d}{dx}[e^{g(x)}] = e^{g(x)} \cdot g'(x), so the exponent stays the same and you multiply by its derivative
  • Leibniz form: dydx=dydu⋅dudx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}, and the units chain together the same way
  • The chain rule often pairs with the product rule, quotient rule, or trig derivatives
  • Plug in numerical values right after finding the derivative to minimize errors
  • Answers can look different depending on how you simplify, so know how to manipulate your result

AP® is a registered trademark of the College Board, which is not affiliated with Dove's Library and was not involved in the production of, and does not endorse, this website.

Providing free, high-quality AP notes to help students succeed, earn college credit, and reach their educational goals, ensuring everyone has access to the resources they need.

© 2026 Standard Learning Group, Inc., which operates Dove's Library. All rights reserved.