Conditioning Zooms the Leftover
Conditioning Zooms the Leftover
Scenario that fails
A junior engineer looks at a spam filter's inbox and reports: "only 16% of the emails that contain free are spam, so the free rule is not worth keeping." She computed
and proposed dropping the rule. The 16% is real arithmetic on the wrong denominator. The question this lesson answers is short: which emails should she have counted? The answer is the strip of emails the word free actually kept, not the whole inbox.
Before the zoom: 8 of the 50 tiles are both free and spam (0.16 of the inbox). [ILLUSTRATION]
The inbox as a rectangle of leftover
Use one secondary inbox for the whole page: 50 emails, 20 spam, 10 contain free, 8 are both. The same numbers appear in the figures, the lab, the quiz and the flashcards.
| Quantity | Value |
|---|---|
| 0.8 (home) | |
| 0.16 (wrong-denominator answer) | |
| 0.4 (swapped answer) | |
| 0.2 | |
| 0.4 |
The inbox is a rectangle of 50 tiles. Spam is a set of tiles inside it; free is a strip of 10 tiles. Eight tiles sit in both. Nothing about those eight tiles changes when we learn the word free — what changes is which tiles we are still allowed to count.
The zoom
Learn "this email contains free". Every tile outside the free strip is now impossible. It does not become zero spam or zero ham; it leaves the picture. The strip of 10 tiles fills the screen and becomes the whole world.
Zooming does not create or destroy emails. It hides the ones you have ruled out and stretches the strip to fill the screen. The fraction you then read is the conditional. The wrong-denominator error is reading the zoomed fraction while still counting the hidden tiles.
Zoom into free and re-read the strip as a whole budget: 8/10 = 0.8. [ILLUSTRATION]
Re-read the strip as a budget of 1
Inside the strip there are 10 emails: 8 spam and 2 ham. The conditional re-reads that strip as a new budget:
The 2 ham emails are the leftover inside the zoom: . And
Lesson 1's budget rule survives the zoom. Conditioning is not a second universe with a new total; it is the same tiles, with a new denominator.
The formula, derived
The counting form divides the overlap by the strip:
Divide the top and the bottom by the inbox size :
Show both lines. The first is the picture: count the strip. The second is what survives when there are no counts, only masses. The mass form is the one that will still work when the inbox size is unknown.
Why the strip must have mass
The mass form divides by , so it needs . In the picture, if no email contained free, there would be no strip to outline and nothing to re-read. A conditional on an empty strip is undefined, not zero: zero would claim the strip exists and contains no spam.
The zoomed budget still sums to 1
Split the zoomed strip into spam and ham:
For the home inbox: . The zoom changes the denominator, never the total.
Multiplication rule, read backwards
The same three numbers, rearranged, give the joint mass:
That is the 0.16 from the report. It is a real quantity — — but it is not . Lesson 8 uses the four-tile table this line comes from.
A one-line preview of total probability
The whole spam mass can be rebuilt from the two strips:
This line is only a preview: Lesson 3 reallocates the leftover from the other direction. On this page it is a check that the strips still add up to the 20 spam tiles.
Back to the 16% report
The engineer's 0.16 is , the eight tiles divided by all fifty. The conditional divides those same eight tiles by the ten emails the zoom kept:
So the report's arithmetic is right and its sentence is wrong. "Only 16% of free emails are spam" should read "80% of free emails are spam; 16% of all emails are both free and spam." Dropping the free rule is a decision about 0.8, not about 0.16.
The other zoom gives a different number
Zoom into spam instead. Now the strip is the 20 spam emails, and 8 of them contain free:
Same eight emails, different strip, different denominator. This is the swap, and it is also Lesson 10's home value. Say the strip out loud before dividing: "I am inside free" gives 8/10; "I am inside spam" gives 8/20.
Same 8 emails, two different strips, two different conditionals. [ILLUSTRATION]
Worked examples
Home: . Mass form: . The strip's leftover is , and .
Wrong paths as numbers: divide by the inbox → ; zoom into the wrong strip → ; condition on an empty strip → undefined (not 0, not NaN).
Transfer: 25 emails contain meeting, and 5 of those are spam.
Follow-up: if the inbox has 100 emails, what does the wrong-denominator answer give? It gives , the joint mass divided by the whole inbox, not the conditional.
Code that prints the numbers
nA, nAB, N, nB = 10, 8, 50, 20
print(nAB / nA) # 0.8 zoom into the 10 free emails
print(nAB / N) # 0.16 wrong denominator: whole inbox
print(nAB / nB) # 0.4 swapped zoom: into 20 spam
print((nAB / N) / (nA / N)) # 0.8 mass form: 0.16 / 0.2
Interactive lab
Three controls: the size of the strip , the overlap , and the fail toggle "divide by the whole inbox (the mistake)". Reset returns to 10 / 8 / off and reads 0.8. Set and the lab prints the undefined sentence instead of 0 or NaN.
Failure modes
- Swapping and . Spot it when the answer is 0.4 for the home question. Fix: say the strip out loud before dividing.
- Dividing by the wrong leftover. Spot it when the answer is 0.16. Fix: the hidden tiles do not count after the zoom; 0.16 is the joint mass.
- Conditioning on a zero-probability strip. Spot it when the answer is "0". Fix: undefined, because there is no budget to re-read.
- "Conditioning is a different universe." Fix: it is the same tiles; the zoomed budget still sums to 1.
Honesty table
| Claim | Tag |
|---|---|
| Home and the secondary inbox 50 / 20 / 10 / 8 | REAL — numpy prove (docs/probability/setup/prove-home-numbers.py) and runProbL2 |
| Junior engineer's 16% report | ILLUSTRATION — teaching failure, not a product screenshot |
Stills prob_l2_inbox_grid, prob_l2_zoom, prob_l2_two_zooms | ILLUSTRATION — teaching diagrams on Worker CDN (HTTP 200 verified) |
| AI hook: supervised learning models | PUBLISHED — standard supervised-learning framing; not proved on this page |
| Lesson video | shipped | Worker mp4 + cover (about 208.7 s walk) |
Video
The lesson plate above is the narrated walk of the conditioning-zooms-the-leftover lesson: the wrong-denominator 0.16 report, the 50-email inbox, the zoom into free (8/10 = 0.8), the mass form 0.16/0.2, the spam-side swap 0.4, the empty-strip undefined case, and the P(y|x) hook. It is served from the SuperLearn media Worker; there is no second copy in the app bundle.
Sources
Rewrite, never paste: Bertsekas & Tsitsiklis 2e §1.3 (conditional probability) and §1.4 (total probability); Piech, Probability for Computer Scientists, Part 1; Blitzstein Ch. 2; Goodfellow §3.5.
Next: Bayes turns the 0.4 back into 0.8 when you only know the spam-side numbers (Lesson 3).
