Visual walkthrough — Joint, marginal, and conditional distributions
Step 1 — A table of squares is the whole story
WHAT. Picture a rectangle chopped into a grid. Each small square is one combination of two facts. Let us call the first fact ("is this email spam?") and the second fact ("does it contain the word free?"). Each of these can only be (no) or (yes).
WHY. Before any formula, probability is just area. If we shade each square so that its area equals the fraction of all emails falling in that box, then the whole rectangle has area (it is 100% of the emails). This picture — total area , split into labelled boxes — is called the joint distribution, written .
PICTURE. In the figure, the four boxes carry the numbers from the parent note. Read as: "the area of the box in row , column ."

Term-by-term, the total-area law reads The symbol ("sigma") just means "add up all the terms as the index runs over its values."
Step 2 — Push a whole row into one pile → the marginal
WHAT. Take the spam row () and slide its two boxes together into a single bar. Its length is .
WHY. By sliding the boxes together we have thrown away the column information (we no longer care whether the word "free" appeared). What survives is "how much area is spam, regardless of ." That surviving number is the marginal . It is called marginal because in a printed table it lands in the margin — the row total written off to the side.
PICTURE. The teal bar on the right is the collapsed row; look how its length equals the two orange boxes stacked end to end.

Numerically here: , and . The two row-totals themselves add to , so the marginal is a perfectly good distribution on its own.
Step 3 — Pick one column and stare at it (the slice)
WHAT. Now do the opposite of pushing: we keep only the column where ("free" appeared). That column has two boxes: ham-and-free and spam-and-free .
WHY. We want to answer "given that the word free showed up, how likely is spam?" The phrase "given that free showed up" means: forget every email that did not contain free. Visually, we grey out every box outside that column and zoom into the strip that remains.
PICTURE. Only the column stays coloured; the rest of the grid is faded. The two live boxes have areas (ham) and (spam).

Here is the crucial observation. The surviving strip has total area which is exactly the column marginal . It is not . So the slice, as it stands, is not yet a valid distribution — its pieces do not add up to a full 100%.
Step 4 — Rescale the slice to 100% → the conditional
WHAT. Stretch the surviving strip so that its total area becomes again. To turn into we divide every box in the strip by .
WHY. "Given free appeared" defines a new, smaller world: the only emails that exist now are the that contained free. Inside that world, probabilities must again sum to (it is the whole of this world). Dividing every piece by the strip's total is exactly the rescaling that restores the total to . The result is the conditional .
PICTURE. The short strip of Step 3 is stretched upward to full height ; the two pieces keep their ratio but now their lengths are and .

The tall bar inside is read "given". Everything to the right of the bar is the world we have zoomed into; everything to the left is the question we ask inside it.
Plugging in the spam numbers:
Step 5 — Read it the other way → the product (chain) rule
WHAT. Take the conditional equation and multiply both sides by the marginal to undo the division.
WHY. The picture says a box's area = (its share of the strip) (the strip's whole area). That is a rectangle's area = width-fraction total — pure geometry. Written in symbols it is the product rule, and it lets us rebuild the joint from a marginal and a conditional (the direction generative models and Probabilistic graphical models actually use).
PICTURE. The stretched strip (height ) shrunk back down by the factor returns to the original box areas — multiplication is the inverse of the rescaling.

Because a box can be reached either by row-first or column-first, there are two factorings: Setting the two right-hand sides equal and dividing by gives Bayes' theorem:
Step 6 — The direction trap ( ≠ )
WHAT. Slice the other way — by row instead of column — and rescale that.
WHY. Zooming into the spam row (, total ) answers a different question: "given spam, how often is free present?" Its denominator is the row total , not the column total . Same box on top (), different strip underneath ⇒ different answer.
PICTURE. Left panel: column strip ÷ gives . Right panel: row strip ÷ gives . Same numerator box , two different denominators.

Step 7 — Degenerate case: an empty strip
WHAT. Suppose some value never occurs, so its whole column is blank: .
WHY. The conditional would ask us to divide by . Geometrically there is no strip to rescale — you cannot stretch an area of up to . The event "given " describes a world that has no inhabitants, so "how likely is spam in it?" is meaningless.
PICTURE. A ghost column of zero width; the stretch arrow has nothing to grab, marked "undefined".

That is exactly why every definition carries the guard . If a value can never happen, we simply do not condition on it.
Step 8 — Special case: the boxes were a perfect product (independence)
WHAT. Now take the continuous joint from the parent note, on the unit square, and slice it at a fixed .
WHY. When we compute the conditional , the cancels. Whatever value of we condition on, the shape over is the same curve . Visually the vertical slices are all the same profile, just scaled — knowing tells you nothing new about . That is exactly independence: the joint factors as . See Independence and conditional independence.
PICTURE. Three vertical slices of the surface at ; after each is rescaled to area , all three collapse onto the identical line .

Contrast this with the spam table, where the word free pushed spam from up to — there the slices had different shapes, so and were dependent. (This shape-comparison is the honest test; a mere zero-correlation is not enough.)
The one-picture summary
Everything above is a single loop: push a row to get the marginal, cut a column to get a slice, divide by that column's total to rescale the slice into a conditional, and multiply back to recover the joint.

Recall Feynman retelling — the whole walkthrough in plain words
Start with a rectangle cut into little boxes, one box per (spam?, free?) combination, shaded so all the boxes together fill exactly 100% of the emails — that is the joint. Slide all the boxes in the spam row into one pile: you get "how much is spam, ignoring words" — the marginal. Now zoom into just the free column and grey out everything else; those boxes only add up to , not to a full 100%, so they're not a real world yet. Stretch that strip until it fills 100% again — i.e. divide every box by — and now each box tells you its share inside the free-only world: that is the conditional, and spam turns out to be . Read the stretch backwards (multiply instead of divide) and you rebuild any box's area from a share times a strip-total — the product rule — and because you can slice by row or column, equating the two ways of rebuilding gives Bayes. Watch the denominator: slice the column and you get ; slice the row and the same box over a different total gives — never swap those. If a column is empty you can't stretch nothing to 100%, so we forbid dividing by zero. And if every column-slice has the same shape after stretching, the two facts don't inform each other — that's independence.
Active recall
Why does the column-slice not already form a valid distribution?
What single operation turns the slice into the conditional, and why that one?
Same box: why is but ?
In , what does the missing signify?
When is conditioning undefined, geometrically?
Connections
- Hinglish version of the parent
- Bayes' theorem — the two factorings of the joint set equal.
- Independence and conditional independence — identical slice shapes (Step 8).
- Marginalization and the law of total probability — the "push a row" move (Step 2).
- Covariance and correlation — a weaker summary than the full slice test.
- Naive Bayes classifier — builds the joint by multiplying conditionals back (Step 5).
- Probabilistic graphical models — choose which product-rule factoring to store.
- Expectation and variance — averages taken against these very distributions.