Marginal Distributions

Suppose you know the full joint behavior of a pair of random variables. For example, how tall a person is and how much they weigh, jointly. Can you recover the distribution of height alone, forgetting weight ever existed? This is the question a marginal distribution answers. It strips a joint law down to the behavior of one coordinate. This is done by summing or integrating the others away. The name itself comes from a bookkeeping habit. In old tables of joint frequencies, the row and column totals were written in the margins of the page. Those margin totals are exactly the marginal distributions. The idea matters because almost no interesting random experiment involves just one quantity in isolation. We measure many things at once. Examples include a stock's return and its volatility, a patient's blood pressure and cholesterol, or the outcomes of several dice. The joint distribution is the complete description of how they behave together. But often we only need the behavior of one variable. Sometimes we need it as a stepping stone toward more refined questions. One such question is how one variable behaves given information about another. Marginalization is the precise operation that lets us move from the "whole picture" (the joint law) to a "partial picture" (the law of a single coordinate). It is the single most-used operation in multivariate probability after specifying the joint law itself. The big picture is a conservation law. Probability mass or density lives on a two- (or higher-) dimensional space. It gets collapsed onto one axis by adding up all the mass that projects onto each point of that axis. In the discrete case this is literal summation over rows or columns of a joint probability table. In the continuous case it is an integral that "integrates out" the unwanted variable. The same idea extends without change of philosophy to any number of variables. It also extends to mixed discrete/continuous situations, though the technical bookkeeping differs. This article gives the formal definition of a marginal distribution and marginal density/mass function. It proves that marginals recovered from a valid joint distribution are themselves valid distributions. It works two fully asymmetric numerical examples. It shows precisely why each hypothesis (countable support, or a genuine joint density) is needed. It ends by pointing toward Conditional Distributions and Covariance and Correlation. Both of these are built on top of the marginal machinery developed here.

Key takeaways
  • A marginal distribution is the distribution of one coordinate of a random vector, obtained by "integrating out" the others.
  • Discrete case: sum the joint pmf over all values of the unwanted variable(s).
  • Continuous case: integrate the joint density over all values of the unwanted variable(s).
  • Marginals are always determined by the joint distribution, but the converse fails — the joint is not determined by its marginals alone.
  • The marginal pmf/density is automatically a valid probability distribution: it is nonnegative and sums/integrates to 1.
  • Key idea: marginalizing is projecting a joint probability distribution onto one axis by summing or integrating away the other coordinates.

Where this lives today

Marginal distributions are the quiet workhorse behind nearly every multivariate calculation. In Bayesian statistics, the marginal likelihood (or "evidence") is obtained by integrating a joint density over the parameter, and is central to model comparison and Bayes factors. In machine learning, marginalizing over latent variables — as in mixture models, hidden Markov models, and variational autoencoders — is exactly the summation/integration described here, often approximated numerically when exact integration is intractable. In statistical mechanics, the marginal distribution of a single particle's velocity, obtained by integrating a joint many-particle density over all other particles' coordinates, recovers the Maxwell–Boltzmann distribution from the full phase-space density. In actuarial science and risk management, marginal distributions of individual loss types are extracted from joint models of correlated risks to price insurance products, even when the joint dependence structure (often modeled via copulas) is much more intricate than either marginal alone. In signal processing and information theory, marginal entropies computed from marginal distributions feed directly into mutual information, which measures the gap between the true joint and the independence baseline built from the marginals — a direct descendant of the counterexample above.

Ask the tutor: How do I find the marginal density of X+YX+Y when XX and YY have a joint density, and how does that relate to marginalizing a transformed joint distribution?

DefinitionMarginal distribution, marginal pmf, marginal density

Let (X,Y)(X,Y) be a pair of random variables on a probability space (Ω,F,P)(\Omega, \mathcal{F}, P) with joint distribution function

FX,Y(x,y)=P(X≤x, Y≤y),(x,y)∈R2.F_{X,Y}(x,y) = P(X \le x,\, Y \le y), \qquad (x,y) \in \mathbb{R}^2.

Marginal CDF. The marginal distribution function of XX is

FX(x):=P(X≤x)=lim⁡y→∞FX,Y(x,y),x∈R,F_X(x) := P(X \le x) = \lim_{y \to \infty} F_{X,Y}(x,y), \qquad x \in \mathbb{R},

and symmetrically FY(y):=lim⁡x→∞FX,Y(x,y)F_Y(y) := \lim_{x\to\infty} F_{X,Y}(x,y).

Discrete case. If (X,Y)(X,Y) takes values in a countable set S⊆R2S \subseteq \mathbb{R}^2 with joint probability mass function

pX,Y(x,y)=P(X=x,Y=y),p_{X,Y}(x,y) = P(X=x, Y=y),

the marginal pmf of XX is

pX(x):=P(X=x)=∑y : (x,y)∈SpX,Y(x,y),p_X(x) := P(X = x) = \sum_{y \,:\, (x,y) \in S} p_{X,Y}(x,y),

summing over all yy for which (x,y)(x,y) has positive probability (equivalently, over all yy in the range of YY).

Continuous case. If (X,Y)(X,Y) has a joint probability density function fX,Yf_{X,Y}, meaning

P((X,Y)∈B)=∬BfX,Y(x,y) dx dyP\big((X,Y) \in B\big) = \iint_B f_{X,Y}(x,y)\,dx\,dy

for all (Borel) sets B⊆R2B \subseteq \mathbb{R}^2, the marginal density of XX is

fX(x):=∫−∞∞fX,Y(x,y) dy,f_X(x) := \int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dy,

and symmetrically fY(y):=∫−∞∞fX,Y(x,y) dxf_Y(y) := \int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dx. The definitions extend verbatim to nn variables X1,…,XnX_1,\dots,X_n with joint pmf/density pp or ff: the marginal of any sub-collection of the coordinates is obtained by summing/integrating the joint pmf/density over all the remaining coordinates, each ranging over its entire support.

Intuition

Picture the joint distribution of (X,Y)(X,Y) as a landscape of probability mass sitting over the plane: a bar chart of heights pX,Y(x,y)p_{X,Y}(x,y) in the discrete case, or a continuous "hill" of density fX,Y(x,y)f_{X,Y}(x,y) in the continuous case. To find the marginal distribution of XX, imagine standing at a fixed value x0x_0 and looking along the entire yy-direction — collecting all the mass that sits above the line x=x0x = x_0, regardless of its yy-coordinate. Summing (or integrating) that mass gives a single number, pX(x0)p_X(x_0) or fX(x0)f_X(x_0): it is exactly as if you flattened the landscape by pushing all of it down onto the xx-axis, like sunlight casting a shadow of the hill straight onto a wall. This "shadow" picture immediately explains why the marginal loses information: two very different joint hills can cast the same shadow, because the shadow only records the total mass at each xx, not how that mass was distributed across yy. This is precisely why marginals cannot be inverted back into a joint law without further assumptions such as independence — a fact made precise in the counterexample below.

Figure
A joint pmf table on {1,2,3}×{1,2}\{1,2,3\}\times\{1,2\}, with row totals as the marginal of XX
Joint pmf p(x,y) and its row marginal p_X(x) y=1 y=2 p_X(x) x=1 0.10 0.20 0.30 x=2 0.05 0.15 0.20 x=3 0.30 0.20 0.50 p_Y(y) 0.45 0.55 1.00
TheoremMarginals are valid probability distributions

Let (X,Y)(X,Y) have joint pmf pX,Yp_{X,Y} (discrete case) or joint density fX,Yf_{X,Y} (continuous case).

(a) Discrete case. The marginal pmf pX(x)=∑ypX,Y(x,y)p_X(x) = \sum_y p_{X,Y}(x,y) satisfies

pX(x)≥0 for all x,∑xpX(x)=1,p_X(x) \ge 0 \text{ for all } x, \qquad \sum_x p_X(x) = 1,

so pXp_X is a valid pmf, and it equals the pmf of the random variable XX in the sense that P(X=x)=pX(x)P(X=x) = p_X(x) for every xx.

(b) Continuous case. Assume additionally that fX,Y(x,y)≥0f_{X,Y}(x,y) \ge 0 is integrable with ∬R2fX,Y=1\iint_{\mathbb{R}^2} f_{X,Y} = 1, and that for a.e. xx the slice y↦fX,Y(x,y)y \mapsto f_{X,Y}(x,y) is integrable (guaranteed by Tonelli's theorem, see proof). Then the marginal density fX(x)=∫−∞∞fX,Y(x,y) dyf_X(x) = \int_{-\infty}^\infty f_{X,Y}(x,y)\,dy satisfies

fX(x)≥0 for a.e. x,∫−∞∞fX(x) dx=1,f_X(x) \ge 0 \text{ for a.e. } x, \qquad \int_{-\infty}^{\infty} f_X(x)\,dx = 1,

so fXf_X is a valid probability density, and it is a density for XX: P(X≤x)=∫−∞xfX(t) dtP(X \le x) = \int_{-\infty}^x f_X(t)\,dt for all xx.

Proof

Technique. Part (a) uses countable additivity of PP directly; part (b) uses Tonelli's theorem for nonnegative measurable functions (which permits interchanging the order of integration without any integrability hypothesis beyond nonnegativity) followed by the Fubini–Tonelli theorem to justify the iterated integral computing the actual measure of a rectangle.

(a) Discrete case. Nonnegativity. Each term pX,Y(x,y)=P(X=x,Y=y)≥0p_{X,Y}(x,y) = P(X=x,Y=y) \ge 0 since probabilities are nonnegative, so the sum pX(x)=∑ypX,Y(x,y)p_X(x) = \sum_y p_{X,Y}(x,y) is a sum of nonnegative terms, hence pX(x)≥0p_X(x) \ge 0. Agreement with P(X=x)P(X=x). Fix xx in the range of XX. Let SyS_y range over all values in the range of YY, and note the events

{X=x,Y=y},y∈range(Y),\{X = x, Y = y\}, \qquad y \in \text{range}(Y),

are pairwise disjoint (they differ in the value of YY) and their union is exactly the event {X=x}\{X = x\}, because on the event {X=x}\{X=x\}, YY must take some value in its range, and it takes exactly one such value. Since the range of YY is countable, countable additivity of PP gives

P(X=x)=P(⋃y{X=x,Y=y})=∑yP(X=x,Y=y)=∑ypX,Y(x,y)=pX(x).P(X = x) = P\left(\bigcup_{y} \{X=x, Y=y\}\right) = \sum_{y} P(X=x, Y=y) = \sum_y p_{X,Y}(x,y) = p_X(x).

This proves pX(x)=P(X=x)p_X(x) = P(X=x) exactly, not merely up to normalization. Normalization. By the same disjoint-union argument applied over all xx in the range of XX simultaneously, the events {X=x,Y=y}\{X=x, Y=y\} over all pairs (x,y)(x,y) in the (countable) joint range partition the whole sample space Ω\Omega (up to a null set — every outcome gives (X,Y)(X,Y) some value in its countable range with probability 1). Hence by countable additivity,

∑xpX(x)=∑x∑ypX,Y(x,y)=∑(x,y)pX,Y(x,y)=P(Ω)=1,\sum_x p_X(x) = \sum_x \sum_y p_{X,Y}(x,y) = \sum_{(x,y)} p_{X,Y}(x,y) = P(\Omega) = 1,

where the double sum of nonnegative terms may be computed in any order or grouping (Tonelli's theorem for series, i.e. nonnegative double series sum unambiguously regardless of order). This completes part (a).

(b) Continuous case. Nonnegativity. Since fX,Y≥0f_{X,Y} \ge 0 everywhere (this is part of what it means to be a joint density), for every fixed xx the integrand y↦fX,Y(x,y)y \mapsto f_{X,Y}(x,y) is nonnegative, so its integral fX(x)=∫fX,Y(x,y) dyf_X(x) = \int f_{X,Y}(x,y)\,dy is nonnegative (it may equal +∞+\infty on a null set of xx's, but is finite and well-defined for a.e. xx by Tonelli's theorem below). Well-definedness via Tonelli. Tonelli's theorem states: if g:R2→[0,∞]g: \mathbb{R}^2 \to [0,\infty] is (jointly) measurable, then

∬R2g(x,y) dx dy=∫R(∫Rg(x,y) dy)dx=∫R(∫Rg(x,y) dx)dy,\iint_{\mathbb{R}^2} g(x,y)\,dx\,dy = \int_{\mathbb{R}} \left(\int_{\mathbb{R}} g(x,y)\,dy\right) dx = \int_{\mathbb{R}} \left(\int_{\mathbb{R}} g(x,y)\,dx\right) dy,

with all three quantities equal in [0,∞][0,\infty], no integrability hypothesis needed beyond nonnegativity and measurability. Apply this with g=fX,Y≥0g = f_{X,Y} \ge 0, measurable since it is a density. The middle expression equals ∫RfX(x) dx\int_{\mathbb R} f_X(x)\,dx by definition of fXf_X, and the left side equals 11 since fX,Yf_{X,Y} is a probability density on R2\mathbb{R}^2. Hence

∫RfX(x) dx=∬R2fX,Y(x,y) dx dy=1<∞,\int_{\mathbb{R}} f_X(x)\,dx = \iint_{\mathbb{R}^2} f_{X,Y}(x,y)\,dx\,dy = 1 < \infty,

which in particular forces the inner integral fX(x)=∫fX,Y(x,y) dyf_X(x) = \int f_{X,Y}(x,y)\,dy to be finite for Lebesgue-almost every xx (an integral of an a.e.-finite nonnegative function over xx can only be finite if the function itself is finite a.e.). This proves normalization and simultaneously the a.e. finiteness (well-definedness) of fXf_X. Agreement with the CDF of XX. Fix x∈Rx \in \mathbb{R}. By definition of the joint distribution function and the fact that fX,Yf_{X,Y} is a joint density,

FX(x)=P(X≤x)=P((X,Y)∈(−∞,x]×R)=∬(−∞,x]×RfX,Y(u,y) du dy.F_X(x) = P(X \le x) = P\big((X,Y) \in (-\infty, x] \times \mathbb{R}\big) = \iint_{(-\infty,x]\times \mathbb{R}} f_{X,Y}(u,y)\,du\,dy.

Apply the Fubini part of the Fubini–Tonelli theorem (justified since fX,Y≥0f_{X,Y} \ge 0 and the double integral over the whole plane is finite, namely =1=1, so fX,Yf_{X,Y} is absolutely integrable) to write this iterated integral in the order uu then yy:

FX(x)=∫−∞x(∫−∞∞fX,Y(u,y) dy)du=∫−∞xfX(u) du,F_X(x) = \int_{-\infty}^x \left(\int_{-\infty}^{\infty} f_{X,Y}(u,y)\,dy\right) du = \int_{-\infty}^x f_X(u)\,du,

using the definition of fXf_X in the inner integral. This shows fXf_X is indeed a density whose antiderivative recovers the true marginal CDF of XX, completing part (b). ■\blacksquare

∎
CorollaryMarginals of a discrete/continuous vector always exist and are unique a.e.

For any joint pmf or joint density on nn variables, marginalizing over any nonempty proper subset of the coordinates via summation/integration always produces a well-defined pmf (exactly) or density (up to redefinition on a Lebesgue-null set) for the remaining coordinates. This follows by applying the two-variable argument above with YY replaced by the vector of all coordinates being integrated out, since Tonelli's theorem places no restriction on the dimension of the variable being integrated over.

Worked examples

Example 1 (discrete, asymmetric joint pmf). Let X∈{1,2,3}X \in \{1,2,3\} (number of defective units found by inspector A) and Y∈{0,1}Y \in \{0,1\} (whether a shipment is flagged, Y=1Y=1 meaning "flagged"), with joint pmf given by the table

X=1X=2X=3Y=00.100.050.30Y=10.200.150.20\begin{array}{c|ccc} & X=1 & X=2 & X=3 \\ \hline Y=0 & 0.10 & 0.05 & 0.30 \\ Y=1 & 0.20 & 0.15 & 0.20 \end{array}

Step 1: check validity. All nine listed entries are nonnegative, and their sum is

0.10+0.05+0.30+0.20+0.15+0.20=1.00,0.10+0.05+0.30+0.20+0.15+0.20 = 1.00,

so this is a legitimate joint pmf on the six pairs shown (this matches the table pictured in the intuition figure, transposed).

Step 2: marginal of XX. Sum down each column:

pX(1)=pX,Y(1,0)+pX,Y(1,1)=0.10+0.20=0.30,p_X(1) = p_{X,Y}(1,0) + p_{X,Y}(1,1) = 0.10 + 0.20 = 0.30,
pX(2)=0.05+0.15=0.20,pX(3)=0.30+0.20=0.50.p_X(2) = 0.05 + 0.15 = 0.20, \qquad p_X(3) = 0.30 + 0.20 = 0.50.

Check: 0.30+0.20+0.50=1.000.30+0.20+0.50 = 1.00 ✓, confirming Theorem: Marginals are valid probability distributions (part a) holds numerically.

Step 3: marginal of YY. Sum across each row:

pY(0)=0.10+0.05+0.30=0.45,pY(1)=0.20+0.15+0.20=0.55.p_Y(0) = 0.10+0.05+0.30 = 0.45, \qquad p_Y(1) = 0.20+0.15+0.20 = 0.55.

Check: 0.45+0.55=1.000.45+0.55 = 1.00 ✓.

Step 4: a genuine use of the marginal. Suppose we only care about the overall probability a shipment gets flagged, ignoring which inspector-count triggered it. The answer is exactly pY(1)=0.55p_Y(1) = 0.55 — read directly off the marginal, without needing to know how that 0.550.55 decomposes across X=1,2,3X=1,2,3. Notice also this joint table is not a product of its marginals: pX,Y(1,0)=0.10p_{X,Y}(1,0) = 0.10 but pX(1)pY(0)=0.30×0.45=0.135≠0.10p_X(1)p_Y(0) = 0.30 \times 0.45 = 0.135 \ne 0.10, so XX and YY are dependent even though each marginal alone is perfectly well defined — a fact marginals alone can never detect (elaborated in the counterexample).

Example 2 (continuous, asymmetric joint density on a triangular region). Let (X,Y)(X,Y) have joint density

fX,Y(x,y)=c (x+2y),0<x<1, 0<y<x,f_{X,Y}(x,y) = c\,(x + 2y), \qquad 0 < x < 1,\ 0 < y < x,

and fX,Y(x,y)=0f_{X,Y}(x,y) = 0 otherwise. This support is the triangle below the line y=xy=x and above y=0y=0, for x∈(0,1)x\in(0,1) — asymmetric in xx and yy, since the range of YY depends on xx but not vice versa.

Step 1: find cc. We need ∬fX,Y=1\iint f_{X,Y} = 1:

∫01∫0xc(x+2y) dy dx=∫01c[xy+y2]y=0y=xdx=∫01c(x2+x2) dx=∫012cx2 dx=2c3.\int_0^1 \int_0^x c(x+2y)\,dy\,dx = \int_0^1 c\Big[xy + y^2\Big]_{y=0}^{y=x} dx = \int_0^1 c(x^2 + x^2)\,dx = \int_0^1 2cx^2\,dx = \frac{2c}{3}.

Setting 2c3=1\frac{2c}{3} = 1 gives c=32c = \frac{3}{2}.

Step 2: marginal density of XX. For 0<x<10 < x < 1, integrate out yy over its range (0,x)(0,x):

fX(x)=∫0x32(x+2y) dy=32[xy+y2]0x=32(x2+x2)=3x2.f_X(x) = \int_0^x \frac{3}{2}(x+2y)\,dy = \frac{3}{2}\Big[xy + y^2\Big]_0^x = \frac{3}{2}(x^2+x^2) = 3x^2.

So fX(x)=3x2f_X(x) = 3x^2 for 0<x<10<x<1 and 00 otherwise. Check normalization:

∫013x2 dx=[x3]01=1.✓\int_0^1 3x^2\,dx = \big[x^3\big]_0^1 = 1. \checkmark

Step 3: marginal density of YY. Here care is needed because the range of xx given yy is (y,1)(y,1) (since we need y<x<1y<x<1), which is the more delicate direction of this asymmetric region. For 0<y<10<y<1:

fY(y)=∫y132(x+2y) dx=32[x22+2yx]x=yx=1=32((12+2y)−(y22+2y2)).f_Y(y) = \int_y^1 \frac{3}{2}(x+2y)\,dx = \frac{3}{2}\left[\frac{x^2}{2} + 2yx\right]_{x=y}^{x=1} = \frac{3}{2}\left(\Big(\tfrac12 + 2y\Big) - \Big(\tfrac{y^2}{2}+2y^2\Big)\right).

Simplify inside the parentheses:

12+2y−y22−2y2=12+2y−5y22.\tfrac12 + 2y - \tfrac{y^2}{2} - 2y^2 = \tfrac12 + 2y - \tfrac{5y^2}{2}.

Hence

fY(y)=32(12+2y−5y22)=34+3y−15y24,0<y<1.f_Y(y) = \frac{3}{2}\left(\frac12 + 2y - \frac{5y^2}{2}\right) = \frac{3}{4} + 3y - \frac{15y^2}{4}, \qquad 0<y<1.

Check normalization:

∫01(34+3y−154y2)dy=34+32−1512=34+32−54.\int_0^1 \left(\frac34 + 3y - \frac{15}{4}y^2\right) dy = \frac34 + \frac32 - \frac{15}{12} = \frac34+\frac32-\frac54.

Convert to quarters: 34+64−54=3+6−54=44=1\frac34 + \frac64 - \frac54 = \frac{3+6-5}{4} = \frac{4}{4} = 1. ✓ This example shows the mechanics in a genuinely asymmetric region: the two marginals (3x23x^2 versus a quadratic-in-yy with three terms) look nothing alike, correctly reflecting the asymmetric shape of the support triangle, and both integrate correctly to 11 exactly as Theorem: Marginals are valid probability distributions guarantees.

CounterexampleMarginals do not determine the joint distribution

The theorem shows a joint pmf/density always produces valid marginals. It says nothing about the converse — and the converse is false: infinitely many different joint distributions can share the same pair of marginals. This shows why "knowing both marginals" is not a hypothesis that can be added to reconstruct the joint law; genuinely more information (such as independence, or the full joint density) is required.

Construction. Let XX and YY each be Bernoulli-type variables taking values in {0,1}\{0,1\} with the same marginal distribution pX(0)=pX(1)=12p_X(0)=p_X(1) = \tfrac12 and pY(0)=pY(1)=12p_Y(0) = p_Y(1) = \tfrac12. Joint law A (independence). Take X,YX,Y independent, so

pX,YA(x,y)=pX(x)pY(y)=14for all (x,y)∈{0,1}2.p^A_{X,Y}(x,y) = p_X(x)p_Y(y) = \tfrac14 \quad \text{for all } (x,y)\in\{0,1\}^2.

Joint law B (perfect agreement). Take Y=XY = X always, so

pX,YB(x,y)={12x=y0x≠y.p^B_{X,Y}(x,y) = \begin{cases} \tfrac12 & x=y \\ 0 & x \ne y.\end{cases}

Both have the stated marginals. For law A: ∑ypX,YA(0,y)=14+14=12=pX(0)\sum_y p^A_{X,Y}(0,y) = \tfrac14+\tfrac14=\tfrac12 = p_X(0), and similarly all four marginal checks pass by symmetry. For law B: ∑ypX,YB(0,y)=pX,YB(0,0)+pX,YB(0,1)=12+0=12=pX(0)\sum_y p^B_{X,Y}(0,y) = p^B_{X,Y}(0,0)+p^B_{X,Y}(0,1) = \tfrac12+0=\tfrac12=p_X(0), and again symmetric checks confirm pX=pY=(12,12)p_X = p_Y = (\tfrac12,\tfrac12) exactly as in law A.

But the joint laws are different, and detectably so. Under law A, P(X=0,Y=0)=14P(X=0,Y=0)=\tfrac14; under law B, P(X=0,Y=0)=12P(X=0,Y=0)=\tfrac12. These joint probabilities differ, so laws A and B are genuinely different probability distributions on {0,1}2\{0,1\}^2 — yet marginalizing either one produces the identical pair of marginal pmfs.

Diagnosis. The hypothesis that fails here is not one of the theorem's hypotheses (both A and B are perfectly valid joint pmfs, so the forward direction — joint gives valid marginals — holds for both, exactly as proved). What fails is an implicit assumption a careless reader might smuggle in: that specifying the marginals is enough to pin down the joint. The theorem never claims this, and this example shows explicitly why it cannot: the "shadow" operation of marginalizing is many-to-one, discarding the dependence structure between XX and YY. Recovering that structure is exactly the job of Conditional Distributions and, in summary form, of the covariance between XX and YY.

Scope, edge cases & common traps

SituationWhat to doCommon mistake
Discrete joint pmfSum pX,Y(x,y)p_{X,Y}(x,y) over yy in the range of YY for fixed xxSumming over a fixed range instead of the actual support, missing or double-counting values
Continuous joint density, rectangular supportIntegrate over the fixed interval for yyUsing constant limits when the support is not a rectangle
Continuous joint density, non-rectangular support (e.g. triangle)Integrate over yy-limits that depend on xx (or vice versa)Forgetting the limits of integration depend on the other variable, integrating over the wrong region
Mixed discrete/continuous vectorSum over discrete coordinates, integrate over continuous onesTreating a discrete coordinate as continuous (or vice versa) and misapplying ∫\int vs. ∑\sum
Wanting to reconstruct joint from marginalsNot possible in general — need joint pmf/density or an independence assumptionAssuming marginals plus "reasonable" combination rules recover the joint (see counterexample)
Checking your answerVerify the marginal sums/integrates to exactly 11Skipping the normalization check, missing an arithmetic slip in the joint density's normalizing constant

The mathematician behind it

Origins · 1 minAndrey Nikolaevich Kolmogorov and how this was discovered
AN
Andrey Nikolaevich Kolmogorov
1903–1987 · Soviet mathematician, founder of modern axiomatic probability theory

Kolmogorov's 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung placed probability on a rigorous measure-theoretic foundation, defining random variables as measurable functions and joint distributions as measures on product spaces. This framework is exactly what makes statements like "the marginal is obtained by integrating out the other variable" precise and provable via Tonelli/Fubini-type theorems, rather than merely a computational recipe. The terminology "marginal," however, predates Kolmogorov by decades and traces to the practical habit — common among actuaries and early statisticians tabulating joint frequency counts — of writing row and column sums in the margins of two-way tables.

History
- 1885 — Francis Galton studies joint tables of parent and offspring heights, an early practical use of row/column ("marginal") totals in bivariate data.
- 1900s — Karl Pearson and collaborators formalize bivariate frequency tables and correlation, relying routinely on marginal totals.
- 1933 — Kolmogorov's axiomatization gives joint distributions and their marginals a rigorous measure-theoretic meaning via product measures and their projections.
- 1930s–1950s — Fubini's (1907) and Tonelli's (1909) theorems on iterated integration, originally developed in real analysis, become the standard justification for interchanging sums/integrals when computing marginal densities.
- Present — marginalization is a foundational operation across statistics, Bayesian inference, and machine learning, generalized to marginalizing over latent variables in complex models.
Why is it called a "marginal" distribution?

The name is historical, not mathematical. Early statisticians tabulating two-way frequency data (for example, counts of people cross-classified by height and weight categories) would write the row totals and column totals in the margins of the printed table. Each such margin total, divided by the overall sample size, approximates exactly the distribution of one variable alone — literally the number written in the margin of the page. The term stuck even after probability theory became fully rigorous and the operation was reinterpreted as an integral or sum rather than a literal tally in a table's border.

Can I get the marginal of XX without knowing the full joint distribution?

No — in general the marginal of XX is a genuine consequence of the joint distribution, and there is no shortcut that bypasses it unless you already know something extra, such as independence. If XX and YY are independent, then trivially pX(x)=P(X=x)p_X(x) = P(X=x) can be computed by treating XX in isolation, ignoring YY entirely, since the joint pmf factors as pX,Y(x,y)=pX(x)pY(y)p_{X,Y}(x,y)=p_X(x)p_Y(y) and marginalizing recovers pX(x)p_X(x) automatically. But if you are not told independence holds, you must have (or compute) the actual joint pmf/density and sum/integrate it, exactly as in the definition.

Does marginalizing always work, or are there joint distributions with no valid marginal?

For any legitimate joint pmf (nonnegative, summing to 1 over a countable support) or joint density (nonnegative, integrating to 1 over the plane), the marginal always exists and is itself a valid pmf or density — this is exactly the content of the theorem proved above, using countable additivity in the discrete case and Tonelli's theorem in the continuous case. The only subtlety in the continuous case is that the marginal density is only guaranteed to be finite for almost every xx, not literally every xx, though this technicality almost never causes trouble in standard examples with continuous, well-behaved joint densities.

If I know the marginal of XX and the marginal of YY, can I recover the joint distribution?

Not in general — this is exactly the point of the counterexample above, where two very different joint pmfs (independent versus perfectly dependent) share identical marginals for XX and for YY. The only case where the marginals suffice is if you are additionally told XX and YY are independent, in which case the joint pmf/density is forced to be the product of the marginals: pX,Y(x,y)=pX(x)pY(y)p_{X,Y}(x,y)=p_X(x)p_Y(y). Without an independence assumption (or the full joint law itself), the marginals alone leave the dependence structure between XX and YY completely unconstrained.

How does marginalizing extend to three or more variables?

Exactly the same way: to find the marginal distribution of a sub-collection of coordinates from a joint pmf or density on nn variables, sum (discrete) or integrate (continuous) the joint pmf/density over every coordinate not in that sub-collection, letting each summed-out coordinate range over its entire support. For instance from a joint density fX,Y,Z(x,y,z)f_{X,Y,Z}(x,y,z), the marginal density of the pair (X,Y)(X,Y) is fX,Y(x,y)=∫−∞∞fX,Y,Z(x,y,z) dzf_{X,Y}(x,y) = \int_{-\infty}^\infty f_{X,Y,Z}(x,y,z)\,dz, and you can then further marginalize this bivariate density down to fX(x)f_X(x) by integrating out yy as well. Tonelli's theorem, which underlies the proof, places no restriction on dimension, so the same justification carries over unchanged.

What is the connection between marginal distributions and conditional distributions?

Marginal and conditional distributions are the two natural "views" you can take of a joint distribution: the marginal ignores the other variable entirely, while the conditional distribution restricts attention to a specific value (or event) of the other variable and renormalizes. Formally, the conditional pmf is pY∣X(y∣x)=pX,Y(x,y)/pX(x)p_{Y\mid X}(y\mid x) = p_{X,Y}(x,y)/p_X(x), which requires the marginal pX(x)p_X(x) in the denominator to even be defined — so marginals are a logical prerequisite for Conditional Distributions, not a competing concept. Averaging the conditional distribution of YY given X=xX=x over the marginal distribution of XX recovers the marginal distribution of YY, a fact known as the law of total probability in distributional form.

Why do we need Tonelli's or Fubini's theorem at all — isn't integrating out a variable "obviously" fine?

It feels obvious, but interchanging an infinite sum or an integral with another integral is a genuinely delicate operation in general — there exist non-negative or signed functions of two variables where iterated integrals in different orders give different answers, or where one order diverges while the other converges. Tonelli's theorem is precisely what guarantees that for nonnegative functions (which joint pmfs and densities always are), no such pathology can occur, and any order of summation/integration gives the same, correctly-defined marginal. Without invoking it explicitly, "obviously" is doing hidden work that the proof makes rigorous.

Before this

Where this leads