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

pYX(yx)=P(Y=yX=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, pYX(yx)p_{Y|X}(y \mid x) is a valid PMF:

  • pYX(yx)0p_{Y|X}(y \mid x) \geq 0
  • ypYX(yx)=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 pXS(x7)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}

pXS(x7)=P(X=xS=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

fYX(yx)=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

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

Example

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

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

fYX(yx)=2exe2yex=2e2yf_{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[YX=x]=yypYX(yx)(discrete)E[Y \mid X = x] = \sum_y y \cdot p_{Y|X}(y \mid x) \quad \text{(discrete)}

E[YX=x]=yfYX(yx)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[YX=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[YX]]E[Y] = E[E[Y \mid X]]

More explicitly:

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

E[Y]=E[YX=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

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

Find E[Y]E[Y].

By law of total expectation:

E[Y]=E[E[YX]]=E[Xp]=pE[X]=pλE[Y] = E[E[Y \mid X]] = E[X \cdot p] = p E[X] = p \lambda

Conditional Variance

Var(YX=x)=E[Y2X=x](E[YX=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]]$