The chain rule: a careful proof and two applications

Original publication: Updated:

Composite functions and the chain rule

If ff maps xx to an intermediate value and gg acts on that value, their composition is g(f(x))g(f(x)). For example, f(x)=x2+1f(x)=x^2+1 and g(u)=u2g(u)=u^2 give g(f(x))=(x2+1)2g(f(x))=(x^2+1)^2.

If ff is differentiable at xx and gg is differentiable at f(x)f(x), then

ddxg(f(x))=g′(f(x))f′(x).\boxed{\frac{d}{dx}g(f(x))=g'(f(x))f'(x).}

A useful reminder is differentiate the outside, keep the inside, then multiply by the derivative of the inside. The derivative of the outside must be evaluated at f(x)f(x), not at xx.

For the example,

ddx(x2+1)2=2(x2+1)⋅2x=4x(x2+1).\frac{d}{dx}(x^2+1)^2=2(x^2+1)\cdot2x=4x(x^2+1).

Expanding the polynomial first gives the same result and provides a simple check.

A proof that also handles zero inner increments

Fix a point xx and write b=f(x)b=f(x). Differentiability of gg at bb means that the function

R(u)={g(b+u)−g(b)u,u≠0,g′(b),u=0R(u)=\begin{cases}\dfrac{g(b+u)-g(b)}u,&u\ne0,\\g'(b),&u=0\end{cases}

is continuous at u=0u=0.

Let Δf=f(x+h)−f(x)\Delta f=f(x+h)-f(x). For every sufficiently small nonzero hh,

g(f(x+h))−g(f(x))h=R(Δf)Δfh.\frac{g(f(x+h))-g(f(x))}{h}=R(\Delta f)\frac{\Delta f}{h}.

This identity remains valid when Δf=0\Delta f=0, because both numerators are then zero. Since differentiability of ff implies continuity, Δf→0\Delta f\to0. Taking limits gives

lim⁡h→0R(Δf)Δfh=g′(f(x))f′(x).\lim_{h\to0}R(\Delta f)\frac{\Delta f}{h}=g'(f(x))f'(x).

The familiar proof that divides by f(x+h)−f(x)f(x+h)-f(x) is a useful heuristic, but this extra definition fills the gap when that increment vanishes, possibly for infinitely many nearby values of hh.

Problem 1: a logistic function and a convergent iteration

Let

f(x)=11+e−x,x∈R.f(x)=\frac1{1+e^{-x}},\qquad x\in\mathbb R.
  1. Find the maximum of f′(x)f'(x).
  2. Prove that f(x)=xf(x)=x has exactly one real solution.
  3. For any real starting value a1a_1, prove that an+1=f(an)a_{n+1}=f(a_n) converges to that solution.

Part 1: differentiate from the outside inward

The outside reciprocal function has derivative −u−2-u^{-2}, while the inside has derivative −e−x-e^{-x}. Thus

f′(x)=e−x(1+e−x)2=1ex+e−x+2.f'(x)=\frac{e^{-x}}{(1+e^{-x})^2}=\frac1{e^x+e^{-x}+2}.

For t=ex>0t=e^x>0, the inequality (t−1/t)2≥0(\sqrt t-1/\sqrt t)^2\ge0 gives t+1/t≥2t+1/t\ge2. Therefore

0<f′(x)≤14,0<f'(x)\le\frac14,

with equality precisely at ex=1e^x=1, or x=0x=0. The maximum is 1/4\boxed{1/4}.

Part 2: a unique fixed point

Put g(x)=f(x)−xg(x)=f(x)-x. Then g′(x)=f′(x)−1≤−3/4<0g'(x)=f'(x)-1\le-3/4<0, so gg is strictly decreasing. Since 0<f(x)<10<f(x)<1,

lim⁡x→−∞g(x)=+∞,lim⁡x→+∞g(x)=−∞.\lim_{x\to-\infty}g(x)=+\infty,\qquad\lim_{x\to+\infty}g(x)=-\infty.

Continuity gives at least one zero, and strict decrease gives at most one. Call it α\alpha. As α=f(α)\alpha=f(\alpha), it lies in (0,1)(0,1).

Part 3: a contraction estimate

Subtract α=f(α)\alpha=f(\alpha) from the recurrence:

an+1−α=f(an)−f(α).a_{n+1}-\alpha=f(a_n)-f(\alpha).

If an≠αa_n\ne\alpha, the mean value theorem gives an intermediate point cnc_n such that

f(an)−f(α)=f′(cn)(an−α).f(a_n)-f(\alpha)=f'(c_n)(a_n-\alpha).

The derivative bound yields

∣an+1−α∣≤14∣an−α∣.|a_{n+1}-\alpha|\le\frac14|a_n-\alpha|.

If an=αa_n=\alpha, both sides are zero, so the inequality holds in that case too. Iteration gives

0≤∣an−α∣≤(14)n−1∣a1−α∣⟶0.0\le|a_n-\alpha|\le\left(\frac14\right)^{n-1}|a_1-\alpha|\longrightarrow0.

Hence an→α\boxed{a_n\to\alpha} for every real initial value. The bound is an inequality, not generally an equality; a maximum derivative provides an upper bound on the contraction factor.

Problem 2: compare an exponential with a cosine

Problem. Prove that for 0<x<π/20<x<\pi/2,

e−x2/2>cos⁡x.e^{-x^2/2}>\cos x.

Instead of differentiating their difference repeatedly, multiply by the positive factor ex2/2e^{x^2/2}. It suffices to show

F(x)=ex2/2cos⁡x<1.F(x)=e^{x^2/2}\cos x<1.

The chain and product rules give

F′(x)=ex2/2(xcos⁡x−sin⁡x).F'(x)=e^{x^2/2}(x\cos x-\sin x).

Let G(x)=xcos⁡x−sin⁡xG(x)=x\cos x-\sin x. Then

G′(x)=−xsin⁡x<0(0<x<π/2).G'(x)=-x\sin x<0\qquad(0<x<\pi/2).

Since G(0)=0G(0)=0, we have G(x)<0G(x)<0, so F′(x)<0F'(x)<0. Consequently F(x)<F(0)=1F(x)<F(0)=1, proving the required strict inequality.

The important rearrangement is to turn a comparison into a product whose derivative contains a common positive exponential factor. The sign question then reduces to an elementary trigonometric expression.

A practical checking routine

Identify every layer before differentiating. In a reciprocal containing an exponential, for example, both the reciprocal and the exponential need the chain rule. Check the sign of each derivative, and distinguish a bound on a derivative from an equality. When a proof involves a difference quotient, do not divide by a quantity that may be zero without handling that case.

Related: logarithmic differentiation and the fundamental sine limit.

Related articles

About the author

Koki Saito

Physician and graduate of the University of Tokyo Faculty of Medicine. Drawing on his entrance-exam experience, he explains how to choose mathematical methods and construct complete solutions.

Full profile →

Have a question or spotted an error? Contact us.