Part III — Probability, Information Theory & Bayesian Inference · Chapter 3

Joint, marginal & conditional probability

Hook

Two variables share one probability table. Read across a row and you get one story; read down a column and you get another; ignore the table's structure entirely and you get a third. Which one answers your actual question?

Intuition
A \ BP(A)
0.200.100.200.50
0.100.300.100.50
P(B)0.300.400.301.00

Click a row (A) or column (B) header to slice the table.

Click a row header (AA) or a column header (BB). The cells you picked light up, and the readout below shows what's left once you renormalize just that slice — the conditional distribution living inside the joint table all along.

Formalize

A joint distribution P(A,B)P(A,B) assigns a probability to every combination of outcomes at once. Summing a whole row or column marginalizes out the other variable:

P(A=a)=bP(A=a,B=b)P(A=a) = \sum_b P(A=a,\,B=b)
  • P(A,B)P(A,B) — the joint probability table: one number per (row, column) combination.
  • P(A=a)P(A=a) — the marginal probability of A=aA=a, found by summing across every value of BB.

A conditional distribution slices out one row or column and renormalizes it so it sums to 1 again:

P(BA=a)=P(A=a,B)P(A=a)P(B\mid A=a) = \frac{P(A=a,\,B)}{P(A=a)}
  • P(BA=a)P(B\mid A=a) — the distribution over BB, restricted to the world where A=aA=a is already known.
  1. Marginals are just row and column sums

    No new arithmetic — marginalizing is exactly the sum you'd take to check a row or column adds up.

  2. Conditioning is slicing, then renormalizing

    Fix one variable's value, take the sub-table that survives, and divide every entry by whatever that sub-table currently sums to. That division is the entire difference between a joint slice and a conditional distribution.

  3. Conditioning on a row and conditioning on a column don't rhyme

    P(BA=a)P(B\mid A{=}a) divides by a row sum; P(AB=b)P(A\mid B{=}b) divides by a column sum. Nothing forces these two conditionals to look alike, even though they come from the same table.

Play
A \ BP(A)
0.200.100.200.50
0.100.300.100.50
P(B)0.300.400.301.00

P(A=a1, B=b1) = 0.20 — the joint cell itself.

P(B=b1 | A=a1) = 0.400 — slice by row, normalize by P(A=a1) = 0.50.

P(A=a1 | B=b1) = 0.667 — slice by column, normalize by P(B=b1) = 0.30.

Pick any cell: the joint value is just that one entry, but the two conditionals built from it divide by completely different denominators — a row sum for P(BA)P(B\mid A), a column sum for P(AB)P(A\mid B) — which is exactly why P(BA)P(AB)P(B\mid A) \ne P(A\mid B) in general.

Worked example
  1. Read off the joint table
    • Row a1a_1: P(a1,b1)=0.2P(a_1,b_1)=0.2, P(a1,b2)=0.1P(a_1,b_2)=0.1, P(a1,b3)=0.2P(a_1,b_3)=0.2 — sums to P(a1)=0.5P(a_1)=0.5
    • Row a2a_2: P(a2,b1)=0.1P(a_2,b_1)=0.1, P(a2,b2)=0.3P(a_2,b_2)=0.3, P(a2,b3)=0.1P(a_2,b_3)=0.1 — sums to P(a2)=0.5P(a_2)=0.5
  2. Marginalize to get P(b3)

    Sum column b3b_3 down both rows: P(b3)=P(a1,b3)+P(a2,b3)=0.2+0.1=0.3P(b_3) = P(a_1,b_3) + P(a_2,b_3) = 0.2 + 0.1 = 0.3.

  3. Condition on b3 to get P(a2 | b3)
    P(a2b3)=P(a2,b3)P(b3)=0.10.3=130.333P(a_2 \mid b_3) = \frac{P(a_2, b_3)}{P(b_3)} = \frac{0.1}{0.3} = \frac{1}{3} \approx 0.333

    Notice this is not the same as P(a2)=0.5P(a_2)=0.5 — seeing B=b3B=b_3 actually shifted the belief about AA.

Checkpoint

From the table below, compute P(A = a2 | B = b3).

A \ Bb1b2b3P(A)
a10.200.100.200.50
a20.100.300.100.50
P(B)0.300.400.301.00
Pick a value to try it
Summary
P(A=a)=bP(A=a,B=b)P(BA=a)=P(A=a,B)P(A=a)P(A=a) = \sum_b P(A=a,B=b) \qquad P(B\mid A=a) = \frac{P(A=a,B)}{P(A=a)}

A joint table quietly contains every marginal and every conditional distribution over its variables — sum a direction to marginalize, slice-and-renormalize to condition. Nearly every "what does the model actually believe, given what it just observed" question in probabilistic ML reduces to one of these two operations.