This page is the "exhaustive drill" companion to the bias topic (the parent). Read that first if you have not — here we assume you know the one line
z = w ⊤ x + b ,
where z is the pre-activation (the number the neuron computes before squashing it), w is the list of weights (one multiplier per input), x is the list of inputs , and b is the bias (a single added number). Everything below is a chase through every kind of case this formula can produce.
Intuition Read this before the table
A picture to hold in your head: the pre-activation z = w x + b (one input case) is a straight line when you plot z against x . The weight w is its slope (tilt); the bias b is its height at x = 0 (the intercept). Almost every scenario below is just "what does moving the slope or the height do?"
Every case this topic can throw at you falls into one of these cells. Each worked example is tagged with the cell(s) it covers.
Cell
What varies
Example(s)
A Positive bias
b > 0 — line/threshold shifts one way
Ex 1
B Negative bias
b < 0 — line/threshold shifts the other way
Ex 2
C Zero bias (degenerate)
b = 0 — forced through origin
Ex 3
D Zero input
all x i = 0 , only bias survives
Ex 3, Ex 4
E Multi-input neuron
w , x are vectors, threshold is a plane
Ex 4
F Sign of the gradient
∂ L / ∂ b positive vs negative → b goes down vs up
Ex 5
G Limiting behaviour
b → + ∞ / b → − ∞ for sigmoid
Ex 6
H Real-world word problem
translate a story into w , b
Ex 7
I Exam twist
"− b / w ", threshold algebra, negative w
Ex 8
J Minibatch gradient
average of per-example δ 's
Ex 9
Two symbols we will lean on:
σ ( z ) = 1 + e − z 1 — the sigmoid , an S-shaped squasher that maps any real z into ( 0 , 1 ) . See Activation functions (sigmoid, ReLU, tanh) . It equals exactly 0.5 when z = 0 , because then e − 0 = 1 and 1 + 1 1 = 2 1 .
δ = ∂ z ∂ L — the neuron's error signal , the sensitivity of the loss L to the pre-activation. From the parent, ∂ b ∂ L = δ .
Worked example Fit a line with a positive intercept
Data: ( x , y ) = ( 0 , 4 ) , ( 2 , 10 ) . Model z = w x + b with identity activation (output = z ). Find w , b giving zero error.
Forecast: Guess w and b before reading. Which one is forced by the point at x = 0 ?
Use the x = 0 point. At x = 0 : z = w ⋅ 0 + b = b . We need z = 4 , so b = 4 .
Why this step? Setting x = 0 kills the weight term, leaving only the bias — the cleanest way to read off b (this is Cell D, zero input, hiding inside Cell A).
Use the second point for the slope. At x = 2 : z = 2 w + 4 = 10 ⇒ 2 w = 6 ⇒ w = 3 .
Why this step? With b known, the remaining point pins the slope.
State the model. z = 3 x + 4 .
Verify: x = 0 → 3 ( 0 ) + 4 = 4 ✓; x = 2 → 3 ( 2 ) + 4 = 10 ✓. A positive b = 4 lifted the whole line up by 4 — exactly the "budge up" role of bias.
Worked example Fit a line with a negative intercept
Data: ( x , y ) = ( 0 , − 3 ) , ( 1 , − 1 ) . Model z = w x + b , identity activation.
Forecast: Same drill — which point gives b , and will b be positive or negative?
At x = 0 : z = b = − 3 , so b = − 3 .
Why? Same origin trick; here the target is negative, so b < 0 .
At x = 1 : z = w ( 1 ) − 3 = − 1 ⇒ w = 2 .
Why? One equation, one unknown w left.
Model: z = 2 x − 3 .
Verify: x = 0 → − 3 ✓; x = 1 → 2 − 3 = − 1 ✓. A negative bias pulled the line down — the mirror image of Example 1. Weights only rotate; the sign of b decides up vs down.
Worked example Why a bias-free neuron can never fit a constant
Data: ( x , y ) = ( 0 , 4 ) , ( 1 , 4 ) — a flat target y = 4 . Model without bias : z = w x . Can any w fit it?
Forecast: Try to find a winning w in your head before continuing.
At x = 0 : z = w ⋅ 0 = 0 for every w . But we need z = 4 . Error = ∣0 − 4∣ = 4 , no matter what.
Why? With b = 0 , the line is pinned to the origin . Zero input forces zero output.
Best possible fit. Minimise MSE L = 2 1 [( w ⋅ 0 − 4 ) 2 + ( w ⋅ 1 − 4 ) 2 ] . Only the second term depends on w ; set it to zero with w = 4 . Then L = 2 1 ( 16 ) + 0 = 8 .
Why? Even the optimal bias-free model leaves loss 8 > 0 .
Add a bias. z = w x + b with w = 0 , b = 4 gives z = 4 everywhere. L = 0 .
Why? The bias supplies the constant the origin-pinned line could not.
Verify: Bias-free best loss = 8 (checked in VERIFY); bias-full loss = 0 . This is Cell C (zero bias fails) meeting Cell D (zero input) meeting the parent's core claim.
Worked example Two inputs, one threshold
Neuron z = w 1 x 1 + w 2 x 2 + b with w = ( 2 , − 1 ) , b = − 3 . (a) Compute z at x = ( 0 , 0 ) . (b) Find where the neuron switches on (z = 0 ).
Forecast: At the all-zero input, what survives?
(a) Zero input: z = 2 ( 0 ) + ( − 1 ) ( 0 ) + ( − 3 ) = − 3 .
Why? Both weighted terms vanish; only b remains — the bias is the output at the origin (Cell D generalised to a vector).
(b) Decision boundary: set z = 0 : 2 x 1 − x 2 − 3 = 0 ⇒ x 2 = 2 x 1 − 3 .
Why? The neuron flips from "off" (z < 0 ) to "on" (z > 0 ) across the line z = 0 . Here it is a straight line in the ( x 1 , x 2 ) plane; the bias sets its offset from the origin.
Check the offset. With b = 0 the boundary would pass through ( 0 , 0 ) ; with b = − 3 its intercept moves to x 2 = − 3 at x 1 = 0 .
Verify: Point ( 1.5 , 0 ) : z = 2 ( 1.5 ) − 0 − 3 = 0 ✓ — sits exactly on the boundary. The bias budged the whole separating line, just like it budged the 1-D line in Ex 1–2.
Worked example Which way does
b move?
Identity neuron a = z = w x + b , squared-error loss L = 2 1 ( a − y ) 2 . Current w = 1 , b = 1 , sample ( x , y ) = ( 2 , 3 ) , learning rate η = 0.1 . Do one bias update.
Forecast: Is the output too high or too low? Will b increase or decrease?
Forward pass: a = 1 ⋅ 2 + 1 = 3 . Wait — that's exactly y = 3 ! Let me instead use b = 2 : a = 1 ⋅ 2 + 2 = 4 .
Why? We need a non-zero error to see the sign; with b = 2 the output overshoots.
Error signal: δ = ∂ z ∂ L = ( a − y ) ⋅ 1 = ( 4 − 3 ) = 1 .
Why? ∂ L / ∂ a = ( a − y ) and ∂ a / ∂ z = 1 (identity). Positive δ means output is too big .
Bias gradient: ∂ b ∂ L = δ = 1 (because ∂ z / ∂ b = 1 ; see Backpropagation and the chain rule ).
Why? Bias gradient equals the pure error — no input factor.
Update: b ← b − η δ = 2 − 0.1 ( 1 ) = 1.9 .
Why? Gradient descent subtracts the gradient; a positive gradient lowers b , shrinking the too-large output.
Verify: New output a = 1 ⋅ 2 + 1.9 = 3.9 , closer to 3 than 4 was ✓. Positive error → b went down . Flip the sign of the error (output too small) and b would go up .
Worked example Push the bias to the extremes
Neuron a = σ ( x + b ) at fixed x = 0 . What happens to a as b → + ∞ ? As b → − ∞ ? As b = 0 ?
Forecast: A "very eager" neuron and a "very reluctant" one — what output do they saturate to?
b = 0 : a = σ ( 0 ) = 1 + 1 1 = 0.5 .
Why? Neutral bias → the balanced midpoint of the S-curve.
b → + ∞ : z = b → + ∞ , e − z → 0 , so a → 1 + 0 1 = 1 .
Why? A huge positive bias makes the neuron fire almost always — "eager". At b = 10 : a = σ ( 10 ) ≈ 0.99995 .
b → − ∞ : e − z = e ∣ b ∣ → + ∞ , so a → ∞ 1 = 0 .
Why? A huge negative bias makes it almost never fire — "reluctant". At b = − 10 : a ≈ 0.0000454 .
Verify: σ ( 10 ) ≈ 0.9999546 and σ ( − 10 ) ≈ 0.0000454 sum to 1 ✓ (sigmoid symmetry σ ( − z ) = 1 − σ ( z ) ). The bias slides the whole S-curve; at the limits the output saturates at 1 or 0.
Worked example The "spam alarm" neuron
A spam detector fires (z > 0 ) based on one feature x = number of suspicious words. Domain rule: fire when x ≥ 5 . Weight is fixed at w = 1 . What bias makes the threshold exactly x = 5 ?
Forecast: Recall the threshold is where z = 0 . Solve for b .
Threshold condition: neuron fires when z = w x + b > 0 , i.e. x > − b / w .
Why? The boundary is z = 0 ; rearranging gives the input value that flips the neuron.
Set threshold to 5: − b / w = 5 with w = 1 ⇒ − b = 5 ⇒ b = − 5 .
Why? We want the switch point at exactly x = 5 ; a negative bias raises the bar.
Interpret. b = − 5 is a "reluctant" neuron: it needs 5 suspicious words before its weighted sum overcomes the offset.
Verify: At x = 5 : z = 1 ( 5 ) + ( − 5 ) = 0 (exactly on threshold) ✓. At x = 6 : z = 1 > 0 fires ✓. At x = 4 : z = − 1 < 0 stays quiet ✓. The bias encoded the business rule "need 5 words".
Worked example Threshold with a negative weight
Sigmoid neuron a = σ ( w x + b ) with w = − 2 , b = 6 . (a) At what x is a = 0.5 ? (b) For which x does the neuron fire (a > 0.5 )?
Forecast: Careful — a negative w flips the direction of "firing". Guess before solving.
(a) Half-activation: a = 0.5 ⟺ z = 0 ⟺ w x + b = 0 ⟺ x = − b / w .
Plug in: x = − 6/ ( − 2 ) = 3 .
Why? σ equals 0.5 exactly when its input is 0 ; that reduces to the linear threshold − b / w .
(b) Fire condition: a > 0.5 ⟺ z > 0 ⟺ − 2 x + 6 > 0 ⟺ x < 3 .
Why? Dividing by the negative w = − 2 flips the inequality — the classic exam trap. So this neuron fires for small x , not large.
Verify: x = 3 → z = − 2 ( 3 ) + 6 = 0 → a = 0.5 ✓. x = 2 → z = 2 > 0 → a = σ ( 2 ) ≈ 0.881 > 0.5 ✓ (fires). x = 4 → z = − 2 < 0 → a ≈ 0.119 < 0.5 ✓ (quiet). Threshold at − b / w = 3 , direction set by sign ( w ) .
Worked example Averaging errors across a batch
Identity neuron. Three examples give per-example errors δ ( 1 ) = + 2 , δ ( 2 ) = − 1 , δ ( 3 ) = + 3 . Compute the minibatch bias gradient (average form) and one update with η = 0.1 , starting b = 0 .
Forecast: Positive average → b down or up?
Average the errors: ∂ b ∂ L = m 1 ∑ k δ ( k ) = 3 2 + ( − 1 ) + 3 = 3 4 ≈ 1.3333 .
Why? For a batch, the bias gradient is the mean of per-example error signals (each ∂ z / ∂ b = 1 , so no input weighting).
Update: b ← b − η ⋅ 3 4 = 0 − 0.1 ⋅ 3 4 = − 15 2 ≈ − 0.1333 .
Why? A net-positive error (outputs too high on average) pushes b down.
Verify: 3 1 ( 4 ) = 1.3333 … and 0 − 0.1 ( 4/3 ) = − 0.13333 … ✓. Note weights would need m 1 ∑ k δ ( k ) x ( k ) (input-weighted) — the bias is the unweighted mean of errors.
Recall In Example 3, what is the best possible loss of the bias-free model?
L = 8 — the x = 0 point contributes 2 1 ( 0 − 4 ) 2 = 8 no matter what w is, since z = w ⋅ 0 = 0 .
Recall In Example 8, why does the neuron fire for
small x ?
Because w = − 2 is negative; dividing the inequality z > 0 by w flips it to x < 3 . Sign of w sets the firing direction; − b / w sets the location.
Recall Why is the batch bias gradient just the mean of the
δ 's (not input-weighted)?
Because ∂ z / ∂ b = 1 for every example, so each contributes δ ( k ) ⋅ 1 ; averaging gives m 1 ∑ δ ( k ) .
"Zero of z , − b / w , sign of w ." The neuron half-fires where z = 0 , that input is − b / w , and the sign of w tells you which side is 'on'.