discrete-joint-distributions

Thu Jul 16 2026

The whole idea in one line The marginals of XX and YY are two shadows of one object, and the joint table is the object. Everything here is that table plus three moves: sum a row to get a marginal, rescale a row to get a conditional, and compare each cell against its row times its column to test independence. The one-time pad's perfect secrecy is the last move in action: the message-ciphertext table factors.

Two marginals do not fix the joint

Suppose XX and YY are each Bern(1/2)\text{Bern}(1/2), and that is everything you know. What is P(X=1,Y=1)P(X=1, Y=1)?

The natural first answer is 1/4:

P(X=1,Y=1)=P(X=1)P(Y=1X=1)=?P(X=1)P(Y=1)=1212=14.\begin{aligned} P(X=1, Y=1) &= P(X=1)\,P(Y=1 \mid X=1) \\ &\overset{?}{=} P(X=1)\,P(Y=1) \\ &= \tfrac12 \cdot \tfrac12 = \tfrac14. \end{aligned}

The chain rule step is fine. The trap is the marked step, which replaced P(Y=1X=1)P(Y=1 \mid X=1) with P(Y=1)P(Y=1). That replacement needs independence, and independence was never given. A counterexample: flip one fair coin, let X=1X=1 for heads and Y=1Y=1 for tails. Both marginals are Bern(1/2)\text{Bern}(1/2), yet P(X=1,Y=1)=120=0P(X=1, Y=1) = \tfrac12 \cdot 0 = 0.

So the honest answer is "cannot be determined." Keep both marginals pinned at Bern(1/2)\text{Bern}(1/2) and change only the relationship: the joint value is 0 when Y=1XY = 1-X (one coin, opposite faces), 1/4 when independent (two separate coins), and 1/2 when Y=XY = X (one coin, same face). Same marginals, three different joints. Why this must happen, and the one-sample-space picture underneath it, is its own note: joint-distribution-mental-model.

The joint PMF as a 2D table

A joint probability mass function (PMF) can be visualized as a table: rows for XX's values, columns for YY's, each cell holding P(X=x,Y=y)P(X=x, Y=y). The comma means "and", so every cell is an intersection event. There is no joint notation for "or": a union goes through inclusion-exclusion, P(X=1 or Y=1)=P(X=1)+P(Y=1)P(X=1,Y=1)P(X{=}1 \text{ or } Y{=}1) = P(X{=}1) + P(Y{=}1) - P(X{=}1, Y{=}1), and even that needs a joint term.

What makes the table work: one outcome ω\omega produces exactly one pair (X(ω),Y(ω))(X(\omega), Y(\omega)), so it lands in exactly one cell. The cells are mutually exclusive and exhaustive, they partition the sample space, and they sum to 1. Each move below rests on this.

joint-three-moves

Marginal PMF: sum a row

P(X=x)=yP(X=x,Y=y).P(X=x) = \sum_y P(X=x, Y=y).

The event {X=x}\{X=x\} is the union of the disjoint cells "X=xX=x with YY anything", so summing them is just the rule for a disjoint union. This move runs one way only. Joint to marginals is easy summing, marginals back to joint is impossible without relationship information. That is the opening question again.

Conditional PMF: rescale a row

Sample a random adult male: X=1X=1 if he currently smokes, Y=1Y=1 if he develops lung cancer.

Y=1Y=1Y=0Y=0
X=1X=15/10020/100
X=0X=03/10072/100

Learning X=1X=1 keeps only the top row, whose total mass is 25/100. Divide each cell by that total and the row becomes a valid PMF:

P(Y=1X=1)=5/10025/100=15,P(Y=0X=1)=2025=45.\begin{aligned} P(Y=1 \mid X=1) &= \frac{5/100}{25/100} = \frac15, \\ P(Y=0 \mid X=1) &= \frac{20}{25} = \frac45. \end{aligned}

A Venn diagram is the wrong tool for this. A circle in a Venn diagram stands for one whole event, but the conditional PMF needs the event {X=1}\{X=1\} split across every value of YY, cell by cell. Those pieces have no home in a two-circle picture. The table shows exactly them.

Redraw the Venn intuition as a grid A random variable is not one circle. Each {X=i}\{X=i\} is its own region, those regions are disjoint and tile all of Ω\Omega, and a second variable YY tiles the same space crosswise with {Y=j}\{Y=j\}. Two r.v.s together give a grid of intersection cells, which is exactly the joint table. Update the Venn picture to this grid view. (Raised during sitting 2, 2026-07-19. Tracked in tasks/redraw-venn-as-grid.)

The comparison that matters is conditional against marginal. Before learning anything, P(Y=1)=8/100P(Y=1) = 8/100. After learning X=1X=1, it jumps to 1/51/5. Learning XX moved YY's distribution, so the pair is dependent. (The event-level version is in conditional-probability.)

Conditioning does not always shrink a probability With Y=XY = X on one coin, P(Y=1X=1)=1P(Y=1 \mid X=1) = 1, larger than the marginal 1/21/2. Learning XX can push a probability of YY up, down, or not at all.

Independence: every cell factors

Three equivalent faces:

  1. CDF face: the joint cumulative distribution function factors, F(x,y)=FX(x)FY(y)F(x,y) = F_X(x)\,F_Y(y) for all x,yx, y.
  2. PMF face: every cell equals its row margin times its column margin, P(X=x,Y=y)=P(X=x)P(Y=y)P(X=x, Y=y) = P(X=x)\,P(Y=y). This is the one case where the marginals do fix the joint.
  3. Conditional face: P(Y=yX=x)=P(Y=y)P(Y=y \mid X=x) = P(Y=y) whenever P(X=x)>0P(X=x) > 0. Every row renormalizes to the same marginal, so conditioning changes nothing.

The two directions cost differently: one non-factoring cell is enough to disprove independence, but proving it requires every one of the XY|X| \cdot |Y| cells to factor.

Bayes' rule and the Law of Total Probability (LOTP) hold on PMFs unchanged, with events replaced by "variable == value":

P(Y=yX=x)=P(X=xY=y)P(Y=y)P(X=x),P(X=x)=yP(X=xY=y)P(Y=y).P(Y=y \mid X=x) = \frac{P(X=x \mid Y=y)\,P(Y=y)}{P(X=x)}, \qquad P(X=x) = \sum_y P(X=x \mid Y=y)\,P(Y=y).

Chicken and egg: a split Poisson is two independent Poissons

A chicken lays NPois(λ)N \sim \text{Pois}(\lambda) eggs. Each egg hatches on its own with probability pp and fails with q=1pq = 1-p. Let XX count the hatched eggs and YY the failed ones, so X+Y=NX + Y = N. The natural guess is that XX and YY are dependent, since Y=NXY = N - X: learn XX and you seem to know something about YY. The joint PMF says otherwise.

Given N=nN = n, the nn eggs are independent trials, so XN=nBin(n,p)X \mid N{=}n \sim \text{Bin}(n, p). To reach the joint, condition on NN with LOTP:

P(X=i,Y=j)=n=0P(N=n)P(X=i,Y=jN=n).P(X=i, Y=j) = \sum_{n=0}^{\infty} P(N=n)\,P(X=i, Y=j \mid N=n).

Given N=nN = n, the pair (i,j)(i, j) is impossible unless n=i+jn = i+j, and once N=i+jN = i+j and X=iX = i, the event Y=jY = j is automatic. So one term survives, and the factorials cancel:

P(X=i,Y=j)=P(N=i+j)P(X=iN=i+j)=eλλi+j(i+j)!(i+ji)piqj=eλλi+jpiqji!j!.\begin{aligned} P(X=i, Y=j) &= P(N=i+j)\,P(X=i \mid N=i+j) \\ &= \frac{e^{-\lambda}\lambda^{i+j}}{(i+j)!} \binom{i+j}{i} p^i q^j \\ &= \frac{e^{-\lambda}\,\lambda^{i+j}\,p^i q^j}{i!\,j!}. \end{aligned}

Split every factor along the i/ji/j seam, using λi+j=λiλj\lambda^{i+j} = \lambda^i \lambda^j and eλ=eλpeλqe^{-\lambda} = e^{-\lambda p}\,e^{-\lambda q}:

P(X=i,Y=j)=eλp(λp)ii!eλq(λq)jj!.P(X=i, Y=j) = \frac{e^{-\lambda p}(\lambda p)^i}{i!} \cdot \frac{e^{-\lambda q}(\lambda q)^j}{j!}.

The joint factors into Pois(λp)×Pois(λq)\text{Pois}(\lambda p) \times \text{Pois}(\lambda q). By the PMF face, XX and YY are independent.

Two points make this result land. First, P(X=i)P(X=i) is well defined on its own even though only XNX \mid N was ever specified. Marginalize YY out of the factored joint, the jj-part sums to 1, and P(X=i)=eλp(λp)i/i!P(X=i) = e^{-\lambda p}(\lambda p)^i/i! with no NN in sight. "Not computed yet" is not the same as "not defined": a marginal is one quantity's distribution with the other randomness averaged out, not ignored. This is Poisson thinning: keep each item of a Pois(λ)\text{Pois}(\lambda) count independently with probability pp, and the kept count is Pois(λp)\text{Pois}(\lambda p).

Second, the dependence intuition is about the wrong pair. Conditional on N=nN = n, the two counts are Bin(n,p)\text{Bin}(n,p) and Bin(n,q)\text{Bin}(n,q) and perfectly dependent, knowing one pins the other. Unconditionally, NN's Poisson randomness is exactly the kind that makes learning XX useless for predicting YY. This is special to the Poisson, no other egg-count distribution does it, and it runs both ways: independent Pois(λp)\text{Pois}(\lambda p) and Pois(λq)\text{Pois}(\lambda q) sum to a Pois(λ)\text{Pois}(\lambda) with a binomial conditional, and a Poisson count split by independent coin flips gives back independent Poissons.

Never substitute a value inside the conditioning event The step P(X=xX+Y=n)=P(X=xY=nx)P(X=x \mid X+Y=n) = P(X=x \mid Y=n-x) is illegal. To the right of the bar, XX is still random, only the hypothesis X+Y=nX+Y=n is given, so X=xX=x cannot be plugged in there. Conditioning on X=xX=x is what licenses replacing XX by xx, and only to the left of the bar: P(X+Y=nX=x)=P(Y=nxX=x)P(X+Y=n \mid X=x) = P(Y=n-x \mid X=x) is fine. The two sides of the illegal step really are different distributions, Bin(n,p)\text{Bin}(n,p) on the left and Pois(λp)\text{Pois}(\lambda p) on the right.

The one-time pad: perfect secrecy is independence

Take a message bit MM with any adversary prior P(M=1)=mP(M=1) = m, a key bit KBern(1/2)K \sim \text{Bern}(1/2) independent of MM, and ciphertext C=MKC = M \oplus K. The chain rule fills the cells:

P(M=i,C=j)=P(M=i)P(K=ijM=i)=P(M=i)P(K=ij)=P(M=i)12,\begin{aligned} P(M=i, C=j) &= P(M=i)\,P(K = i \oplus j \mid M=i) \\ &= P(M=i)\,P(K = i \oplus j) \\ &= P(M=i) \cdot \tfrac12, \end{aligned}

where dropping the conditioning is exactly where KMK \perp M gets used. Without it the table falls apart.

C=0C=0C=1C=1
M=0M=0(1m)/2(1-m)/2(1m)/2(1-m)/2
M=1M=1m/2m/2m/2m/2

The column sums give P(C=0)=P(C=1)=1/2P(C=0) = P(C=1) = 1/2 whatever mm is, and every cell factors as P(M=i)P(C=j)P(M=i)\,P(C=j). So CMC \perp M, the adversary's posterior P(M=iC=j)P(M=i \mid C=j) equals the prior, and seeing the ciphertext teaches them nothing. That is Shannon's perfect secrecy, and it is plain independence, no extra cryptographic machinery.

At real sizes nobody checks 2n×2n2^n \times 2^n cells, the argument goes structural. Fix any pair (m,c)(m, c): exactly one key k=mck = m \oplus c produces it, and keys are uniform over 2n2^n values, so every row of the giant table is uniform. The table gives the statement to prove, a bijection proves it.

The requirement is identical rows, not a uniform CC. If every row is the same PMF DD, LOTP averages identical things and returns that thing:

P(C=c)=mP(M=m)D(c)=D(c),\begin{aligned} P(C=c) &= \sum_m P(M=m)\,D(c) \\ &= D(c), \end{aligned}

so conditional equals marginal and posterior equals prior. Uniformity is just what XOR with a uniform key happens to produce. A non-uniform case: append an independent Bern(0.9)\text{Bern}(0.9) junk bit to every ciphertext. The rows stay identical to each other, the marginal of CC is now biased, and the adversary still learns nothing about MM.

What is still shaky

The seam between conditional and joint quantities. A conditional is not automatically smaller than the marginal, and it is not the joint cell either, the two differ by the row-total factor. The continuous version of this material is built on exactly that move: conditional probability density functions (PDFs) as renormalized slices of a density surface, with integrals in place of row sums. Watch that seam.