~/tedtes/writing/math-foundations-for-reasoning-models

~/writing/math-foundations-for-reasoning-models $ ls

Calculus and Gradients

Chain Rule

The chain rule describes how changes pass through composed functions.

~/writing/math-foundations-for-reasoning-models $ cat topic.md

Chain Rule

Definition

The chain rule describes how change passes through composed functions.

If one function feeds into another:

x -> g(x) -> f(g(x))

then a change in x affects g, and the change in g affects f.

Chain rule = tracking change through a chain of functions.


Function Composition

Earlier, function composition meant applying one function after another.

Example:

g(x) = x + 1
f(u) = u^2

Composed function:

f(g(x)) = (x + 1)^2

The output depends on x indirectly through g(x).

Composition creates indirect dependency.


Why Ordinary Derivative Is Not Enough

If:

y = f(u)
u = g(x)

then y depends on x, but not directly.

The path is:

x changes -> u changes -> y changes

To know how y changes with respect to x, we must combine both effects.

The chain rule handles indirect change.


Basic Form

If:

y = f(u)
u = g(x)

then:

dy/dx = dy/du * du/dx

In words:

change of y with respect to x
=
change of y with respect to u
times
change of u with respect to x

Changes multiply along a dependency chain.


Simple Example

Let:

u = x + 1
y = u^2

Then:

dy/du = 2u
du/dx = 1

So:

dy/dx = 2u * 1

Since u = x + 1:

dy/dx = 2(x + 1)

The derivative follows the structure of the computation.


Why This Matters For Multi-Step Systems

Many systems are built as sequences:

input -> step 1 -> step 2 -> step 3 -> output

If the output changes, we may need to understand how earlier values contributed.

The chain rule gives a principled way to trace sensitivity through steps.

The chain rule connects local changes across a composed process.


Do Not Overcomplicate It

The core idea is simple:

if A affects B
and B affects C
then A affects C through B

The chain rule tells how strong that indirect effect is.

The chain rule measures indirect influence.


Final Summary

  • The chain rule applies to composed functions.
  • It tracks how change passes through intermediate values.
  • Changes multiply along the chain.
  • It is needed when output depends on input indirectly.
  • This becomes important whenever a system is built from multiple connected steps.

~/writing/math-foundations-for-reasoning-models $ open

Continue the series.

Critical Point