TL;DR
A joint distribution assigns a probability to every combination of values of two or more random variables. It tells you how likely and are to take particular values together. From it you can recover each variable on its own (the marginal) and how one variable behaves once you know the other (the conditional).
Without the joint, two variables are just two separate stories. With it, you can ask questions about how they move together.
Where you'll see it: in a pair of sensor readings that drift together, in the pixel values of an image treated as one vector, and in the (input, label) pairs of a supervised learning dataset.
Intuition
A table of who-with-what
Suppose you record the weather (: sunny or rainy) and whether a person carries an umbrella (: yes or no) every morning for a year. Count the mornings in each cell and divide by the total. The grid of four numbers is the joint distribution.
| umbrella: yes | umbrella: no | total | |
|---|---|---|---|
| sunny | 0.10 | 0.50 | 0.60 |
| rainy | 0.30 | 0.10 | 0.40 |
| total | 0.40 | 0.60 | 1.00 |
The four inner cells are the joint. The bottom and right margins, the row and column totals, are the marginals. They are what you see if you look at one variable and ignore the other. The marginal totals are the shadows the joint casts on each axis.
The table already shows something a single variable cannot. Rainy mornings are much more likely to come with an umbrella: out of , against out of on sunny days. That dependence lives in the joint, not in either margin.
- Y given X = 0
- Y given X = 1
- marginal of Y
The plot shows the continuous version of the same idea. Fix at one value and the joint becomes a curve in . Those curves are the conditionals. Averaging them over all values of gives back the marginal.
The math
Definitions
For discrete random variables and , the joint probability mass function is
It is never negative, and its values sum to 1 over all pairs. For continuous variables, the joint probability density is never negative and integrates to 1 over the whole plane. The probability that lands in a region is .
Here and are the values the two variables can take, and is the probability of seeing both at once. The same definition extends to any number of variables. Three variables give a joint , and so on.
Marginal distributions
To get the distribution of one variable, add (discrete) or integrate (continuous) over the other:
This is "integrating out" . Each value of collects all the ways it can happen, whatever turns out to be. In the umbrella table, .
Conditional distributions
The conditional distribution of given restricts attention to the slice where and renormalises it so it sums to 1:
Rearranged, this is the product rule: . Any joint can be built by taking one variable's marginal and then a conditional for the next. For three variables, .
Independence
and are independent exactly when the joint factorises into its marginals:
Equivalently, the conditional equals the marginal: . Learning tells you nothing about .
A continuous example
Take on the unit square . First check it is a density:
The marginal of is on . The conditional density of given is then .
To find , integrate the joint over the lower-left quarter. The inner integral is . The outer one is .
Since in general, and are not independent.
Worked examples
Use the table above: , , , .
- Marginals: , and .
- Conditional: .
- Compare with the base rate: . Knowing someone carries an umbrella raises the chance of rain from 40% to 75%.
- Independence test: , but . The two are not equal, so the variables are dependent.
Interpretation: the umbrella is evidence about the weather, and the joint is what lets you measure how strong that evidence is.
A filter looks at one word, "free", in each email, and records whether the email is spam. Across a large sample, the joint probabilities are:
| spam | not spam | total | |
|---|---|---|---|
| contains "free" | 0.20 | 0.05 | 0.25 |
| no "free" | 0.10 | 0.65 | 0.75 |
| total | 0.30 | 0.70 | 1.00 |
- Probability an email is spam given it contains "free": .
- Probability an email is spam given it lacks "free": .
- The ratio of these two is about 6. The word is strong evidence for spam.
- Check: the unconditional spam rate is , and the two conditionals average back to it, weighted by how often "free" appears: .
Interpretation: a single word moves the spam probability from 30% to 80% or down to about 13%. The filter is useful because the joint is not independent.
Tradeoffs and failure modes
| Situation | Problem | Better choice |
|---|---|---|
| Many variables | A full discrete joint over binary variables needs numbers, which grows too fast to estimate | Factorise it into conditionals, or assume a structure such as conditional independence |
| Continuous variables that look roughly bell-shaped together | A nonparametric joint needs far more data than a parametric one | A [[multivariate-gaussian |
| Sparse data for some combinations | Cells with few counts give noisy conditionals | Smooth the estimates, or pool sparse categories |
| Assuming independence without checking | Joint probabilities are then wrong, and so are any uncertainty estimates | Check on data before relying on it |
| Reading a conditional as the reverse conditional | is not | Go back to the joint table and divide by the right margin |
The marginals never determine the joint. Two different joints can share the same margins. Take with zeros elsewhere, and compare it with the table where all four cells are . Both have margins and . The first says and always agree, and the second says they are independent. Only the joint can tell them apart.
History
Joint probability was implicit in the earliest work on chance. Thomas Bayes's essay, published posthumously in 1763, reasoned about two events at once and about how one changes the probability of the other. Pierre-Simon Laplace used joint and conditional probabilities systematically in the early 1800s. Francis Galton and Karl Pearson developed the bivariate normal and the idea of correlation in the late 1800s, because they needed a precise way to say how two measurements move together. Andrey Kolmogorov's 1933 axioms gave probability a measure-theoretic foundation, which made joint distributions of any number of variables a standard, precise object. The joint became central to modern statistics and machine learning because so many quantities of interest are relationships between variables.
Check yourself
QuestionRecall: What two properties must a joint probability mass function have?Show answer
Every value must be nonnegative, and the values must sum to 1 over all pairs . The first says each entry is a probability, and the second says some pair must occur.
QuestionComputation: Using the umbrella table, what is ?Show answer
. Divide the joint cell by the marginal for the variable you are conditioning on.
QuestionWhy: Why can't the two marginals alone determine the joint distribution?Show answer
Different joints can have the same row and column totals. Take and compare it with the table where all four cells are . Both have margins of and , but one has and always agreeing and the other has them independent. The joint records how the variables relate, and the margins do not.
QuestionApplied: A spam classifier uses 20 binary word features. How many free parameters does a full joint table over those features and the label need, and what assumption makes it practical?Show answer
The features and the label are 21 binary variables, so the full joint needs numbers. That is far more than any training set can estimate reliably. Naive Bayes assumes the words are independent given the label. Then the joint factorises into one label marginal and one conditional per word and label, which is about parameters.