Quant Memo
Core

Conditional Expectation

The average of one random variable once you know the value of another — a prediction that updates as information arrives. It is a function of what you know, the best possible forecast in a squared-error sense, and the engine behind the tower property.

Prerequisites: Conditional Probability, Expected Value

Conditional expectation is the answer to "given what I now know, what should I expect on average?" Plain Expected Value gives one number for a random quantity before you learn anything. Conditional expectation, written E[YX]E[Y \mid X], gives your updated average for YY once the value of some related variable XX is revealed. It's the mathematical form of learning: new information reshapes your best guess.

The subtle, important part is that E[YX]E[Y \mid X] is itself a random variable, not a single number. For each possible value xx that XX might take, there's a conditional average E[YX=x]E[Y \mid X = x], computed from the conditional distribution of YY given that xx. Collect those averages into a rule and you get a function of XX: feed in whatever XX turned out to be, read off the corresponding expected YY. Once XX is observed the answer becomes a number; before that, it's random because XX is.

E[Y | X = x] x₁ x₂ x₃ Y X →
At each value of X sits a whole conditional distribution of Y (the faint ellipses). The dot in each is its average, and the green line threading through those averages is the conditional expectation E[Y | X = x] — the best forecast of Y as X varies.

The tower property

The most-used fact about conditional expectation is the law of total expectation, also called the tower property. It says that if you average all the conditional averages, weighting each by how likely its condition is, you get back the plain unconditional average:

E[E[YX]]=E[Y].E\big[\,E[Y \mid X]\,\big] = E[Y] .

In words: split the world by the value of XX, take the average of YY inside each slice, then average those slice-averages by their probabilities, and you recover the overall mean. It's a formal version of "condition on something to simplify, then un-condition at the end," and it turns many gnarly expectation problems into a two-step calculation.

E[YX]E[Y \mid X] is a function of XX, hence a random variable, not a number. Its defining identity is the tower property E[E[YX]]=E[Y]E[E[Y \mid X]] = E[Y]: average the conditional means, weighted by their probabilities, and you get the unconditional mean back.

Worked example: total expectation in two steps

A stock's daily return depends on which regime the market is in. In a calm "up" regime, which occurs with probability 0.60.6, the average daily return is +0.5%+0.5\%. In a jittery "down" regime, probability 0.40.4, the average return is 0.3%-0.3\%. What's the overall expected daily return?

Condition on the regime, then apply the tower property:

E[R]=P(up)E[Rup]+P(down)E[Rdown]E[R] = P(\text{up})\,E[R \mid \text{up}] + P(\text{down})\,E[R \mid \text{down}] =(0.6)(0.5%)+(0.4)(0.3%)=0.30%0.12%=0.18%.= (0.6)(0.5\%) + (0.4)(-0.3\%) = 0.30\% - 0.12\% = 0.18\% .

The conditional expectations E[Rup]=0.5%E[R \mid \text{up}] = 0.5\% and E[Rdown]=0.3%E[R \mid \text{down}] = -0.3\% are the two values of the random variable E[Rregime]E[R \mid \text{regime}]; weighting them by the regime probabilities collapses everything to the single unconditional mean 0.18%0.18\%. That two-line move, condition, then average the conditions, is the workhorse pattern.

The best-predictor property

There's a second reason conditional expectation is everywhere: among all possible functions of XX, the conditional mean E[YX]E[Y \mid X] is the one that predicts YY with the smallest average squared error. If you must guess YY from XX and you'll be scored on squared mistakes, you cannot beat E[YX]E[Y \mid X]. This is exactly why regression targets the conditional mean, and, when the variables are jointly Gaussian (see the The Multivariate Normal Distribution), that best predictor happens to be a straight line, which is what makes linear regression the correct model there rather than merely a convenient one.

E[YX]E[Y \mid X] is the minimum-mean-squared-error forecast of YY from XX: no other function of XX predicts YY with smaller average squared error. Regression is just the search for this conditional mean.

Common pitfalls

  • It's a function, not a number. E[YX]E[Y \mid X] varies with XX; only E[YX=x]E[Y \mid X = x], at a specific xx, is a number. Mixing the two up is the classic beginner slip.
  • Mean-independence is weaker than independence. E[YX]=E[Y]E[Y \mid X] = E[Y] says XX doesn't move YY's mean, but XX could still change YY's variance or shape. Full independence is a stronger condition than a flat conditional mean.
  • Condition on the right thing. Choosing a helpful variable to condition on is an art; a good choice (like the regime above) makes the inner expectations trivial, a bad one leaves you exactly where you started.

Conditional expectation grows straight out of Conditional Probability (average with respect to the conditional distribution), pairs with the The Law of Total Probability as its expectation-flavoured twin, reads slices out of Joint and Marginal Distributions, and underlies martingales, filtering, and nearly every forecasting model in quant finance.

Related concepts

Practice in interviews

Further reading

  • Blitzstein & Hwang, Introduction to Probability, ch. 9
  • Williams, Probability with Martingales (ch. 9)
ShareTwitterLinkedIn