ReLU is the keystone for exact backprop here. Its derivative is a discrete gate: open for positive pre-activations, closed for negative ones, with the stated convention at zero. Because the gate is exact, no transcendental derivative enters this book, and the reverse pass stays rational.

highlighted = computed this step

ReLU's derivative is exact

ReLU'(z) is 1 when z is positive and 0 otherwise; at z=0 this surface uses the stated convention ReLU'(0)=0. This derivative is a discrete gate, not a curve with a transcendental slope. That is the keystone reason this toy backward pass stays in the exact rational register.

ReLU(z)={1z>00z0\operatorname{ReLU}'(z)=\begin{cases}1&z>0\\0&z\le0\end{cases}
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00chain-rule products through ReLU gatesupstream gradient * local derivative = downstream gradientdL/dz1 = dL/dh1 * ReLU'(z1) = -2 * 1 = -2derived product: -2dL/dz2 = dL/dh2 * ReLU'(z2) = -2 * 0 = 0derived product: 0

Two derivative gates

Here z1=2 gives ReLU'(z1)=1, while z2=-1 gives ReLU'(z2)=0. The positive pre-activation keeps the incoming gradient alive. The negative pre-activation closes the gate, so the graph records the branch but sends no gradient through it.

ReLU(z1)=1,ReLU(z2)=0\operatorname{ReLU}'(z_1)=1,\quad \operatorname{ReLU}'(z_2)=0
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00chain-rule products through ReLU gatesupstream gradient * local derivative = downstream gradientdL/dz1 = dL/dh1 * ReLU'(z1) = -2 * 1 = -2derived product: -2dL/dz2 = dL/dh2 * ReLU'(z2) = -2 * 0 = 0derived product: 0

The dead branch

Multiplying by the second derivative gate blocks that branch exactly. The result is dL/dz1=-2 and dL/dz2=0. These are gradients with respect to the pre-activation nodes, so they are the precise signals that will feed the hidden weights and biases in the next lesson.

dLdz1=21=2,dLdz2=20=0\frac{dL}{dz_1}=-2\cdot1=-2,\quad \frac{dL}{dz_2}=-2\cdot0=0
ReLU derivative gateReLU derivatives are exact zero-or-one values.ReLU derivative gateReLU derivatives are exact zero-or-one values.one reverse-chain step (all exact)quantityrulevaluedL/dyhat2*(2-3)-2dL/dv1-2*2-4dL/dv2-2*00dL/dcdL/dyhat-2dL/dh1-2*1-2dL/dh2-2*1-2ReLU'(z1)z1=2>01ReLU'(z2)z2=-1<=00dL/dz1-2*1-2dL/dz2-2*00chain-rule products through ReLU gatesupstream gradient * local derivative = downstream gradientdL/dz1 = dL/dh1 * ReLU'(z1) = -2 * 1 = -2derived product: -2dL/dz2 = dL/dh2 * ReLU'(z2) = -2 * 0 = 0derived product: 0