W02 · Primer — everything from one 4 × 4 table of counts
Invalid Date
Everything in probability is built from a pair of functions that point at different arguments.
| Map | Takes | Gives | Example |
|---|---|---|---|
| Probability | an event — a set of outcomes | a number in | |
| Random variable | an outcome — a single | a real number | $X() = $ the face shown |
Probabilities attach to events. Numbers attach to outcomes. Almost every early confusion is these two being swapped.
A random variable is not a function of events. The odd-indicator does not send the set to 0 — it sends the outcome 2 to 0, and 4 to 0, and 6 to 0. Three outcomes that happen to share a number.
The arrow that does exist runs backwards, and it is how every probability gets computed:
random variable → numerical condition → event → probability
A coin has two faces. Give it four, roll two of them, and record the pair.
Toss the pair 100 times and tally how often each of the 16 combinations came up. That tally is the next slide, and everything today comes out of it.
| Y = 1 | Y = 2 | Y = 3 | Y = 4 | row total | |
|---|---|---|---|---|---|
| X = 1 | 12 | 8 | 4 | 1 | 25 |
| X = 2 | 6 | 14 | 7 | 3 | 30 |
| X = 3 | 3 | 7 | 12 | 5 | 27 |
| X = 4 | 1 | 3 | 6 | 8 | 18 |
| col total | 22 | 32 | 29 | 17 | 100 |
| Y = 1 | Y = 2 | Y = 3 | Y = 4 | row total | |
|---|---|---|---|---|---|
| X = 1 | 12 | 8 | 4 | 1 | 25 |
| X = 2 | 6 | 14 | 7 | 3 | 30 |
| X = 3 | 3 | 7 | 12 | 5 | 27 |
| X = 4 | 1 | 3 | 6 | 8 | 18 |
| col total | 22 | 32 | 29 | 17 | 100 |
Ignore entirely and ask only how the first die behaved — read the row totals:
Ignore and read the column totals:
Marginal = total ÷ net. The name is literal: the answer is written in the margin of the table.
| Y = 1 | Y = 2 | Y = 3 | Y = 4 | row total | |
|---|---|---|---|---|---|
| X = 1 | 12 | 8 | 4 | 1 | 25 |
| X = 2 | 6 | 14 | 7 | 3 | 30 |
| X = 3 | 3 | 7 | 12 | 5 | 27 |
| X = 4 | 1 | 3 | 6 | 8 | 18 |
| col total | 22 | 32 | 29 | 17 | 100 |
Now suppose you are told the first die showed 1. Only the highlighted row is still in play — the other 75 tosses never happened. Keep that row and rescale it so it sums to one:
Divide by the row total (25), not by the net (100). Dividing by the net would give the joint — a sliver of mass that sums to 0.25, not a distribution.
Do it for all four rows. Each is a legitimate probability distribution over — four numbers, non-negative, summing to 1:
| Given | Y = 1 | Y = 2 | Y = 3 | Y = 4 | Σ |
|---|---|---|---|---|---|
| X = 1 (÷25) | 0.48 | 0.32 | 0.16 | 0.04 | 1 |
| X = 2 (÷30) | 0.20 | 0.47 | 0.23 | 0.10 | 1 |
| X = 3 (÷27) | 0.11 | 0.26 | 0.44 | 0.19 | 1 |
| X = 4 (÷18) | 0.06 | 0.17 | 0.33 | 0.44 | 1 |
Independence check: if and were independent, cell (1,1) would be . It is . These dice are loaded together.
| Y = 1 | Y = 2 | Y = 3 | Y = 4 | row total | |
|---|---|---|---|---|---|
| X = 1 | 12 | 8 | 4 | 1 | 25 |
| X = 2 | 6 | 14 | 7 | 3 | 30 |
| X = 3 | 3 | 7 | 12 | 5 | 27 |
| X = 4 | 1 | 3 | 6 | 8 | 18 |
| col total | 22 | 32 | 29 | 17 | 100 |
Nothing privileges rows. Told that the second die showed 2, keep that column and divide by its total (32):
One table, two families of conditionals. Rows give , columns give . The table does not care which way you slice it — and that symmetry is Bayes’ rule.
A single cell can be reached from either direction, so it has two factorizations:
Divide, and you can convert either conditional into the other:
| Piece | From the table | Value |
|---|---|---|
| row 1, cell 2 ÷ 25 | 0.32 | |
| row total ÷ net = 25/100 | 0.25 | |
| col total ÷ net = 32/100 | 0.32 | |
| 0.32 × 0.25 / 0.32 | 0.25 | |
| check: directly | col 2, cell 1 ÷ 32 = 8/32 | 0.25 ✓ |
No new axiom — just bookkeeping on one table. Bayes matters because in practice you can build (a cause producing an observation) but you want .
Now let the dice have more and more faces — 4, then 400, then a continuum. The table becomes a fine grid over the plane, and:
| Discrete table | Continuous joint |
|---|---|
| cell count ÷ net | — a joint density |
| a single row | a vertical slice of the surface at |
| that row’s total | the marginal value — the slice’s area |
| row ÷ row total | — the slice, renormalised |
| column totals |
Nothing conceptual changes. Sums become integrals, and “divide the row by its total” becomes “divide the slice by its area”. Slice, then renormalise.
Summing a row is exactly integrating out the variable you do not care about:
Marginalising loses information and cannot be undone: many different joints share the same margins. Two dice with these row and column totals could have been independent — they were not.
Read the other way — not as an identity to check, but as a recipe to generate: draw from its marginal, then draw from the row it selects.
Pick any ordering of the variables and the same move chains:
This is the chain rule of probability, and it is how every sequential generative model is defined: language models factorise left to right, diffusion models factorise along the noise level.
| Today’s object | Where it reappears |
|---|---|
| Joint | the mixture model — latent label and observation |
| Marginalising out | the mixture density; later, the evidence and the ELBO |
| Conditional as a renormalised slice | : the forward noising step |
| Bayes, the two slicings | : the posterior a denoiser estimates |
| Posterior mean of a slice | — W01’s denoiser, exactly |
| Chain rule with an ordering | — the reverse process |
The whole of diffusion is these four moves on one very large joint: the joint of a clean signal and its noisy versions.
One table. Totals give marginals, rows give conditionals, and reading a cell two ways gives Bayes.
Tutorials: Probability & Random Variables · Joint, Marginal, Conditional — and Bayes · demo: The Joint Slicer