Conditional Expectation and Variance

Published on May 8, 2025 by Aman K Sahu

Conditional expectation and variance help us understand what happens to one variable when we know something about another. They are useful in making better predictions and decisions using probability.

1. What is Conditional Expectation?

Conditional expectation is the average (or expected) value of a random variable X when we already know something about another variable Y.

It's written as E[X | Y] and helps us make better guesses by using known information.

For example:
E[X | Y = y] = ∑ x · P(X = x | Y = y) (for discrete values)
E[X | Y = y] = ∫ x · f(x | y) dx (for continuous values)

  • Imagine flipping two coins. Let X be the number of heads. If we know at least one head came up (Y), conditional expectation helps us find the average number of heads given that info.

2. What is Conditional Variance?

Conditional variance tells us how much the values of X spread out when we already know something about Y.

It is written as:
Var(X | Y) = E[(X - E[X | Y])² | Y]

  • It helps us understand how uncertain X is, given what we know about Y.
  • This is used in things like regression models, time series predictions, and Bayesian stats.

3. Putting It All Together

These two powerful formulas help us connect conditional and total (unconditional) values:

  • Law of Total Expectation: E[X] = E[E[X | Y]]
    (The overall expected value is the average of all the conditional expectations.)
  • Law of Total Variance: Var(X) = E[Var(X | Y)] + Var(E[X | Y])
    (Overall spread = average of conditional spreads + spread of the conditional means.)

4. Example: Student Test Scores

Let’s say a student’s score on a test depends on whether they studied or not.

  • If studied (Y = 1): E[X | Y = 1] = 80, Var(X | Y = 1) = 100
  • If not studied (Y = 0): E[X | Y = 0] = 50, Var(X | Y = 0) = 150
  • Probability of studying: P(Y = 1) = 0.6; Not studying: P(Y = 0) = 0.4

✅ Total Expected Score:
E[X] = 0.6 × 80 + 0.4 × 50 = 48 + 20 = 68

✅ Total Variance:
Var(X) = 0.6×100 + 0.4×150 + 0.6×(80−68)² + 0.4×(50−68)²
= 60 + 60 + 0.6×144 + 0.4×324
= 60 + 60 + 86.4 + 129.6 = 336

So, the average score is 68 and the overall variation in scores is 336.

Previous: Bayes' Theorem
Next: Mean, Median, Mode, and Standard Deviation