Skip to content

Continuous Law of Total Probability

Theorem

For continuous random variables XX and YY for which the conditional density fX∣Yf_{X\mid Y} exists,

fX(x)=∫fX∣Y(x∣y) fY(y) dy\begin{aligned} f_X(x)=\int f_{X\mid Y}(x\mid y)\,f_Y(y)\,\mathrm{d}y \end{aligned}

for every xx except possibly on a set of zero length, for example at finitely many points.

The left side is the Marginal Probability Density Function of the response. It is recovered by averaging the conditional densities over the other variable’s marginal law.


Interpretation

The continuous law of total probability describes a two-stage model: first YY is drawn, then XX is drawn from the conditional density fX∣Y(⋅∣y)f_{X\mid Y}(\cdot\mid y). The unconditional density of XX is then a weighted mixture of the conditional densities, with the density of YY as the weight.

Uniform conditional densities of X given Y = 1/4, 1/2, 3/4 and 1, drawn as rectangles of decreasing height, and the mixed marginal density 2(1 - x) obtained by averaging them.

For X∣Y=y∼Unif⁡(0,y)X\mid Y=y\sim\operatorname{Unif}(0,y), each conditional density is a rectangle of height 1/y1/y on (0,y)(0,y): heights 44, 22, 4/34/3 and 11 for y=1/4,1/2,3/4,1y=1/4,1/2,3/4,1. A point xx lies under the rectangles with y>xy>x only, so with fY(y)=2yf_Y(y)=2y on (0,1)(0,1) the average is fX(x)=∫x1(1/y)2y dy=2(1−x)f_X(x)=\int_x^1(1/y)2y\,\mathrm{d}y=2(1-x) for 0<x<10<x<1. Values near 11 lie under few rectangles, so the red marginal decreases.

Cut the range of YY into mm slices: each contributes fX∣Y(x∣yj)fY(yj)Δyf_{X\mid Y}(x\mid y_j)f_Y(y_j)\Delta y. Raise mm and the sum becomes fXf_X.

The formula is the law of total probability P(A)=∑iP(A∣Bi)P(Bi)\displaystyle \mathbb{P}(A)=\sum_i\mathbb{P}(A\mid B_i)\mathbb{P}(B_i) with the cases BiB_i replaced by the values yy, the sum by an integral and P(Bi)\mathbb{P}(B_i) by fY(y) dyf_Y(y)\,\mathrm{d}y; the slider above shows exactly this limit of sums. Since fX∣Y(x∣y)fY(y)=fX,Y(x,y)f_{X\mid Y}(x\mid y)f_Y(y)=f_{X,Y}(x,y), it is also the computation of a marginal density from the joint density.

The same integral is the normalizing denominator in the continuous Bayes rule, and the same averaging applied to means returns as Adam’s law.

The integration range is easy to get wrong: fX∣Y(x∣y)f_{X\mid Y}(x\mid y) is zero unless y>xy>x, so the integral runs from xx to 11. Integrating over all of (0,1)(0,1) would give the constant 22, which integrates to 22 rather than 11; checking that the result integrates to one catches such errors.


Key Results

  • The event form is P(X∈A)=∫P(X∈A∣Y=y)fY(y) dy\mathbb{P}(X\in A)=\int\mathbb{P}(X\in A\mid Y=y)f_Y(y)\,\mathrm{d}y.
  • Integrating the conditional density mixture over xx gives total probability one.

Examples

  • For density 22 on 0<x<y<10<x<y<1, fX(x)=∫x1(1/y)(2y) dy=2(1−x)f_X(x)=\int_x^1(1/y)(2y)\,\mathrm{d}y=2(1-x) for 0<x<10<x<1.
  • If Y∼Unif⁡(0,1)Y\sim\operatorname{Unif}(0,1) and X∣Y=y∼Bern⁡(y)X\mid Y=y\sim\operatorname{Bern}(y), then P(X=1)=∫01y dy=1/2\mathbb{P}(X=1)=\int_0^1y\,\mathrm{d}y=1/2, using the event form.

Prerequisites

Sources

Aliases: continuous LOTP Symbols: delta, element of, integral, sum

Last updated: 20 October 2026 03:02