Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.The long-run average
Roll a die thousands of times and average the results. You’ll get close to 3.5, even though no single roll is ever 3.5. That long-run average is the expectation. Picture the probabilities as weights on a see-saw: the expectation is where it balances.
The average alone isn’t enough. A bus that’s always 5 minutes late and a bus that’s either on time or 10 minutes late have the same average delay, but very different reliability. Variance measures how spread out the values are.
A navigation system averages several noisy sensors. How much does averaging help? Variance and covariance give the exact answer, and they show that sensors whose errors move together help much less than independent ones.
- 1. The average of a fair die is…
- 2. Variance measures…
- 3. Win $5 half the time, lose $3 otherwise. Expected gain?
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.Definitions
- (discrete), or (continuous).
- For a function, . You don’t need the distribution of first.
- , and .
- .
- .
| Rule | Holds when |
|---|---|
| always | |
| always | |
| always | |
| (Cov = 0) | if independent |
A die: and , so .
- 1. E[X] = 4. E[2X + 3] = ?
- 2. Var X = 2. Var(3X) = ?
- 3. Var(X + 7) vs Var X?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Linearity is a superpower
holds with or without independence. To find an expected count, write it as a sum of indicators (A4.1-5):
- Expected sixes in 12 rolls: .
- Expected fixed points of a random permutation: , for every (Practice Code 3).
- Expected number of pairs sharing a birthday among people: .
Vectors and covariance matrices
For a random vector , the mean is and the covariance is , which is symmetric and PSD. For any weights,
This one formula covers portfolio risk, error budgets, the Kalman filter’s covariance propagation, and PCA (A2.3).
Correlation’s blind spot
measures linear association only. If is symmetric about 0 and , then , though is a function of . Independent ⇒ uncorrelated, but not conversely, except for jointly Gaussian variables (A4.2-4).
- 1. Independent X, Y with Var 2 and 3. Var(X − Y) = ?
- 2. Var(wᵀX) = ?
- 3. Uncorrelated implies independent?
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Proofs
- Linearity. , by summing the joint PMF over the other variable. No independence is needed. ∎
- Variance of a sum. Expand to get . ∎
- . Cauchy–Schwarz (A3.5-5) in the inner product on centred variables gives . Equality holds iff almost surely, i.e. an exact linear relation. ∎
- Independent ⇒ . factorizes. ∎
Expectations can fail to exist
The Cauchy distribution has . Its sample means don’t converge: the average of Cauchys is again standard Cauchy (Practice Code 5). The St. Petersburg game has an infinite expected payoff. Heavy tails, such as sensor glitches, multipath GPS errors or financial returns, call for medians and robust losses (Huber, A3.3-4) instead of means.
Variance as squared distance
, attained at . So the mean is the best constant predictor under squared error, and the median is the best under absolute error. That’s the probabilistic version of least squares, and why MSE-trained regressors predict conditional means (A4.1-8).
Exercise 3.1: Show that E[(X − c)²] is minimized at c = E[X]
. The cross term vanishes because . The second term is minimized, at 0, when .
- 1. |ρ| = 1 exactly when…
- 2. The best constant predictor under squared error is the…
- 3. Sample means of Cauchy data…
Level 4: Expert
★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.Fusing sensors: covariance decides everything
Several unbiased sensors measure the same quantity with error covariance . Among unbiased linear combinations with , the variance is minimized by . That’s the best linear unbiased estimator (BLUE; Aitken, 1935).
- Independent sensors get inverse-variance weights.
- Equicorrelated sensors: averaging sensors with pairwise correlation gives variance . Ten thousand IMUs with ρ = 0.2 are barely better than five.
- Correlated pairs: two sensors sharing an error source should split one sensor’s worth of weight (Exercise 2).
This is why redundant navigation systems prize dissimilar sensors, such as GPS plus inertial plus vision. Their errors are less correlated.
Moments everywhere
- Kalman filters propagate means and covariances, . They’re the optimal linear estimators, which minimize expected squared error (Kalman, 1960).
- Bias–variance decomposition. Expected test error is bias² + variance + noise. It’s the same algebra as Exercise 3.1, applied to a learned predictor (Geman, Bienenstock and Doursat, 1992; B2).
- Variance reduction in learning. Policy-gradient baselines, control variates and antithetic sampling all exploit covariance to reduce estimator variance without bias (Greensmith, Bartlett and Baxter, 2004). Batch averaging reduces SGD noise only to the extent that per-example gradients aren’t correlated.
- Ensembles work because of imperfect correlation. An ensemble of models with error correlation has error variance . Diversity is the point (Lakshminarayanan, Pritzel and Blundell, 2017).
References
- D. Bertsekas, J. Tsitsiklis (2008). Introduction to Probability, 2nd ed., Ch. 2, 4. Athena Scientific.
- A. Aitken (1935). “On least squares and linear combination of observations.” Proceedings of the Royal Society of Edinburgh, 55.
- R. E. Kalman (1960). “A new approach to linear filtering and prediction problems.” Journal of Basic Engineering, 82.
- S. Geman, E. Bienenstock, R. Doursat (1992). “Neural networks and the bias/variance dilemma.” Neural Computation, 4(1).
- E. Greensmith, P. Bartlett, J. Baxter (2004). “Variance reduction techniques for gradient estimates in reinforcement learning.” JMLR, 5.
- B. Lakshminarayanan, A. Pritzel, C. Blundell (2017). “Simple and scalable predictive uncertainty estimation using deep ensembles.” NeurIPS.
- P. Huber (1964). “Robust estimation of a location parameter.” Annals of Mathematical Statistics, 35(1).
- P. Groves (2013). Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems, 2nd ed. Artech House.