Expectation, Variance & Moments

the law of the unconscious statistician (LOTUS)

/ LOH-tus /

Suppose you know the distribution of X, and you want the expectation of some function of it — say E[X^2], or E[cos X], or E[ profit(X) ]. The naive worry is that you must first find the whole distribution of the new variable g(X), which can be painful. The good news, packaged in a rule with a charming name, is that you can skip that step entirely.

The law of the unconscious statistician says: to compute E[g(X)], just weight the values of g(x) by the probabilities of X, not of g(X). Discretely, E[g(X)] = sum over x of g(x) P(X = x). Continuously, E[g(X)] = integral of g(x) f(x) dx. You feed each x into g, then average using the original distribution. The name pokes gentle fun: a statistician uses this formula so automatically — 'unconsciously' — that they may forget it is a theorem needing proof, not an obvious definition.

This is the engine behind nearly every derived quantity. Variance is E[(X - mu)^2], the k-th moment is E[X^k], the moment generating function is E[e^(tX)] — all are LOTUS applied to a chosen g. Without it, every one of these would require first deriving a brand-new distribution. One caution: g(X) is generally not g(E[X]); averaging then transforming is not the same as transforming then averaging, which is exactly the gap that Jensen's inequality measures.

X is a fair die. To get E[X^2], do not find the distribution of X^2 — just apply LOTUS: E[X^2] = (1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2)/6 = 91/6 ≈ 15.17. (Compare (E[X])^2 = 3.5^2 = 12.25; they differ, and the gap is the variance.)

Average g(x) using X's own probabilities — no need to derive the distribution of g(X).

LOTUS computes E[g(X)], which is generally not equal to g(E[X]). Confusing the two is one of the most common errors; Jensen's inequality says which way the gap points for convex or concave g.

Also called
LOTUSlaw of the unconscious statistician無意識統計學家法則