Module 2.4 · Counting and Probability
Linearity of expectation
"Find the expected number of..." questions can look impossible: the full probability distribution may be a nightmare. Linearity of expectation lets you skip the distribution entirely. You break the count into tiny yes-or-no pieces, find the probability of each piece, and add.
The key fact
The expected value of a random quantity is its long-run average, . The most useful property of expectation is that it adds.
Linearity of expectation
For any random quantities ,
This is true even when the depend on each other. No independence is needed.
Indicator variables
To find the expected number of times something happens, write the count as a sum of indicators. An indicator is if some event happens and if not, so .
Definition
Indicator method
If counts how many of the events occur, write , where exactly when occurs. Then
For example, in a random permutation of , let if is in position . Each , so the expected number of fixed points is , for every . The events " is fixed" and " is fixed" are not independent, and it doesn't matter.
Common choices of indicator:
- one per position (is position special?),
- one per pair of positions or objects (is this pair adjacent, matching, inverted?),
- one per object (does this object appear, get picked, come before something?).
Waiting times
The expected number of trials until an event of probability first happens is . Combine this with linearity to handle multi-stage waiting. To collect all faces of a fair -sided die, split the wait into stages: after you have seen faces, a new face appears with probability , so that stage lasts rolls on average. Adding,
Common mistake
Linearity works for sums, not products or maxima. is not unless and are independent, and is not . If the question asks for the expected value of a maximum or minimum, look for a way to write it as a sum of indicators first.
Worked example: Mixed neighbors
Five men and five women sit at random around a round table. Find the expected number of pairs of neighbors consisting of one man and one woman, written as in lowest terms; give .
There are neighboring pairs of seats. For a given pair, the probability that the two seats hold one man and one woman is . So the expectation is , and .
Worked example: The smallest element
A -element subset of is chosen at random. Find the expected value of its smallest element.
Write the minimum as a sum of indicators: , where if . Then
by the hockey stick identity. In general the expected minimum of a random -subset of is .
Worked example: Distinct faces
Six fair dice are rolled. What is the expected number of different values that appear?
Let if value appears at least once. . So the expectation is .
Tip
When you're stuck, ask "what is the smallest yes-or-no event whose count is my answer?" If each event has an easy probability, you're done.
Practice
A random permutation of is chosen. The expected number of indices with and is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Three fair six-sided dice are rolled. The expected number of distinct values showing is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A standard -card deck is shuffled and laid out in a row. The expected number of pairs of adjacent cards that are both aces is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A fair -sided die with faces is rolled repeatedly until every face has appeared at least once. The expected number of rolls is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Each cell of a grid is colored black or white independently with probability each. The expected number of blocks of cells (out of the such blocks) whose four cells all have the same color is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Ten people stand in a room. Each person points at one of the other nine people, chosen uniformly at random and independently. A pair of people is mutual if each points at the other. The expected number of mutual pairs is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A bag holds red marbles and blue marbles. Marbles are drawn one at a time without replacement. The expected number of red marbles drawn before the first blue marble is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
The letters are arranged in a random order. A run is a maximal block of consecutive identical letters; for example, has runs. The expected number of runs is in lowest terms. Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Real contest practice
- 1996 AIME, Problem 12: the average of a sum of absolute differences over all permutations, one pair at a time.
- 2022 AIME I, Problem 12: a sum over pairs of subsets, handled by counting each element's contribution separately.