Computing via
Conditioning
Master the art of computing expectations and variances by conditioning on auxiliary random variables: the tower property and the Eve's law decomposition.
What Is Conditioning?
In probability, conditioning means restricting our probability space to a particular event or value of a random variable. When we condition on \(Y\), we treat \(Y\) as if it were known, compute a quantity as a function of \(Y\), and then average over all possible values of \(Y\).
\(E[X \mid Y]\) as a Random Variable
When we write \(E[X \mid Y]\), we do not get a single number: we get a function of \(Y\). For each possible value \(y\) of \(Y\), we have the number \(E[X \mid Y = y]\). Since \(Y\) is random, \(E[X \mid Y] = g(Y)\) is itself a random variable.
Why Conditioning Matters
Many real-world problems involve mixture models, random sample sizes, or multi-stage experiments where direct computation of \(E[X]\) or \(\text{Var}(X)\) is intractable. Conditioning provides a systematic decomposition strategy.
The Tower Property
Discrete form: If \(Y\) takes values \(y_1, y_2, \ldots\), then $$ E[X] = \sum_{i} E[X \mid Y = y_i]\, P(Y = y_i). $$ Continuous form: If \(Y\) has density \(f_Y\), then $$ E[X] = \int_{-\infty}^{\infty} E[X \mid Y = y]\, f_Y(y)\, dy. $$
Eve's Law: Total Variance
Variance Decomposition Diagram
Adam's vs Eve's Law
| Adam's Law | Eve's Law | |
|---|---|---|
| Computes | \(E[X]\) | \(\text{Var}(X)\) |
| Formula | \(E[E[X \mid Y]]\) | \(E[\text{Var}(X \mid Y)] + \text{Var}(E[X \mid Y])\) |
| Number of terms | 1 | 2 |
| Mnemonic | Iterated expectation | EVVE: E of Var + Var of E |
| Key insight | Average the conditional means | Partition total variability |
How to Apply Conditioning
Example 1: Random Sum
Let \(N \sim \text{Pois}(\lambda)\) and let \(X_1, X_2, \ldots\) be i.i.d. with mean \(\mu\) and variance \(\sigma^2\), independent of \(N\). Define \(T = \sum_{i=1}^{N} X_i\). Find \(E[T]\).
Example 1: Variance of \(T\)
We continue with \(T = \sum_{i=1}^{N} X_i\) where \(N \sim \text{Pois}(\lambda)\). Find \(\text{Var}(T)\) using Eve's Law.
Example 2: Mixture of Normals
Let \(Y \sim N(0, 1)\), and given \(Y = y\), let \(X \mid Y \sim N(y, 1)\). Find \(E[X]\) and \(\text{Var}(X)\).
Example 3: First-Step Analysis
A gambler flips a fair coin until the first Head. Let \(X\) be the number of flips. Use conditioning on the first flip to find \(E[X]\).
Choosing \(Y\) Wisely
The power of conditioning hinges on choosing the right variable to condition on. A good choice makes the conditional distribution of \(X\) a known, named distribution.
Common Mistakes
Summary of Key Formulas
| Formula | Statement | Mnemonic |
|---|---|---|
| Total Expectation | \(E[X] = E[E[X \mid Y]]\) | Adam's Law |
| Total Variance | \(\text{Var}(X) = E[\text{Var}(X \mid Y)] + \text{Var}(E[X \mid Y])\) | Eve's Law (EVVE) |
| Random Sum Mean | \(E\![\sum_{i=1}^N X_i] = E[N] \cdot E[X_1]\) | Wald's identity |
| Random Sum Var | \(E[N]\sigma^2 + \mu^2 \text{Var}(N)\) | EVVE on random sum |
Question 1 of 5
By the Law of Total Expectation, \(E[X] = E\![E[X \mid Y]]\). What is the nature of \(E[X \mid Y]\)?
Question 2 of 5
Let \(N \sim \text{Pois}(5)\), and \(X_1, X_2, \ldots\) i.i.d. with \(E[X_i] = 3\), independent of \(N\). What is \(E\![\sum_{i=1}^N X_i]\)?
Question 3 of 5
In Eve's Law, the term \(\text{Var}\!(E[X \mid Y])\) captures which component of total variability?
Question 4 of 5
Let \(Y \sim N(0,1)\) and \(X \mid Y \sim N(Y, 4)\). What is \(\text{Var}(X)\)?
Question 5 of 5
A fair coin is flipped repeatedly. Let \(X\) be the number of flips to get the first Head. Conditioning on the first flip outcome, which equation correctly determines \(E[X]\)?