ProbabilityJoint Distributions

Marginal and Conditional Densities

f_X(x) = ∫ f(x, y) dy, and X and Y are independent when f(x, y) = f_X(x) f_Y(y) everywhere.

Not started Jump to practice

From a joint density we can recover the density of each variable alone and the density of one given the other, just as rows and columns did for joint tables. Sums become integrals.

Key idea

$$f_X(x) = \int f(x, y)\,dy, \qquad f_{Y \mid X}(y \mid x) = \frac{f(x, y)}{f_X(x)},$$ integrating over the values of $y$ where $f(x, y) > 0$ for that $x$. $X$ and $Y$ are independent when $f(x, y) = f_X(x)\,f_Y(y)$ everywhere, which needs a support that is a rectangle.

Why it works

$$P(a \le X \le b) = \int_{a}^{b}\left(\int f(x, y)\,dy\right)dx$$ so the inner integral is the density of $X$: integrate out $y$. Dividing a slice $f(x, \cdot)$ by its total $f_X(x)$ makes it a density in $y$, the conditional density. If the support is not a rectangle, some pairs $(x, y)$ are impossible although $x$ and $y$ are each possible alone; there $f(x, y) = 0$ while $f_X(x)f_Y(y) > 0$, so independence fails.
The density 2 on the triangle where x is below y. Each vertical slice runs from y equal to x up to 1, so its total, the marginal density of X, shrinks as x grows.

Worked examples

Worked example: A constant on a triangle

$f(x, y) = 2$ for $0 \le x \le y \le 1$. Find $f_X$, $f_Y$ and $f_{Y \mid X}(y \mid x)$.
  1. For fixed $x$, $y$ runs from $x$ to 1: $f_X(x) = \int_{x}^{1} 2\,dy = 2(1 - x)$ on $[0, 1]$.
  2. For fixed $y$, $x$ runs from 0 to $y$: $f_Y(y) = \int_{0}^{y} 2\,dx = 2y$.
  3. $f_{Y \mid X}(y \mid x) = \frac{2}{2(1 - x)} = \frac{1}{1 - x}$ for $x \le y \le 1$: given $X = x$, $Y$ is uniform on $[x, 1]$.

Answer: $2(1 - x)$, $2y$, and uniform on $[x, 1]$.

Worked example: A sum on the square

$f(x, y) = x + y$ on the unit square. Find $f_X$ and decide whether $X$ and $Y$ are independent.
  1. $f_X(x) = \int_{0}^{1}(x + y)\,dy = x + \frac{1}{2}$; by symmetry $f_Y(y) = y + \frac{1}{2}$.
  2. $$f_X(x)f_Y(y) = xy + \frac{x + y}{2} + \frac{1}{4} \ne x + y$$ (try $x = y = 0$: $\frac{1}{4} \ne 0$).

Answer: $f_X(x) = x + \frac{1}{2}$; dependent.

Worked example: A product that is not independent

$f(x, y) = 8xy$ for $0 \le x \le y \le 1$. Are $X$ and $Y$ independent?
  1. The formula is a product, but the support is a triangle.
  2. $f_X(x) = \int_{x}^{1} 8xy\,dy = 4x(1 - x^{2})$ and $f_Y(y) = \int_{0}^{y} 8xy\,dx = 4y^{3}$; their product is not $8xy$.
  3. Directly: $f(0.9, 0.5) = 0$ although $f_X(0.9) > 0$ and $f_Y(0.5) > 0$.

Answer: No.

Common mistake

Calling $f(x, y) = 2$ on the triangle $0 < x < y < 1$ "a product of separate functions" because it is constant. The support is not a rectangle, so knowing $X$ limits $Y$ (if $X = 0.9$ then $Y \ge 0.9$). Check two things: the formula splits as (a function of $x$) × (a function of $y$), and the support is a rectangle.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • MIT OpenCourseWare 18.05, Introduction to Probability and Statistics (Spring 2014), readings on marginal and conditional densities, independence
  • Grinstead and Snell, Introduction to Probability (2nd revised edition, American Mathematical Society; free from Dartmouth College), chapter 4 (Conditional Probability), section 4.2
@teddyrookbook GitHub