The Chain Rule

A composite function \(f(g(x))\) is a chain of dependencies — x moves the inner function, the inner moves the outer — and its derivative is the product of the two rates: \(f'(g(x))\cdot g'(x)\).

By the end you'll be able to differentiate any composite with "outer-at-inner times inner," and peel deeper nests layer by layer, multiplying a rate for each.

Predict: the stretch slider starts at k = 1. If you double k to 2, the inner rate \(du/dx = 2kx\) doubles at every x. Will the slope of the composite exactly double too? Slide k and watch the three colored numbers below — the outer rate \(3u^2\) climbs as well (because u itself climbed), so the product grows by even more than the inner factor alone. The chain rule feels both rates.

Left panel: the inner function \(u = kx^2 + 1\) with its tangent of slope \(du/dx = 2kx\). Right panel: the composite \(y = u^3 = (kx^2+1)^3\), whose tangent slope is exactly the product \(3u^2\) × \(2kx\). Drag either point (or use the x slider), and hover or focus a point for exact values. Park x at 0: the inner rate is zero there, so the composite goes flat no matter how large the outer rate is — one zero factor kills the whole product.

outer rate dy/du = 3u² = 8.07  ×  inner rate du/dx = 2kx = 1.60  →  dy/dx = 12.91  (u = 1.64)

Inner: u = kx² + 1 — tangent slope du/dx = 2kx
u(x) and its tangent
Composite: y = (kx² + 1)³ — tangent slope 3u² · 2kx
y(x) and its tangent

The chain rule differentiates a composite \(f(g(x))\) as \(f'(g(x))\cdot g'(x)\) — the derivative of the outer function evaluated at the inner, times the derivative of the inner — and applies repeatedly for deeper compositions.

Formal

For \(y = f(g(x))\): \(\dfrac{d}{dx}\big[f(g(x))\big] = f'(g(x))\cdot g'(x)\). In Leibniz notation, set \(u = g(x)\) so \(y = f(u)\); then \(\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot \dfrac{du}{dx}\) — the rates multiply. Why: a small change \(dx\) produces \(du \approx g'(x)\,dx\) in the inner variable, which in turn produces \(dy \approx f'(u)\,du\) in the output; substituting gives \(dy \approx f'(g(x))\,g'(x)\,dx\). That cascade is exactly what the two linked panels above traced — and it's why the \(du\) appears to "cancel" in the Leibniz form. Chant it: outer-at-inner, times inner. The two classic slips are forgetting the \(\cdot\,g'(x)\) factor entirely, and evaluating \(f'\) at \(x\) instead of at \(g(x)\).

Applied

Chained rates are everywhere: inflate a spherical balloon and the volume depends on the radius, while the radius depends on time. How fast is volume growing? \(\dfrac{dV}{dt} = \dfrac{dV}{dr}\cdot\dfrac{dr}{dt}\) — cubic-feet-per-inch times inches-per-second gives cubic-feet-per-second, the units multiplying just like the rates. Any time one quantity drives a second and the second drives a third, the overall sensitivity is the product of the link-by-link sensitivities.

Worked example

Differentiate \(y = (3x^2 + 1)^5\). Outer: \(u^5\), derivative \(5u^4\). Inner: \(u = 3x^2 + 1\), derivative \(6x\). Outer-at-inner times inner: \(y' = 5(3x^2+1)^4 \cdot 6x = \) \(30x(3x^2+1)^4\). Note the outer derivative kept the untouched inner function \(3x^2+1\) as its input — only then did the \(6x\) factor come in.

Your turn

Differentiate \(y = (2x^3 - 5)^4\). Outer: \(u^4\), derivative \(4u^3\), so the outer step gives \(4(2x^3-5)^3\). Inner derivative: \(\dfrac{d}{dx}\big[2x^3 - 5\big] = \) ____ . Multiply: \(y' = \) ____

Reveal the answer

The inner derivative is \(6x^2\) (power rule on \(2x^3\); the constant \(-5\) contributes 0). So \(y' = 4(2x^3-5)^3 \cdot 6x^2 = \) \(24x^2(2x^3-5)^3\). If you wrote only \(4(2x^3-5)^3\), you hit the classic pitfall — the missing \(\cdot\,6x^2\) is the inner rate the chain rule insists on.

More info — deeper nests: peel layers outermost to innermost

Three layers just chain three factors. For \(y = f(g(h(x)))\): \(\dfrac{dy}{dx} = f'(g(h(x)))\cdot g'(h(x))\cdot h'(x)\) — differentiate the outermost layer at everything inside it, then the next layer at what's inside it, and so on inward, multiplying as you go. Try \(y = \sin\!\big(e^{2x}\big)\): the outer \(\sin\) gives \(\cos\!\big(e^{2x}\big)\) (the sine derivative you already know), the middle \(e^{u}\) gives \(e^{2x}\) (the exponential rule from the previous lesson), and the innermost \(2x\) gives 2 — so \(y' = 2e^{2x}\cos\!\big(e^{2x}\big)\). The OpenStax section in Dive deeper below states this general composition-of-three form precisely.

Check your understanding

Question 1 of 4

Differentiate \(y = (5x^2 - 2)^3\).

Question 2 of 4

A classmate writes \(\frac{d}{dx}\sin(x^2) = \cos(x^2)\). What went wrong?

Question 3 of 4

Which pair of derivatives is correct?

Question 4 of 4

For a triple composition \(y = f(g(h(x)))\), what is \(\frac{dy}{dx}\)?

Recap

  • Chain rule: \(\dfrac{d}{dx}\big[f(g(x))\big] = f'(g(x))\cdot g'(x)\) — outer-at-inner, times inner.
  • Leibniz form: with \(u = g(x)\), \(\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot \dfrac{du}{dx}\) — the intermediate rates multiply.
  • Deeper compositions chain more factors: \(f(g(h(x)))\) differentiates to \(f'(g(h(x)))\cdot g'(h(x))\cdot h'(x)\), peeling outermost to innermost.
  • Top pitfalls: dropping the \(\cdot\,g'(x)\) factor, and evaluating \(f'\) at \(x\) instead of at \(g(x)\).

Dive deeper

Sources

  • The Chain Rule