The Chain Rule

Suppose a chemical reaction's temperature depends on time. Suppose also its reaction rate depends on temperature. How fast does the rate change with time? This is a composition problem: rate is a function of temperature, and temperature is a function of time. We want the derivative of the composite. The naive guess — multiply the two derivatives — turns out to be correct. But why it is correct is subtler than it looks. The most tempting proof divides by a quantity that can equal zero infinitely often near the point of interest. The chain rule is the differentiation rule for composite functions h=g∘fh = g \circ f. It is arguably the single most-used computational tool in calculus. Nearly every derivative computed in practice — of sin⁡(x2)\sin(x^2), of e−x2/2e^{-x^2/2}, of 1+tan⁡x\sqrt{1+\tan x} — is an application of it. Often it is applied several times nested. Beyond computation, the chain rule expresses a deep structural fact. Linear approximations compose by matrix (here, scalar) multiplication. This is the seed of the multivariable chain rule. It is also the seed of the change-of-variables formula in integration. And it underlies the derivative of an inverse function. The subtlety mentioned above is real. If y=f(x)y = f(x) and z=g(y)z = g(y), the difference quotient for zz as a function of xx factors as

g(f(x+h))−g(f(x))h=g(f(x+h))−g(f(x))f(x+h)−f(x)⋅f(x+h)−f(x)h,\frac{g(f(x+h)) - g(f(x))}{h} = \frac{g(f(x+h)) - g(f(x))}{f(x+h) - f(x)} \cdot \frac{f(x+h)-f(x)}{h},

and letting h→0h \to 0 looks like it gives g′(f(x))⋅f′(x)g'(f(x)) \cdot f'(x). But this manipulation is illegal whenever f(x+h)=f(x)f(x+h) = f(x) for a sequence of h→0h \to 0. In that case we divide by zero. A correct proof must route around this obstacle entirely. This article gives the precise statement of the chain rule. It also gives a complete, gap-free proof. The proof uses the increment (error-term) formulation of differentiability. This approach sidesteps the division-by-zero trap. We also examine what fails without each hypothesis. We work two nontrivial examples. Finally, we connect the result forward to inverse function differentiation and Taylor's theorem.

Key takeaways
  • The chain rule computes the derivative of a composite h(x)=g(f(x))h(x) = g(f(x)) as h′(x)=g′(f(x)) f′(x)h'(x) = g'(f(x))\,f'(x).
  • The naive quotient-splitting proof is invalid because f(x+h)−f(x)f(x+h)-f(x) can vanish infinitely often as h→0h\to 0.
  • The fix: write differentiability via an increment equation with an error term that vanishes at the base point, valid even when the increment is zero.
  • Hypotheses needed: ff differentiable at xx, and gg differentiable at f(x)f(x) — nothing more.
  • The rule generalizes immediately to chains of any finite length by iteration.
  • Key idea: near a point, differentiable functions behave like linear maps, and linear maps compose by multiplying their slopes — the chain rule is this fact made rigorous despite the vanishing-increment obstruction.

Where this lives today

The chain rule is the computational backbone of differentiation itself: nearly every derivative formula for elementary functions built from compositions — sin⁡(x2)\sin(x^2), ln⁡(cos⁡x)\ln(\cos x), (3x+1)7(3x+1)^7 — relies on it directly. In multivariable calculus it generalizes to the Jacobian chain rule, D(g∘f)(a)=Dg(f(a)) Df(a)D(g\circ f)(a) = Dg(f(a))\, Df(a), a matrix product replacing the scalar product, foundational for Derivatives of Inverse Functions and the inverse and implicit function theorems. In physics, related rates and dimensional analysis in mechanics (e.g. ddt[potential energy(x(t))]=U′(x(t)) x′(t)\frac{d}{dt}[\text{potential energy}(x(t))] = U'(x(t))\,x'(t), giving force times velocity as power) are direct chain-rule statements. In machine learning, the backpropagation algorithm that trains neural networks is a systematic, layer-by-layer application of the chain rule to compute gradients of a loss function through many nested compositions of affine maps and activation functions. In probability and statistics, the change-of-variables formula for probability density functions of transformed random variables uses the chain rule (via the derivative of the inverse transform) to convert one density into another. In cryptography and numerical analysis, sensitivity and error-propagation analyses — how small perturbations in an input propagate through a composed algorithm — are chain-rule estimates. The chain rule also underlies the derivation of the derivative of an inverse function, (f−1)′(b)=1/f′(f−1(b))(f^{-1})'(b) = 1/f'(f^{-1}(b)), by differentiating the identity f(f−1(y))=yf(f^{-1}(y))=y, and it is a key ingredient in building up higher-order Taylor expansions of composite functions, connecting directly to Taylor's Theorem with Remainder.

Ask the tutor: Can you show me how the increment-based chain rule proof adapts when aa is a left endpoint of the domain, using one-sided derivatives?

DefinitionComposition and the chain rule setup

Let I,J⊆RI, J \subseteq \mathbb{R} be intervals (or more generally sets containing an open interval around the relevant point), and let

f:I→J,g:J→R.f : I \to J, \qquad g : J \to \mathbb{R}.

Define the composite function h=g∘f:I→Rh = g \circ f : I \to \mathbb{R} by

h(x)=g(f(x))for all x∈I.h(x) = g(f(x)) \quad \text{for all } x \in I.

Fix a∈Ia \in I and suppose aa is an interior point of II (so that difference quotients at aa make sense for h→0h \to 0 from both sides), and suppose f(a)∈Jf(a) \in J is an interior point of JJ. Recall that ff is differentiable at aa if

f′(a)=lim⁡h→0f(a+h)−f(a)hf'(a) = \lim_{h \to 0} \frac{f(a+h) - f(a)}{h}

exists as a finite real number, and likewise gg is differentiable at b:=f(a)b := f(a) if

g′(b)=lim⁡k→0g(b+k)−g(b)kg'(b) = \lim_{k \to 0} \frac{g(b+k) - g(b)}{k}

exists finitely. The chain rule asserts that under these hypotheses, hh is differentiable at aa and

h′(a)=g′(f(a))⋅f′(a).h'(a) = g'(f(a)) \cdot f'(a).

Intuition

Think of ff and gg as zoom factors. Near aa, the function ff stretches small displacements by an approximate factor f′(a)f'(a): moving xx by a tiny amount hh moves f(x)f(x) by about f′(a) hf'(a)\, h. Near b=f(a)b = f(a), the function gg stretches displacements by a factor g′(b)g'(b). Composing the two zooms multiplies the factors: a displacement hh in xx produces about f′(a)hf'(a) h in y=f(x)y = f(x), which in turn produces about g′(b)⋅f′(a)hg'(b) \cdot f'(a) h in z=g(y)z = g(y). The overall zoom factor of h=g∘fh = g\circ f at aa is the product g′(b)f′(a)g'(b) f'(a). The delicate point is that "ff stretches by f′(a)f'(a)" is only an approximate, local statement — it can fail to be exactly true for any particular nonzero increment, and in fact the increment f(a+h)−f(a)f(a+h)-f(a) might be exactly zero for some sequence of small hh even though ff is not locally constant. The rigorous proof needs a formulation of differentiability robust enough to survive this, which is exactly the increment/error-term formulation introduced below.

Figure
Composing two local linear approximations: slopes multiply
x y=f(x) a, f(a) slope f'(a) → y z=g(y) b=f(a), g(b) slope g'(b) → x h(x)=g(f(x)) slope g'(b)·f'(a)
TheoremChain Rule for a Single Composition

Let I,J⊆RI, J \subseteq \mathbb{R} be intervals, let aa be an interior point of II, let f:I→Jf: I \to J, and let b=f(a)b = f(a) be an interior point of JJ. Let g:J→Rg : J \to \mathbb{R}. Assume: 1. ff is differentiable at aa, and 2. gg is differentiable at b=f(a)b = f(a). Then the composite h=g∘fh = g \circ f is differentiable at aa, and

h′(a)=g′(f(a))⋅f′(a).h'(a) = g'(f(a)) \cdot f'(a).
LemmaIncrement (error-term) formulation of differentiability

Let FF be defined on an interval containing cc as an interior point. Then FF is differentiable at cc with derivative F′(c)=LF'(c) = L if and only if there exists a function ε\varepsilon, defined for all sufficiently small tt (including t=0t=0), such that

F(c+t)=F(c)+L t+ε(t) tfor all such t,F(c+t) = F(c) + L\,t + \varepsilon(t)\, t \qquad \text{for all such } t,

with

lim⁡t→0ε(t)=0=ε(0).\lim_{t \to 0} \varepsilon(t) = 0 = \varepsilon(0).
Proof

(⇒\Rightarrow) Suppose F′(c)=LF'(c) = L exists. Define, for t≠0t \neq 0 in a neighborhood of 00 small enough that c+tc+t is in the domain,

ε(t)=F(c+t)−F(c)t−L,\varepsilon(t) = \frac{F(c+t) - F(c)}{t} - L,

and set ε(0)=0\varepsilon(0) = 0. Then by definition of the derivative,

lim⁡t→0ε(t)=lim⁡t→0(F(c+t)−F(c)t−L)=F′(c)−L=0,\lim_{t\to 0} \varepsilon(t) = \lim_{t \to 0}\left(\frac{F(c+t)-F(c)}{t} - L\right) = F'(c) - L = 0,

which matches ε(0)=0\varepsilon(0) = 0, so ε\varepsilon is continuous at 00 with ε(0)=0\varepsilon(0)=0, i.e. lim⁡t→0ε(t)=0\lim_{t\to0}\varepsilon(t) = 0. Rearranging the definition of ε(t)\varepsilon(t) (valid for t≠0t \neq 0) gives

F(c+t)=F(c)+Lt+ε(t)t.F(c+t) = F(c) + Lt + \varepsilon(t) t.

For t=0t = 0 this equation reads F(c)=F(c)+0+0F(c) = F(c) + 0 + 0, which is trivially true. So the increment equation holds for all small tt, including t=0t=0. (⇐\Leftarrow) Suppose such ε\varepsilon exists with the stated properties. For t≠0t \neq 0 small, divide the increment equation by tt:

F(c+t)−F(c)t=L+ε(t).\frac{F(c+t)-F(c)}{t} = L + \varepsilon(t).

Since ε(t)→0\varepsilon(t) \to 0 as t→0t \to 0, the right side tends to LL, so

lim⁡t→0F(c+t)−F(c)t=L,\lim_{t\to 0} \frac{F(c+t)-F(c)}{t} = L,

i.e. FF is differentiable at cc with F′(c)=LF'(c) = L. ■\blacksquare

∎

Why this lemma matters. The increment equation F(c+t)=F(c)+Lt+ε(t)tF(c+t) = F(c) + Lt + \varepsilon(t) t holds identically for every small tt, including t=0t = 0 and including values of tt where some other quantity we might want to divide by happens to vanish. This is exactly what we need to route around the division-by-zero obstruction in the composite derivative computation.

Proof

Proof of the Chain Rule. (Technique: increment/error-term substitution — no division by a possibly-vanishing quantity is ever performed.) By hypothesis (2), gg is differentiable at b=f(a)b = f(a). By the increment lemma applied to gg at c=bc = b, there is a function η\eta defined for all sufficiently small kk (including k=0k=0), with η(k)→0\eta(k) \to 0 as k→0k \to 0 and η(0)=0\eta(0) = 0, such that

g(b+k)=g(b)+g′(b) k+η(k) k(1)g(b + k) = g(b) + g'(b)\, k + \eta(k)\, k \tag{1}

for all such kk. By hypothesis (1), ff is differentiable at aa. By the increment lemma applied to ff at c=ac = a, there is a function δ\delta defined for all sufficiently small tt (including t=0t=0), with δ(t)→0\delta(t) \to 0 as t→0t \to 0 and δ(0)=0\delta(0)=0, such that

f(a+t)=f(a)+f′(a) t+δ(t) t(2)f(a+t) = f(a) + f'(a)\, t + \delta(t)\, t \tag{2}

for all such tt.

Step 1: substitute. Fix tt small and nonzero (so that a+t∈Ia + t \in I), and define

k=k(t):=f(a+t)−f(a)=f′(a) t+δ(t) t=(f′(a)+δ(t)) t.(3)k = k(t) := f(a+t) - f(a) = f'(a)\, t + \delta(t)\, t = \big(f'(a) + \delta(t)\big)\, t. \tag{3}

Note k(t)k(t) may be zero for some nonzero tt — this causes no problem, since equation (1) holds even at k=0k=0. Since b+k(t)=f(a)+(f(a+t)−f(a))=f(a+t)∈Jb + k(t) = f(a) + \big(f(a+t)-f(a)\big) = f(a+t) \in J by construction (and a+t∈Ia+t \in I for tt small since aa is interior to II), we may legitimately evaluate gg at b+k(t)b + k(t), and apply (1) with k=k(t)k = k(t):

g(f(a+t))=g(b+k(t))=g(b)+g′(b) k(t)+η(k(t)) k(t).(4)g\big(f(a+t)\big) = g(b + k(t)) = g(b) + g'(b)\, k(t) + \eta(k(t))\, k(t). \tag{4}

Step 2: express the increment of hh. Since h(x)=g(f(x))h(x) = g(f(x)), we have h(a)=g(b)h(a) = g(b) and h(a+t)=g(f(a+t))h(a+t) = g(f(a+t)), so from (4),

h(a+t)−h(a)=g′(b) k(t)+η(k(t)) k(t).h(a+t) - h(a) = g'(b)\, k(t) + \eta(k(t))\, k(t).

Substitute (3) for k(t)k(t):

h(a+t)−h(a)=g′(b)(f′(a)+δ(t))t+η(k(t))(f′(a)+δ(t))t.h(a+t) - h(a) = g'(b)\big(f'(a) + \delta(t)\big) t + \eta(k(t))\big(f'(a)+\delta(t)\big) t.

Divide by tt (legitimate since we assumed t≠0t \neq 0):

h(a+t)−h(a)t=g′(b)f′(a)+g′(b) δ(t)+η(k(t))(f′(a)+δ(t)).(5)\frac{h(a+t)-h(a)}{t} = g'(b) f'(a) + g'(b)\,\delta(t) + \eta(k(t))\big(f'(a)+\delta(t)\big). \tag{5}

Step 3: take the limit t→0t \to 0. We examine each term on the right of (5) as t→0t \to 0:

  • g′(b)f′(a)g'(b) f'(a) is constant.
  • g′(b) δ(t)→g′(b)⋅0=0g'(b)\,\delta(t) \to g'(b) \cdot 0 = 0, since δ(t)→0\delta(t) \to 0 as t→0t \to 0 (this is part of the increment lemma for ff).
  • For the last term, we must show η(k(t))→0\eta(k(t)) \to 0 as t→0t \to 0. First, from (3), as t→0t \to 0,
k(t)=(f′(a)+δ(t)) t⟶(f′(a)+0)⋅0=0,k(t) = \big(f'(a) + \delta(t)\big)\, t \longrightarrow \big(f'(a) + 0\big)\cdot 0 = 0,

using that f′(a)f'(a) is a fixed finite number and δ(t)→0\delta(t) \to 0, t→0t \to 0 (product and sum of functions with limits, plus continuity of multiplication). So k(t)→0k(t) \to 0 as t→0t \to 0. Since η(k)→0\eta(k) \to 0 as k→0k \to 0 (with η(0)=0\eta(0)=0, so η\eta is continuous at 00), and k(t)→0k(t) \to 0 as t→0t \to 0, the composition rule for limits (continuity of η\eta at 00 composed with k(t)→0k(t) \to 0) gives

η(k(t))⟶η(0)=0as t→0.\eta(k(t)) \longrightarrow \eta(0) = 0 \quad \text{as } t \to 0.

This step uses only the continuity of η\eta at the single point 00, established already in the increment lemma — it is not circular, since continuity of η\eta at 00 was proved directly from differentiability of gg at bb, independent of the chain rule. Also f′(a)+δ(t)→f′(a)+0=f′(a)f'(a) + \delta(t) \to f'(a) + 0 = f'(a), a finite limit. Hence, by the product rule for limits,

η(k(t))(f′(a)+δ(t))⟶0⋅f′(a)=0.\eta(k(t))\big(f'(a) + \delta(t)\big) \longrightarrow 0 \cdot f'(a) = 0.

Step 4: combine. By the sum rule for limits, taking t→0t \to 0 in (5):

lim⁡t→0h(a+t)−h(a)t=g′(b)f′(a)+0+0=g′(b)f′(a).\lim_{t \to 0} \frac{h(a+t) - h(a)}{t} = g'(b) f'(a) + 0 + 0 = g'(b) f'(a).

This limit exists and equals g′(f(a))⋅f′(a)g'(f(a)) \cdot f'(a); by definition of the derivative, hh is differentiable at aa and

h′(a)=g′(f(a)) f′(a).h'(a) = g'(f(a))\, f'(a).

■\blacksquare

∎
CorollaryChain rule for finite chains

Let f1,f2,…,fnf_1, f_2, \dots, f_n be functions such that f1f_1 is differentiable at aa, f2f_2 is differentiable at f1(a)f_1(a), f3f_3 is differentiable at f2(f1(a))f_2(f_1(a)), and so on, with fnf_n differentiable at the appropriate iterated image point. Then H=fn∘fn−1∘⋯∘f1H = f_n \circ f_{n-1} \circ \cdots \circ f_1 is differentiable at aa, and

H′(a)=fn′(fn−1(⋯f1(a)))⋅fn−1′(fn−2(⋯f1(a)))⋯f2′(f1(a))⋅f1′(a).H'(a) = f_n'\big(f_{n-1}(\cdots f_1(a))\big) \cdot f_{n-1}'\big(f_{n-2}(\cdots f_1(a))\big) \cdots f_2'(f_1(a)) \cdot f_1'(a).
Proof

By induction on nn, using The Chain Rule (the theorem just proved) as the inductive step. For n=1n=1 the claim is vacuous (just H=f1H = f_1). Assume the result for chains of length n−1n-1; let G=fn−1∘⋯∘f1G = f_{n-1}\circ \cdots \circ f_1, differentiable at aa by the inductive hypothesis with the stated derivative formula. Then H=fn∘GH = f_n \circ G, and applying the two-function chain rule to fnf_n and GG (with fnf_n differentiable at G(a)=fn−1(⋯f1(a))G(a) = f_{n-1}(\cdots f_1(a)) by hypothesis, and GG differentiable at aa by the inductive hypothesis) gives

H′(a)=fn′(G(a))⋅G′(a),H'(a) = f_n'(G(a)) \cdot G'(a),

and substituting the inductive formula for G′(a)G'(a) yields the claimed product. ■\blacksquare

∎

Worked examples

Example 1: A composite with a non-monotonic inner function. Let

h(x)=sin⁡ ⁣(x3−4x).h(x) = \sin\!\big(x^3 - 4x\big).

Here f(x)=x3−4xf(x) = x^3 - 4x (which is not monotonic — it has local extrema, so f(a+t)−f(a)f(a+t) - f(a) genuinely vanishes for infinitely many small nonzero tt near certain points aa, e.g. near a critical point) and g(y)=sin⁡yg(y) = \sin y. We have f′(x)=3x2−4f'(x) = 3x^2 - 4 and g′(y)=cos⁡yg'(y) = \cos y, both differentiable everywhere (polynomial and sine are differentiable on all of R\mathbb{R}, standard facts from Algebraic Rules of Differentiation and direct computation). By the chain rule, at any a∈Ra \in \mathbb{R},

h′(a)=g′(f(a))⋅f′(a)=cos⁡(a3−4a)⋅(3a2−4).h'(a) = g'(f(a)) \cdot f'(a) = \cos\big(a^3 - 4a\big) \cdot (3a^2 - 4).

Check at a=2/3a = 2/\sqrt{3} (a critical point of ff, since 3a2−4=03a^2 - 4 = 0 there): f′(2/3)=0f'(2/\sqrt3) = 0, so h′(2/3)=cos⁡(f(2/3))⋅0=0h'(2/\sqrt3) = \cos(f(2/\sqrt3)) \cdot 0 = 0, regardless of the cosine factor. This matches intuition: near this aa, ff's increments are O(t2)O(t^2) rather than O(t)O(t), so composing with any differentiable gg still gives an hh with zero linear term at aa. Note also that at exactly this point, f(a+t)−f(a)f(a+t) - f(a) is not eventually nonzero for small t≠0t \ne 0 in general (near a local extremum of a smooth function, the difference can vanish only at isolated points typically, but the point of this example is that the proof method never needed to worry about whether it vanishes — the increment method handles it uniformly regardless). Let's also numerically sanity-check at a=1a = 1: f(1)=1−4=−3f(1) = 1 - 4 = -3, f′(1)=3−4=−1f'(1) = 3 - 4 = -1. So

h′(1)=cos⁡(−3)⋅(−1)=−cos⁡(3)≈−(−0.98999)≈0.98999.h'(1) = \cos(-3)\cdot(-1) = -\cos(3) \approx -(-0.98999) \approx 0.98999.

Direct check via difference quotient with t=0.001t = 0.001: f(1.001)=(1.001)3−4(1.001)=1.003003001−4.004=−3.000996999f(1.001) = (1.001)^3 - 4(1.001) = 1.003003001 - 4.004 = -3.000996999. Then h(1.001)=sin⁡(−3.000996999)≈−0.141254h(1.001) = \sin(-3.000996999) \approx -0.141254, and h(1)=sin⁡(−3)≈−0.141120h(1) = \sin(-3) \approx -0.141120. Difference quotient ≈(−0.141254−(−0.141120))/0.001=−0.000134/0.001=−0.134\approx (-0.141254 - (-0.141120))/0.001 = -0.000134/0.001 = -0.134. This does not match 0.989990.98999 — let us recompute carefully. sin⁡(−3)=−sin⁡(3)≈−0.141120\sin(-3) = -\sin(3) \approx -0.141120. sin⁡(−3.000996999)=−sin⁡(3.000996999)\sin(-3.000996999) = -\sin(3.000996999). Using sin⁡(3+Δ)≈sin⁡3+Δcos⁡3\sin(3 + \Delta) \approx \sin 3 + \Delta\cos 3 with Δ=0.000996999\Delta = 0.000996999: sin⁡(3.000997)≈0.141120+0.000997×(−0.989992)≈0.141120−0.000987=0.140133\sin(3.000997) \approx 0.141120 + 0.000997\times(-0.989992) \approx 0.141120 - 0.000987 = 0.140133. So sin⁡(−3.000997)≈−0.140133\sin(-3.000997) \approx -0.140133. Difference quotient: (h(1.001)−h(1))/0.001=(−0.140133−(−0.141120))/0.001=0.000987/0.001=0.987\big(h(1.001) - h(1)\big)/0.001 = \big(-0.140133 - (-0.141120)\big)/0.001 = 0.000987/0.001 = 0.987. This matches h′(1)≈0.98999h'(1) \approx 0.98999 well (small discrepancy from linear approximation truncation), confirming the chain-rule computation. (The earlier miscomputation of f(1.001)f(1.001) above used an arithmetic slip; the corrected value f(1.001)≈−3.000997f(1.001) \approx -3.000997 is what was used in the second, correct pass.)

Example 2: A chain of three functions, asymmetric at every stage. Let

H(x)=ln⁡ ⁣(1+e2x).H(x) = \ln\!\Big(\sqrt{1 + e^{2x}}\Big).

Write H=f3∘f2∘f1H = f_3 \circ f_2 \circ f_1 with

f1(x)=1+e2x,f2(u)=u,f3(v)=ln⁡v.f_1(x) = 1 + e^{2x}, \qquad f_2(u) = \sqrt{u}, \qquad f_3(v) = \ln v.

Check domains and interiority: f1(x)>1>0f_1(x) > 1 > 0 for all real xx, so f2f_2 is applied to a point in (0,∞)(0,\infty), an open set, hence interior; f2(u)=u>1f_2(u) = \sqrt{u} > 1 there, so f3=ln⁡f_3 = \ln is applied to a point in (1,∞)⊂(0,∞)(1,\infty) \subset (0,\infty), again interior. All composition points are interior, satisfying the theorem's hypotheses. Derivatives:

f1′(x)=2e2x,f2′(u)=12u,f3′(v)=1v,f_1'(x) = 2e^{2x}, \qquad f_2'(u) = \frac{1}{2\sqrt u}, \qquad f_3'(v) = \frac{1}{v},

each differentiable on the relevant domain (f1f_1 on R\mathbb R; f2f_2 on (0,∞)(0,\infty) since u\sqrt{u} is not differentiable at u=0u=0 but we never land there; f3f_3 on (0,∞)(0,\infty)). By the finite-chain corollary, at any a∈Ra \in \mathbb{R}, with u=f1(a)=1+e2au = f_1(a) = 1+e^{2a} and v=f2(u)=1+e2av = f_2(u) = \sqrt{1+e^{2a}}:

H′(a)=f3′(v)⋅f2′(u)⋅f1′(a)=11+e2a⋅121+e2a⋅2e2a=e2a1+e2a.H'(a) = f_3'(v)\cdot f_2'(u) \cdot f_1'(a) = \frac{1}{\sqrt{1+e^{2a}}} \cdot \frac{1}{2\sqrt{1+e^{2a}}} \cdot 2e^{2a} = \frac{e^{2a}}{1+e^{2a}}.

Let's verify at a=0a = 0: the formula gives H′(0)=11+1=12H'(0) = \dfrac{1}{1+1} = \dfrac12. Direct check: H(x)=12ln⁡(1+e2x)H(x) = \tfrac12 \ln(1+e^{2x}) (using ln⁡u=12ln⁡u\ln\sqrt{u} = \tfrac12 \ln u — an algebraic identity, not a differentiation shortcut, just to cross-check), so H′(x)=12⋅2e2x1+e2x=e2x1+e2xH'(x) = \tfrac12 \cdot \dfrac{2e^{2x}}{1+e^{2x}} = \dfrac{e^{2x}}{1+e^{2x}}, agreeing exactly with the chain-rule computation for all xx, in particular H′(0)=1/2H'(0) = 1/2. Numerically, H(0.001)=ln⁡1+e0.002H(0.001) = \ln\sqrt{1+e^{0.002}} . Compute e0.002≈1.002002e^{0.002} \approx 1.002002, so 1+e0.002≈2.0020021+e^{0.002} \approx 2.002002, 2.002002≈1.415275\sqrt{2.002002}\approx 1.415275, ln⁡(1.415275)≈0.347385\ln(1.415275) \approx 0.347385. And H(0)=ln⁡2≈0.346574H(0) = \ln\sqrt2 \approx 0.346574. Difference quotient ≈(0.347385−0.346574)/0.001=0.811\approx (0.347385-0.346574)/0.001 = 0.811 — but this should approximate H′(0)=0.5H'(0)=0.5; the discrepancy signals an arithmetic check is needed with a smaller step or more precision, since first-order finite differences at t=0.001t=0.001 carry O(t)O(t) error only if computed with enough significant digits. Recomputing with more precision: e0.002=1+0.002+0.000002+⋯≈1.0020020e^{0.002} = 1 + 0.002 + 0.000002 + \cdots \approx 1.0020020. Then 1+e0.002=2.00200201+e^{0.002} = 2.0020020. 2.0020020\sqrt{2.0020020}: since 2≈1.4142136\sqrt{2}\approx 1.4142136 and d(u)/du=1/(2u)d(\sqrt u)/du = 1/(2\sqrt u), 2.0020020≈1.4142136+0.00200202(1.4142136)≈1.4142136+0.0007080=1.4149216\sqrt{2.0020020} \approx 1.4142136 + \dfrac{0.0020020}{2(1.4142136)} \approx 1.4142136 + 0.0007080 = 1.4149216. Then ln⁡(1.4149216)≈ln⁡(1.4142136)+0.00070801.4142136≈0.3465736+0.0005007=0.3470743\ln(1.4149216) \approx \ln(1.4142136) + \dfrac{0.0007080}{1.4142136} \approx 0.3465736 + 0.0005007 = 0.3470743. Difference quotient: (0.3470743−0.3465736)/0.001=0.0005007/0.001=0.5007(0.3470743 - 0.3465736)/0.001 = 0.0005007/0.001 = 0.5007, which matches H′(0)=0.5H'(0) = 0.5 closely (the residual 0.00070.0007 is the expected second-order error). This confirms the chain-rule formula.

CounterexampleDropping differentiability of the outer function

The chain rule requires gg to be differentiable at the point b=f(a)b = f(a), not merely continuous there. Here is what fails if we only assume continuity of gg at bb. Let f(x)=xf(x) = x (so f′(a)=1f'(a) = 1 for every aa) and let

g(y)=∣y∣.g(y) = |y|.

Take a=0a = 0, so b=f(0)=0b = f(0) = 0. The function gg is continuous everywhere, including at b=0b=0, but gg is not differentiable at 00: the right-hand difference quotient lim⁡k→0+∣k∣−0k=1\lim_{k\to 0^+} \frac{|k|-0}{k} = 1 while the left-hand one is lim⁡k→0−∣k∣−0k=−1\lim_{k\to0^-}\frac{|k|-0}{k} = -1; these disagree, so g′(0)g'(0) does not exist. The composite is h(x)=g(f(x))=∣x∣h(x) = g(f(x)) = |x|, and h′(0)h'(0) likewise fails to exist by the identical one-sided computation. So the conclusion "hh is differentiable at aa with h′(a)=g′(f(a))f′(a)h'(a) = g'(f(a))f'(a)" simply cannot hold — there is no value of g′(0)g'(0) to plug in, and indeed h′(0)h'(0) does not exist either. If one were to naively write "h′(0)=g′(0)⋅f′(0)h'(0) = g'(0)\cdot f'(0)", the right side is undefined since g′(0)g'(0) does not exist, consistent with the left side also failing to exist — the theorem's hypothesis (differentiability of gg at bb) was essential, and without it no valid conclusion can be drawn. A second, sharper illustration: let f(x)=x2sin⁡(1/x)f(x)=x^2\sin(1/x) for x≠0x\neq0, f(0)=0f(0)=0 (differentiable at 00 with f′(0)=0f'(0)=0, by a standard squeeze argument), and let g(y)=∣y∣g(y) = |y| again with b=f(0)=0b=f(0)=0. Then h(x)=∣x2sin⁡(1/x)∣h(x)=|x^2 \sin(1/x)| for x≠0x \ne 0, h(0)=0h(0)=0. One can check hh is not differentiable at 00: near 00, ff takes both signs infinitely often (since sin⁡(1/x)\sin(1/x) oscillates), so h(x)/x=∣f(x)/x∣⋅sign(x)⋅sign(… )h(x)/x = |f(x)/x|\cdot \mathrm{sign}(x)\cdot\mathrm{sign}(\dots) oscillates in sign without settling to a single limit as x→0x\to0, even though f′(0)=0f'(0)=0 — again driven entirely by gg's failure to be differentiable at b=0b=0.

Scope, edge cases & common traps

SituationWhat happens
ff differentiable at aa, gg differentiable at f(a)f(a)Chain rule holds exactly as stated.
ff differentiable at aa, gg only continuous (not differentiable) at f(a)f(a)Chain rule can fail; see counterexample.
f(a+t)=f(a)f(a+t) = f(a) for infinitely many t→0t\to0No problem for the increment-based proof; the naive quotient-splitting proof breaks here.
aa or f(a)f(a) not an interior point (e.g. an endpoint)State the rule with one-sided derivatives; the proof adapts by using one-sided increment lemmas.
Chain of n≥3n \geq 3 functionsHandled by induction (see corollary); differentiability needed at each successive image point.
ff or gg differentiable on a whole interval, not just at one pointRule then gives h′(x)=g′(f(x))f′(x)h'(x) = g'(f(x))f'(x) for every xx in that interval, recovering the familiar "for all xx" formula used in computations.

The mathematician behind it

Origins · 1 minGottfried Wilhelm Leibniz and how this was discovered
GW
Gottfried Wilhelm Leibniz
1646–1716 · Co-founder of the calculus, Hanover and Paris

Leibniz developed the differential calculus independently of Newton in the 1670s, and it is his notation — dzdx=dzdy⋅dydx\frac{dz}{dx} = \frac{dz}{dy}\cdot\frac{dy}{dx} — that makes the chain rule look almost like cancelling fractions, a mnemonic so effective it persists in every calculus classroom today. Leibniz worked as a diplomat, philosopher, and librarian for the House of Hanover while developing calculus, symbolic logic, and early mechanical calculators. The rigorous ε\varepsilon-based proof of the chain rule given here, however, is a 19th-century achievement, built on the arithmetization of analysis by Cauchy and Weierstrass, since Leibniz's own "infinitesimal" quantities lacked a rigorous logical foundation in his time.

History
- 1675 — Leibniz introduces differential notation dydy, dxdx and the ratio dy/dxdy/dx, implicitly using chain-rule-like reasoning in manipulating differentials.
- 1755 — Euler's Institutiones Calculi Differentialis systematizes differentiation rules for composite functions in the language of infinitesimals.
- 1821 — Cauchy's Cours d'Analyse gives the first rigorous limit-based definition of the derivative, setting the stage for a fully rigorous chain rule.
- 1861 — Weierstrass, in his Berlin lectures, formalizes the increment/error-term (ε\varepsilon-δ\delta) approach to differentiability used in the modern proof of the chain rule.
- 1900s — The increment formulation becomes the standard textbook route (e.g. via Carathéodory's equivalent formulation) precisely because it avoids the division-by-zero pitfall in composite differentiation.
Why can't we just define the derivative of gg at bb using the quotient g(f(a+t))−g(b)f(a+t)−f(a)\frac{g(f(a+t))-g(b)}{f(a+t)-f(a)} directly?

Because that quotient is undefined whenever f(a+t)=f(a)f(a+t) = f(a), i.e. whenever the denominator is zero, and this can happen for infinitely many tt arbitrarily close to 00 even when ff is differentiable and non-constant near aa (a classic example is f(x)=x2sin⁡(1/x)f(x)=x^2\sin(1/x) with f(0)=0f(0)=0, which vanishes at t=1/(nπ)t=1/(n\pi) for every integer nn). The increment/error-term formulation avoids this entirely: it expresses g(b+k)=g(b)+g′(b)k+η(k)kg(b+k) = g(b) + g'(b)k + \eta(k)k as an identity that holds for every small kk, including k=0k=0, so no division by a possibly-vanishing quantity is ever required.

Does the chain rule require ff or gg to be continuous, as a separate hypothesis?

No separate continuity hypothesis is needed, because differentiability at a point already implies continuity at that point — this is a standard consequence of the definition of the derivative (if f′(a)f'(a) exists, then f(a+t)−f(a)=f′(a)t+ε(t)t→0f(a+t)-f(a) = f'(a)t + \varepsilon(t)t \to 0 as t→0t\to0, so ff is continuous at aa). So requiring ff differentiable at aa and gg differentiable at f(a)f(a) already automatically forces the continuity needed for the composite g∘fg\circ f to even make sense as a function near aa and for the proof to go through.

Can the chain rule fail if ff is differentiable at aa but not differentiable anywhere else nearby?

The theorem as stated only requires differentiability of ff at the single point aa and of gg at the single point f(a)f(a) — it does not require differentiability on a whole neighborhood. The proof given uses only the increment equations at these two specific points, so pointwise differentiability suffices and the conclusion h′(a)=g′(f(a))f′(a)h'(a) = g'(f(a))f'(a) holds regardless of how badly ff or gg behave away from aa and f(a)f(a) respectively.

How does the chain rule relate to the derivative of an inverse function?

If ff is differentiable at aa with f′(a)≠0f'(a) \neq 0, and f−1f^{-1} exists and is differentiable at b=f(a)b=f(a), differentiating the identity f−1(f(x))=xf^{-1}(f(x)) = x at x=ax=a via the chain rule gives (f−1)′(f(a))⋅f′(a)=1(f^{-1})'(f(a))\cdot f'(a) = 1, hence (f−1)′(b)=1/f′(a)=1/f′(f−1(b))(f^{-1})'(b) = 1/f'(a) = 1/f'(f^{-1}(b)). This is exactly the formula developed in Derivatives of Inverse Functions; the chain rule is the engine that derives it, though a fully rigorous treatment also needs to separately justify that f−1f^{-1} is differentiable in the first place.

Why does the proof need aa and f(a)f(a) to be interior points?

Interiority guarantees that difference quotients F(c+t)−F(c)t\frac{F(c+t)-F(c)}{t} make sense for tt approaching 00 from both sides, matching the two-sided limit definition of the derivative used throughout the proof. If aa or b=f(a)b=f(a) were an endpoint of the domain, only a one-sided limit would be meaningful there, and the theorem and its proof would need to be restated using one-sided derivatives and one-sided increment lemmas; the logical structure of the argument carries over essentially unchanged, but the interior-point hypothesis keeps the statement and proof clean and matches the two-sided derivative definition assumed in the prerequisites.

Is the chain rule still true if g′(f(a))=0g'(f(a)) = 0 or f′(a)=0f'(a)=0?

Yes — the theorem makes no assumption that either derivative is nonzero. If either factor is 00, the conclusion is simply h′(a)=0h'(a) = 0, and the proof goes through exactly as written, since nowhere in the argument did we divide by f′(a)f'(a) or g′(f(a))g'(f(a)); we only ever multiplied and took limits of sums and products, operations that are perfectly well-behaved even when one of the derivatives in question is zero.

Does the chain rule extend to functions of several variables?

Yes, and the increment-based proof strategy used here is exactly the one that generalizes: differentiability of f:Rn→Rmf:\mathbb{R}^n\to\mathbb{R}^m at a point is defined via a linear map Df(a)Df(a) and an error term that is o(∥t∥)o(\|t\|) rather than merely o(t)o(t), and composing two such linear approximations gives the multivariable chain rule D(g∘f)(a)=Dg(f(a))∘Df(a)D(g\circ f)(a) = Dg(f(a))\circ Df(a), a composition (matrix product) of linear maps replacing the scalar product g′(f(a))f′(a)g'(f(a))f'(a) from the one-variable case.

Before this

Where this leads