Skip to content
Part IA Easter Term

LOTUS and Moments

LOTUS: Law of the Unconscious Statistician

When computing E[g(X)]E[g(X)], you might think we need the distribution of Y=g(X)Y = g(X) first. LOTUS says no: we can compute directly using the distribution of XX.

Statement: For a discrete random variable XX:

E[g(X)]=xg(x)p(x)E[g(X)] = \sum_{x} g(x) \cdot p(x)

For a continuous random variable XX:

E[g(X)]=g(x)f(x)dxE[g(X)] = \int_{-\infty}^{\infty} g(x) f(x) \, dx

Why “unconscious”? Many people apply this “unconsciously” without realising it’s a theorem requiring proof.

Proof (Discrete Case)

Let Y=g(X)Y = g(X). By definition:

E[Y]=yyP(Y=y)=yyP(g(X)=y)E[Y] = \sum_y y \cdot P(Y = y) = \sum_y y \cdot P(g(X) = y)

But P(g(X)=y)=x:g(x)=yp(x)P(g(X) = y) = \sum_{x: g(x) = y} p(x). So:

E[Y]=yyx:g(x)=yp(x)=yx:g(x)=yyp(x)=yx:g(x)=yg(x)p(x)E[Y] = \sum_y y \sum_{x: g(x) = y} p(x) = \sum_y \sum_{x: g(x) = y} y \cdot p(x) = \sum_y \sum_{x: g(x) = y} g(x) \cdot p(x)

Each xx appears exactly once (grouped by the value g(x)g(x)), giving:

E[Y]=xg(x)p(x)E[Y] = \sum_x g(x) \cdot p(x)

Why LOTUS Matters

Instead of finding the PMF/PDF of Y=g(X)Y = g(X), we compute directly. This is often much easier.

Example: Squared Die

XX = fair die roll. Find E[X2]E[X^2].

Without LOTUS: Find distribution of X2X^2 (values {1,4,9,16,25,36}\{1, 4, 9, 16, 25, 36\}), then compute expectation.

With LOTUS:

E[X2]=i=16i216=1+4+9+16+25+366=916E[X^2] = \sum_{i=1}^{6} i^2 \cdot \frac{1}{6} = \frac{1 + 4 + 9 + 16 + 25 + 36}{6} = \frac{91}{6}

Moments

nth Moment

The nnth moment of XX is:

E[Xn]=xxnp(x)E[X^n] = \sum_x x^n \cdot p(x)

The first moment is the expectation: E[X]E[X].

Central Moments

The nnth central moment is:

E[(XE[X])n]E[(X - E[X])^n]

The second central moment is the variance.

Common Functions

Linear Function

E[aX+b]=aE[X]+bE[aX + b] = aE[X] + b

This follows from linearity, not specifically LOTUS.

Positive Powers

E[Xn]=xxnp(x)E[X^n] = \sum_x x^n p(x)

Used for computing variance and higher moments.

Absolute Value

E[X]=xxp(x)E[|X|] = \sum_x |x| p(x)

The expectation of X|X| is called the mean absolute deviation from zero.

Example: E[2X]E[2^X]

If XX ~ Binomial(nn, pp), find E[2X]E[2^X].

By LOTUS:

E[2X]=k=0n2k(nk)pk(1p)nk=k=0n(nk)(2p)k(1p)nkE[2^X] = \sum_{k=0}^{n} 2^k \binom{n}{k} p^k (1-p)^{n-k} = \sum_{k=0}^{n} \binom{n}{k} (2p)^k (1-p)^{n-k}

This is the binomial expansion of (2p+(1p))n=(1+p)n(2p + (1-p))^n = (1 + p)^n.

E[2X]=(1+p)nE[2^X] = (1 + p)^n

Probability Generating Functions

For a non-negative integer-valued random variable XX, the probability generating function is:

GX(t)=E[tX]=k=0tkP(X=k)G_X(t) = E[t^X] = \sum_{k=0}^{\infty} t^k P(X = k)

This is LOTUS with g(x)=txg(x) = t^x.

Key property: P(X=k)=GX(k)(0)k!P(X = k) = \frac{G_X^{(k)}(0)}{k!} (the kkth derivative at 0).

Variance via LOTUS

Var(X)=E[X2]E[X]2\text{Var}(X) = E[X^2] - E[X]^2

LOTUS computes E[X2]E[X^2] directly.

For a fair die:

Var(X)=E[X2]E[X]2=916(72)2=916494=18214712=3512\text{Var}(X) = E[X^2] - E[X]^2 = \frac{91}{6} - \left(\frac{7}{2}\right)^2 = \frac{91}{6} - \frac{49}{4} = \frac{182 - 147}{12} = \frac{35}{12}

Summary

ConceptFormula
LOTUS (discrete)E[g(X)]=xg(x)p(x)E[g(X)] = \sum_x g(x) p(x)
LOTUS (continuous)E[g(X)]=g(x)f(x)dxE[g(X)] = \int g(x) f(x) dx
nnth momentE[Xn]E[X^n]
nnth central momentE[(XE[X])n]E[(X - E[X])^n]
PGFG(t)=E[tX]G(t) = E[t^X]