Find a course

Module 3: Differentiation TechniquesLesson 8 of 1214 min

The Chain Rule

Differentiate composite functions by spotting the inside and outside, apply the chain rule to powers, exponentials, logs and trig, and combine rules.

Step 1 of 14Learn

Rates multiply

Three gears are linked. Gear A turns 3 times for every turn of gear B, and gear B turns 2 times for every turn of gear C. How many times does A turn for each turn of C? 3 × 2 = 6. Rates of change along a chain multiply.

That's the chain rule, the most important differentiation rule of all. It handles composite functions, a function inside another function, like (3x + 1)⁵, √(x² + 1) or sin(x²).

If y = f(u) and u = g(x), then y = f(g(x)) and

dy/dx = (dy/du) · (du/dx)

In prime notation: d/dx [f(g(x))] = f'(g(x)) · g'(x).

In words: differentiate the outside function, leaving the inside alone, then multiply by the derivative of the inside.

Leibniz notation makes it look like fractions canceling, du over du. That isn't a proof, but it's a reliable memory aid, and it shows the gear idea: y changes with u, u changes with x, so the rates multiply.

Example. y = (3x + 1)⁵. The outside is (something)⁵ and the inside is u = 3x + 1.

  • Outside derivative: 5u⁴ = 5(3x + 1)⁴
  • Inside derivative: 3
  • dy/dx = 5(3x + 1)⁴ · 3 = 15(3x + 1)⁴

Expanding (3x + 1)⁵ and differentiating term by term would give the same thing after a lot more work.

Step 2 of 14Learn

Chain rule examples

The key skill is spotting the inside. Ask: "If I were computing this on a calculator, what would I compute first?" That's the inside.

Square root. y = √(x² + 1) = (x² + 1)1/2

  • Outside: u1/2 gives (1/2)u−1/2. Inside: x² + 1, derivative 2x.
  • dy/dx = (1/2)(x² + 1)−1/2 · 2x = x / √(x² + 1)

Exponential. y = e2x

  • Outside: eᵘ stays eᵘ. Inside: 2x, derivative 2.
  • dy/dx = 2e2x

Trig. y = sin(x²)

  • Outside: sin u gives cos u. Inside: x², derivative 2x.
  • dy/dx = 2x cos(x²)

Compare with y = sin² x = (sin x)². Now the outside is the square and the inside is sin x:

  • dy/dx = 2 sin x · cos x

sin(x²) and sin² x look similar but have different insides, so their derivatives differ.

General patterns worth memorizing, with u = g(x):

FunctionDerivative
uⁿn uⁿ⁻¹ · u'
eᵘeᵘ · u'
ln uu'/u
sin ucos u · u'
cos u−sin u · u'

Step 3 of 14Diagram

The chain rule for y = √(x2 + 1)

The chain rule for y = √(x^2 + 1)Process diagram: x → Inside: u = x^2 + 1 → Outside: y = √u → Multiply the rates.xInside: u =x^2 + 1Outside: y =√uMultiply therates

Tap a shape with to see more.

x
Inside: u = x^2 + 1

du/dx = 2x.

Outside: y = √u

dy/du = 1 / (2√u).

Multiply the rates

dy/dx = (1 / (2√(x2 + 1))) · 2x = x / √(x2 + 1).

Step 4 of 14Practice · Match the pairs

Match each function to its derivative.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. (5x − 2)³
  2. e4x
  3. sin(3x)
  4. ln(x² + 1)
  5. cos(x²)

Step 5 of 14Practice · Work it out

If f(x) = (x² + 1)³, what is f'(1)?

Step 6 of 14Learn

Layers, and combining rules

More than two layers. Peel from the outside in, multiplying one derivative per layer.

y = sin³(2x) = [sin(2x)]³ has three layers: cube, sine, 2x.

  • Cube: 3[sin(2x)]²
  • Sine: cos(2x)
  • Inside: 2
  • dy/dx = 3 sin²(2x) · cos(2x) · 2 = 6 sin²(2x) cos(2x)

Chain rule plus product rule. y = x² e3x

  • Product rule: (x²)' e3x + x² (e3x)'
  • (e3x)' needs the chain rule: 3e3x
  • dy/dx = 2x e3x + 3x² e3x = x e3x(2 + 3x)

Chain rule plus quotient rule. y = x / √(x + 1) can be done with the quotient rule, where the derivative of √(x + 1) needs the chain rule: 1/(2√(x + 1)).

Strategy for big expressions. Decide what the outermost operation is. If it's a product, start with the product rule; if it's a quotient, the quotient rule; if it's a function of something (a power, a root, eˣ, sin, ln), start with the chain rule. Then apply rules to the pieces as needed.

Why d/dx [aˣ] = aˣ ln a. Write aˣ = ex ln a. By the chain rule, the derivative is ex ln a · ln a = aˣ ln a. The chain rule explains formulas you've already used.

Step 7 of 14Practice · Diagram

Peeling y = sin3(2x) from the outside in

Which layer contributes the factor 2?

Tap the shape that answers the question, then press Check.

Peeling y = sin^3(2x) from the outside inLayer diagram: Cube: [ ]^3, Sine: sin( ), Inside: 2x.Cube: [ ]^3Sine: sin( )Inside: 2x
Multiply one factor per layer: 3 sin2(2x) · cos(2x) · 2 = 6 sin2(2x) cos(2x).
Cube: [ ]^3

Derivative 3[sin(2x)]2, inside left alone.

Sine: sin( )

Derivative cos(2x).

Inside: 2x

Derivative 2.

Step 8 of 14Practice · Choose one

What is d/dx [ln(x² + 5)]?

Step 9 of 14Practice · Work it out

If f(x) = (2x − 3)⁴, what is f'(2)?

Step 10 of 14Note

Step 11 of 14Explore

Why sin(kx) has derivative k cos(kx)

Squeezing the sine wave horizontally by a factor k makes every slope k times steeper. Watch the slope at the origin.

-101 -202
Slope at x = 0: k cos(0)
1
Wave length (period) 2π/k
6.28

Step 12 of 14Practice · True or false

d/dx [ex²] = ex²

Step 13 of 14Learn

Why the chain rule matters

The chain rule isn't just one more formula. It's the reason calculus can handle the functions that appear in real models, which are almost always compositions.

  • Physics. A pendulum's angle might be θ(t) = 0.2 cos(3t). Its angular velocity is θ'(t) = −0.6 sin(3t). The factor 3, from the chain rule, means the faster the oscillation, the faster the motion.
  • Biology. A population growing as P(t) = 500e0.04t has growth rate P'(t) = 20e0.04t, which is 0.04P: the growth rate is proportional to the population, the defining property of exponential growth.
  • Machine learning. Neural networks are long chains of composed functions. Training them uses an algorithm called backpropagation, which is the chain rule applied layer by layer, millions of times.
  • Units. If the cost of fuel depends on the distance driven and distance depends on time, then (dollars per hour) = (dollars per mile) × (miles per hour). The chain rule is unit conversion for rates.

In the next lesson, the chain rule powers two more techniques: implicit differentiation, where y is secretly a function of x, and related rates, where everything is secretly a function of time.

Step 14 of 14Practice · Choose one

What is the derivative of f(x) = esin x?