What is the chain rule in backpropagation?
The chain rule in backpropagation is the calculus rule that lets a neural network compute how the loss changes with respect to weights in earlier layers.
Backpropagation applies the chain rule repeatedly from the output layer toward the input layer.
Why is the chain rule needed?
A neural network is made of many nested functions.
For example:
x → Layer 1 → Layer 2 → Prediction → Loss
A weight in Layer 1 affects the loss indirectly through every later operation.
The chain rule connects all of those effects.
Simple chain rule idea
If:
y = f(u)
and:
u = g(x)
then:
dy/dx = (dy/du) × (du/dx)
Backpropagation uses the same idea across many layers.
In a neural network
Suppose:
z = wx + b
a = f(z)
L = loss(a)
To find how the loss changes with respect to the weight w, the chain rule gives:
dL/dw = (dL/da) × (da/dz) × (dz/dw)
Each term represents one local relationship in the computation.
Why is this useful?
Instead of deriving one huge equation for the entire network, backpropagation computes local derivatives and multiplies them together.
This makes gradient calculation efficient even for networks with many layers and parameters.
What happens after the gradients are calculated?
The optimizer uses the gradients to update the weights.
For example:
w_new = w_old - learning_rate × dL/dw
For the full training process, see “How does backpropagation work?” and “How are neural network weights updated during training?”.
In short, the chain rule allows backpropagation to trace how each parameter influences the final loss by multiplying local derivatives through the network.
Learning Sequence
Deep Learning Curriculum
Explore Related Questions
Deepen your understanding across related Deep Learning topics.