MATH 5010 • Section 6

Conditional Distributions

An interactive lesson on conditional PMFs, conditional PDFs, conditional expectation, the laws of total expectation and total variance, and simulation-based intuition.

Concept map

What is a conditional distribution?

A conditional distribution updates the distribution of one random variable after we learn information about another. The guiding question is: after we know $Y=y$, how is $X$ distributed?

Discrete:
$p_{X|Y}(x|y)=P(X=x\mid Y=y)$.
Continuous:
$f_{X|Y}(x|y)=f_{X,Y}(x,y)/f_Y(y)$.
Expectation:
$E[X]=E(E[X\mid Y])$.
$$\boxed{p_{X|Y}(x|y)=\frac{p_{X,Y}(x,y)}{p_Y(y)}}\qquad\boxed{f_{X|Y}(x|y)=\frac{f_{X,Y}(x,y)}{f_Y(y)}}$$ $$\boxed{E[X]=E(E[X\mid Y])},\qquad \boxed{\operatorname{Var}(X)=E[\operatorname{Var}(X\mid Y)]+\operatorname{Var}(E[X\mid Y])}.$$
Interactive 1

Conditional PMF from a joint probability table

Edit the joint table below. The page normalizes the entries to form a joint PMF, then computes marginals and a conditional distribution such as $P(X=x\mid Y=y)$.

$Y=0$$Y=1$$Y=2$

Blue bars show the marginal distribution of $X$; green bars show the conditional distribution of $X$ after observing the selected value of $Y$.

$$P(X=x\mid Y=y)=\frac{P(X=x,Y=y)}{P(Y=y)}.$$
Interactive 2

Continuous conditional density on a triangle

Let $(X,Y)$ be uniformly distributed on the triangle $0

$$f_X(x)=\int_0^x 2\,dy=2x,\qquad 0

The vertical slice at the selected $x$ is the conditional support for $Y\mid X=x$.

Interactive 3

Random success probability: $S\mid U=u\sim \operatorname{Bin}(n,u)$

This example shows why conditional expectation and conditional variance are powerful. First choose a hidden random probability $U\sim\operatorname{Uniform}(0,1)$, then run $n$ Bernoulli trials with success probability $U$.

$$E[S\mid U]=nU,\qquad \operatorname{Var}(S\mid U)=nU(1-U).$$ $$E[S]=E[nU]=\frac n2.$$ $$\operatorname{Var}(S)=E[nU(1-U)]+\operatorname{Var}(nU)=\frac n6+\frac{n^2}{12}.$$

The unconditional distribution of $S$ is much more spread out than a single binomial distribution with fixed $p=1/2$.

Interactive 4

Conditional distribution in the bivariate normal model

Suppose $(X,Y)$ is standard bivariate normal with correlation $\rho$. Then the conditional distribution of $Y$ given $X=x$ is normal.

$$Y\mid X=x\sim N\left(\rho x,\,1-\rho^2\right).$$

Learning $X=x$ shifts the conditional mean and reduces uncertainty when $|\rho|$ is large.

The curve is the conditional density of $Y\mid X=x$.

Interactive 5

Conditional expectation in stick breaking

Start with a stick of length 1, break it uniformly, and keep the longer piece $L_1$. If $L_1=\ell$, breaking again and keeping the longer piece gives $L_2=\ell M$, where $M$ has the same distribution as the longer piece from a unit stick.

$$E[M]=\frac34,\qquad \operatorname{Var}(M)=\frac1{48}.$$ $$E[L_2\mid L_1=\ell]=\frac34\ell,\qquad \operatorname{Var}(L_2\mid L_1=\ell)=\frac{\ell^2}{48}.$$

The histogram is a simulation of $L_2\mid L_1=\ell$; it is uniform on $[\ell/2,\ell]$.

Practice

Quick checks

1. Conditional PMF

If $P(X=1,Y=2)=0.12$ and $P(Y=2)=0.30$, what is $P(X=1\mid Y=2)$?

2. Total expectation

If $E[X\mid Y]=2Y+1$ and $E[Y]=3$, what is $E[X]$?

Teaching notes

Suggested order: start with the discrete table, emphasize normalization by the marginal; then show continuous slicing; then connect to conditional expectation and variance through the random-$U$ binomial and stick-breaking examples.