Artificial intelligence · lesson 2 of 4
Backpropagation and the chain rule
A computational graph records how intermediate values compose. Forward evaluation computes values; reverse differentiation accumulates gradients.
Learn the ideas
Prerequisites: Derivatives and computational graphs.
Graph
A computational graph records how intermediate values compose. Forward evaluation computes values; reverse differentiation accumulates gradients.
Chain rule
For L depending on y and y on x, dL/dx=(dL/dy)(dy/dx). Branching paths contribute additively.
Backpropagation
Reverse-mode differentiation efficiently computes a scalar loss gradient with respect to many parameters. It is differentiation, not the optimizer update itself.
Diagnostics
Check shapes, signs and numerical derivatives on small examples. Saturation, poor scaling and depth can affect gradient propagation.
Worked examples
If y=3x and L=y², find dL/dx at x=2.
y=6, dL/dy=12 and dy/dx=3, so the product is 36.
36
For L=(wx−y)², x=2,y=1,w=1, find dL/dw.
2(wx−y)x=2(2−1)2=4.
4
Check your understanding
8 questionsDecimals or fractions are accepted for numeric answers. Proofs and written responses use sample answers and require human marking. This is practice, not a protected examination.
Further reading and review references
These are reference links, not copied exercises, institutional endorsement or proof of independent review.