Pure · Differentiation · Year 2

The Chain Rule

The general technique behind every composite function — powers, trig, exponentials and logarithms of anything more complicated than x.

8 min read 3 worked examples

Composite functions

Many functions are built by feeding one function into another — a composite function, like $(3x^2-1)^5$, $\sin(3x^2)$, or $e^{\sin x}$. In each case an "outer" operation (a power, a trig function, an exponential) is applied to an "inner" expression that isn't simply $x$. The previous three lessons previewed a pattern for handling these when the inner expression is linear; the chain rule is the general version, valid for any inner expression.

The chain rule

If $y$ is a function of $u$, and $u$ is itself a function of $x$, the chain rule says

$\dfrac{dy}{dx}=\dfrac{dy}{du}\times\dfrac{du}{dx}$

To differentiate a composite function, set $u$ equal to the "inner" expression, differentiate the "outer" expression with respect to $u$, differentiate $u$ with respect to $x$, then multiply the two results together.

Spotting the chain rule

Look for a function wrapped around another expression — $(3x^2-1)^5$, $\sin(4x^2)$, $e^{x^2}$, $\sqrt{2x+1}$, $\ln(x^3+2)$. An "outer" operation is applied to an "inner" expression that isn't simply $x$.

The general power rule

The single most common use of the chain rule is differentiating $\big(f(x)\big)^n$ for some function $f(x)$ and constant $n$:

$\dfrac{d}{dx}\Big[\big(f(x)\big)^n\Big]=n\big(f(x)\big)^{n-1}f'(x)$

This single result — "bring down the power, reduce it by one, multiply by the derivative of the inside" — covers roots too, since $\sqrt{f(x)}=\big(f(x)\big)^{1/2}$.

The general pattern for standard functions

Every standard derivative from the last three lessons extends the same way, with $f(x)$ in place of a simple $kx$:

$\dfrac{d}{dx}\big[\sin f(x)\big]=f'(x)\cos f(x) \qquad \dfrac{d}{dx}\big[e^{f(x)}\big]=f'(x)e^{f(x)} \qquad \dfrac{d}{dx}\big[\ln f(x)\big]=\dfrac{f'(x)}{f(x)}$
The recipe, every time

Differentiate the outer function exactly as if the inside were $x$, leaving the inside untouched — then multiply by the derivative of the inside. This works identically whether the outer function is a power, a trig function, an exponential, a logarithm, or one of the reciprocal or inverse trig functions from the previous lesson.

Worked example 1

The general power rule
Differentiate $y=(3x^2-1)^5$.
MethodApply the chain rule with $u=3x^2-1$
1
Let $u=3x^2-1$, so $y=u^5$.
Identify the inner expression being raised to a power.
2
$\dfrac{dy}{du}=5u^4$ and $\dfrac{du}{dx}=6x$.
Differentiate the outer and inner functions separately.
3
$\dfrac{dy}{dx}=\dfrac{dy}{du}\times\dfrac{du}{dx}=5u^4\times6x=30xu^4$.
Multiply by the chain rule.
4
$\dfrac{dy}{dx}=30x(3x^2-1)^4$.
Substitute $u$ back in terms of $x$.
▪ solved
Shortcut

With practice, this can be written directly: differentiate the outer power to get $5(3x^2-1)^4$, then multiply by the derivative of the inside, $6x$, without formally naming $u$.

Worked example 2

Trig and exponential composites
Differentiate (a) $y=\sin(3x^2)$, (b) $y=e^{\sin x}$.
MethodDifferentiate the outer function, multiply by the inner derivative
1
(a) Inner function $f(x)=3x^2$, so $f'(x)=6x$.
Identify the inside of the sine function.
2
$\dfrac{dy}{dx}=f'(x)\cos f(x)=6x\cos(3x^2)$.
Outer derivative of sine is cosine, evaluated at the same inner function, times the inner derivative.
3
(b) Inner function $f(x)=\sin x$, so $f'(x)=\cos x$.
Identify the inside of the exponential.
4
$\dfrac{dy}{dx}=f'(x)e^{f(x)}=\cos x\,e^{\sin x}$.
$e^{f(x)}$ differentiates to itself times $f'(x)$.
▪ solved

Worked example 3

A root, and a gradient · Challenge
Differentiate $y=\sqrt{2x+1}$, then find the gradient of the curve at $x=4$.
MethodRewrite as a power, apply the general power rule, then substitute
1
$y=(2x+1)^{1/2}$.
Rewrite the square root as a fractional power.
2
$\dfrac{dy}{dx}=\dfrac12(2x+1)^{-1/2}\times2=(2x+1)^{-1/2}$.
Apply the general power rule with $n=\dfrac12$; the factor of 2 (derivative of the inside) cancels with the $\dfrac12$.
3
$\dfrac{dy}{dx}=\dfrac{1}{\sqrt{2x+1}}$.
Rewrite the negative power as a fraction.
4
At $x=4$: $\dfrac{dy}{dx}=\dfrac{1}{\sqrt9}=\dfrac13$.
Substitute $x=4$, since $2(4)+1=9$.
▪ solved
Look deeper

Whenever the inner function is linear, $f'(x)$ is just a constant, and it cancels neatly with the fractional power — which is exactly why the earlier "multiply by $k$" shortcut for $\sin(kx)$, $e^{kx}$, and similar worked without ever mentioning the chain rule by name.

Common mistake

Forgetting to multiply by the inner derivative altogether — differentiating $(3x^2-1)^5$ as $5(3x^2-1)^4$ with no $\times6x$. Also common: differentiating the inside of the function instead of the outside, e.g. writing $\dfrac{d}{dx}\big[\sin(3x^2)\big]=6x\sin(3x^2)$ instead of $6x\cos(3x^2)$.

Check yourself

Differentiate $y=\ln(x^2+1)$.
(Hint: use $\dfrac{d}{dx}\big[\ln f(x)\big]=\dfrac{f'(x)}{f(x)}$.)

Method
1
Inner function $f(x)=x^2+1$, so $f'(x)=2x$.
Identify the inside of the logarithm.
2
$\dfrac{dy}{dx}=\dfrac{f'(x)}{f(x)}=\dfrac{2x}{x^2+1}$.
Apply the chain rule pattern for $\ln f(x)$.
▪ solved