Math Core

Module 2.5 · Counting and Probability

Expected value

Expected value is the long-run average of a random quantity. It shows up on almost every AMC 10 and 12, and the problems that look hardest often collapse in two lines thanks to one fact: linearity of expectation. This module teaches the definition, then shows how to break a messy count into simple pieces.

The definition

If a random quantity XX takes values x1,x2,…x_1, x_2, \dots with probabilities p1,p2,…p_1, p_2, \dots, its expected value is

E[X]=x1p1+x2p2+⋯ .E[X] = x_1 p_1 + x_2 p_2 + \cdots.

For a fair die, E[X]=1+2+3+4+5+66=72E[X] = \dfrac{1 + 2 + 3 + 4 + 5 + 6}{6} = \dfrac{7}{2}. The expected value doesn't have to be a possible outcome; it's an average.

Linearity of expectation

Linearity of expectation

For any random quantities XX and YY and constants aa, bb,

E[X+Y]=E[X]+E[Y],E[aX+b]=aE[X]+b.E[X + Y] = E[X] + E[Y], \qquad E[aX + b] = aE[X] + b.

This holds even when XX and YY are dependent.

The expected sum of three dice is 3⋅72=2123 \cdot \dfrac72 = \dfrac{21}{2}, with no need to list 216216 outcomes.

The real power comes from indicator variables. To find the expected number of times something happens, write the count as a sum of 00-or-11 variables, one for each place it could happen:

X=I1+I2+⋯+In,Ik={1if event k happens0otherwise.X = I_1 + I_2 + \cdots + I_n, \qquad I_k = \begin{cases} 1 & \text{if event } k \text{ happens} \\ 0 & \text{otherwise.} \end{cases}

Since E[Ik]=P(event k)E[I_k] = P(\text{event } k),

E[X]=P(event 1)+P(event 2)+⋯+P(event n).E[X] = P(\text{event } 1) + P(\text{event } 2) + \cdots + P(\text{event } n).

You never need the distribution of XX itself, only the probability of each small event. The events can overlap and depend on each other in complicated ways; it doesn't matter.

Waiting times

If each trial succeeds with probability pp, independently, then the expected number of trials up to and including the first success is 1p\dfrac{1}{p}. For example, you expect to roll a die 66 times to get a 66.

Why: let EE be the expected number of trials. The first trial always counts. With probability pp you're done; otherwise you're back where you started. So E=1+(1−p)EE = 1 + (1 - p)E, which gives E=1pE = \dfrac1p.

Worked example: Direct definition

You roll a fair die and win n2n^2 dollars, where nn is the number rolled. What is your expected winnings?

E=1+4+9+16+25+366=916≈15.17 dollars.E = \frac{1 + 4 + 9 + 16 + 25 + 36}{6} = \frac{91}{6} \approx 15.17 \text{ dollars}.

Note that E[X2]=916E[X^2] = \tfrac{91}{6} is not (E[X])2=494(E[X])^2 = \tfrac{49}{4}. Linearity works for sums, not for squares or products of dependent quantities.

Worked example: Indicators: adjacent heads

A fair coin is flipped 1010 times. What is the expected number of places where two consecutive flips are both heads? (In HHHT, there are 22 such places.)

There are 99 pairs of consecutive flips. Let Ik=1I_k = 1 if flips kk and k+1k + 1 are both heads. Each has probability 14\tfrac14. So the expected count is 9⋅14=949 \cdot \tfrac14 = \tfrac94.

The indicators overlap (pairs 11–22 and 22–33 share a flip), but linearity doesn't care.

Worked example: Indicators: distinct values

Three fair dice are rolled. What is the expected number of different values that appear?

For each face value vv from 11 to 66, let Iv=1I_v = 1 if vv appears at least once. By the complement, P(Iv=1)=1−(56)3=91216P(I_v = 1) = 1 - \left(\tfrac56\right)^3 = \tfrac{91}{216}. So the expected number of distinct values is

6⋅91216=9136≈2.53.6 \cdot \frac{91}{216} = \frac{91}{36} \approx 2.53.

Common mistake

Don't try to find the full distribution when linearity will do. Students often spend ten minutes computing P(X=0),P(X=1),…P(X = 0), P(X = 1), \dots for a count XX. If the question only asks for E[X]E[X], look for indicators first: "the expected number of ___" almost always means "sum the probabilities of each ___."

Worked example: Collecting every face

A fair die is rolled until every face has appeared at least once. What is the expected number of rolls?

Split the process into stages. Once you've seen kk different faces, each roll shows a new face with probability 6−k6\tfrac{6 - k}{6}, so that stage takes 66−k\tfrac{6}{6 - k} rolls on average. By linearity, the total is

66+65+64+63+62+61=6(1+12+13+14+15+16)=14710=14.7.\frac66 + \frac65 + \frac64 + \frac63 + \frac62 + \frac61 = 6\left(1 + \tfrac12 + \tfrac13 + \tfrac14 + \tfrac15 + \tfrac16\right) = \frac{147}{10} = 14.7.

Practice

Practice 1

Three fair dice are rolled. What is the expected value of their sum?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

A bag holds 44 red marbles and 66 blue marbles. Three marbles are drawn without replacement. What is the expected number of red marbles drawn?

Practice 3

Two fair dice are rolled. What is the expected value of the larger of the two numbers? (If they are equal, that number is the larger.)

Practice 4

Seven people each put their name in a hat, and each person draws one name at random (all 7!7! assignments are equally likely). What is the expected number of people who draw their own name?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Every subset of {1,2,3,…,10}\{1, 2, 3, \dots, 10\}, including the empty set, is written on a card, and one card is chosen at random. What is the expected value of the sum of the numbers in the chosen subset? (The empty set has sum 00.)

Practice 6

The numbers 11 through 88 are arranged in a random order a1,a2,…,a8a_1, a_2, \dots, a_8. A descent is a position ii with ai>ai+1a_i \gt a_{i+1}. What is the expected number of descents?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 7

A fair coin is flipped repeatedly until two heads in a row appear. What is the expected number of flips?

Practice 8

Four fair dice are rolled. What is the expected number of different values that appear?

Practice 9

Five men and five women sit at random around a round table with 1010 seats. What is the expected number of pairs of neighbors consisting of one man and one woman?

Real contest practice