= Chain rule
{title2=$(g\circ f)'(a)=g'(f(a))f'(a)$}
{wiki}
The <chain rule> calculates the <derivative> of a <function composition> by combining local rates. If the inner <function> $f$ is <differentiable> at $a$ and the outer <function> $g$ is <differentiable> at $f(a)$, then
$$
(g\circ f)'(a)=g'(f(a))f'(a).
$$
The evaluation point matters: the outer <derivative> is evaluated at the inner output $f(a)$, not at $a$. A small input change first scales by $f'(a)$; the resulting intermediate change then scales by $g'(f(a))$. In terms of <linear approximations>, composing those two local descriptions multiplies their scale factors. https://openstax.org/books/calculus-volume-1/pages/3-6-the-chain-rule[OpenStax, Calculus Volume 1: statement and proof of the chain rule]{ref}.
For example, $h(x)=\sin(x^2)$ applies a <quadratic function> and then the <sine>. With $f(x)=x^2$ and $g(u)=\sin u$, the <chain rule> gives
$$
h'(x)=\cos(x^2)\,2x,\qquad h'(1)=2\cos1\approx1.08060461.
$$
Here all <angles> are in <radians>. Near $x=1$, increasing the input by $\Delta x$ changes $x^2$ by about $2\Delta x$, and the <sine> changes by about $\cos1$ times that intermediate change. For $\Delta x=0.01$, the <linear approximation> predicts an output increase of $0.0108060$; the exact increase is $\sin(1.0201)-\sin1\approx0.0106894$.
\Image[/chain-rule-local-rates.png]
{title=The chain rule multiplies the local rates through two successive functions}
{description=The inner <quadratic function> has <derivative> $2$ at $x=1$, and the outer <sine> has <derivative> $\cos1$ at its input $u=1$. Their composite has <derivative> $2\cos1$. Each panel shows the corresponding <tangent line> and the exact output of the input change from $1$ to $1.01$. Tangents describe <linear approximations>, not exact finite changes.}
The same rule handles several nested stages. For $h=g\circ f\circ k$, the <derivative> is $h'(x)=g'(f(k(x)))f'(k(x))k'(x)$ under the corresponding <differentiability> assumptions. Writing each intermediate output prevents evaluating a <derivative> at the wrong stage. It also makes the <chain rule> useful for propagating sensitivities through a mathematical model, where one measured quantity influences another through several transformations.
For a quick proof idea, replace $f$ near $a$ by its <linear approximation>, then replace $g$ near $f(a)$ by its <linear approximation>. The composite leading term is their product; <differentiability> ensures the remaining error is smaller than the original input change. This argument still applies when $f'(a)=0$, so the informal cancellation $dh/dx=(dh/du)(du/dx)$ should not be interpreted as division by a possibly zero finite change. The hypotheses are sufficient, but are not necessary for every composite to be <differentiable>, as the <nondifferentiable inner function with a differentiable nondegenerate composite> example shows.
Back to article page