Instead of studying $X$ and $Y$ apart, a joint distribution treats the pair $(X,Y)$ as a single object, assigning a probability or density to every combination of values it can take.
This matters whenever the two variables are not chosen at random with respect to each other. Height and weight, study hours and exam score, or the goals scored by two teams in the same match all carry a relationship that a joint distribution can capture.
As with single random variables, a pair can be discrete, continuous, or one of each. This visual guide focuses on the two matching cases.
| Type | Values | Examples |
|---|---|---|
| Discrete pair | countable combinations | goals scored by two teams in a match, likes and comments on a social media post |
| Continuous pair | any point in a region of the plane | height and weight, study hours and exam score |
| Symbol | Meaning |
|---|---|
| $X, Y$ | two random variables defined on the same sample space |
| $(x,y)$ | a specific pair of values that $X$ and $Y$ could take together |
| support of $(X,Y)$ | the set of pairs $(x,y)$ the pair can actually take |
For a discrete pair, the joint PMF gives the probability that $X$ equals $x$ and $Y$ equals $y$ at the same time.
It must satisfy the same two conditions as a single PMF, now over every pair of values.
Let $X$ be the number of goals Barça scores in a match (0, 1 or 2) and $Y$ whether Madrid scores at least once (0 for no, 1 for yes). Tracking many matches gives this joint PMF.
| $X \backslash Y$ | $y=0$ | $y=1$ |
|---|---|---|
| $x=0$ | 0.15 | 0.05 |
| $x=1$ | 0.20 | 0.15 |
| $x=2$ | 0.25 | 0.20 |
To be clear, this is not a table that reflects reality. In real life Barça would score more than 2 goals with fairly high probability.
For a continuous pair, probability comes from the volume under a surface $f_{X,Y}(x,y)$ over a region $A$ of the plane, not from the value of $f_{X,Y}$ at any single point.
It must satisfy the same two conditions as a joint PMF, now stated for a density.
Let $f_{X,Y}(x,y) = 2$ on the triangle where $0 < x < y < 1$, and 0 elsewhere.
We check that this triangle example is a valid joint PDF by integrating $f_{X,Y}$ over its whole support and confirming the result is exactly 1.
The quick shortcut is the same thing geometrically: a constant height of 2 times the triangle's area, $2 \times \tfrac{1}{2} = 1$.
| Symbol | Meaning |
|---|---|
| $p_{X,Y}(x,y)$ | joint PMF, probability that $X=x$ and $Y=y$ together (discrete case) |
| $f_{X,Y}(x,y)$ | joint PDF, density of $(X,Y)$ around the point $(x,y)$ (continuous case) |
The marginal PMF of $X$ ignores $Y$ entirely. It is found by fixing a value of $x$ and adding up the joint probability across every possible value of $Y$.
Geometrically, this means summing across a row of the joint table to get $p_X$, or down a column to get $p_Y$.
Adding row totals and column totals to the match table gives both marginal distributions at once.
| $X \backslash Y$ | $y=0$ | $y=1$ | $p_X(x)$ |
|---|---|---|---|
| $x=0$ | 0.15 | 0.05 | 0.20 |
| $x=1$ | 0.20 | 0.15 | 0.35 |
| $x=2$ | 0.25 | 0.20 | 0.45 |
| $p_Y(y)$ | 0.60 | 0.40 | 1.00 |
Madrid scores at least once about 40% of the time, and Barça scores 2 goals about 45% of the time, regardless of what the other variable does.
For a continuous pair, the sums become integrals over the other variable.
Integrating the joint density from section 02 over the other variable gives the marginal density, the continuous analog of summing a row or column.
| Symbol | Meaning |
|---|---|
| $p_X(x)$, $p_Y(y)$ | marginal PMFs, the distribution of one variable alone (discrete case) |
| $f_X(x)$, $f_Y(y)$ | marginal PDFs, obtained by integrating out the other variable (continuous case) |
The joint CDF answers "what is the chance that $X$ is at most $x$ and $Y$ is at most $y$, both at once?"
For a discrete pair, this means summing the joint PMF over the lower left block of the table, every cell with a row and column at or below $(x,y)$.
That's a 35% chance across all matches in the table.
For a continuous pair, the sum becomes a double integral over the same lower-left region of the plane.
We compute $F_{X,Y}(0.5, 0.8) = P(X \le 0.5,\ Y \le 0.8)$, the probability that $(X,Y)$ from the triangle density falls in the shaded corner shown below.
There is a 55% chance that $(X,Y)$ falls in this lower-left corner of the plane.
| Symbol | Meaning |
|---|---|
| $F_{X,Y}(x,y)$ | joint CDF, probability that $X \le x$ and $Y \le y$ together |
$X$ and $Y$ are independent when knowing one gives no information about the other. This holds exactly when the joint distribution factors into the two marginals.
Discrete case
The continuous version replaces the PMFs with PDFs, and the same factoring works for the joint CDF.
Continuous case
| Symbol | Meaning |
|---|---|
| $X \perp Y$ | shorthand for "$X$ and $Y$ are independent" |
Once we learn that $X = x$, the distribution of $Y$ can be updated. The conditional PMF rescales the row for $x$ so it adds up to 1 again.
Discrete case
For a continuous pair, the same idea rescales the joint density along the slice $X=x$.
Continuous case
When $X$ and $Y$ are independent, this simplifies to $p_{Y|X}(y \mid x) = p_Y(y)$: learning $X$ changes nothing about $Y$.
Consider the table from section 2 where $x$ = Barça goals and $y$ = Madrid goals.
| $X \backslash Y$ | $y=0$ | $y=1$ |
|---|---|---|
| $x=0$ | 0.15 | 0.05 |
| $x=1$ | 0.20 | 0.15 |
| $x=2$ | 0.25 | 0.20 |
| Symbol | Meaning |
|---|---|
| $p_{Y|X}(y \mid x)$ | conditional PMF of $Y$ given that $X = x$ |
Covariance measures whether $X$ and $Y$ tend to be above their means at the same time, or in opposite directions.
Discrete and continuous cases
The formula is the same either way; only how $E[\cdot]$ is computed changes, a sum over the joint PMF or an integral over the joint PDF.
Depending on the sign of the covariance:
The variance of a sum is not just the sum of the variances. It also includes twice the covariance, which is the whole reason covariance matters in practice.
Discrete and continuous cases
If $X$ and $Y$ are independent, $\text{Cov}(X,Y) = 0$ and the formula reduces to simple addition of variances.
| Symbol | Meaning |
|---|---|
| $\text{Cov}(X,Y)$ | covariance, the average product of deviations from the two means |
Covariance depends on the units of $X$ and $Y$, which makes its size hard to interpret. Dividing by both standard deviations fixes that.
Discrete and continuous cases
The correlation coefficient always falls between $-1$ and $1$, and it does not change if either variable is rescaled or shifted.
Drag the slider to change $\rho$ and see how the point cloud tilts, from a negative slope through no pattern to a tight positive line.
| Symbol | Meaning |
|---|---|
| $\rho_{X,Y}$ | correlation coefficient, covariance rescaled to fall between $-1$ and $1$ |
| $\sigma_X$, $\sigma_Y$ | standard deviations of $X$ and $Y$ |