Intuition What this page is for
The parent note built the rule: to get ∂ x ∂ z , you sum over every path from x to z , and along each path you multiply the derivatives . This page throws every kind of situation at that rule so you never meet one unprepared: a single path, two paths that fight each other, a path that dies to zero, a saturated neuron, a real word problem, and an exam trap. First we lay out the full menu of cases; then we cook each one from scratch.
Before anything, one plain-words reminder so no symbol is used unearned:
Definition The three symbols we will lean on
∂ x ∂ z (a "partial derivative") = "if I nudge only x by a tiny bit and hold every independent input frozen, how fast does z move?" The curly ∂ instead of d is the flag that says "other inputs exist, I'm holding them still." When there is only one input, no freezing is needed and we write the straight d instead: d x d z . So d = single-variable chain, ∂ = multivariate chain — you'll see the switch happen in Example 1 (one input, d ) versus Example 2 onward (many inputs, ∂ ).
A path = one chain of arrows in the diagram of who-depends-on-whom, e.g. x → u → z .
σ ( a ) = 1 + e − a 1 = the sigmoid , an S-shaped squashing function (see Activation Functions ). Its derivative is σ ′ ( a ) = σ ( a ) ( 1 − σ ( a ) ) ; we prove this by hand in Example 5 (Step 1b) and it is machine-checked (see box below).
Definition What "machine-checked" and the VERIFY block mean
Throughout this page you will see phrases like "confirmed in VERIFY" or "machine-checked." VERIFY is a small hidden block attached to this note (your tutoring system runs it automatically) that re-computes every numeric answer with a symbolic-math engine and confirms it equals what the text claims. You do not need to open it — it simply guarantees that every number below (1.5 , 6 , 20 , 2.2 cm²/s, 0.25 , and so on) has been independently re-derived and matches. When we say "confirmed in VERIFY," read it as "a computer double-checked this exact value."
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.
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 x → u → z
just multiply — no sum
Ex 1
B
Two paths x → u → z and x → v → z
must add both
Ex 2
C
Paths cancel (contributions opposite sign)
net derivative can be 0
Ex 3
D
Degenerate / zero link (∂ u / ∂ x = 0 )
a whole path vanishes
Ex 4
E
Saturated nonlinearity (h ( 1 − h ) → 0 )
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 → 0 or → ∞
Ex 8
Worked example Single-path chain rule
Given: z = ln ( u ) where u = 3 x 2 + 1 . Find d x d z at x = 1 .
Forecast (guess first): Only one road from x to z , so there is nothing to add. Do you expect the answer to be positive, negative, or zero at x = 1 ?
Note on notation: x is the only input here, so we use the straight d (single-variable). From Example 2 on there will be more than one input, and we switch to the curly ∂ .
Step 1. d u d z = u 1 .
Why this step? This is the outer link u → z ; the derivative of ln is 1/ u .
Step 2. d x d u = 6 x .
Why this step? This is the inner link x → u ; differentiate 3 x 2 + 1 .
Step 3. Multiply along the single path:
d x d z = u 1 ⋅ 6 x = 3 x 2 + 1 6 x .
Why this step? One path ⇒ pure product, no summing.
Step 4. At x = 1 : u = 4 , so d x d z = 4 6 = 1.5 .
Verify: Sanity-check the sign — at x = 1 , x increasing makes u increase makes ln u increase, so the derivative should be positive. It is + 1.5 . ✓
Worked example Two paths that reinforce
Given: z = u v where u = x + y and v = x − y . Find ∂ x ∂ z at ( x , y ) = ( 3 , 1 ) .
Note on notation: now there are two inputs x and y , so z has more than one direction to move in — we switch to the curly ∂ to signal "hold the other input still."
Forecast: x reaches z through two intermediates. You must add two products. Will they help or hurt each other here?
Step 1. Path derivatives out of z : ∂ u ∂ z = v , ∂ v ∂ z = u .
Why this step? z = uv , differentiate treating the other factor as a constant.
Step 2. Path derivatives into the intermediates: ∂ x ∂ u = 1 , ∂ x ∂ v = 1 .
Why this step? These are the two roads x → u and x → v .
Step 3. Sum over paths:
∂ x ∂ z = v ⋅ 1 + u ⋅ 1 = u + v = ( x + y ) + ( x − y ) = 2 x .
Why this step? Two paths ⇒ add. Forgetting one term is the #1 mistake.
Step 4. At ( 3 , 1 ) : 2 x = 6 .
Verify: Substitute first: z = ( x + y ) ( x − y ) = x 2 − y 2 , so ∂ z / ∂ x = 2 x = 6 . ✓ Both paths pointed the same way and reinforced.
Read the figure below before moving on. It draws the two roads explicitly: x (white) branches up to u (blue) and down to v (green), and both roads rejoin at z (yellow). The blue and green edge labels are the link derivatives from Steps 1–2; the total ∂ z / ∂ x 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 1 — Two paths from input x to output z : multiply along each coloured road, add across roads.
Worked example When contributions fight and net to zero
Given: z = u 2 − v 2 with u = x + y , v = x − y . Find ∂ x ∂ z at ( x , y ) = ( 0 , 5 ) .
Forecast: Two paths again — but now with a minus in z . Do you think the total can be zero even though each path alone is nonzero?
Step 1. ∂ u ∂ z = 2 u , ∂ v ∂ z = − 2 v .
Why this step? z = u 2 − v 2 ; note the sign on the v term.
Step 2. ∂ x ∂ u = 1 , ∂ x ∂ v = 1 .
Why this step? The two roads x → u and x → v each have slope 1 .
Step 3. Sum:
∂ x ∂ z = 2 u ⋅ 1 + ( − 2 v ) ⋅ 1 = 2 ( x + y ) − 2 ( x − y ) = 4 y .
Why this step? One path pushes up, the other pulls down; the x -terms cancel .
Step 4. At ( 0 , 5 ) : 4 y = 20 .
Step 5 — the exact-cancel case. Now take ( x , y ) = ( 7 , 0 ) and compute each single path's product explicitly, so we can see them cancel:
Here u = x + y = 7 and v = x − y = 7 .
u -path product: ∂ u ∂ z ⋅ ∂ x ∂ u = ( 2 u ) ( 1 ) = 2 ⋅ 7 = + 14 .
v -path product: ∂ v ∂ z ⋅ ∂ x ∂ v = ( − 2 v ) ( 1 ) = − 2 ⋅ 7 = − 14 .
Sum: + 14 + ( − 14 ) = 0 .
Why this step? It shows the total can be 0 while each individual path carries a hefty ± 14 — the paths are alive but exactly opposite.
Verify: Direct: z = ( x + y ) 2 − ( x − y ) 2 = 4 x y , so ∂ z / ∂ x = 4 y . At ( 0 , 5 ) : 20 . ✓ At ( 7 , 0 ) : 0 , and the two path products are + 14 and − 14 . ✓ Lesson: never assume a nonzero path means a nonzero total.
Worked example A path with a zero link
Given: z = u + v 2 , u = x 3 , v = y (so v does not depend on x ). Find ∂ x ∂ z .
Forecast: There look like two intermediates, but does x actually reach z through v ?
Step 1. ∂ u ∂ z = 1 , ∂ v ∂ z = 2 v .
Why this step? These are the two link derivatives out of z : from z = u + v 2 , the coefficient of u is 1 and differentiating v 2 gives 2 v . We need them before we can walk either path.
Step 2. ∂ x ∂ u = 3 x 2 , and crucially ∂ x ∂ v = 0 .
Why this step? v = y contains no x , so the link x → v has zero strength — that whole path is dead.
Step 3. Sum:
∂ x ∂ z = 1 ⋅ 3 x 2 + 2 v ⋅ 0 = 3 x 2 .
Why this step? A zero factor anywhere on a path zeroes that path's entire product. Include it consciously — don't just "forget" it.
Verify: z = x 3 + y 2 directly, ∂ z / ∂ x = 3 x 2 . ✓ The v -path contributed nothing, exactly as the diagram predicts.
Worked example One neuron, backprop, saturated case
Given: h = σ ( a ) with a = w x + b , and loss L = 2 1 ( h − t ) 2 . Take w = 2 , x = 3 , b = 1 , t = 0 . Find ∂ w ∂ L and comment on its size.
Forecast: a = 2 ⋅ 3 + 1 = 7 is large, so h = σ ( 7 ) is very close to 1 . Do you expect a big or tiny gradient?
Step 1. Build the path w → a → h → L . Link derivatives:
∂ h ∂ L = h − t , ∂ a ∂ h = h ( 1 − h ) , ∂ w ∂ a = x .
Why this step? Each is one arrow: loss slope, sigmoid slope, and a 's slope in w .
Step 1b — prove the sigmoid slope σ ′ ( a ) = σ ( a ) ( 1 − σ ( a )) by hand.
Write σ ( a ) = ( 1 + e − a ) − 1 . By the (single-variable) chain rule,
σ ′ ( a ) = − ( 1 + e − a ) − 2 ⋅ d a d ( 1 + e − a ) = − ( 1 + e − a ) − 2 ⋅ ( − e − a ) = ( 1 + e − a ) 2 e − a .
Now split the fraction: ( 1 + e − a ) 2 e − a = 1 + e − a 1 ⋅ 1 + e − a e − a . The first factor is σ ( a ) ; the second is 1 + e − a e − a = 1 + e − a ( 1 + e − a ) − 1 = 1 − σ ( a ) . Hence σ ′ ( a ) = σ ( a ) ( 1 − σ ( a )) , i.e. h ( 1 − h ) . (Machine-checked in VERIFY.)
Why this step? This is the promised proof — it turns "standard result" into something you derived.
Step 2. Multiply along the single path:
∂ w ∂ L = ( h − t ) h ( 1 − h ) x .
Step 3. Plug numbers. a = 7 ⇒ h = σ ( 7 ) ≈ 0.99909 . Then h ( 1 − h ) ≈ 0.000911 .
∂ w ∂ L ≈ ( 0.99909 − 0 ) ⋅ 0.000911 ⋅ 3 ≈ 0.002729.
Why this step? The factor h ( 1 − h ) is the sigmoid's slope; near h = 1 it is nearly zero — the neuron is saturated , so almost no gradient flows back. This is the seed of Vanishing and Exploding Gradients .
Verify: Numeric check in VERIFY confirms ≈ 0.00273 . Sanity: the neuron is stuck near 1 , learning slowly — exactly why saturated units learn poorly. ✓
Study the figure before reading on. The blue S-curve is the sigmoid h ; the yellow bump is its slope h ( 1 − h ) — the exact factor from Step 1b that decides how much gradient survives. Notice the yellow curve peaks at the green dot (a = 0 , h = 0.5 , slope = 0.25 , the "active learning zone") and collapses toward the red dot (a = 7 , h ≈ 0.999 , slope ≈ 0.0009 , the "saturated" case of this very example). The tiny gradient we computed (≈ 0.0027 ) 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 2 — Sigmoid (blue) and its slope h ( 1 − h ) (yellow): steep at the centre (green), nearly flat when saturated (red).
Worked example Expanding metal plate (chain rule in time)
Given: A heated rectangular plate has width u and height v ; its area is z = uv . As it heats, u grows at d t d u = 0.2 cm/s and v grows at d t d v = 0.1 cm/s. At the instant u = 10 cm, v = 6 cm, how fast is the area growing?
Forecast: Time t is the single input; it reaches area through two intermediates u and v . Two paths ⇒ add. Guess: a few cm²/s?
Step 1. Identify the graph: t → u → z and t → v → z .
Why this step? Time changes both side lengths, and both feed the area.
Step 2. Link derivatives: ∂ u ∂ z = v , ∂ v ∂ z = u .
Why this step? Area z = uv .
Step 3. Multivariate chain rule in t (sum the two paths):
d t d z = ∂ u ∂ z d t d u + ∂ v ∂ z d t d v = v ⋅ 0.2 + u ⋅ 0.1.
Step 4. Plug u = 10 , v = 6 : d t d z = 6 ( 0.2 ) + 10 ( 0.1 ) = 1.2 + 1.0 = 2.2 cm²/s.
Verify: Units: ( cm ) ( cm/s ) = cm 2 / s — an area rate, correct. Numeric 2.2 cm²/s confirmed in VERIFY. ✓
Worked example Composing two layers — get the multiply order right
Given: u = A x then z = B u , with
A = [ 1 0 2 1 ] , B = [ 1 3 0 1 ] .
Find the Jacobian ∂ x ∂ z .
Forecast: The chain rule says ∂ x ∂ z = ∂ u ∂ z ∂ x ∂ u . The exam trap: is it B A or A B ? (Matrix multiply does not commute.) Guess before computing.
Step 1. ∂ u ∂ z = B (since z = B u ), ∂ x ∂ u = A (since u = A x ).
Why this step? The Jacobian of a linear map M x is just M — each output is a fixed linear combination of the inputs, so its table of partial derivatives is M itself.
Step 2. Chain rule keeps the outer-then-inner order: the outer Jacobian ∂ u ∂ z = B goes on the left , the inner ∂ x ∂ u = A on the right, so
∂ x ∂ z = B A .
Why this step? Entry ( i , j ) of the answer must be ∑ k ∂ u k ∂ z i ∂ x j ∂ u k — that is exactly "row i of B dotted with column j of A ," which is the definition of the matrix product B A (in that order). Writing A B would dot the wrong rows and columns together (see Jacobian and Hessian Matrices ; this ordering is the heart of Backpropagation Algorithm ).
Step 3. Compute:
B A = [ 1 3 0 1 ] [ 1 0 2 1 ] = [ 1 3 2 7 ] .
Why this step? Row 1 of B is ( 1 , 0 ) : dotted with the columns of A gives ( 1 , 2 ) . Row 2 of B is ( 3 , 1 ) : dotted with the columns of A gives ( 3 ⋅ 1 + 1 ⋅ 0 , 3 ⋅ 2 + 1 ⋅ 1 ) = ( 3 , 7 ) .
Verify: Direct: substituting, z = B ( A x ) = ( B A ) x , so its Jacobian is B A . Also A B = [ 7 3 2 1 ] = B A — proving the order genuinely matters. Both facts confirmed in VERIFY. ✓
Worked example The limit of stacked saturated slopes
Given: L passes back through n sigmoid neurons in series; each contributes a slope factor at most max h h ( 1 − h ) . What is the largest single-neuron slope, and what happens to the product through n layers as n → ∞ ?
Forecast: Sigmoid's slope h ( 1 − h ) is a downward parabola in h ∈ ( 0 , 1 ) . Where is it biggest, and how big? Then guess the fate of that number raised to the n .
Step 1. Maximise s ( h ) = h ( 1 − h ) . Set s ′ ( h ) = 1 − 2 h = 0 ⇒ h = 0.5 .
Why this step? The steepest the sigmoid ever is happens at its centre h = 0.5 ; setting the derivative of the slope to zero finds that peak.
Step 2. Value there: s ( 0.5 ) = 0.5 ⋅ 0.5 = 0.25 . So every sigmoid link multiplies the backward gradient by at most 0.25 .
Why this step? This ceiling of 0.25 is what turns "one layer loses a little gradient" into "many layers lose almost all of it."
Step 3. Through n layers the gradient is scaled by at most 0.2 5 n :
lim n → ∞ 0.2 5 n = 0.
Why this step? A number below 1 raised to a growing power collapses to 0 — the vanishing gradient . This is the limiting scenario that motivates Activation Functions like ReLU and links to Gradient Descent slowing to a crawl.
Verify: s ( 0.5 ) = 0.25 and 0.2 5 10 ≈ 9.5 × 1 0 − 7 (already microscopic) confirmed in VERIFY. ✓
Recall Quick self-test
Two paths from x to z — combine how? ::: Multiply along each path, then add the paths.
A link with derivative 0 does what to its path? ::: Kills the whole path (product becomes 0 ).
Biggest possible sigmoid slope h ( 1 − h ) ? ::: 0.25 , at h = 0.5 .
In ∂ z / ∂ x = ? for z = B u , u = A x ? ::: B A (outer Jacobian on the left).
Units of d z / d t when z is area (cm²)? ::: cm²/s.
Mnemonic Remember the rule in five words
"Multiply along, add across paths." Zero anywhere on a path ⇒ that path is gone.
Related vault notes: Computational Graphs · Automatic Differentiation · Loss Functions .