What is backpropagation?
Answer
Backpropagation (backward propagation of errors) is the algorithm by which neural networks learn: it efficiently computes how much every weight and bias contributed to the prediction error, so an optimizer can adjust each parameter in the direction that reduces the loss. At its core it is the chain rule of calculus applied systematically: after a forward pass computes the output and the loss, a backward pass starts at the output layer, computes the error signal there, and recursively propagates it backward: each layer’s error is a weighted sum of the next layer’s errors times the local activation derivative, and each weight’s gradient is simply its neuron’s error signal times the input it received. This reuses intermediate results so the cost of computing all gradients is roughly one extra forward pass, which is what makes training deep networks tractable. Gradients then feed an optimizer (SGD, Adam) that performs the actual update
.
(1) Forward Pass: Inputs flow through the network producing a prediction; all intermediate activations are cached.
(2) Backward Pass: The loss error propagates backward via the chain rule: each layer’s is built from the next layer’s.
(3) Gradient & Update: ; the optimizer subtracts a learning-rate-scaled step.

Figure 1: The two passes: activations flow forward (blue) through each layer to the loss; error signals flow backward (orange) along the same edges, and every weight’s gradient combines the forward activation with the backward error.
Mathematical Formulation:
Where:
is the pre-activation and
the activation of a neuron;
the loss.
is the error signal: how much the loss changes per unit change of
; at hidden neuron
it sums contributions
from all downstream neurons
.
is the input feeding weight
: the gradient is proportional to it; the bias gradient equals
itself.

Figure 2: One numeric step through a neuron: forward values (blue) compute and
; backward gradients (orange) multiply local derivatives down the chain:
, so the weight updates as
.



















