Learn/Combinatorics/Linearity of Expectation
Combinatorics • Topic 25

Linearity of Expectation

This is the "Swiss Army Knife" of Olympiad probability. It allows you to calculate averages for complex systems without knowing the full distribution.

The Theorem

Theorem (Linearity of Expectation)
For any random variables and (dependent or independent):
Generally:

Indicator Variables

The most powerful way to use linearity is to break a count into binary "indicator" variables.
where if event happens, and otherwise. Then .
Example (Hat Check Problem)
people drop their hats. The hats are returned randomly. What is the expected number of people who get their own hat back?

Proof. Let be the number of matches. Hard to find . Use Indicators: Let if person gets their own hat, otherwise. . . By Linearity:

The answer is 1, regardless of !

Practice Problems

Exercise (Problem 1)
A deck of 52 cards is shuffled. What is the expected number of Aces in the top 5 cards?
Exercise (Problem 2)
Find the expected number of times "HH" appears in a sequence of coin flips. (Hint: Let be the indicator that flips are HH).
Exercise (Problem 3)
If distinct balls are placed into distinct bins randomly, what is the expected number of empty bins?