lotus-and-variance
The session in one line LOTUS says : you can average any transform of using only 's own PMF. And variance is itself such an average, , so LOTUS is what makes variance computable. That was the connection I came for.
LOTUS: the shortcut that is secretly a theorem
To compute for a die roll, the definition of expectation says I owe the PMF of first: values of , weighted by probabilities of . But everyone just writes and never finds that PMF. Why is that legal?
For the question barely bites. Squaring is one-to-one on , so the six weights carry over unchanged and the formula is the definition with values relabeled. The real test is a function with collisions:
Now and both map to , and to , and to . The relabeling defense is dead. Compute both ways:
- Honest route, PMF of first: .
- Shortcut, never forming 's PMF: over the six faces.
Pair the shortcut's six terms by collision and each brace holds a constant value of with weight , which is exactly . The shortcut is the honest sum, rearranged. That regrouping is the entire proof, and it is the same move that proves linearity of expectation. The move itself lives in pebble-grouping.
The general statement is Theorem 4.5.1, the law of the unconscious statistician: for any function ,
The name is a joke. You swap for in the expectation formula without thinking, and the theorem's content is that the thoughtless substitution is correct. For one-to-one it is pure relabeling. For many-to-one , several values pool into one , like the collision pairs above. Rearranging is the word that covers both cases, relabeling only covers the first.
What LOTUS does not license
The tempting sibling shortcut, , is false for nonlinear . The die already shows it: but . For linear the two agree, and that is just linearity of expectation again.
St. Petersburg shows how badly it can fail. Flip a fair coin until the first heads. Let be the number of flips, so and (waiting times average ). The casino pays dollars. The naive shortcut prices the game at dollars. LOTUS prices it honestly:
Every term is exactly 1 and the support never stops, since no flip count is guaranteed to end the game. So by the expectation criterion, no finite ticket price is too high. Pay a million, the game is still a bargain. My gut said a couple of dollars, and the gut is onto something real: the game almost always ends within a few flips and pays pocket change. The mean is infinite only because it is propped up by astronomically rare jackpots.
Both answers are right about different things. Expectation is a center of mass, not a typical value. It tells you where the distribution balances and nothing about how far a single play lands from that point. That gap is what variance exists to fill.
Variance: the second number
The naive spread measure fails first. Averaging the signed deviations gives , for every distribution, by linearity. This is not a symmetry accident. Take with probability and with probability . The mean is 1, and the deviations are carrying weight against carrying weight . They cancel. The mean is the point where probability-weighted pulls from left and right agree, so signed deviations always net to zero.
The fix is to kill the signs before averaging:
For the die this is exactly the collision exercise: , so . I had computed the die's variance before knowing its name.
Why square instead of absolute value? is a legitimate spread measure (mean absolute deviation), so the square has to win on merit. Three reasons, in increasing order of importance:
- Algebra. expands into and the expansion feeds straight into linearity. Every clean variance formula flows from this. Absolute values do not expand and give almost no formulas.
- Additivity. For independent and , . Spreads add. Mean absolute deviation obeys no such law. This is what gives binomial variance in one line below, and it is the engine behind behavior, Chebyshev, and the tail bounds crypto arguments lean on.
- Geometry. Squared deviations give independent contributions a Pythagorean structure. They combine like perpendicular vectors, and SD behaves like a Euclidean length. The additivity in point 2 is the Pythagorean theorem in disguise.
The standing complaint, wrong units (the die's 2.92 is in squared pips), is patched by pips.
Expanding the definition with linearity gives the workhorse form:
The piece is a LOTUS computation, which closes the loop: variance is an , and LOTUS is the license to compute it from 's PMF alone. Die check: , the same as the honest route. One notation trap the book itself flags: write , not . The two differ by exactly the variance.
What variance is asking
Variance is the expected squared distance from the mean, and it answers one question: if I draw once, how far from the center should I expect to land? It measures unpredictability, not size. A random variable that always outputs 42 is huge but perfectly predictable, so its variance is 0.
That is the whole intuition behind . Spread is disagreement between draws. A constant never surprises: every draw lands exactly on the mean, the distance is 0 on every single draw, and the average of all zeros is 0. In the pebble picture, a constant piles every pebble on one spot, which then is the balance point, so no pebble sits any distance away. Zero variance means the distribution has collapsed to a point.
The same reading applied to the distributions I know:
- Bernoulli(p): , maximal at , the most unpredictable coin. As or the variance slides to 0 because the coin degenerates into a constant.
- Binomial(n, p): , the same per-flip uncertainty added over independent copies.
- Uniform(a, b): . The spread depends only on how wide the room is, not where the room is. Shifting costs nothing, and squeezing the width to zero collapses it back to a constant.
- Fair die: , six distinct outcomes each holding mass away from 3.5.
Indicators and binomial variance
An indicator is 1 if an event happens (probability ) and 0 otherwise. One coin flip, one trial, one bit of a hash output. Indicators are the only random variables whose square is themselves: and , so identically and with no computation. Then
The shape is a sanity check by itself. Variance is 0 at and (a certain event does not vary) and maximal at , value . An unbiased bit is the most unpredictable bit.
A binomial count is a sum of independent indicators, so the additivity law gives in one line. Compare where the assumptions land: never consulted independence, because linearity holds unconditionally (see pebble-grouping for why). Variance addition is the step that consumes it.
Variance is not linear, and I called it that I wrote "linearity of variance" during the session, and the book stamps a biohazard next to that idea (4.6.3). The failure case is itself: , not . Dependence makes spread compound rather than add. The correct rules: constants escape squared, (so SD, not variance, scales like the quantity itself). Shifts vanish, . And only under independence.
What stayed shaky
The recall check at close: I blanked on which number fills the gap expectation leaves. It is the standard deviation. is how far a single realization typically lands from , in 's own units. Die: single rolls sit roughly 1.7 pips from 3.5. St. Petersburg: infinite variance, so is a uselessly bad guide to a single play. Re-test this reading first next session.
Natural continuations: Chebyshev's inequality, where SD literally becomes a tail bound (the crypto motivation), and Poisson, section 4.7, next in the book.