Conditional Expectation
E[X|Y] is a random variable in Y, and averaging it over Y's distribution recovers E[X] — the law of total expectation.
1. The idea
is the average of restricted to the event . Viewed as a function of before is observed, is itself a random variable.
The law of total expectation states : average the conditional means over the distribution of . This lets you compute a hard unconditional expectation by conditioning on whichever variable makes the problem simple.
Conditioning on the first step of a process (a coin flip, a die roll, an arrival) is one of the most common ways to set up a solvable recursion for a global expectation.
2. Why it matters
Conditioning on the right variable turns an intractable direct calculation into a weighted average of simple cases — the core move behind recursive expectation and optimal stopping.
3. Core mathematics
Law of total expectation
Conditional expectation as a variable
4. How to recognize it
Think of this when…
- A natural variable (a coin flip, a category, a first roll) splits the problem into cases
- Each case is easy to compute an expectation within, but the overall expectation is not
- The phrase 'condition on' or 'given the first outcome' fits naturally
5. Worked example
Worked example
A box has 2 fair coins and 1 two-headed coin. A coin is picked at random and flipped twice. Find the expected number of heads.
- 1
Condition on which coin type is picked. , .
- 2
Given a fair coin, 2 flips give . Given the two-headed coin, both flips are heads: .
- 3
Combine with total expectation.
- Answer:
6. Common mistakes
- Treating as a number instead of a random variable before is known
- Forgetting to weight each conditional case by its own probability
- Conditioning on a variable that does not actually simplify each case
- Confusing (a number) with (a random variable)
7. Quick check
If , , and , what is ?
8. Practice
3 QuantSolve questions use this concept.
Practice this concept9. Related methods
Create a free account to save lesson progress.
Recommended next lessonTail-Sum Formula →