Many random variables are counts: how many sixes, how many matches, how many distinct values. Split the count into one 0-1 variable per possible event. Each indicator has mean equal to its probability, and the means add even when the events are dependent.
| Step | On the expected number of people who get their own hat back, 5 hats returned at random | |
|---|---|---|
| 1 | Define one indicator per event you are counting. Let if event happens and otherwise (indicator definition). | if person gets their own hat, |
| 2 | Write the count as their sum. Each occurrence adds exactly to the total. | |
| 3 | Find the mean of one indicator. (expectation of an indicator). | |
| 4 | Add the means. Linearity holds without independence, so the dependence between the hats does not matter.Linearity of expectation ↗ |