⚜ PRINCIPIA ORTHOGONA · Book XVIII · Ch 2 Book XVIII contents · Ch 3 →
Book XVIII · The Chain Rule · Chapter 2 · 2026-09-27
MATHEMATICS · APPLIEDCOMPUTING · MACHINE LEARNING

The Rule Itself

The chain rule as a cancellation, as a theorem about linear maps, and applied to this corpus's own operator chain. The derivative sees one of its non-commutations and misses another.
Held textsKnill, Math 1a Unit 10 · Deisenroth et al. pp. 148–149 · Loomis & Sternberg Thm 6.2, p. 143
CorpusAMonster/dm3_operators.lean
Every numberch02-verify.py — run first, 0 FAIL

Every calculus course teaches the chain rule as a cancellation, dz/dx = dz/dy · dy/dx, and every rigorous text then adds that the cancellation is not what is really happening. This chapter follows the rule through three held texts, from the fraction to the linear map. It then applies the rule to this corpus's own operator chain and finds something the corpus had not said.

§ 1

The rule as a cancellation

Oliver Knill's Harvard course introduces the rule in Unit 10 with sin(x7): take the derivative of the inside, multiply by the derivative of the outside evaluated at the inside, and get 7x6 cos(x7). He adds that avoiding the rule by expanding a power by hand “is called the pain rule”. His justification is the one most people remember: write the difference quotient of f(g(x)) as a product of two quotients, the second over h and the first over H = g(x+h) − g(x), and let both go to zero CITED.

That is Leibniz's notation doing the thinking. Written as fractions, the dy's cancel, and the rule looks like arithmetic. Chapter 1 of this volume will argue from Leibniz's own text why that property mattered historically. It is waiting for the 1684 paper to be held. This chapter is about what the property is worth mathematically.

§ 2

Where the cancellation breaks

The cancellation argument divides by H, and H can be zero. Take g(x) = x² sin(1/x) with g(0) = 0. It is differentiable at 0 with g′(0) = 0, yet g(h) = 0 exactly at every h = 1/(kπ), points that crowd in on zero. At each of them H = 0 and the “first quotient” is 0/0 COMPUTED. The rule itself is still true there. The derivative of exp(g(x)) at 0 is exp(0) · 0 = 0, and the script's difference quotients go to zero with it. What fails is the proof.

Deisenroth, Faisal and Ong say the same thing in a margin note beside their statement of the rule (p. 148): the fraction reading “is only an intuition, but not mathematically correct since the partial derivative is not a fraction.” Their own gloss is more useful than the cancellation. The factors behave like matrices whose inner dimensions must match, and “∂f cancels” is what matching dimensions look like CITED.

§ 3

The rule as a composition of linear maps

Loomis and Sternberg state the version that needs no fractions (Theorem 6.2, p. 143). If F is differentiable at a and G is differentiable at F(a), then G ∘ F is differentiable at a, and

d(G ∘ F)a = dGF(a) ∘ dFa

The differential of a composite is the composite of the differentials. Each d is a linear map, the best linear approximation at a point, and the proof on p. 144 is a chain of equalities that never divides by anything. In coordinates the linear maps are Jacobian matrices and composition is matrix multiplication. That is Deisenroth's “neighbouring dimensions have to match”, now as a theorem.

Two things follow, and the script checks both on a pair of maps of the plane. The rule holds in both orders: d(f∘g) = dfg(x)·dgx and d(g∘f) = dgf(x)·dfx, to six decimal places. And the two orders give different derivatives, differing by 0.99 in their largest entry COMPUTED. Matrix products do not commute, so composition order shows up in the derivative. That is the bridge to the next section.

§ 4

The corpus's chain, differentiated

This series composes four operators and calls the result the generator, G = U ∘ F ∘ K ∘ C. In AMonster/dm3_operators.lean they are written out as explicit maps of (r, θ, z):

operatormapJacobian
C₃ constraintz ↦ r²θidentity except the z-row, which is (2rθ, r², 0)
K₃ kineticsz ↦ z + 1the identity
F₃ foldr ↦ r below κ, 2κ − r aboveradial slope +1 or −1
U₃ unfoldr ↦ r₀ + (r − r₀)e−1radial slope e−1

At two sample states, one on each side of the fold, the Jacobian of G₃ equals the product dU₃·dF₃·dK₃·dC₃, each evaluated where the chain passes COMPUTED. The corpus's generator is a composite map, and its derivative is Leibniz's rule. That is the thesis of this volume, checked on the corpus's own definitions.

What the derivative does not see

The Lean file's first theorem is that constraint and kinetics do not commute: C₃(K₃(1,1,0)) = (1,1,1) while K₃(C₃(1,1,0)) = (1,1,2). That is true, and the script reproduces it. But their derivatives are identical everywhere the script looks. dK₃ is the identity, and C₃ ignores the incoming z, so d(C₃∘K₃) = d(K₃∘C₃) COMPUTED. The two orders differ by a constant shift, and a derivative cannot see a constant. The corpus's showcase non-commutation is invisible to first order.

Other pairs are different. Constraint and unfold do not commute, and neither do their derivatives: d(C₃∘U₃) and d(U₃∘C₃) differ by 1.26 in their largest entry at (1,1,0), because C₃'s Jacobian depends on r and U₃ moves it. If the series wants an order effect that survives linearisation, which is what every gradient-based method sees, this is the pair to cite, not the first theorem. MODEL — computed at sample points from the definitions; no derivative is stated or proved in the Lean file.

Where the rule does not apply

The fold has slope +1 just below κ and −1 just above. At r = κ it has a corner and no derivative, so the rule has nothing to say there COMPUTED. That point is exactly where the series locates its transition. A method that differentiates through G, such as Chapter 3's backpropagation, works on either side of the threshold and is blind at it. OPEN — whether the corpus's other definitions of F are smooth at the fold is not checked here.

§ 5

What to carry out of this chapter

  1. The fraction is a mnemonic. It is right about the answer and wrong about the reason. The reason is that differentials are linear maps and they compose.
  2. Order survives into the derivative, unless it does not. Non-commuting maps usually have non-commuting Jacobians. A difference that is a constant shift vanishes on differentiation.
  3. A corner is outside the rule. The rule needs differentiability at the point, and a fold made from two straight pieces does not have it.
Formal version§4's finding that the two orders differ as maps but share a derivative is stated and proved in Lean 4 in ChainRule.lean: C₃_comp_K₃, K₃_comp_C₃, orders_differ, same_derivative. KERNEL-CHECKED 2026-09-27, Lean v4.32.0 with Mathlib: every theorem on the three standard axioms (dual_pow on propext alone). Gate report: geometry__book18__ChainRule.axioms.txt.

References

  1. O. Knill, Introduction to Calculus (Harvard Math 1a, Spring 2021), Unit 10, “Chain rule”.
  2. M. P. Deisenroth, A. A. Faisal, C. S. Ong, Mathematics for Machine Learning (Cambridge, 2020), §5.2.2, (5.48)–(5.53), pp. 148–149, including the margin note on p. 148 and the gradient check on p. 149.
  3. L. H. Loomis and S. Sternberg, Advanced Calculus, revised edition, §3.6, Theorem 6.2, pp. 143–144.
  4. This corpus: AMonster/dm3_operators.lean, the operators C₃, K₃, F₃, U₃, G₃ and the theorem C₃_K₃_noncommutative.