5.3 Chain Rule
The chain rule is the rule of differentiation for the composition of two or more functions. It is used to find the derivative of a composite function $h(x) = f(g(x))$.
The chain rule states that the derivative of $h(x)$ is the derivative of the outer function evaluated at the inner function, multiplied by the derivative of the inner function:
EXAMPLE 1
Let $h(x) = \sin(2x^2+3)$.
- Inner function: $g(x) = 2x^2+3 \implies g'(x) = 4x$
- Outer function: $f(u) = \sin u \implies f'(u) = \cos u$
EXAMPLE 2
Let $h(x) = e^{5x+3}$.
- Inner function: $g(x) = 5x+3 \implies g'(x) = 5$
- Outer function: $f(u) = e^u \implies f'(u) = e^u$
EXAMPLE 3
Let $h(x) = e^{\sin x}$.
- Inner function: $g(x) = \sin x \implies g'(x) = \cos x$
- Outer function: $f(u) = e^u \implies f'(u) = e^u$
EXAMPLE 4
Let $h(x) = \ln(x^2+4)$.
- Inner function: $g(x) = x^2+4 \implies g'(x) = 2x$
- Outer function: $f(u) = \ln u \implies f'(u) = \dfrac{1}{u}$
EXAMPLE 5
Let $h(x) = \sqrt{3x^2+5x+2}$.
- Inner function: $g(x) = 3x^2+5x+2 \implies g'(x) = 6x+5$
- Outer function: $f(u) = \sqrt{u} \implies f'(u) = \dfrac{1}{2\sqrt{u}}$
EXAMPLE 6
Let $h(x) = \sqrt{\cos x}$.
- Inner function: $g(x) = \cos x \implies g'(x) = -\sin x$
- Outer function: $f(u) = \sqrt{u} \implies f'(u) = \dfrac{1}{2\sqrt{u}}$
EXAMPLE 7
Consider the function $h(x) = (2x^2+3)^2$.
$h(x) = 4x^4 + 12x^2 + 9$
Then $h'(x) = \mathbf{16x^3 + 24x}$
If we follow the chain rule:
- Inner function: $g(x) = 2x^2+3 \implies g'(x) = 4x$
- Outer function: $f(u) = u^2 \implies f'(u) = 2u$
But what about $h(x) = (2x^2+3)^{10}$?
Do not attempt to expand, it will be laborious! Using the chain rule:
- Inner function: $g(x) = 2x^2+3 \implies g'(x) = 4x$
- Outer function: $f(u) = u^{10} \implies f'(u) = 10u^9$
NOTICE: Linear Substitutions
In many examples, the inner function is $g(x) = ax+b$ (linear) so that $g'(x) = a$. Hence, we differentiate the outer function and simply multiply the result by the constant scalar $a$.
A confusing case of the chain rule is the differentiation of the function $\sin^n x$ (or $\cos^n x$). Remember that:
EXAMPLE 8
-
For $h(x) = \sin^3 x$:
Inner: $g(x) = \sin x \implies g'(x) = \cos x$
Outer: $f(u) = u^3 \implies f'(u) = 3u^2$
$h'(x) = 3(\sin x)^2 \cdot (\cos x) = \mathbf{3\sin^2 x \cos x}$ -
For $h(x) = \sin^2 x$:
Inner: $g(x) = \sin x \implies g'(x) = \cos x$
Outer: $f(u) = u^2 \implies f'(u) = 2u$
$h'(x) = 2(\sin x)^1 \cdot (\cos x) = \mathbf{2\sin x \cos x}$ -
For $h(x) = \cos^5 x$:
Inner: $g(x) = \cos x \implies g'(x) = -\sin x$
Outer: $f(u) = u^5 \implies f'(u) = 5u^4$
$h'(x) = 5(\cos x)^4 \cdot (-\sin x) = \mathbf{-5\cos^4 x \sin x}$ -
For $h(x) = \dfrac{1}{\sin x} = (\sin x)^{-1}$:
Inner: $g(x) = \sin x \implies g'(x) = \cos x$
Outer: $f(u) = u^{-1} \implies f'(u) = -1u^{-2}$
$h'(x) = -1(\sin x)^{-2} \cdot (\cos x) = \mathbf{-\dfrac{\cos x}{\sin^2 x}}$ -
For $h(x) = \dfrac{1}{\cos^2 x} = (\cos x)^{-2}$:
Inner: $g(x) = \cos x \implies g'(x) = -\sin x$
Outer: $f(u) = u^{-2} \implies f'(u) = -2u^{-3}$
$h'(x) = -2(\cos x)^{-3} \cdot (-\sin x) = \mathbf{\dfrac{2\sin x}{\cos^3 x}}$
It is possible to have a "double chain", which is the derivative of the composition of three functions. We systematically identify the layers from outside to inside.
EXAMPLE 9
-
a) Let $h(x) = \ln(\sin(3x+1))$
Inner: $g(x) = \sin(3x+1) \implies g'(x) = 3\cos(3x+1)$
Outer: $f(u) = \ln u \implies f'(u) = \dfrac{1}{u}$
$$ h'(x) = \dfrac{1}{\sin(3x+1)} \cdot [3\cos(3x+1)] = \mathbf{3\dfrac{\cos(3x+1)}{\sin(3x+1)}} $$ -
b) Let $h(x) = 3\sin^5(x^2+1) = 3[\sin(x^2+1)]^5$
Inner: $g(x) = \sin(x^2+1) \implies g'(x) = \cos(x^2+1) \cdot (2x)$
Outer: $f(u) = 3u^5 \implies f'(u) = 15u^4$
$$ \begin{aligned} h'(x) &= 15[\sin(x^2+1)]^4 \cdot [\cos(x^2+1) \cdot (2x)] \\ &= \mathbf{30x\sin^4(x^2+1)\cos(x^2+1)} \end{aligned} $$ -
c) Let $h(x) = e^{\sin(3x)}$
Inner: $g(x) = \sin(3x) \implies g'(x) = 3\cos(3x)$
Outer: $f(u) = e^u \implies f'(u) = e^u$
$$ h'(x) = e^{\sin(3x)} \cdot [3\cos(3x)] = \mathbf{3e^{\sin(3x)}\cos(3x)} $$ -
d) Let $h(x) = \sqrt{\sin^2 x + \sin(2x)}$
Inner: $g(x) = \sin^2 x + \sin(2x) \implies g'(x) = 2\sin x\cos x + 2\cos(2x)$
Outer: $f(u) = \sqrt{u} \implies f'(u) = \dfrac{1}{2\sqrt{u}}$
$$ \begin{aligned} h'(x) &= \dfrac{1}{2\sqrt{\sin^2 x + \sin(2x)}} \cdot (2\sin x\cos x + 2\cos(2x)) \\ &= \mathbf{\dfrac{\sin x\cos x + \cos(2x)}{\sqrt{\sin^2 x + \sin(2x)}}} \end{aligned} $$
We may also encounter a combination of differentiation rules.
EXAMPLE 10
Find the derivative of $h(x) = e^{2x}\sin(3x)$.
- First piece: $e^{2x} \implies$ Inner $2x$, Outer $e^u \implies$ derivative is $2e^{2x}$
- Second piece: $\sin(3x) \implies$ Inner $3x$, Outer $\sin u \implies$ derivative is $3\cos(3x)$
$h'(x) = \mathbf{2e^{2x}\sin(3x) + 3e^{2x}\cos(3x)}$
EXAMPLE 11
Find the derivative of $h(x) = e^{x^2\sin x}$.
- Inner: $g(x) = x^2\sin x \implies g'(x) = 2x\sin x + x^2\cos x$
- Outer: $f(u) = e^u \implies f'(u) = e^u$
EXAMPLE 12
Differentiate the following abstract functions ($f$ is an unknown differentiable function):
| Function | Derivative |
|---|---|
| $h(x) = \sin(f(x))$ | $h'(x) = \cos(f(x)) \cdot f'(x)$ (Inner: $f(x)$, Outer: $\sin u$) |
| $h(x) = f(\sin x)$ | $h'(x) = f'(\sin x) \cdot \cos x$ (Inner: $\sin x$, Outer: $f(u)$) |
| $h(x) = [f(x)]^5$ | $h'(x) = 5[f(x)]^4 \cdot f'(x)$ (Inner: $f(x)$, Outer: $u^5$) |
| $h(x) = f(x^5)$ | $h'(x) = f'(x^5) \cdot 5x^4$ (Inner: $x^5$, Outer: $f(u)$) |
Visualizing the Chain Rule (Leibniz Notation)
In Leibniz notation, we explicitly define the intermediate variable $u$. Let $y$ depend on $u$, and $u$ depend on $x$. We map the chain:
The chain rule states that
EXAMPLE 13
Let $y = e^{\sin x}$. Then $y = e^u$ where $u = \sin x$. $$ \dfrac{dy}{dx} = \dfrac{dy}{du} \cdot \dfrac{du}{dx} = e^u \cdot \cos x = \mathbf{e^{\sin x}\cos x} $$
EXAMPLE 14 (Mainly for HL)
Let $P = Q^3$ and $Q = \ln R$. Find $\dfrac{dP}{dR}$ in terms of $R$.
The chain rule provides $$ \dfrac{dP}{dR} = \dfrac{dP}{dQ} \cdot \dfrac{dQ}{dR} = 3Q^2 \cdot \dfrac{1}{R} = \mathbf{3(\ln R)^2 \dfrac{1}{R}} $$