Chain Rule

The chain rule finds the derivative of a composite function, one function inside another. For y = f(g(x)), the derivative is f'(g(x)) \cdot g'(x): take the derivative of the outside function, keep the inside the same, then multiply by the derivative of the inside.

Before this lesson: Power Rule, Product Rule and Composition of Functions

What the chain rule means

Many functions are built in layers. In y = (3x^2 + 1)^5, the inside layer is u = 3x^2 + 1, and the outside layer raises u to the 5th power. The chain rule handles each layer separately and then multiplies.

Rates of change multiply when they are chained together. If u changes 3 times as fast as x, and y changes 2 times as fast as u, then y changes 2 × 3 = 6 times as fast as x. That is the chain rule in Leibniz notation: \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}.

Diagram of a composite function as two machines in a row. The input x goes into the inside function g, which outputs u = g(x). Then u goes into the outside function f, which outputs y = f(u). Under the first machine the rate is du/dx = g′(x); under the second it is dy/du = f′(u). The total rate is their product, dy/dx = f′(u) · g′(x).
Each machine multiplies small changes by its own rate, so the rates multiply.

The chain rule formula

\frac{d}{dx}\left[f(g(x))\right] = f'(g(x)) \cdot g'(x) \qquad \text{or} \qquad \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}

The most common use is the general power rule, the chain rule applied to a power of a function:

\frac{d}{dx}\left[u^n\right] = n\,u^{n-1} \cdot u'
  1. Find the inside function u = g(x) and the outside function f(u).
  2. Differentiate the outside, leaving the inside unchanged: f′(u).
  3. Multiply by the derivative of the inside: u′ = g′(x).
  4. Substitute u back in terms of x and simplify.

Chain rule examples

Example 1: A power of a polynomial

Differentiate y = (3x^2 + 1)^5.

u = 3x^2 + 1

The inside function is the expression in the parentheses.

y = u^5

The outside function is the 5th power.

\frac{dy}{du} = 5u^4

Differentiate the outside with the power rule.

\frac{du}{dx} = 6x

Differentiate the inside.

y' = 5(3x^2 + 1)^4 \cdot 6x

Multiply the two rates and put u back as 3x² + 1.

y' = 30x(3x^2 + 1)^4

Multiply 5 · 6x and write the factor in front.

Answer: y' = 30x(3x^2 + 1)^4. Expanding (3x^2 + 1)^5 first would take much longer.

Example 2: A square root

Differentiate y = \sqrt{x^2 + 9}. Then find the slope at x = 4.

y = (x^2 + 9)^{1/2}

Write the root as a power (see rational exponents).

y' = \frac{1}{2}(x^2 + 9)^{-1/2} \cdot 2x

General power rule: bring down ½, subtract 1 from the exponent, multiply by the inside’s derivative 2x.

y' = x(x^2 + 9)^{-1/2}

Multiply ½ · 2x.

y' = \frac{x}{\sqrt{x^2 + 9}}

Rewrite the negative power as a root in the denominator.

y'(4) = \frac{4}{\sqrt{25}} = \frac{4}{5}

Substitute x = 4: 16 + 9 = 25.

Answer: y' = \frac{x}{\sqrt{x^2 + 9}}, and the slope at x = 4 is \frac{4}{5}.

Example 3: A power in the denominator

Differentiate y = \frac{1}{(2x - 3)^4}.

y = (2x - 3)^{-4}

Move the power up with a negative exponent (see negative exponents).

y' = -4(2x - 3)^{-5} \cdot 2

General power rule. The inside 2x − 3 has derivative 2.

y' = -8(2x - 3)^{-5}

Multiply −4 · 2.

y' = \frac{-8}{(2x - 3)^5}

Rewrite with a positive exponent.

Answer: y' = -\frac{8}{(2x - 3)^5}. Rewriting first is faster than the quotient rule here.

Example 4: Using a table of values

Let h(x) = f(g(x)). You know g(1) = 3, g′(1) = −2, f′(1) = 7 and f′(3) = 5. Find h′(1).

h'(1) = f'(g(1)) \cdot g'(1)

Write the chain rule at x = 1.

h'(1) = f'(3) \cdot g'(1)

Replace g(1) with 3. The outside derivative is taken at 3, not at 1.

h'(1) = 5 \cdot (-2)

Substitute f′(3) = 5 and g′(1) = −2.

h'(1) = -10

Multiply.

Answer: h′(1) = −10. The value f′(1) = 7 is a trap. The outside derivative is evaluated at the inside’s output, g(1) = 3.

Example 5: Word problem with a factory’s cost

A factory’s daily cost is C(q) = 200 + 3q + 0.01q^2 dollars for q items. Its daily output grows with time: q(t) = 50 + 5t items, t weeks from now. How fast is the daily cost rising at t = 10 weeks?

\frac{dC}{dt} = \frac{dC}{dq} \cdot \frac{dq}{dt}

Cost depends on q, and q depends on t, so chain the rates.

\frac{dC}{dq} = 3 + 0.02q

Differentiate C(q).

\frac{dq}{dt} = 5

Differentiate q(t).

q(10) = 50 + 5(10) = 100

Find the output at t = 10.

\frac{dC}{dq} = 3 + 0.02(100) = 5

Substitute q = 100. Each extra item costs about $5.

\frac{dC}{dt} = 5 \cdot 5 = 25

Multiply the two rates.

Answer: at 10 weeks, the daily cost is rising by about $25 per week. Each week brings 5 more items a day, and each costs about $5.

Common mistakes

MistakeExample of the errorFix
Forgetting the inside derivativeFor (3x^2 + 1)^5: “y' = 5(3x^2 + 1)^4“Multiply by the inside’s derivative: \cdot 6x.
Differentiating the inside inside the parentheses“y' = 5(6x)^4“Keep the inside the same in f′: 5(3x^2 + 1)^4 \cdot 6x.
Evaluating the outside derivative at the wrong pointUsing f′(1) for h′(1) in Example 4Use f′(g(1)) = f′(3).
Missing a layer in a triple compositionFor \sqrt{(x^2 + 1)^3}, stopping after two layersWork from the outside in, one layer at a time, and multiply every derivative.
Using the chain rule when the inside is just xMultiplying by 1 again and again for x^5When the inside is x, its derivative is 1. The power rule is enough.

Related methods

The chain rule with the product and quotient rules

Many problems need two rules. For y = x(x^2 + 1)^3, use the product rule first, and the chain rule to differentiate (x^2 + 1)^3. Practice Problem 8 works through this.

Three or more layers

For y = f(g(h(x))), multiply three derivatives: y' = f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x). Peel the layers from the outside in.

Coming next

The chain rule is the key step in implicit differentiation and in related rates. It also gives the derivatives of functions like \sin(3x) and e^{x^2} in the next unit.

Practice problems

  1. Differentiate y = (4x - 1)^3.
  2. Differentiate y = (x^2 - 5x)^4.
  3. Differentiate y = \sqrt{6x + 1}.
  4. Differentiate y = \frac{1}{(x^3 + 2)^2}.
  5. Find y′(1) for y = \sqrt[3]{x^2 + 7}.
  6. Let h(x) = f(g(x)). If g(2) = 0, g′(2) = 4 and f′(0) = −3, find h′(2).
  7. Find the tangent line to y = \sqrt{x^2 + 16} at x = 3.
  8. Differentiate y = x(x^2 + 1)^3 and factor the answer.
  9. Differentiate y = \left(\frac{x + 1}{x - 1}\right)^2.
  10. A balloon’s radius is r(t) = 2 + 0.5t cm after t seconds. Its volume is V = \frac{4}{3}\pi r^3. How fast is the volume growing at t = 4?
Show answers

1.

y' = 3(4x - 1)^2 \cdot 4

General power rule. The inside has derivative 4.

y' = 12(4x - 1)^2

Multiply 3 · 4.

Answer: y' = 12(4x - 1)^2

2.

y' = 4(x^2 - 5x)^3 \cdot (2x - 5)

General power rule. The inside has derivative 2x − 5.

Answer: y' = 4(2x - 5)(x^2 - 5x)^3

3.

y = (6x + 1)^{1/2}

Write the root as a power.

y' = \frac{1}{2}(6x + 1)^{-1/2} \cdot 6

General power rule.

y' = \frac{3}{\sqrt{6x + 1}}

Multiply ½ · 6 and rewrite as a root.

Answer: y' = \frac{3}{\sqrt{6x + 1}}

4.

y = (x^3 + 2)^{-2}

Rewrite with a negative exponent.

y' = -2(x^3 + 2)^{-3} \cdot 3x^2

General power rule. The inside has derivative 3x².

y' = \frac{-6x^2}{(x^3 + 2)^3}

Multiply and rewrite with a positive exponent.

Answer: y' = -\frac{6x^2}{(x^3 + 2)^3}

5.

y = (x^2 + 7)^{1/3}

Write the cube root as a power.

y' = \frac{1}{3}(x^2 + 7)^{-2/3} \cdot 2x

General power rule: ⅓ − 1 = −⅔.

y'(1) = \frac{1}{3} \cdot 8^{-2/3} \cdot 2

Substitute x = 1: 1 + 7 = 8.

8^{-2/3} = \frac{1}{(\sqrt[3]{8})^2} = \frac{1}{4}

Take the cube root, square it, then flip it.

y'(1) = \frac{1}{3} \cdot \frac{1}{4} \cdot 2 = \frac{1}{6}

Multiply.

Answer: y'(1) = \frac{1}{6}

6.

h'(2) = f'(g(2)) \cdot g'(2)

Chain rule at x = 2.

h'(2) = f'(0) \cdot 4 = -3 \cdot 4

Replace g(2) with 0, then substitute.

h'(2) = -12

Multiply.

Answer: −12

7.

y(3) = \sqrt{9 + 16} = 5

Find the point (3, 5).

y' = \frac{x}{\sqrt{x^2 + 16}}

General power rule, as in Example 2.

y'(3) = \frac{3}{5}

Substitute x = 3.

y - 5 = \frac{3}{5}(x - 3)

Point-slope form (see point-slope form).

y = \frac{3}{5}x + \frac{16}{5}

Distribute, then add 5 = 25/5 to both sides.

Answer: y = \frac{3}{5}x + \frac{16}{5}

8.

y' = 1 \cdot (x^2 + 1)^3 + x \cdot 3(x^2 + 1)^2 \cdot 2x

Product rule, with the chain rule for the second factor.

y' = (x^2 + 1)^3 + 6x^2(x^2 + 1)^2

Simplify the second term.

y' = (x^2 + 1)^2\left[(x^2 + 1) + 6x^2\right]

Factor out the common factor (x² + 1)² (see factoring out the GCF).

y' = (x^2 + 1)^2(7x^2 + 1)

Combine like terms in the brackets.

Answer: y' = (x^2 + 1)^2(7x^2 + 1)

9.

y' = 2\left(\frac{x + 1}{x - 1}\right) \cdot \frac{d}{dx}\left[\frac{x + 1}{x - 1}\right]

General power rule: the inside is the fraction.

\frac{d}{dx}\left[\frac{x + 1}{x - 1}\right] = \frac{(x - 1) - (x + 1)}{(x - 1)^2} = \frac{-2}{(x - 1)^2}

Quotient rule for the inside.

y' = 2 \cdot \frac{x + 1}{x - 1} \cdot \frac{-2}{(x - 1)^2}

Substitute the inside derivative.

y' = \frac{-4(x + 1)}{(x - 1)^3}

Multiply the fractions.

Answer: y' = -\frac{4(x + 1)}{(x - 1)^3}

10.

\frac{dV}{dt} = 4\pi r^2 \cdot \frac{dr}{dt}

Chain rule: dV/dr = 4πr², times dr/dt.

\frac{dr}{dt} = 0.5, \; r(4) = 2 + 0.5(4) = 4

Differentiate r(t) and find r at t = 4.

\frac{dV}{dt} = 4\pi(4)^2(0.5) = 32\pi

Substitute r = 4 and dr/dt = 0.5.

32\pi \approx 100.5

Multiply by π ≈ 3.14159.

Answer: about 100.5 cm³ per second

Chain rule FAQ

What is the chain rule in simple terms?

Differentiate the outside function, leave the inside alone, then multiply by the derivative of the inside. It is how you differentiate a function inside another function.

How do you know when to use the chain rule?

Use it whenever something more than plain x sits inside another function, like a power of a polynomial or a square root of an expression. If the inside is just x, you don’t need it.

What is the general power rule?

It is the chain rule for powers: \frac{d}{dx}[u^n] = n u^{n-1} \cdot u'. For example, the derivative of (2x + 1)^3 is 3(2x + 1)^2 \cdot 2.

How is the chain rule written in Leibniz notation?

\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}. It looks like fractions canceling, which is a handy way to remember it, even though derivatives are not really fractions.

Summary

  • Chain rule: \frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x).
  • Outside derivative first, inside unchanged, then times the inside’s derivative.
  • General power rule: \frac{d}{dx}[u^n] = n u^{n-1} u'.
  • With a table, evaluate the outside derivative at g(a), not at a.
  • In word problems, chained rates multiply: \frac{dC}{dt} = \frac{dC}{dq} \cdot \frac{dq}{dt}.

Previous lesson: Quotient Rule

Next lesson: Implicit Differentiation

Back to the Calculus 1 Index