Intuition What this page does
The parent note proved the one rule that matters: ==the boundary is where z = 0 ==. This page beats that rule against every kind of input you could ever meet — positive scores, negative scores, points sitting exactly on the line, weird thresholds, curved boundaries, and even a "broken" degenerate model where the boundary vanishes. Guess before you read each answer.
First, one reminder of the machinery so no symbol arrives unexplained.
Definition The four symbols we reuse
x — a point in feature space . In 1D it is a single number x ; in 2D it is a pair ( x 1 , x 2 ) you can dot on graph paper.
z = w ⊤ x + b — the score . w ⊤ x means "multiply each feature by its weight and add up": for 2D that is w 1 x 1 + w 2 x 2 . Then add the offset b . z is a plain number.
σ ( z ) = 1 + e − z 1 — the sigmoid , which squashes any score into a probability between 0 and 1. We only ever need one fact: σ ( z ) = 0.5 exactly when z = 0 .
P ( y = 1 ) = σ ( z ) — the model's probability that the point is class 1 . This is what "69% risk" means later: P ( y = 1 ) = 0.69 . Since the two classes sum to 1, P ( y = 0 ) = 1 − σ ( z ) .
The class rule: z > 0 ⇒ predict class 1 , z < 0 ⇒ predict class 0 , z = 0 ⇒ dead tie, right on the fence.
Every worked example below is tagged with the cell it covers. Together they fill the table.
Cell
What makes it different
Example
A. Positive score
point on the class-1 side, z > 0
Ex 1
B. Negative score
point on the class-0 side, z < 0
Ex 1
C. Exactly on boundary
z = 0 , perfect tie, P = 0.5
Ex 2
D. Solve boundary in 1D
boundary is a single point
Ex 3
E. Solve boundary in 2D
boundary is a line; find its geometry
Ex 4
F. Non-default threshold
σ ( z ) = t = 0.5 shifts the line
Ex 5
G. Scaling w , b
boundary must NOT move
Ex 6
H. Curved boundary (features)
circle/ellipse via x 2 terms
Ex 7
I. Degenerate / zero model
w = 0 : boundary disappears
Ex 8
J. Real-world word problem
translate words → z → decision
Ex 9
K. Exam twist
recover w , b from two known points
Ex 10
Worked example Ex 1 — Cells A & B: which side of the line?
Model z = 3 x 1 − x 2 + 1 . Classify p = ( 2 , 1 ) and q = ( − 1 , 5 ) .
Forecast: guess the sign of z at each point before computing.
Plug in p = ( 2 , 1 ) : z = 3 ( 2 ) − 1 + 1 = 6 .
Why this step? The class rule reads off the sign of z , so we just evaluate the score.
Read sign: z = 6 > 0 ⇒ class 1 . This is cell A .
Why this step? A positive score means σ ( z ) > 0.5 , i.e. P ( y = 1 ) > 0.5 , so the majority vote is class 1 — we never need the exact probability, only the sign.
Plug in q = ( − 1 , 5 ) : z = 3 ( − 1 ) − 5 + 1 = − 7 .
Why this step? Same rule, different point.
Read sign: z = − 7 < 0 ⇒ class 0 . This is cell B .
Why this step? A negative score means σ ( z ) < 0.5 , i.e. P ( y = 1 ) < 0.5 , so class 0 wins the vote — again the sign is enough.
Verify: σ ( 6 ) ≈ 0.9975 > 0.5 (confidently class 1) and σ ( − 7 ) ≈ 0.0009 < 0.5 (confidently class 0). The signs and probabilities agree.
Worked example Ex 2 — Cell C: sitting exactly on the fence
Same model z = 3 x 1 − x 2 + 1 . Find a point that is a perfect tie and confirm P = 0.5 .
Forecast: what value of z must a tie point have?
Set the boundary condition: a tie means z = 0 , so 3 x 1 − x 2 + 1 = 0 .
Why this step? By the parent's rule, P = 0.5 ⇔ z = 0 . The fence is the z = 0 set.
Pick x 1 = 0 : then − x 2 + 1 = 0 ⇒ x 2 = 1 . So ( 0 , 1 ) lies on the boundary.
Why this step? One free choice picks a concrete point on the line.
Check the score there: z = 3 ( 0 ) − 1 + 1 = 0 . ✓
Verify: σ ( 0 ) = 1 + e − 0 1 = 1 + 1 1 = 2 1 = 0.5 , so P ( y = 1 ) = 0.5 . Exactly the knife-edge — the model is maximally unsure. This is why the boundary is "where the model flips."
Worked example Ex 3 — Cell D: the 1D boundary is one point
Model z = − 5 x + 10 . Find the boundary and describe both sides.
Forecast: in 1D the boundary is a single number — bigger or smaller than 2?
Set z = 0 : − 5 x + 10 = 0 .
Why this step? One dimension, one equation; z = 0 still defines the fence.
Solve: − 5 x = − 10 ⇒ x = 2 . Boundary is the point x = 2 .
Why this step? Isolating x turns the fence condition into the fence location — the single number where the score crosses zero.
Watch the sign flip. The weight is negative (− 5 ), so as x grows, z shrinks . For x < 2 : z > 0 ⇒ class 1. For x > 2 : z < 0 ⇒ class 0.
Why this step? A negative weight flips which side is class 1 — the classic sign-trap. Always check the weight's sign, don't assume "right side is class 1."
Look at the figure below (s01). The violet line is the score z = − 5 x + 10 sloping downward (that's the negative weight). It crosses the navy zero-line at the magenta dot x = 2 . The orange-shaded region left of the dot is where the line sits above zero (z > 0 , class 1); the violet-shaded region right of the dot is where it dips below zero (z < 0 , class 0). The figure makes the sign-flip visible: everything hinges on which side of the magenta dashed line you stand.
Verify: at x = 1 (left of 2): z = − 5 + 10 = 5 > 0 ✓ class 1. At x = 3 : z = − 15 + 10 = − 5 < 0 ✓ class 0. The flip lives exactly at x = 2 .
Worked example Ex 4 — Cell E: the 2D boundary is a line
Model z = 2 x 1 + 4 x 2 − 8 . Draw the boundary and find which side the origin is on.
Forecast: where does the line cross each axis?
Set z = 0 : 2 x 1 + 4 x 2 − 8 = 0 ⇒ x 1 + 2 x 2 = 4 (divide by 2).
Why this step? Simplifying doesn't move the line — { z = 0 } and { z /2 = 0 } are the same set (previews cell G).
Find intercepts. Set x 2 = 0 : x 1 = 4 ⇒ ( 4 , 0 ) . Set x 1 = 0 : 2 x 2 = 4 ⇒ x 2 = 2 ⇒ ( 0 , 2 ) .
Why this step? Two points fix a straight line; intercepts are the easiest two.
Normal vector. w = ( 2 , 4 ) is perpendicular to the line and points toward the class-1 side (where z > 0 ).
Why this step? z increases fastest along w , so w aims into the class-1 region.
Classify the origin ( 0 , 0 ) : z = 2 ( 0 ) + 4 ( 0 ) − 8 = − 8 < 0 ⇒ class 0 . So the origin is on the opposite side from where w points.
Why this step? We evaluate the score at the origin because a labelled test point tells us which of the two half-planes is class 1 and which is class 0 — the boundary equation alone doesn't say which side is which.
Look at the figure below (s02). The magenta line is the boundary 2 x 1 + 4 x 2 − 8 = 0 , pinned by the two magenta squares at the intercepts ( 4 , 0 ) and ( 0 , 2 ) . The violet arrow is the normal w = ( 2 , 4 ) , planted on the line and stabbing into the violet-shaded half-plane — that's the class-1 side. The origin (navy dot) sits in the orange half-plane on the far side, with z = − 8 < 0 , confirming it is class 0. The picture shows why the arrow direction and the sign of z always agree.
Verify: midpoint of intercepts is ( 2 , 1 ) ; check it lies on the line: 2 + 2 ( 1 ) = 4 ✓. Origin score − 8 < 0 matches "class 0" and σ ( − 8 ) ≈ 0.00034 .
Worked example Ex 5 — Cell F: a non-default threshold shifts the line
Model z = x 1 + x 2 − 3 . Instead of the usual 0.5 , we only call something "class 1" if P ( y = 1 ) ≥ 0.7 . Find the new boundary.
Forecast: stricter threshold — does the line stay put, tilt, or slide?
Set σ ( z ) = 0.7 , not 0.5 .
Why this step? The boundary is always where the decision flips; raising the bar to P ( y = 1 ) = 0.7 moves that flip point.
Invert the sigmoid. σ ( z ) = t ⇒ z = ln 1 − t t . Here z = ln 0.3 0.7 = ln 3 7 ≈ 0.8473 .
Why this step? The sigmoid is monotonic, so each threshold maps to exactly one score value.
New boundary equation: x 1 + x 2 − 3 = 0.8473 ⇒ x 1 + x 2 = 3.8473 .
Why this step? Replace the constant. Notice w = ( 1 , 1 ) is unchanged — only the offset moved.
Look at the figure below (s03). The solid violet line is the default (t = 0.5 ) boundary x 1 + x 2 = 3 ; the dashed magenta line is the stricter (t = 0.7 ) boundary x 1 + x 2 = 3.847 . The orange arrow shows the shift: the line slid away from the origin along its own normal without rotating. Same tilt, new position — this is the visual proof that a threshold change never changes orientation w , only the offset b .
Verify: the line slid parallel to itself (same w , orientation identical) — exactly the parent's "threshold shifts, never tilts" rule. Sanity: σ ( 0.8473 ) = 1 + e − 0.8473 1 ≈ 0.70 ✓.
Worked example Ex 6 — Cell G: scaling the weights does NOT move the boundary
Two models: z A = x 1 + x 2 − 2 and z B = 10 x 1 + 10 x 2 − 20 . Do they share a boundary?
Forecast: bigger weights, sharper sigmoid — different fence or same fence?
Boundary of A: x 1 + x 2 − 2 = 0 ⇒ x 1 + x 2 = 2 .
Why this step? z = 0 defines the fence, so we set model A's score to zero and read the line.
Boundary of B: 10 x 1 + 10 x 2 − 20 = 0 . Divide by 10: x 1 + x 2 − 2 = 0 ⇒ x 1 + x 2 = 2 .
Why this step? w B = 10 w A and b B = 10 b A ; a positive constant factor cancels out of the equation = 0 .
Same set of points. The boundaries are identical .
Why this step? Because both simplify to the exact same equation x 1 + x 2 = 2 , the two { z = 0 } sets are literally the same points — proving that scaling by c > 0 leaves the fence's location untouched.
Verify at a test point ( 3 , 0 ) : z A = 3 + 0 − 2 = 1 , σ ( 1 ) ≈ 0.731 . z B = 30 + 0 − 20 = 10 , σ ( 10 ) ≈ 0.99995 . Different confidence, same class (both > 0.5 ), and both put ( 3 , 0 ) on the class-1 side. Magnitude tunes steepness, not location. ✓
Worked example Ex 7 — Cell H: a curved (elliptical) boundary from engineered features
Model z = x 1 2 + 4 x 2 2 − 16 . Describe the boundary and classify ( 3 , 1 ) and ( 1 , 1 ) .
Forecast: circle, ellipse, or line?
Set z = 0 : x 1 2 + 4 x 2 2 = 16 . Divide by 16: 16 x 1 2 + 4 x 2 2 = 1 .
Why this step? z = 0 still defines the fence, but the squared features make it a conic , not a line. This is the standard ellipse form a 2 x 2 + b 2 y 2 = 1 with a = 4 , b = 2 .
Read the shape: an ellipse, semi-axis 4 along x 1 , semi-axis 2 along x 2 . Inside (z < 0 ) is class 0; outside (z > 0 ) is class 1.
Why this step? The sign of z tells inside vs outside just like the circle example in the parent.
Classify ( 3 , 1 ) : z = 9 + 4 − 16 = − 3 < 0 ⇒ class 0 (inside). Classify ( 1 , 1 ) : z = 1 + 4 − 16 = − 11 < 0 ⇒ class 0 (inside). Classify ( 5 , 0 ) : z = 25 − 16 = 9 > 0 ⇒ class 1 (outside).
Why this step? Covers both inside points and an outside point so every region is shown.
Look at the figure below (s04). The magenta oval is the boundary x 1 2 + 4 x 2 2 = 16 — wider (a = 4 ) than it is tall (b = 2 ), exactly as the semi-axes predict. The orange-shaded interior is class 0 (z < 0 ); the outside is class 1 (z > 0 ). The dots confirm the arithmetic: ( 3 , 1 ) and ( 1 , 1 ) land inside (orange labels), ( 5 , 0 ) lands outside (violet label), and ( 4 , 0 ) sits on the oval (magenta) — the tie point. This is the "curved-in-input-space" boundary made visible.
Verify: a point exactly on the ellipse, ( 4 , 0 ) : z = 16 − 16 = 0 ✓ tie, σ ( 0 ) = 0.5 . The boundary is linear in the feature vector ( x 1 2 , x 2 2 ) but curved in ( x 1 , x 2 ) — see Feature Engineering .
Worked example Ex 8 — Cell I: the degenerate zero-weight model
Model z = 0 ⋅ x 1 + 0 ⋅ x 2 + b with w = ( 0 , 0 ) . What is the boundary when b = 0 ? When b = 2 ?
Forecast: where is the fence if the weights are all zero?
Case b = 0 : z = 0 for every point. Then σ ( 0 ) = 0.5 everywhere — the whole plane is one giant tie. There is no boundary and no decision ; the model is useless.
Why this step? The boundary set { z = 0 } becomes all of feature space (or empty when we demand a strict flip) — the degenerate limit.
Case b = 2 : z = 2 for every point. σ ( 2 ) ≈ 0.881 > 0.5 everywhere ⇒ always predict class 1 , no matter the input. Boundary set { z = 0 } = { 2 = 0 } = ∅ — empty .
Why this step? With zero weights the score can't depend on x , so either everything ties or one class always wins. This is the "constant classifier" limit.
Verify: b = 0 ⇒ σ ( 0 ) = 0.5 (no info). b = 2 ⇒ σ ( 2 ) = 1 + e − 2 1 ≈ 0.8808 , constant > 0.5 . The takeaway: a real boundary needs w = 0 .
Worked example Ex 9 — Cell J: real-world word problem
A loan model scores default risk: z = 0.02\,(\text{age}) - 0.5\,(\text{income in \ 10k}) + 3. C l a ss 1 = " w i l l d e f a u l t ." S h o u l d w e a pp r o v e a ppl i c an t A g e =40, I n co m e =$60\text{k}( so in co m e f e a t u r e =6$)?
Forecast: high income should push toward no default — will z come out negative?
Translate words to a score: z = 0.02 ( 40 ) − 0.5 ( 6 ) + 3 .
Why this step? Every word problem is just plugging real numbers into z , respecting the feature's units (income measured in units of $10k).
Compute: 0.02 ( 40 ) = 0.8 , − 0.5 ( 6 ) = − 3 , so z = 0.8 − 3 + 3 = 0.8 .
Why this step? We do the arithmetic term-by-term so the two large opposite contributions (− 3 from income and + 3 from the offset) are seen to cancel, leaving the small age term 0.8 to decide the sign.
Decide: z = 0.8 > 0 ⇒ class 1 = predicted to default ⇒ do not approve .
Why this step? Positive score means the class-1 (default) side of the boundary.
Verify: P ( y = 1 ) = σ ( 0.8 ) = 1 + e − 0.8 1 ≈ 0.690 , a 69% default risk — above 0.5 , so rejection is consistent. To approve we'd need z < 0 : solve 0.8 − 0.5 ( x − 6 ) < 0 where x is income in $10k, i.e. 0.02 ( 40 ) − 0.5 x + 3 < 0 ⇒ x > 7.6 , income >\ 76\text{k}. U ni t sc h ec k : a g e in y e a r s × 0.02$/year gives a dimensionless score contribution. ✓
Worked example Ex 10 — Cell K: exam twist — recover
w , b from two boundary points
You are told the decision line passes through ( 1 , 0 ) and ( 0 , 2 ) , and the point ( 0 , 0 ) is class 0. Reconstruct a valid z = w 1 x 1 + w 2 x 2 + b .
Forecast: you have 3 unknowns and 2 points — is the answer unique?
Both given points sit on z = 0 : w 1 ( 1 ) + w 2 ( 0 ) + b = 0 and w 1 ( 0 ) + w 2 ( 2 ) + b = 0 .
Why this step? "On the boundary" literally means z = 0 there — that's how you turn geometry into equations.
Solve the two equations. First gives w 1 = − b . Second gives 2 w 2 = − b ⇒ w 2 = − b /2 .
Why this step? Scaling freedom (cell G!) means we can fix b freely — the boundary is unique but ( w , b ) is only unique up to a positive scale.
Choose b = − 2 : then w 1 = 2 , w 2 = 1 . Candidate: z = 2 x 1 + x 2 − 2 .
Why this step? We pick b = − 2 (rather than, say, − 1 ) purely to clear the fraction in w 2 = − b /2 , giving whole-number weights — any negative b works and yields the same line by cell G's scaling rule.
Fix the orientation using ( 0 , 0 ) = class 0: z ( 0 , 0 ) = − 2 < 0 ✓ class 0. Good — if it had come out positive we'd flip the sign of all three.
Why this step? Two points fix the line but not which side is class 1; the extra labeled point resolves the sign.
Verify: line through ( 1 , 0 ) : 2 ( 1 ) + 0 − 2 = 0 ✓. Through ( 0 , 2 ) : 0 + 2 − 2 = 0 ✓. Origin: − 2 < 0 ✓ class 0. A valid model is z = 2 x 1 + x 2 − 2 (any positive multiple works too).
Recall Self-check: name the cell
Point with z = − 7 ::: Cell B, class 0.
σ ( z ) = 0.5 ::: Cell C, exactly on the boundary, z = 0 .
z = x 1 2 + 4 x 2 2 − 16 ::: Cell H, an ellipse boundary.
w = 0 , b = 2 ::: Cell I, constant classifier, always class 1, empty boundary.
Threshold raised to 0.7 ::: Cell F, line slides parallel by ln 0.3 0.7 .
Multiply w , b by 10 ::: Cell G, same boundary, sharper confidence.
Mnemonic The universal move
Whatever the scenario, set z to the target score and solve. z = 0 for the default fence, z = ln 1 − t t for threshold t . Sign of z picks the class. Everything else is arithmetic.
Decision boundaries — the parent rule (z = 0 ) this page exercises.
Logistic Regression — source of the score z = w ⊤ x + b .
Sigmoid Function — why 0.5 ⇔ z = 0 and how thresholds invert.
Feature Engineering — Ex 7's ellipse from squared features.
Linear Regression — same z , different output layer.
Support Vector Machines — the max-margin cousin of Ex 4's hyperplane.
Softmax Classification — many boundaries at once for multi-class.