The Chain Rule

The chain rule is how you differentiate a composite function, a function with another function inside it, like (3x + 1)⁵ or sin(x²). It is the most used rule in calculus after the power rule. If the basic rules are new to you, start with derivatives for beginners.

The rule

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

y′ = f′(g(x)) · g′(x)

In words: take the derivative of the outside function, leave the inside alone, then multiply by the derivative of the inside.

With Leibniz notation, if y depends on u and u depends on x:

dy/dx = dy/du · du/dx

Find the inside and the outside

The inside is whatever is sitting where a plain x would normally go.

FunctionOutsideInside
(3x + 1)⁵u⁵3x + 1
√(x² + 4)√ux² + 4
sin(x²)sin ux²
e5xeᵘ5x
ln(x³ + 1)ln ux³ + 1
cos³xu³cos x

Example Differentiate y = (3x + 1)⁵

  1. Outside: u⁵, derivative 5u⁴.
  2. Inside: 3x + 1, derivative 3.
  3. y′ = 5(3x + 1)⁴ · 3 = 15(3x + 1)⁴.

Forgetting the inside derivative

d/dx (3x + 1)⁵ is not 5(3x + 1)⁴. You can check with a simple case: (2x)² = 4x², whose derivative is 8x. The chain rule gives 2(2x) · 2 = 8x. Leaving off the · 2 gives 4x.

Roots

Rewrite a root as a power, then use the chain rule.

Example Differentiate y = √(x² + 4)

  1. y = (x² + 4)1/2.
  2. y′ = ½(x² + 4)−1/2 · 2x.
  3. y′ = x/√(x² + 4).

Trig, exponential and log functions

The same pattern applies to every rule you know:

RuleWith the chain rule
(sin x)′ = cos x(sin u)′ = cos u · u′
(cos x)′ = −sin x(cos u)′ = −sin u · u′
(eˣ)′ = eˣ(eᵘ)′ = eᵘ · u′
(ln x)′ = 1/x(ln u)′ = u′/u

Example Differentiate y = sin(x²)

y′ = cos(x²) · 2x = 2x cos(x²).

Example Differentiate y = e−4x

y′ = e−4x · (−4) = −4e−4x.

Example Differentiate y = ln(x³ + 1)

y′ = 3x²/(x³ + 1).

Example Differentiate y = cos³x

  1. This means (cos x)³. Outside: u³. Inside: cos x.
  2. y′ = 3cos²x · (−sin x) = −3 sin x cos²x.

More than two layers

Peel the layers from the outside in, multiplying a derivative for each one.

Example Differentiate y = sin²(3x)

  1. Three layers: something squared, sine of something, and 3x.
  2. Squared: 2 sin(3x).
  3. Sine: cos(3x).
  4. 3x: 3.
  5. y′ = 2 sin(3x) · cos(3x) · 3 = 6 sin(3x) cos(3x).

With the product rule

When a product has a composite piece, use the product rule, and the chain rule on that piece.

Example Differentiate y = x²(2x − 1)³

  1. Product rule: (first)′ · second + first · (second)′.
  2. (x²)′ = 2x. ((2x − 1)³)′ = 3(2x − 1)² · 2 = 6(2x − 1)².
  3. y′ = 2x(2x − 1)³ + 6x²(2x − 1)².
  4. Factor out 2x(2x − 1)²: y′ = 2x(2x − 1)²(2x − 1 + 3x) = 2x(2x − 1)²(5x − 1).

Why it works

If u changes 3 times as fast as x, and y changes 5 times as fast as u, then y changes 15 times as fast as x. The rates multiply. That’s all dy/dx = dy/du · du/dx says.

Practice problems

  1. Differentiate (4x − 7)³.

    Show answer

    12(4x − 7)².

  2. Differentiate √(1 − x²).

    Show answer

    −x/√(1 − x²).

  3. Differentiate cos(5x + 2).

    Show answer

    −5 sin(5x + 2).

  4. Differentiate ex².

    Show answer

    2x ex².

  5. Differentiate ln(sin x).

    Show answer

    cos x/sin x = cot x.

  6. Differentiate x e3x.

    Show answer

    e3x + 3x e3x = e3x(1 + 3x).

Keep studying

Drafted with help from AI tools. Every example is worked through step by step so you can check it.