← Back to course

The Chain Rule

The chain rule differentiates composite functions by multiplying the derivative of the outer function (with the inner function unchanged inside) by the derivative of the inner function: ddx[f(g(x))]=f′(g(x))⋅g′(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x).

The Chain Rule

Many functions are composites—one function plugged inside another, like f(g(x))f(g(x)). For example, sin⁡(x2)\sin(x^2) combines an outer function f(u)=sin⁡(u)f(u) = \sin(u) with an inner function g(x)=x2g(x) = x^2. The chain rule is the fundamental tool for differentiating such compositions:

ddx[f(g(x))]=f′(g(x))⋅g′(x)\frac{d}{dx}\big[f(g(x))\big] = f'(g(x)) \cdot g'(x)

In plain terms: differentiate the outer function (keeping the inner function unchanged), then multiply by the derivative of the inner function.

Identifying Outer and Inner Functions

The critical first step is recognizing which function is outer and which is inner. Ask yourself: what would I compute last if I plugged in a number? That final operation is the outer function. For 3x+1\sqrt{3x+1}, you first compute 3x+13x+1, then take the square root—so the square root is outer (f(u)=uf(u)=\sqrt{u}) and 3x+13x+1 is inner (g(x)=3x+1g(x)=3x+1).

Quick Examples

Power: For y=(x2+1)5y = (x^2 + 1)^5, differentiate the power to get 5(x2+1)45(x^2+1)^4, then multiply by the derivative of the inner function: dydx=5(x2+1)4⋅2x=10x(x2+1)4\frac{dy}{dx} = 5(x^2+1)^4 \cdot 2x = 10x(x^2+1)^4

Trigonometric: For y=sin⁡(3x)y = \sin(3x), the outer derivative is cos⁡(3x)\cos(3x), multiplied by the inner derivative 33: dydx=3cos⁡(3x)\frac{dy}{dx} = 3\cos(3x)

Multiple Layers

Some composites nest deeper. For y=sin⁡(e2x)y = \sin(e^{2x}), apply the chain rule repeatedly from outside to inside: dydx=cos⁡(e2x)⋅e2x⋅2=2e2xcos⁡(e2x)\frac{dy}{dx} = \cos(e^{2x}) \cdot e^{2x} \cdot 2 = 2e^{2x}\cos(e^{2x})

Each layer contributes one factor; multiply all factors together.

Common Pitfalls

The most frequent error is omitting the inner derivative entirely—writing ddxsin⁡(3x)=cos⁡(3x)\frac{d}{dx}\sin(3x) = \cos(3x) instead of 3cos⁡(3x)3\cos(3x). Another mistake is misidentifying the outer function when the inner function is itself a sum or product. Always verify: does your answer preserve the original inner function unchanged inside the outer derivative?

Practice problems

Practice similar problems interactively, with instant feedback.

Start Closing the Gap