Tutorials › Probability Theory (Graduate) › Marginal Densities by Integrating Joint Densities

Product Measures and Fubini · Tutorial 200 of 946

Marginal Densities by Integrating Joint Densities

Learn how integrating a joint density along coordinate sections produces marginal densities, and how to compute those integrals on several types of support.

Intermediate 9 min read

What You'll Learn

  • State the marginal-density formulas for a random vector with a joint density
  • Derive those formulas from Tonelli’s theorem
  • Compute marginals by integrating over the support sections
  • Work out rectangular, bounded triangular, and unbounded-support examples
  • Explain why marginal densities are determined only up to null sets
  • Recognize when a joint law does not have a density with respect to planar Lebesgue measure

From a Joint Density to Marginal Densities

A joint density describes how probability is distributed across pairs of coordinates. To find the distribution of one coordinate alone, we must account for all possible values of the other coordinate. For a joint density, this amounts to integrating along a section parallel to the other coordinate’s axis.

The justification is Tonelli’s theorem: because a density is nonnegative, we can integrate it over a strip in the plane by first integrating along its sections. This works even before we know that the section integrals are finite at every point.

Definition: Let \((X,Y)\) be a random vector with values in \(\mathbb{R}^2\). A joint density of \((X,Y)\) is a nonnegative, product-measurable function \(f:\mathbb{R}^2\to[0,\infty]\) such that, for every Borel set \(C\subseteq\mathbb{R}^2\), $$ \mathbb{P}((X,Y)\in C)=\int_C f(x,y)\,d(x,y). $$ In particular, \(\int_{\mathbb{R}^2} f(x,y)\,d(x,y)=1\). Here \(d(x,y)\) denotes integration with respect to two-dimensional Lebesgue measure.

The marginal density of \(X\) is obtained by integrating over the \(y\)-coordinate; the marginal density of \(Y\) is obtained by integrating over the \(x\)-coordinate. These formulas are understood as functions defined almost everywhere, since an integrable density can have exceptional values on a set of measure zero.

Theorem: If \((X,Y)\) has joint density \(f\), then versions of the marginal densities of \(X\) and \(Y\) are $$ f_X(x)=\int_{\mathbb{R}} f(x,y)\,dy, \qquad f_Y(y)=\int_{\mathbb{R}} f(x,y)\,dx. $$ The section integrals are measurable, may take the value \(+\infty\) on a null set, and each integrates to \(1\).
Proof. Define \(f_X(x)=\int_{\mathbb{R}}f(x,y)\,dy\). Tonelli’s theorem gives measurability of this section integral and, for any Borel set \(A\subseteq\mathbb{R}\),

\[ \int_A f_X(x)\,dx =\int_{\mathbb{R}}\int_{\mathbb{R}} \mathbf{1}_A(x)f(x,y)\,dy\,dx =\int_{A\times\mathbb{R}}f(x,y)\,d(x,y). \]

The last integral is \(\mathbb{P}(X\in A)\) by the definition of the joint density. Thus \(f_X\) is a density of \(X\). Taking \(A=\mathbb{R}\) shows that its integral is \(1\), so it is finite almost everywhere. Interchanging the roles of \(x\) and \(y\) proves the formula and claims for \(f_Y\). \(\square\)

Integrating Over the Support

The formulas integrate over the entire real line, but a density often vanishes outside a specified support \(S\subseteq\mathbb{R}^2\). For a fixed \(x\), the relevant part of the support is the section \[ S_x=\{y\in\mathbb{R}:(x,y)\in S\}. \] Thus \(f_X(x)\) can be computed by integrating \(f(x,y)\) over \(S_x\). The corresponding section for \(Y\) is \(S^y=\{x:(x,y)\in S\}\).

These sections may have different shapes at different coordinate values. On a rectangle, their endpoints are constant. On a triangle, an endpoint typically depends on the coordinate being held fixed. On an unbounded support, the integral may extend to infinity. The formula remains the same; what changes is the range of the section integral.

Worked Example: A Rectangular Support

Suppose \(a,b>0\) and \[ f(x,y)=\frac{1}{ab}\mathbf{1}_{(0,a)\times(0,b)}(x,y). \] This is a joint density because \[ \int_{\mathbb{R}^2}f(x,y)\,d(x,y) =\int_0^a\int_0^b\frac{1}{ab}\,dy\,dx =\int_0^a\frac{1}{a}\,dx=1. \]

For \(0<x<a\), the vertical section of the rectangle has \(0<y<b\), so \[ f_X(x)=\int_0^b\frac{1}{ab}\,dy=\frac{1}{a}. \] Outside this interval, the section contributes zero. Similarly, for \(0<y<b\), \[ f_Y(y)=\int_0^a\frac{1}{ab}\,dx=\frac{1}{b}. \] Consequently \(f_X(x)=a^{-1}\mathbf{1}_{(0,a)}(x)\) and \(f_Y(y)=b^{-1}\mathbf{1}_{(0,b)}(y)\). Their integrals are \(a^{-1}a=1\) and \(b^{-1}b=1\), respectively.

Worked Example: A Bounded Triangular Support

Let \[ f(x,y)=2\mathbf{1}_{\{(x,y):0<y<x<1\}}(x,y). \] The support is the triangle below the diagonal in the unit square. Its total mass is \[ \int_0^1\int_0^x 2\,dy\,dx =\int_0^1 2x\,dx=1, \] so \(f\) is a joint density.

At a fixed \(x\) with \(0<x<1\), the allowed \(y\)-values range from \(0\) to \(x\). Hence \[ f_X(x)=\int_0^x 2\,dy=2x. \] At a fixed \(y\) with \(0<y<1\), the condition \(y<x<1\) gives \(y<x<1\), and therefore \[ f_Y(y)=\int_y^1 2\,dx=2(1-y). \] Both formulas are zero outside \((0,1)\). Checking their total masses gives \[ \int_0^1 2x\,dx=1, \qquad \int_0^1 2(1-y)\,dy=1. \] The changing endpoints are essential: using the full interval \((0,1)\) for every section would ignore the triangular support.

Worked Example: An Unbounded Triangular Support

Consider \[ f(x,y)=e^{-x}\mathbf{1}_{\{(x,y):0<y<x\}}(x,y). \] The support is unbounded, and the density is constant along each vertical section. Its total mass is \[ \int_0^\infty\int_0^x e^{-x}\,dy\,dx =\int_0^\infty xe^{-x}\,dx=1. \] For the last equality, integration by parts gives \(\int_0^\infty xe^{-x}\,dx=[-xe^{-x}]_0^\infty+\int_0^\infty e^{-x}\,dx=1\).

For fixed \(x>0\), the \(y\)-section is \((0,x)\), so \[ f_X(x)=\int_0^x e^{-x}\,dy=xe^{-x}. \] For fixed \(y>0\), the condition \(0<y<x\) requires \(x>y\), giving \[ f_Y(y)=\int_y^\infty e^{-x}\,dx=e^{-y}. \] Each marginal vanishes for nonpositive arguments. Their masses are \[ \int_0^\infty xe^{-x}\,dx=1, \qquad \int_0^\infty e^{-y}\,dy=1, \] as required.

Why the Formulas Are Almost-Everywhere Statements

A density is not specified uniquely at individual points. Changing its values on a set of Lebesgue measure zero does not change any of its integrals, and therefore does not change the probability law it represents. The same issue applies to the marginal densities: they are determined only up to changes on null sets.

In particular, Tonelli’s theorem guarantees that a marginal section integral is finite almost everywhere, not necessarily everywhere. If it equals \(+\infty\) at an exceptional coordinate value, this causes no problem for the density formula because the exceptional set has measure zero. One may redefine the marginal density there, for example by setting it to zero, without changing the law.

Proposition: If two nonnegative integrable functions \(g\) and \(h\) satisfy \(\int_A g=\int_A h\) for every Lebesgue-measurable set \(A\subseteq\mathbb{R}\), then \(g=h\) almost everywhere.
Proof. Since \(g\) and \(h\) are integrable, both are finite almost everywhere. Let \(F=\{x:g(x)<\infty,\ h(x)<\infty\}\), which has full measure, and let \(E=\{x:g(x)>h(x)\}\). If \(E\) has positive measure, then \(E\cap F\) also has positive measure. For \(n\in\mathbb{N}\), define \[ E_n=\{x\in F:g(x)\ge h(x)+1/n,\ |x|\le n\}. \] Every \(x\in E\cap F\) belongs to some \(E_n\): its finite positive difference \(g(x)-h(x)\) exceeds \(1/n\) for some sufficiently large \(n\), and \(n\) can also be chosen with \(n\ge |x|\). Thus \(E\cap F\subseteq\bigcup_{n\in\mathbb{N}}E_n\). If \(E\cap F\) has positive measure, at least one \(E_n\) has positive measure. For that \(n\), \[ \int_{E_n}g-\int_{E_n}h =\int_{E_n}(g-h) \ge \frac{1}{n}\lambda(E_n)>0, \] contradicting the assumed equality of the integrals on every measurable set. Hence \(g\le h\) almost everywhere. Repeating the argument with \(g\) and \(h\) interchanged gives \(h\le g\) almost everywhere, so \(g=h\) almost everywhere. \(\square\)

The restriction to finite values in this argument matters. Extended-real arithmetic at points where both functions equal \(+\infty\) cannot be used to identify a strict inequality. Integrability avoids any difficulty by ensuring that such points form a null set.

What the Marginal Formula Does Not Say

The section-integral formula applies when the joint law has a density with respect to two-dimensional Lebesgue measure. Not every joint law has one. For instance, a random vector concentrated on the diagonal \(\{(x,y):x=y\}\) assigns probability one to a set of planar Lebesgue measure zero, so its law cannot be represented by integrating a density over the plane.

When a joint density does exist, the marginal formulas are a direct and reliable way to obtain the coordinate laws. The main practical task is to describe the support section correctly at each fixed coordinate. In a curved or piecewise-defined region, that section may need to be written as several intervals; in an unbounded region, its endpoint may be infinite. The integrand remains the joint density, and Tonelli justifies the resulting nonnegative section integral.

Key takeaway: To obtain a marginal density, fix the coordinate of interest, integrate the joint density over all allowed values of the other coordinate, and interpret the resulting formula almost everywhere.

Check Your Understanding

Try answering these questions by identifying the appropriate sections and applying the marginal-density formulas.

  1. For a joint density supported on \(0<x<1\), \(0<y<1-x\), what are the \(y\)-integration limits when computing \(f_X(x)\)?
  2. Why does Tonelli’s theorem apply to a joint density without a separate absolute-integrability assumption?
  3. For the unbounded triangular example, why does the \(x\)-section used to compute \(f_Y(y)\) begin at \(y\)?
  4. Can a marginal section integral be infinite at one point and still define a density? Explain.
  5. Why does a probability law concentrated on the diagonal fail to have a joint density with respect to planar Lebesgue measure?
Clinical Biostats