In sums of random variables you added means. The rule is stronger than it first looks: it needs no independence at all. Together with indicator variables it computes expected counts that would be hard to find any other way, building on expected values of functions.
Key idea
Why it works
Worked examples
Worked example: Cards in their own place
- Let $I_k = 1$ when card $k$ stays in position $k$. In a random order, card $k$ is equally likely to be in any of the 52 spots, so $P(I_k = 1) = \frac{1}{52}$.
- The $I_k$ are dependent (if 51 cards stay, so does the last), but linearity does not care.
- $E[X] = 52 \cdot \frac{1}{52} = 1$, for a deck of any size.
Answer: 1
Worked example: Shared birthdays
- One indicator per pair: there are $\binom{30}{2} = 435$ pairs.
- Each pair matches with probability $\frac{1}{365}$.
- $E[X] = \frac{435}{365} = \frac{87}{73} \approx 1.19$. Compare the birthday problem: a match is likely, and on average there is more than one.
Answer: $\frac{87}{73}$
Worked example: Different faces
- Let $I_f = 1$ if face $f$ appears at least once. Face $f$ is missed by all 6 rolls with probability $\left(\frac{5}{6}\right)^{6}$.
- $E[I_f] = 1 - \left(\frac{5}{6}\right)^{6}$.
- $$E[X] = 6\left(1 - \left(\frac{5}{6}\right)^{6}\right) = \frac{31031}{7776} \approx 3.99$$ about 4 faces, not 6.
Answer: $\frac{31031}{7776} \approx 3.99$
The same recipe handles many counts. Name the small events, find the chance of one of them, and multiply by how many there are:
- Patterns in coin flips. In $n$ flips there are $n - 1$ neighboring pairs, each HH with chance $\frac{1}{4}$, so the expected number of HH is $\frac{n - 1}{4}$. A new run starts at each switch, and each neighboring pair is a switch with chance $\frac{1}{2}$: expected runs $= 1 + \frac{n - 1}{2}$.
- Empty boxes. Toss $b$ balls into $m$ boxes: box $j$ stays empty with chance $\left(\frac{m - 1}{m}\right)^{b}$, so the expected number of empty boxes is $m\left(\frac{m - 1}{m}\right)^{b}$.
- Mixed neighbors. Line up $b$ boys and $g$ girls at random ($n = b + g$). Each of the $n - 1$ neighboring pairs is mixed with chance $\frac{2bg}{n(n - 1)}$, so the expected number of mixed pairs is $\frac{2bg}{n}$.
Common mistake