Backpropagation in One Neuron
Intuition
Backpropagation is the chain rule applied systematically: to know how the loss changes with a weight, multiply how the loss changes with the output, how the output changes with the pre-activation, and how the pre-activation changes with the weight.
Precise explanation
Graph for one example: → → . Local derivatives:
- , Chain: , so and .
flowchart LR
x & w --> z["z = w·x + b"] --> p["p = σ(z)"] --> L["L = BCE(p, y)"]
L -. "∂L/∂p" .-> p -. "·p(1−p)" .-> z -. "·x" .-> w
Worked example
x = [1, 2], w = [0.5, −0.25], b = 0, y = 1: z = 0, p = 0.5, L = log 2 = 0.693; ∂L/∂p = −2, ∂p/∂z = 0.25, ∂L/∂z = −0.5; ∇w = [−0.5, −1], ∂b = −0.5.
Common mistakes
- Multiplying by instead of .
- Sign errors (gradient points uphill).
- Not reusing forward values (p) in the backward pass.
Why this matters
Every deep-learning framework does exactly this, layer by layer (DL-19).
References
- CS231n: Backpropagation notes — Stanford University CS231n (
S016) - Neural Networks and Deep Learning — free online book (author not stated on landing page) (
S014)