Reading and display settings

Appearance

System follows your operating system and keeps following it, even if you change it later. The header's sun, moon and monitor cycle the same three options.

Text size (%) 100%

Default. Scales every text size on the site, equations and tables included.

Reading width 70ch

How much text runs across one line of prose. Narrower is easier to track; wider fits more on screen.

Line spacing 1.6

The leading on body text. Taller leading helps a tired eye stay on the line.

Density

Padding and gaps around controls, cards, and tables — how much breathing room the layout leaves itself.

Motion

System follows your operating system. Reduced removes every transition on this site. Full keeps them on unless your system asks for less.

1

A machine made of machines

Composition, and the difference quotient that multiplies

Our robot on a line now moves through two stages. The motor's clock $t$ drives an intermediate shaft whose angle is $u = g(t)$; a nonlinear linkage turns that angle into the robot's position $y = f(u)$. The position is the composition of the two machines:

$$ y \;=\; f(g(t)), \qquad\text{equivalently}\qquad y = (f \circ g)(t). $$

Let $t$ move by a small amount $\Delta t$. That moves $u$ by $\Delta u$, which moves $y$ by $\Delta y$. The three changes are tied together by an exact identity for any nonzero steps — the $\Delta u$ cancels like an ordinary fraction:

$$ \frac{\Delta y}{\Delta t} \;=\; \frac{\Delta y}{\Delta u}\cdot\frac{\Delta u}{\Delta t}. $$

Now let $\Delta t \to 0$. A differentiable $g$ is continuous, so $\Delta u \to 0$ too, and both factors slide onto derivatives. That is the chain rule:

$$ \frac{dy}{dt} \;=\; \lim_{\Delta t \to 0}\frac{\Delta y}{\Delta u}\cdot\lim_{\Delta t \to 0}\frac{\Delta u}{\Delta t} \;=\; \frac{dy}{du}\cdot\frac{du}{dt}, \qquad (f \circ g)'(t) \;=\; f'(g(t))\,g'(t). $$

Read it as an instruction: differentiate the outer function at the inner value, then multiply by the inner function's derivative. The gear train below is the picture. The inner shaft rate is $\tfrac{du}{dt} = kt$ and the outer linkage rate is $\tfrac{dy}{du} = \cos u$; their product is the output rate. Slide $t$ and the inner gain $k$ and watch the two gauges and their product move together.

Two meshing gears: the inner gear turns at $\tfrac{du}{dt}$, the outer at $\tfrac{dy}{du}$. The bars below are rate gauges; the output rate is their product.

2

Compose two functions

The rule at a point, checked numerically

The identity is general. Pick an inner function $g$ and an outer function $f$ and the graph below draws $y = f(g(x))$. Drag the probe, or use the slider, and the readout compares two numbers: the derivative computed directly from the composed curve, and the product $f'(g(x))\,g'(x)$ assembled from the two pieces. They agree because the cancellation above is exact before the limit.

The composed curve $f(g(x))$ with its tangent at the probe. Drag the probe point along the curve.

3

Rates you can multiply

Why the units work out

Chain-rule factors are rates with units, and the units cancel the same way the $\Delta u$ did. An engine shaft turns at $\omega_e$ revolutions per second. A gearbox with ratio $R$ slows the wheel to $\omega_w = \omega_e / R$, so $\tfrac{d\omega_w}{d\omega_e} = \tfrac{1}{R}$ — revolutions of wheel per revolution of engine, dimensionless. The wheel of radius $r$ then rolls out $\tfrac{dv}{d\omega_w} = 2\pi r$ metres of ground per revolution. Multiply the factors and the output rate is

$$ \frac{dv}{d\omega_e} \;=\; \frac{dv}{d\omega_w}\cdot\frac{d\omega_w}{d\omega_e} \;=\; 2\pi r \cdot \frac{1}{R} \quad\text{metres per second, per engine revolution per second.} $$

Change the gear ratio and the output rate scales by exactly the same factor. Slide any of the three inputs; the speedometer and the readout recompute the chain.

Engine gear meshing with the wheel, plus a speedometer for the rolling rate $v = \omega_w \cdot 2\pi r$.

4

Running the chain outward-in

A preview of backpropagation

When a composition has more than two layers, the chain rule just keeps multiplying. Here three stages turn $t$ into $u_1$, $u_1$ into $u_2$, and $u_2$ into the output $y$:

$$ \frac{dy}{dt} \;=\; \frac{dy}{du_2}\cdot\frac{du_2}{du_1}\cdot\frac{du_1}{dt}. $$

To differentiate, you sweep from the outside in: start at the output, read off the local derivative on each edge, and accumulate the product as you travel back toward the input. Press play to run the sweep, and slide $t$ to see each local factor change. This is the whole idea backpropagation needs — the graph is just wider, and the multiplication runs in reverse.

A three-layer chain. The highlighted edges are the factors already picked up by the outward-in sweep; their product is the running gradient.

LayerLocal derivativeValueRunning product
5

Where this shows up

The rule the whole site runs on

Backpropagation is this rule evaluated in reverse on a computation graph. Each edge carries a local derivative; the gradient of a loss with respect to any weight is the product of the factors along the path from that weight out to the loss. That is exactly Volume II, Part 9, where the chain rule is applied layer by layer through a small network. The same multiplication is why training a language model is tractable at all: every gradient in LLM training is a long chain of local rates, swept outward-in. And running the rule the other direction — integrating the factors — is substitution, in Part 10.

6

The chain rule on one card

FormReads asWhere it comes up
(f ∘ g)′(x) = f′(g(x)) g′(x)Outer derivative at the inner value, times inner derivativeEvery composition, this part
dy/dx = dy/du · du/dxThe rate is the product of the two stage ratesRelated rates (Part 6), units
Δy/Δx = (Δy/Δu)(Δu/Δx)The exact finite-step identity the limit is taken fromThe derivation, Step 1
dy/dx = dy/du₁ · du₁/du₂ · … · duₙ/dxKeep multiplying for a chain of any depthBackpropagation (Vol II Part 9)
d/dx f(g(x))Differentiate outside-in; never forget the inner factorThe most common mistake in the subject
7

Further reading

8

Check your understanding

0/4 answered