Worked examples — Forward propagation computation
Before anything: a quick reminder of the two symbols we lean on, in plain words.
Recall What do
and mean again? (pre-activation) ::: the weighted sum of inputs plus bias, before bending — a plain number. (activation) ::: the number after bending through — what gets passed forward.
The scenario matrix
Every forward-pass exercise is really one of these case classes. Think of it as a checklist: each worked example below fills one or more cells.
| # | Case class | What is being stressed | Example |
|---|---|---|---|
| C1 | Positive & negative pre-activations with ReLU | the "gate" behaviour, on both signs | Ex 1 |
| C2 | Zero input vector () | does the network still output something? role of bias | Ex 2 |
| C3 | Sigmoid saturation (very large / very negative ) | limiting values and | Ex 3 |
| C4 | tanh with mixed signs | odd symmetry, output range | Ex 4 |
| C5 | Batch of several inputs at once () | matrix form, bias broadcast, shape legality | Ex 5 |
| C6 | Softmax — normal + degenerate (all-equal logits) | probabilities summing to 1, uniform case, shift-invariance | Ex 6 |
| C7 | Real-world word problem (spam scorer) | translating a story into | Ex 7 |
| C8 | Exam twist: "linear-only net" collapse | proving depth is wasted without | Ex 8 |
We now clear the board one cell at a time.
Ex 1 — ReLU on both signs (C1)
Forecast: guess the sign of each neuron's before computing. Which neuron do you think ReLU will switch off?
Step 1 — Compute (top neuron). Why this step? Row 1 of dotted with is exactly neuron 1's weighted sum (the parent's "row = neuron " rule).
Step 2 — Compute (bottom neuron). Why? Same recipe, row 2.
Step 3 — Bend through ReLU. Why? ReLU clips negatives to 0. A negative means the neuron's evidence didn't clear its threshold, so it stays silent.

Look at the figure: the top neuron's lands on the flat part of the ReLU (output 0, the gate is shut); the bottom neuron's lands on the sloped part (output passes through unchanged).
Verify: ReLU never returns a negative number — both outputs are . ✓ Neuron 1 was killed exactly because its , matching our forecast if you guessed the top one dies.
Ex 2 — The zero input vector (C2)
Forecast: if you feed a network nothing, does it output zero? (Trap: no.)
Step 1 — Weighted sum vanishes. Why? Every product has , so the entire sum . Only the bias survives.
Step 2 — Bend. Why? This is the whole point of bias: it lets a neuron fire even with zero input.
Verify: With the pre-activation must equal exactly — and . ✓ This is why biases exist: a bias-free net always outputs for zero input, unable to shift the decision boundary off the origin.
Ex 3 — Sigmoid saturation, both extremes (C3)
The sigmoid squashes any real number into :
Forecast: where does send a huge positive number? A huge negative one? And exactly ?
Step 1 — . Why start here? is the pivot; so the fraction is .
Step 2 — (large positive). Why? To see the upper limiting value. Here , tiny.
Step 3 — (large negative). Why? The lower limit. Now , huge.

The figure shows the S-curve flattening at both ends — the shaded "saturation zones." There the curve is almost horizontal, so its slope (gradient) is nearly zero. That flatness is the seed of vanishing gradients: in a saturated region the neuron barely responds to changes in .
Verify: must stay strictly inside and satisfy the symmetry . Check: . ✓
Ex 4 — tanh with mixed signs (C4)
Unlike sigmoid, tanh outputs live in and it is odd: .
Forecast: because tanh is odd, guess the relationship between the two outputs before computing.
Step 1 — Compute . Why? Directly from the formula with , .
Step 2 — Compute . Why? Use oddness — no fresh arithmetic needed.
Step 3 — Assemble.
Verify: Both outputs lie in ✓, and they are exact negatives of each other, confirming oddness ✓ — matching the forecast. This centred-around-zero behaviour is why tanh is often preferred over sigmoid in hidden layers; see Activation functions.
Ex 5 — A whole batch at once (C5)
Forecast: first predict the shape of before any numbers. (Hint: is , is .)
Step 1 — Shape sanity. Why first? Illegal shapes are the #1 forward-pass bug. is ? No — . is . The product is . So is : one column per example.
Step 2 — Matrix multiply . Why? is the identity here, so it just copies — the cleanest way to isolate what the bias does.
Step 3 — Broadcast the bias. Why broadcast? is but is ; we add the same bias to every column (every example gets the same neuron offsets).
Step 4 — ReLU element-wise. Why? Clip each negative to 0, independently.
Verify: Column 2 came from input : ✓. Every entry of is ✓. Shape is , exactly as forecast ✓. This is the batch machinery of Matrix multiplication that makes GPUs efficient.
Ex 6 — Softmax: normal case AND the degenerate uniform case (C6)
Forecast: for part (b), what must the answer be if all three logits are identical? Guess before computing.
Step 1 — Part (a), exponentiate. Why? Exponentials are positive & monotonic, turning scores into comparable positive weights.
Step 2 — Normalize. Why divide by the sum? So the three outputs add to exactly 1 — a valid probability distribution.
Step 3 — Part (b), the degenerate case. Why does this matter? Equal logits carry zero information about which class wins. Each is identical, so:

The figure contrasts the two bar charts: peaked on the left, perfectly flat (uniform) on the right.
Verify: (a) ✓. (b) ✓, and softmax is shift-invariant — subtracting 5 from every logit gives , whose softmax is also , confirming the answer doesn't depend on the value 5, only on the differences. See Softmax and cross-entropy loss.
Ex 7 — Word problem: a tiny spam scorer (C7)
Forecast: more caps and more links push toward spam. With these counts, do you expect or ?
Step 1 — Translate the story into . Why? Each weight is "how suspicious this feature is per unit." The bias is the neuron's baseline scepticism (needs enough evidence before firing).
Step 2 — Bend through sigmoid. Why sigmoid here? We want a probability in , and this is the output neuron.
Step 3 — Decide. , so flag as spam.
Verify: Sanity by units — is dimensionless (a score), maps it to a probability in ; is inside that range ✓. Cross-check the threshold: , and indeed ✓, matching the forecast.
Ex 8 — Exam twist: the linear-only collapse (C8)
Forecast: the parent claimed "stacked linear layers collapse." Predict: will the two-layer output differ from some one-layer output? (Trap: it can't.)
Step 1 — Forward pass the long way. Why? To get a concrete number to compare against. Identity activation: .
Step 2 — Collapse algebraically. Why? To prove the collapse in general, substitute layer 1 into layer 2:
Step 3 — Compute the effective single layer. Why? This is the "one layer that does the same job." So the whole two-layer net is just .
Verify: Plug into the collapsed form: — identical to Step 1 ✓. This is exactly the parent's warning: without a nonlinearity, depth buys nothing — the reason Activation functions and the Universal approximation theorem matter, and the thing Backpropagation later trains.