Skip to content
Part IA Easter Term

Conditional Distributions

Motivation

Conditional distributions describe the distribution of one random variable given that another has a specific value. This is fundamental to regression, prediction, and Bayesian inference.

Discrete Case

Conditional PMF

pY∣X(y∣x)=P(Y=y∣X=x)=p(x,y)pX(x)p_{Y|X}(y \mid x) = P(Y = y \mid X = x) = \frac{p(x, y)}{p_X(x)}

provided pX(x)>0p_X(x) > 0.

Properties

For fixed xx with pX(x)>0p_X(x) > 0, pY∣X(y∣x)p_{Y|X}(y \mid x) is a valid PMF:

  • pY∣X(y∣x)≥0p_{Y|X}(y \mid x) \geq 0
  • ∑ypY∣X(y∣x)=∑yp(x,y)pX(x)=pX(x)pX(x)=1\sum_y p_{Y|X}(y \mid x) = \frac{\sum_y p(x,y)}{p_X(x)} = \frac{p_X(x)}{p_X(x)} = 1

Example: Dice Game

Roll two dice: XX = first die, YY = second die. Joint: p(x,y)=136p(x,y) = \frac{1}{36}.

Given X+Y=7X + Y = 7, what is the distribution of XX?

Let S=X+YS = X + Y. We want pX∣S(x∣7)p_{X|S}(x \mid 7).

Possible pairs with sum 7: (1,6),(2,5),(3,4),(4,3),(5,2),(6,1)(1,6), (2,5), (3,4), (4,3), (5,2), (6,1).

P(S=7)=636=16P(S = 7) = \frac{6}{36} = \frac{1}{6}

pX∣S(x∣7)=P(X=x∣S=7)=16 for x=1,…,6p_{X|S}(x \mid 7) = P(X = x \mid S = 7) = \frac{1}{6} \text{ for } x = 1, \ldots, 6

Given the sum is 7, the first die is equally likely to be any value 1 through 6.

Continuous Case

Conditional PDF

fY∣X(y∣x)=f(x,y)fX(x)f_{Y|X}(y \mid x) = \frac{f(x, y)}{f_X(x)}

provided fX(x)>0f_X(x) > 0.

Interpretation

fY∣X(y∣x)f_{Y|X}(y \mid x) gives the density of YY given that XX takes value xx.

Example

f(x,y)=2e−xe−2yf(x, y) = 2e^{-x} e^{-2y} for x,y>0x, y > 0.

We found fX(x)=e−xf_X(x) = e^{-x}.

fY∣X(y∣x)=2e−xe−2ye−x=2e−2yf_{Y|X}(y \mid x) = \frac{2e^{-x} e^{-2y}}{e^{-x}} = 2e^{-2y}

The conditional distribution of YY given X=xX = x is Exp(2)\text{Exp}(2), independent of xx. This confirms XX and YY are independent.

Conditional Expectation

The conditional expectation of YY given X=xX = x:

E[Y∣X=x]=∑yy⋅pY∣X(y∣x)(discrete)E[Y \mid X = x] = \sum_y y \cdot p_{Y|X}(y \mid x) \quad \text{(discrete)}

E[Y∣X=x]=∫y⋅fY∣X(y∣x) dy(continuous)E[Y \mid X = x] = \int y \cdot f_{Y|X}(y \mid x) \, dy \quad \text{(continuous)}

Example

From the example above: E[Y∣X=x]=E[Exp(2)]=12E[Y \mid X = x] = E[\text{Exp}(2)] = \frac{1}{2}.

The conditional expectation is constant (doesn’t depend on xx) when XX and YY are independent.

Law of Total Expectation

E[Y]=E[E[Y∣X]]E[Y] = E[E[Y \mid X]]

More explicitly:

E[Y]=∑xE[Y∣X=x]⋅pX(x)(discrete)E[Y] = \sum_x E[Y \mid X = x] \cdot p_X(x) \quad \text{(discrete)}

E[Y]=∫E[Y∣X=x]⋅fX(x) dx(continuous)E[Y] = \int E[Y \mid X = x] \cdot f_X(x) \, dx \quad \text{(continuous)}

Application

This law lets us compute E[Y]E[Y] by conditioning on XX, often simplifying complex problems.

Example

X∼Pois(λ)X \sim \text{Pois}(\lambda) and given X=nX = n, Y∼Bin(n,p)Y \sim \text{Bin}(n, p).

Find E[Y]E[Y].

By law of total expectation:

E[Y]=E[E[Y∣X]]=E[X⋅p]=pE[X]=pλE[Y] = E[E[Y \mid X]] = E[X \cdot p] = p E[X] = p \lambda

Conditional Variance

Var(Y∣X=x)=E[Y2∣X=x]−(E[Y∣X=x])2\text{Var}(Y \mid X = x) = E[Y^2 \mid X = x] - (E[Y \mid X = x])^2

Summary

ConceptDiscreteContinuous
Conditional PMF/PDFp(x,y)pX(x)\frac{p(x,y)}{p_X(x)}f(x,y)fX(x)\frac{f(x,y)}{f_X(x)}
Conditional expectation$\sum_y y \cdot p_{YX}(y
Law of total expectation$E[E[YX]]$