1.2.14 · D3Calculus & Optimization Basics

Worked examples — Chain rule for multivariate functions (backprop foundation)

3,068 words14 min readBack to topic

Before anything, one plain-words reminder so no symbol is used unearned:

The Cell column names the class of scenario each example belongs to — the letters A–H are just labels for the eight rows of the matrix below, so that every worked example can announce "this one hits Cell C" and you can see the whole menu is covered with none skipped.

The scenario matrix

Every problem this topic can throw is one (or a mix) of the cells below. "Cell" here means one row of this table — a single named class of situation, labelled A through H. Each worked example names the cell(s) it lands in.

Cell (scenario class) Situation What's tricky Example
A Single path just multiply — no sum Ex 1
B Two paths and must add both Ex 2
C Paths cancel (contributions opposite sign) net derivative can be Ex 3
D Degenerate / zero link () a whole path vanishes Ex 4
E Saturated nonlinearity () gradient dies — vanishing gradient Ex 5
F Real-world word problem (rates over time) build the graph from a story Ex 6
G Vector/Jacobian, exam twist order of matrix multiply matters Ex 7
H Limiting behaviour (large-input, saturation limit) reason about or Ex 8

Example 1 — Cell A: the single path


Example 2 — Cell B: two paths, both add

Read the figure below before moving on. It draws the two roads explicitly: (white) branches up to (blue) and down to (green), and both roads rejoin at (yellow). The blue and green edge labels are the link derivatives from Steps 1–2; the total at the bottom is what you get by walking each coloured road (multiplying its two labels) and then adding the two roads. Trace the blue road with your finger, then the green — the addition of exactly these two walks is the whole content of Cell B.

Figure — Chain rule for multivariate functions (backprop foundation)
Figure 1 — Two paths from input to output : multiply along each coloured road, add across roads.


Example 3 — Cell C: paths that cancel to zero



Example 5 — Cell E: the neural neuron (saturation shrinks the gradient)

Study the figure before reading on. The blue S-curve is the sigmoid ; the yellow bump is its slope — the exact factor from Step 1b that decides how much gradient survives. Notice the yellow curve peaks at the green dot (, slope , the "active learning zone") and collapses toward the red dot (, slope , the "saturated" case of this very example). The tiny gradient we computed () is small precisely because our neuron sits at the red dot on the yellow curve — that is the visual meaning of a vanishing gradient.

Figure — Chain rule for multivariate functions (backprop foundation)
Figure 2 — Sigmoid (blue) and its slope (yellow): steep at the centre (green), nearly flat when saturated (red).


Example 6 — Cell F: a real-world rates-over-time word problem


Example 7 — Cell G: vector/Jacobian, the exam order-trap


Example 8 — Cell H: limiting behaviour (why deep saturated nets stall)


Recall Quick self-test

Two paths from to — combine how? ::: Multiply along each path, then add the paths. A link with derivative does what to its path? ::: Kills the whole path (product becomes ). Biggest possible sigmoid slope ? ::: , at . In for ? ::: (outer Jacobian on the left). Units of when is area (cm²)? ::: cm²/s.

Related vault notes: Computational Graphs · Automatic Differentiation · Loss Functions.