Conditional Expectations
Last modified — 02 Dec 2026
By the end of this lecture, students are anticipated to be able to:
Calculate conditional expectations from discrete and continuous distributions
Use the laws of total expectation to calculate expectations of hierarchical models
If \(X\) and \(Y\) are two random variables, then the conditional expectation of \(X\) given \(Y = y\) is \[\begin{aligned} \mathbb{E}\left[ X | Y= y \right] &= \int_{-\infty }^{\infty } x f_{X|Y}\left( x | y \right) \mathsf{d}x, & \mathbb{E}\left[ X | Y= y \right] &= \sum_{x} x p_{X|Y}(x|y). \end{aligned}\]
Let \(X\) and \(Y\) be random variables with joint density \(f(x, y) = 2\) for \(0 < x < 1, 0 < y < x\). What is the conditional expectation of \(Y\) given \(X\)?
If \(X\) and \(Y\) are two random variables, then the conditional variance of \(X\) given \(Y = y\) is \[\begin{aligned} \operatorname{Var}(X | Y = y ) &= \int_{-\infty }^{\infty } ( x - \mathbb{E}[X|Y=y] ) ^{2}f_{X|Y}\left( x|y \right) \mathsf{d}x,\\ \operatorname{Var}(X | Y = y ) &= \sum_{x} ( x - \mathbb{E}[X|Y=y] ) ^{2}p_{X|Y}(x|y). \end{aligned}\]
Let \(X\) and \(Y\) be random variables with joint density \(f(x, y) = 2\) for \(0 < x < 1, 0 < y < x\). What is the conditional variance of \(Y\) given \(X\)?
Sometimes we are directly given information about the conditional distribution. If this is a “known” distribution, we can just use the properties of that distribution.
What are \(\mathbb{E}[Y|\Theta]\) and \(\operatorname{Var}(Y|\Theta)\)?
Because the conditional expectation follows \({\mathrm{Binom}}(n, \Theta)\), we know:
Important
Quick knowledge check. Are conditional expectations and variances random variables?
But there are some additional properties as well because \(\mathbb{E}[X|Y]\) and \(\operatorname{Var}[X|Y]\) are themselves random variables, and have their own distributions.
Consider again \(Y | \Theta \sim {\mathrm{Binom}}(n, \Theta)\) and \(\Theta \sim {\mathrm{Unif}}(0, 1)\)
This general set up is referred to as a hierarchical model.
Find the distribution of \(W = \mathbb{E}[X|\Lambda]\) and \(\mathbb{E}[W]\).
Let \(X\) and \(Y\) be two random variables. Then \(\mathbb{E}[X] = \mathbb{E}[\mathbb{E}[X|Y]]\)
You can prove this result in the discrete or continuous cases by starting with the definition of the conditional expectation.
We also have:
Let \(X\) and \(Y\) be two random variables. Then, \(\operatorname{Var}(X) = \mathbb{E}[\operatorname{Var}(X|Y)] + \operatorname{Var}(\mathbb{E}[X|Y]).\)
This shows that the variance of \(X\) can be decomposed into two parts: the expected value of the conditional variance of \(X\) given \(Y\), and the variance of the conditional expectation of \(X\) given \(Y\).
Recall the previous exercise where
We technically applied the tower property without knowing it!
\[ \begin{aligned} \mathbb{E}[W] &= \mathbb{E}[\mathbb{E}[X \ \vert\ \Lambda]]\\ &= \mathbb{E}\left[\frac{1}{1/\Lambda}\right] \text{ since } X \ \vert\ \Lambda \sim {\mathrm{Exp}}(1/\lambda) \\ &=\mathbb{E}\left[\Lambda\right]\\ &=\frac{1}{2} \text{ since } \Lambda \sim Gam(1,2) \end{aligned} \] Same result!
Let \(X\) and \(U\) be random variables such that \(U \sim {\mathrm{Unif}}(0. 1)\), and \(\mathbb{E}[X\ \vert\ U] = 3U^2\). Find \(\mathbb{E}[X]\).
You may have:
HANDWRITTEN Cheat Sheet
Non-graphing, non-programmable calculator
Writing materials
Phones and laptops put away, please! You can have 20 minutes.
Stat 302 - Winter 2025/26