1.2.14 · D1Calculus & Optimization Basics

Foundations — Chain rule for multivariate functions (backprop foundation)

2,279 words10 min readBack to topic

This page assumes you know nothing about the notation in the parent note. We will earn every squiggle before it is allowed to appear. If a symbol shows up in the parent's formulas, it gets a plain-words meaning, a picture, and a reason for existing, right here.


0. What is a function, and why the arrows?

Before any calculus, fix the picture in your head: a function is a machine. You drop a number in, one number comes out.

Figure — Chain rule for multivariate functions (backprop foundation)

The picture: a box labelled . An arrow goes in carrying , an arrow goes out carrying . When machines are wired in a line — the output of one becomes the input of the next — we get a chain, and that chain is the entire reason this topic exists.

Cloze check: a function returns exactly one output for each input.


1. The symbols — names for travellers

These are just labels for numbers that flow through the machines.

  • — the inputs we control (the knobs at the far left).
  • intermediate values, produced partway along, before the end.
  • — the final output (in ML this becomes the loss ).

The picture: stations on an assembly line. is raw material, and are half-built parts, is the finished product.

Why the topic needs them: the chain rule is about tracing influence from an input all the way to the output. You cannot trace a path without naming the stops along it. and are the stops.


2. Slope — "how sensitive is out to in?"

Here is the seed of everything. Take one machine . Nudge the input by a tiny amount. How much does the output move?

Figure — Chain rule for multivariate functions (backprop foundation)

The picture: the graph of is a curve. Zoom in on one point until the curve looks like a straight line — a ramp. Slope = rise ÷ run of that ramp: go right by "run", the line climbs by "rise". A steep ramp = big sensitivity; a flat ramp = tiny sensitivity.

Why this tool and not another? We could describe a curve a thousand ways, but the only thing that matters for "how does a nudge propagate" is the local steepness. Slope is precisely the sensitivity number, and sensitivity is exactly what backpropagation shuttles backward.

Reveal — Slope in one word
sensitivity.

3. The tiny-change symbol and the limit

The parent writes things like and "take the limit". Let's earn those.

The picture: on the curve from §2, put two dots a distance apart. The line through them is a rough ramp. Slide the second dot towards the first (); the rough ramp snaps onto the true tangent ramp. The number it settles on is the exact slope.

Why we need the limit: for a straight ramp, rise/run is the same everywhere. For a curve, rise/run changes depending on how big your step is — until you shrink the step to nothing. The limit removes that ambiguity and gives one honest slope per point.


4. The derivative — the settled slope, given a name

That settled-down slope gets its own symbol.

The picture: the exact tangent ramp from §3, and is its rise-over-run.

Why the topic needs it: every "how sensitive is this link?" number in the chain rule is a derivative. The chain is a row of these tangent ramps handed one to the next.


5. Functions of two inputs, and the partial

Real machines have several knobs: depends on two inputs at once. Now "the slope" is ambiguous — slope as you push which knob?

Figure — Chain rule for multivariate functions (backprop foundation)

The picture: the graph of is now a surface — a hillside — sitting over a flat floor. Walk east (increase , keep fixed): the steepness of the ground under your east-facing step is . Turn and walk north (increase , keep fixed): that steepness is . Same hill, two different slopes depending on your compass heading.

Why this tool and not the ordinary derivative? A neural network's output depends on thousands of weights simultaneously. To ask "how does the loss react to this one weight," we must freeze all the others — that is exactly what enforces. Ordinary can't express "hold the rest still."

Reveal — What does the curly warn you about?
other input variables exist and are being held constant.

6. Multiple paths — why we ADD

This is the heart of the multivariate case, and the parent's most important idea.

Suppose one input affects the output through two different routes: and . When you nudge , both routes carry a wave to at the same time.

Figure — Chain rule for multivariate functions (backprop foundation)

The picture: a river splits into two channels around an island and rejoins. Water you pour in at the top () arrives at the bottom () via both channels; the total flow at the bottom is the sum of the two channels.

  • Along one channel you MULTIPLY: the nudge in becomes a nudge in (scaled by ), which becomes a nudge in (scaled by ). Two scalings in a row = multiply.
  • Across channels you ADD: because the two effects on arrive independently and pile up.

7. The differential — the "sum of channels" written cleanly

The parent uses . This is just §6 said in one line before choosing which input to push.

Why it exists: it lets us postpone the question "with respect to what?" We collect all contributions first, then afterwards divide by (holding fixed) to read off . It is bookkeeping that keeps every path in view.


8. The sum sign — many paths at once

When there are intermediate stations , writing every path by hand is silly. The symbol ("sigma", Greek S for Sum) means "add up the following as the counter runs through its range."

Read it aloud: "for input number , add up — over every intermediate — the slope from into times the slope from into ." It's §6 with as many channels as you like.


9. Vectors, matrices, and the Jacobian — packaging the sums

The parent's Example 3 jumps to in bold and calls a table of partials a Jacobian. Bold letters just mean a list of numbers stacked together (a vector). A grid of numbers is a matrix.

Why bother? The chain-rule sum is exactly the recipe for matrix multiplication (row dotted with column). So stacking the partials into grids lets one clean product replace thousands of hand-written sums. That is why Jacobians are the natural language of layer-by-layer backprop. (Full detail is left to those notes — here you only need to know the word names a table of partials.)


10. The sigmoid and its neat slope

Example 2 uses . You don't need its internals yet, only two facts:

  • is a squashing machine: any input, output between and . It is one of the Activation Functions.
  • Its slope has a famously tidy form: . In the chain, this is just "the link's sensitivity number" and drops straight into the product.

We flag it here so the symbol is never a surprise; the derivative itself is derived in the Activation Functions note.


Prerequisite map

Function as a machine

Slope rise over run

Delta nudge and limit

Derivative dz dx

Partial derivative

Multiple paths add

Total differential dz

Sum over intermediates

Jacobian as a grid

Multivariate chain rule

Backpropagation

Sigmoid activation

This map feeds directly into the parent topic, which in turn powers Backpropagation Algorithm, Computational Graphs, Automatic Differentiation and Gradient Descent.


Equipment checklist

Test yourself — if you can complete each reveal from memory, you are ready for the parent note.

I can state what a function does in one sentence
it turns each input into exactly one output; picture a labelled box with an in-arrow and an out-arrow.
I can define slope without formulas
rise divided by run of the local tangent ramp — the sensitivity of output to input.
I know what and "the limit" mean
is a small nudge in ; the limit shrinks the nudge to zero so the slope settles on one exact value.
I can read aloud
"how much changes per unit change in " — the settled tangent slope.
I know why is curly, not straight
it warns that other inputs exist and are frozen while I push just one.
I can explain why multiple paths ADD
independent channels each carry a change to the output; the arrivals pile up, so we sum them (multiply along a path, add across paths).
I can say what instructs
add the following expression as the counter runs from to .
I know what a Jacobian is in words
a grid holding every output's partial sensitivity to every input.
I know what the sigmoid does and its slope form
squashes any input into ; its slope is .