Lessons · Probability
Expected value and linearity
Expected value is the single most-used idea in quant interviews. Most "how many on average" questions become easy once you know two tools: linearity of expectation and geometric waiting times.
What expected value means
The expected value of a random quantity is its probability-weighted average: multiply each outcome by its probability and add. For one roll of a fair die:
E[X] = (1 + 2 + 3 + 4 + 5 + 6) × 1/6 = 3.5
It's the long-run average, not a value you expect to see on any single roll. That's why traders think in expected value: over many trades, the average is what you keep.
Linearity: the most useful trick
The expectation of a sum is the sum of the expectations:
E[X + Y] = E[X] + E[Y]
This holds even when X and Y are dependent, which is what makes it so powerful. To count something complicated, break it into simple pieces whose expectations you can find one at a time.
Worked example: matching cards
Shuffle ten numbered cards. How many end up in their original position, on average? The arrangements are hopelessly tangled, but linearity cuts through it. Let Iₖ be 1 if card k stays put and 0 otherwise. Card k stays put with probability 1/10, so E[Iₖ] = 1/10. The number of fixed cards is I₁ + … + I₁₀, so its expectation is 10 × 1/10 = 1. The cards affect each other, and it doesn't matter.
These 0/1 variables are called indicators. "Expected number of X" questions almost always yield to an indicator for each possible X.
Waiting times: 1/p
If each attempt succeeds with probability p, independently, the expected number of attempts until the first success is 1/p. Rolling until a 6 takes 6 rolls on average. Flipping until heads takes 2.
Waits add up. Collecting all six faces of a die takes 6/6 + 6/5 + 6/4 + 6/3 + 6/2 + 6/1 = 14.7 rolls: each new face is its own geometric wait with a shrinking success probability.
Conditioning on the first step
For patterns like "two heads in a row", write an equation for the expected time from each state and solve. Let E₀ be the expected flips from scratch and E₁ the expected flips after one head:
E₀ = 1 + ½E₁ + ½E₀ E₁ = 1 + ½ · 0 + ½E₀
Solving gives E₀ = 6. The same method handles any finite pattern.
Common traps
- E[XY] ≠ E[X]E[Y] in general. Products only split when X and Y are independent.
- E[f(X)] ≠ f(E[X]). The average of squares isn't the square of the average: E[X²] for a die is 91/6, not 3.5².
- Optimal stopping isn't the average. If you may reroll a die once, you should keep a 4 or more, so the game is worth 4.25, not 3.5.
Practice
Next: Conditional probability and Bayes · More probability questions