Joint and Marginal Distributions
How to describe two or more random variables at once (the joint), how to recover one at a time (the marginal), and why the marginals alone can never tell you how the variables move together.
Prerequisites: Random Variables & Distributions, Conditional Probability
Most interesting questions involve more than one random quantity: a stock's return and the market's, a customer's age and their spend, two dice at once. The joint distribution is the full bookkeeping of how likely every combination of outcomes is. From it you can answer any question about the variables together, and, by "summing out" the ones you don't care about, recover the behaviour of each variable on its own, its marginal distribution.
For two discrete variables, the joint distribution is just a table of probabilities , one entry per pair, all adding to 1. To get the marginal of , you collapse the table along the other axis, adding up each row:
In words: the chance takes a value is the total probability of all the joint outcomes where it does, regardless of what did. The name "marginal" is literal, it's the total you'd scribble in the margin of the table.
A joint table with its margins
Here's a concrete joint distribution for two 0/1 variables. The interior cells are the joint probabilities; the shaded edges are the marginals, obtained by adding across each row and down each column.
| Marginal of | |||
|---|---|---|---|
| 0.30 | 0.20 | 0.50 | |
| 0.15 | 0.35 | 0.50 | |
| Marginal of | 0.45 | 0.55 | 1.00 |
Read straight off it: (the row sum), and (the column sum). The lone corner, 1.00, is a sanity check that the whole table's probability accounts for everything.
The joint is the full table of combination-probabilities; a marginal is what you get by summing (or integrating) the joint over the variables you're ignoring. The margins are shadows of the joint, cast onto one axis at a time.
Independence: when the joint is just the product
Two variables are independent when knowing one tells you nothing about the other, and that has a crisp signature: the joint probability factorises into the product of the marginals,
Test it on the table. If and were independent, the top-left cell would be . But the actual joint value is , not , so these two variables are dependent: they show up together more often than chance alone would produce. This single check, does every interior cell equal the product of its margins?, is the whole definition of independence.
Independence means the joint table is exactly the "outer product" of the two margins, every cell is (its row total) × (its column total). If even one cell breaks that rule, the variables are dependent.
Worked example: from joint to conditional
Using the same table, suppose you learn that . What's now the chance that ? Conditioning zooms in on the row and renormalises it so its entries sum to 1:
Before you knew anything, had probability ; after learning , it jumps to . That shift, from marginal to conditional, is dependence made visible: the information in genuinely changed your view of . If they'd been independent, the conditional would have equalled the marginal and nothing would have moved.
The marginals do not determine the joint. Two very different joint tables can share the exact same row and column totals, differing entirely in how the variables co-move. You can never reconstruct correlation from the margins alone, that information lives only in the interior of the table.
The continuous version
For continuous variables the ideas carry over with integrals in place of sums. The joint density describes probability per unit area, and you marginalise by integrating the unwanted variable out:
The bivariate normal at the heart of the The Multivariate Normal Distribution is the most important continuous example: its joint density is a tilted bell over the plane, and every marginal and conditional slice of it is again a normal.
Joint and marginal thinking is the gateway to the rest of multivariable probability. Conditioning on part of a joint distribution leads to Conditional Probability and Conditional Expectation; summing a joint over one variable while weighting by the other is the The Law of Total Probability; and the co-movement the margins hide is exactly what Correlation and the The Multivariate Normal Distribution are built to capture.
Related concepts
Practice in interviews
Further reading
- Blitzstein & Hwang, Introduction to Probability, ch. 7
- Ross, A First Course in Probability