Skip to content

The chain rule, step by step

5 min read

Short answer

For a composition f(g(x))f(g(x)), the derivative is f′(g(x))⋅g′(x)f'(g(x))\cdot g'(x): differentiate the outside, leave the inside alone, then multiply by the derivative of the inside. For longer chains, repeat from the outside in.

Steps1Identify the inner function g(x)and the outer function f2Differentiate the outerfunction, keeping g(x) inside3Multiply by g′(x)4Nested? Repeat from the outside in5Simplifyd/dx f(g(x)) = f′(g(x)) · g′(x)
Work from the outside in and multiply the derivatives as you go.

Why the factors multiply

If y=f(u)y=f(u) and u=g(x)u=g(x), a small change Δx\Delta x changes uu by about g′(x)Δxg'(x)\Delta x, and that changes yy by about f′(u)⋅g′(x)Δxf'(u)\cdot g'(x)\Delta x. In Leibniz notation, dydx=dydu⋅dudx\dfrac{dy}{dx}=\dfrac{dy}{du}\cdot\dfrac{du}{dx}: rates multiply along the chain.

Spotting the inside

In (3x2+1)5(3x^2+1)^5 the inside is 3x2+13x^2+1 and the outside is "to the fifth". In sin⁡(ex)\sin(e^{x}) the inside is exe^x. In ecos⁡xe^{\cos x} the inside is cos⁡x\cos x. If you could name the last operation you would perform when evaluating, that is the outer function.

Worked example

Differentiate h(x)=sin⁡ ⁣(x2+1)3h(x)=\sin\!\big(x^2+1\big)^3, that is, (sin⁡(x2+1))3\big(\sin(x^2+1)\big)^3.

Outer: cube. Middle: sine. Inner: x2+1x^2+1. So h′(x)=3sin⁡2(x2+1)⋅cos⁡(x2+1)⋅2x=6x sin⁡2(x2+1)cos⁡(x2+1)h'(x)=3\sin^2(x^2+1)\cdot\cos(x^2+1)\cdot2x=6x\,\sin^2(x^2+1)\cos(x^2+1).

Try it yourself

Differentiate f(x)=e3x2f(x)=e^{3x^2}.

Show the answer

Outer: eue^{u}, inner: u=3x2u=3x^2. So f′(x)=e3x2⋅6x=6x e3x2f'(x)=e^{3x^2}\cdot6x=6x\,e^{3x^2}.

Keep going with practice

The multivariable chain rule in Vidi's lessons is this same idea with a sum over paths.