BackpropagationLesson 3 of 6
The chain rule, with numbers
Local derivatives and contributions from shared parameters
The prediction leads to an error , which leads to a loss . A change in w affects the loss through those intermediate values.
Keep x = 2, y = 5, and w = b = 1. Then , , and .
Multiply the rates along one path
Section titled “Multiply the rates along one path”Read the path forward first:
| One local change | Rate at the starting values | Meaning |
|---|---|---|
| w changes the prediction | A small w change produces twice that prediction change | |
| The prediction changes the error | Subtracting a fixed target leaves the rate unchanged | |
| The error changes the loss | Increasing this negative error toward zero reduces the loss |
Multiply the rates:
That is the chain rule. It gives the same −4 we found by expanding the square. It uses the derivatives of the small operations instead of requiring one expanded formula.
For b, only the first part of the path differs: . The loss derivative is therefore .
Does the notation literally cancel?
The matching intermediate letters can help you remember the order, but the chain rule is a theorem about derivatives. Here the operations are differentiable. Their local linear predictions compose: , , and . Substitution gives .
Add when a parameter has two uses
Section titled “Add when a parameter has two uses”Now change the model itself: replace the independent bias b with the same parameter w, so . At x = 2 and w = 1, the prediction is still 3.
w now affects the prediction twice: through the multiplier and through the added term. The loss derivative includes both contributions:
Holding the second occurrence fixed would give the wrong derivative. A parameter reused in several places must collect the contributions from all of those uses.
Along a path, multiply local derivatives. At a shared input, add the contributions. This is the rule the backward pass will organize.
Explore another chain and a branching example
Your turn: one parameter in a product twice
Section titled “Your turn: one parameter in a product twice”Let . At w = 3, what is du/dw? Count both uses of w.
Work it through
The first occurrence contributes and the second contributes . Add them to get 6. This agrees with the familiar derivative of , namely 2w. A graph must accumulate both contributions even when the input node is shared.
Next: organize these calculations in a backward pass.