Define expected value and variance. What are their key properties?
Expected value is the probability-weighted average outcome of a random variable; variance measures average squared deviation from that mean. Both are linear/additive in specific ways — knowing these rules prevents algebraic mistakes under interview pressure.
How to think about it
These two quantities underpin every loss function, every risk metric, and every A/B test power calculation. Know the definitions cold and the algebra by heart.
Expected value
For a discrete random variable X:
E[X] = Σ x · P(X = x)
For a continuous random variable:
E[X] = ∫ x · f(x) dx
Key properties:
- Linearity:
E[aX + bY] = a·E[X] + b·E[Y]for any constants a, b — even when X and Y are dependent. E[c] = cfor any constant c.
Variance
Var(X) = E[(X - E[X])²] = E[X²] - (E[X])²
The second form — “mean of squares minus square of mean” — is usually easier to compute.
Key properties:
Var(aX + b) = a²·Var(X)— shifting by b has no effect; scaling multiplies by a².- If X and Y are independent:
Var(X + Y) = Var(X) + Var(Y). - If dependent, add the covariance term:
Var(X + Y) = Var(X) + Var(Y) + 2·Cov(X,Y).
Worked numeric example
A game pays £5 with probability 0.4 and -£2 with probability 0.6.
E[X] = 5×0.4 + (-2)×0.6 = 2.0 - 1.2 = 0.80
E[X²] = 25×0.4 + 4×0.6 = 10 + 2.4 = 12.4
Var(X) = 12.4 - (0.80)² = 12.4 - 0.64 = 11.76
SD(X) = √11.76 ≈ 3.43
Expected profit is £0.80 per game, but the standard deviation is £3.43 — high risk relative to the reward.