2.7.9 · D2Statistics & Probability — Intermediate

Visual walkthrough — Bayes' theorem — derivation and applications

1,923 words9 min readBack to topic

This page is the picture-companion to the parent note. If a symbol here feels unfamiliar, it was drawn a step earlier.


Step 1 — The whole world is one square of area 1

WHAT. Draw a square whose total area equals . Every possible outcome lives somewhere inside it. "Area" will mean "probability" for the entire page — a bigger patch means a more likely thing.

WHY. Probability is just "what fraction of all outcomes?". A square of area turns that fraction into something you can literally see and measure with a ruler. This is the same bookkeeping as Tree Diagrams, but flattened onto a picture where areas add up.

PICTURE. In the figure below, the full peach square is the sample space. We haven't cut anything yet — total area .

Figure — Bayes' theorem — derivation and applications

Step 2 — Cut the square by the cause

WHAT. Slice the square with one vertical line. Everything left of the line is (the cause happened); everything right is ("not ", the cause did not happen).

WHY. We split by the cause first because that is what we usually know the base rate of. The width of the left strip is exactly the prior — how likely the cause is before any evidence.

PICTURE. The magenta strip has width ; the rest has width .

Figure — Bayes' theorem — derivation and applications

  • — the fraction of the whole square that is the cause. A width.
  • — the leftover, forced by "the whole square is 1".

Step 3 — Inside each strip, cut by the evidence

WHAT. Now cut horizontally, but at a different height in each strip. Inside the strip, the fraction that also shows evidence is . Inside the strip, that fraction is .

WHY. This is the likelihood — "given I'm in this strip, how tall is the part?". It is a height inside one strip, not a fraction of the whole square. Read $P(B\mid A)$ out loud as "the probability of , once we already know we are inside ." This is the definition from Conditional Probability made visible: a proportion within a chosen region.

PICTURE. Two shaded bands — one tall band in the strip (height ), one in the strip (height ).

Figure — Bayes' theorem — derivation and applications

  • — a height within the magenta strip. Its denominator is that strip, not the square.
  • — the same idea inside the other strip. In tests this is the false-positive rate.

Step 4 — The four rectangles: joint probabilities are AREAS

WHAT. The two cuts leave four rectangles. The area of any rectangle is width height. The top-left rectangle has area — the chance and both happen.

WHY. Area width height is why we drew a square at all. Multiplying a strip's width by a band's height gives a genuine fraction of the whole square — a joint probability. Written symbolically:

PICTURE. The magenta corner rectangle is highlighted. Its two sides are labelled; its area is the joint probability.

Figure — Bayes' theorem — derivation and applications
  • — the area of one corner rectangle (both events true). The symbol means "and".
  • The equation is just "area = width × height" wearing probability clothes.

Step 5 — The same area, sliced the other way

WHAT. Here is the trick. Cut the identical square starting with evidence first (a horizontal strip of height ), then cause. The -and- corner is the same physical rectangle — its area cannot change just because we measured its sides in a different order.

WHY. Two honest ways to compute one area must agree. So:

This is the whole engine of Bayes: one area, two decompositions.

PICTURE. Left panel: cut cause-first. Right panel: cut evidence-first. Same green rectangle, different labelled sides.

Figure — Bayes' theorem — derivation and applications
  • — width... sorry, height of the evidence strip when we cut first: the fraction of the whole square that shows evidence.
  • — the posterior, the thing we actually want: given evidence, how much of that strip is the cause?

Step 6 — Divide to isolate the posterior

WHAT. Take the chain of equalities from Step 5 and divide both sides by .

WHY. We want alone on the left. Dividing by peels away everything else. Term by term:

PICTURE. The posterior is literally "green rectangle area ÷ full evidence strip area". The figure shows the green corner sitting inside the whole strip — the fraction of that strip that is also .

Figure — Bayes' theorem — derivation and applications

Step 7 — Where does come from? The evidence strip is built from pieces

WHAT. The full evidence strip is not one rectangle — it is the -part of the strip plus the -part of the strip.

WHY. Every point showing evidence lives in exactly one of the cause-strips (they don't overlap and they fill the square — a partition). So we add the two green areas. This is exactly the Law of Total Probability:

PICTURE. Both green pieces glow; a bracket on the right shows they stack to the total evidence height .

Figure — Bayes' theorem — derivation and applications
  • Adding these two areas is the denominator. This is why the parent note writes — here .
  • If you forget a piece, the fractions of all causes won't add to — a classic mistake.

Step 8 — Degenerate & edge cases (never let the reader fall through)

WHAT & WHY. Real problems throw weird inputs. Here is what the picture does in each:

Figure — Bayes' theorem — derivation and applications

The figure shows three shrunken squares for the zero-width, zero-height, and independent cases so you can see the fraction collapse.


The one-picture summary

Everything on one square. The whole derivation is: slice the unit square by cause, then by evidence; one corner is the joint; divide that corner by the whole evidence strip; and the strip itself is the sum of its pieces. That single sentence is the figure below.

Figure — Bayes' theorem — derivation and applications

Recall Feynman: the whole walkthrough in plain words

Picture the world as a square rug with total area one. Draw a vertical line: the left part is "the cause is true", and how wide that part is tells you how common the cause is before any clue — that's your prior. Now inside each half, colour the strip where the clue appears. The coloured patch in the left half is "cause AND clue". Here's the punchline: you could have coloured that exact same patch by cutting the rug horizontally first — same patch, two ways to describe its sides. Set those two descriptions equal, divide by the total coloured height, and out pops Bayes' theorem. The answer to "given the clue, is the cause true?" is just: what slice of ALL the coloured area sits in the cause half? If the cause was impossibly rare (zero width), its coloured patch is zero, and no clue can save it. If the clue looks identical in both halves, the clue is useless and your belief doesn't move. That is Bayes — nothing but comparing areas on a rug.

Recall

In the area picture, what does the numerator of Bayes' theorem represent? ::: The area of the single rectangle where cause and evidence both happen: . In the picture, what does the denominator represent? ::: The area of the entire evidence strip — the sum of the coloured pieces from every cause-strip. Why does force ? ::: A zero-width cause-strip has a zero-area corner, so no evidence can give it positive posterior — the prior is a gate. When does the posterior equal the prior in the picture? ::: When the evidence band has equal height in both strips (independence): the evidence carries no information.


Connections

  • Conditional Probability — every "height inside a strip" is a conditional probability.
  • Law of Total Probability — Step 7: the evidence strip as a sum of pieces.
  • Independent Events — the edge case where the posterior equals the prior.
  • Tree Diagrams — the same bookkeeping in branch form instead of areas.
  • Naive Bayes Classifier — this square, repeated for many features.
  • Prior and Posterior Distributions — the continuous version of the strip widths.