Skip to content
LeetQuant
F4 Random Variables and Expectation

F4 · Random Variables and Expectation · Lesson 7 of 8

The Law of Large Numbers and the Central Limit Theorem

Why averages settle down and why sums look normal: Chebyshev and the weak law, the CLT with continuity correction, fast interview estimates, and the cases where the CLT fails.

18 min

Two statements about averages

Let X1,X2,…X_1, X_2, \dots be i.i.d. with mean μ\mu and variance σ2\sigma^2, and let Sn=X1+⋯+XnS_n = X_1 + \dots + X_n and Xˉn=Sn/n\bar X_n = S_n / n.

  • The law of large numbers says where the average goes: Xˉn→μ\bar X_n \to \mu.
  • The central limit theorem says how it fluctuates on the way: the error Xˉn−μ\bar X_n - \mu is of size σ/n\sigma/\sqrt n and approximately normal.

The engine behind both is one line of variance algebra. Independence kills the covariance terms, so

Var⁡(Sn)=nσ2,Var⁡(Xˉn)=σ2n,sd⁡(Xˉn)=σn.\operatorname{Var}(S_n) = n\sigma^2, \qquad \operatorname{Var}(\bar X_n) = \frac{\sigma^2}{n}, \qquad \operatorname{sd}(\bar X_n) = \frac{\sigma}{\sqrt n} .

The sum spreads out like n\sqrt n, the mean concentrates like 1/n1/\sqrt n. To halve an error you need four times the data.

Markov, Chebyshev and the weak law

Markov's inequality. For X≥0X \ge 0 and a>0a > 0, P(X≥a)≤E[X]/aP(X \ge a) \le \mathbb{E}[X]/a. Proof: a 1{X≥a}≤Xa\,\mathbf{1}\{X \ge a\} \le X; take expectations.

Chebyshev's inequality. Apply Markov to (X−μ)2(X - \mu)^2 with a=k2σ2a = k^2\sigma^2:

P(∣X−μ∣≥kσ)≤1k2.P(|X - \mu| \ge k\sigma) \le \frac{1}{k^2} .

It holds for every distribution with finite variance, which is why it is loose: at k=2k = 2 it gives 25%25\% where a normal has 4.6%4.6\%.

Weak law of large numbers. Apply Chebyshev to Xˉn\bar X_n:

P(∣Xˉn−μ∣≥ε)≤σ2nε2  ⟶  0.P(|\bar X_n - \mu| \ge \varepsilon) \le \frac{\sigma^2}{n\varepsilon^2} \;\longrightarrow\; 0 .

That is the whole proof, and it is worth being able to give it in an interview. (The weak law only needs a finite mean; the finite variance makes the proof one line.)

Strong law. If E∣X1∣<∞\mathbb{E}|X_1| < \infty, then Xˉn→μ\bar X_n \to \mu with probability 1: almost every individual sequence of averages converges, not just the probability of a large deviation at each fixed nn. This is what justifies "the long-run frequency of heads is 12\tfrac12" and Monte Carlo estimation.

The central limit theorem

If the XiX_i are i.i.d. with finite variance σ2>0\sigma^2 > 0, then for every zz

P(Sn−nμσn≤z)→Φ(z).P\left(\frac{S_n - n\mu}{\sigma\sqrt n} \le z\right) \to \Phi(z) .

In practice: Sn≈N(nμ,nσ2)S_n \approx N(n\mu, n\sigma^2) and Xˉn≈N(μ,σ2/n)\bar X_n \approx N(\mu, \sigma^2/n). Nothing about the shape of the XiX_i survives except the mean and the variance.

How large must nn be? The Berry–Esseen theorem bounds the worst-case CDF error by Cρ/(σ3n)C\rho/(\sigma^3\sqrt n), where ρ=E∣X−μ∣3\rho = \mathbb{E}|X - \mu|^3 and C<0.48C < 0.48. Symmetric, light-tailed summands (dice, fair coins) look normal by n≈10n \approx 10–3030; skewed ones (a coin with p=0.01p = 0.01, lottery payoffs) need far more.

Continuity correction

When SnS_n is integer-valued, the normal spreads each integer's probability over an interval of width 1 around it. So P(S≤k)P(S \le k) is approximated by the normal probability up to k+12k + \tfrac12, and P(S≥k)P(S \ge k) by the probability above k−12k - \tfrac12.

For X∼Bin(100,12)X \sim \text{Bin}(100, \tfrac12), mean 50, sd 5:

MethodP(X≤55)P(X \le 55)
Exact0.86440.8644
Normal at 55.555.5 (corrected)Φ(1.1)=0.8643\Phi(1.1) = 0.8643
Normal at 5555 (uncorrected)Φ(1.0)=0.8413\Phi(1.0) = 0.8413

The correction matters most when the sd is small; with sd 5 it moves the answer by more than two percentage points.

Worked example

the sum of 100 dice

You roll 100 fair dice. Estimate the probability the total is at least 380.

Show solution

One die has mean 3.53.5 and variance 35/1235/12. The sum has mean 350350 and variance 100×35/12≈291.7100 \times 35/12 \approx 291.7, so sd ≈17.08\approx 17.08.

The total is an integer, so P(S≥380)≈P(S≥379.5)P(S \ge 380) \approx P(S \ge 379.5):

z=379.5−35017.08≈1.73,P(Z≥1.73)≈0.042.z = \frac{379.5 - 350}{17.08} \approx 1.73, \qquad P(Z \ge 1.73) \approx 0.042 .

The exact probability, by convolving 100 dice, is 0.04200.0420. Without the continuity correction you get P(Z≥1.76)≈0.039P(Z \ge 1.76) \approx 0.039.

Out loud: "Sum is about normal, mean 350, sd about 17. 380 is about 1.75 sd above, so roughly 4%."

Worked example

Chebyshev versus the CLT

You flip a fair coin 1000 times. Bound, then estimate, the probability that the number of heads differs from 500 by at least 50.

Show solution

H∼Bin(1000,12)H \sim \text{Bin}(1000, \tfrac12) has mean 500 and variance 1000×14=2501000 \times \tfrac14 = 250, sd ≈15.81\approx 15.81.

Chebyshev: P(∣H−500∣≥50)≤250/502=0.1P(|H - 500| \ge 50) \le 250/50^2 = 0.1.

CLT with correction: ∣H−500∣≥50|H - 500| \ge 50 means H≤450H \le 450 or H≥550H \ge 550, approximated by the normal beyond ±49.5\pm 49.5:

2 P ⁣(Z≥49.515.81)=2 P(Z≥3.13)≈0.0017.2\,P\!\left(Z \ge \frac{49.5}{15.81}\right) = 2\,P(Z \ge 3.13) \approx 0.0017 .

The exact binomial value is 0.00170.0017. Chebyshev is correct but nearly sixty times too generous, because it must also cover distributions with much fatter tails than a binomial. Use it when you know nothing about the shape; use the CLT when you have a sum of many independent pieces.

Fast estimates for interviews

QuantityRule of thumb
Heads in nn fair flipsmean n/2n/2, sd n/2\sqrt n / 2
Sum of nn dicemean 3.5n3.5n, sd ≈1.71n\approx 1.71\sqrt n
Sample proportionsd p(1−p)/n≤0.5/n\sqrt{p(1-p)/n} \le 0.5/\sqrt n
Monte Carlo estimatestandard error σ/n\sigma/\sqrt n
Normal mass within 1, 2, 3 sd68%68\%, 95%95\%, 99.7%99.7\% (two-sided 95% is 1.961.96)

How many flips to detect a 1% edge? A coin with p=0.51p = 0.51 versus a fair one: the sample proportion has sd about 0.5/n0.5/\sqrt n. To put the 1% gap two standard deviations out, 0.01≥2×0.5/n0.01 \ge 2 \times 0.5/\sqrt n, so n≥100\sqrt n \ge 100 and n≥10,000n \ge 10{,}000. Edges are expensive to confirm because the error shrinks only like 1/n1/\sqrt n.

The casino. A player bets $1 on red at American roulette 10,000 times, winning each bet with probability 18/3818/38. Each bet has mean −1/19≈−0.0526-1/19 \approx -0.0526 and sd ≈0.9986\approx 0.9986. Over 10,000 bets the expected loss is about $526 and the sd is about $100. Breaking even is more than 5 sd away: the normal gives about 7×10−87 \times 10^{-8} (the exact binomial is 6.6×10−86.6 \times 10^{-8}). The mean grows like nn, the noise like n\sqrt n, so the house edge always wins eventually.

When the CLT fails or misleads

  • Infinite variance. If XiX_i are standard Cauchy, Xˉn\bar X_n is standard Cauchy for every nn: averaging does nothing. P(∣Xˉn∣>1)=12P(|\bar X_n| > 1) = \tfrac12 whether nn is 1 or a million. Neither the LLN nor the CLT applies, because E∣X∣\mathbb{E}|X| is infinite.
  • Heavy but finite-mean tails. For a Pareto tail P(X>x)∼x−αP(X > x) \sim x^{-\alpha} with 1<α<21 < \alpha < 2, the mean exists, so the LLN holds, but the variance is infinite. The fluctuations of SnS_n grow like n1/αn^{1/\alpha}, faster than n\sqrt n, and the limit is a skewed stable law, not a normal. Sums are dominated by their single largest term.
  • Dependence. Autocorrelated data break Var⁡(Sn)=nσ2\operatorname{Var}(S_n) = n\sigma^2. For an AR(1) with lag-one correlation ρ\rho, Var⁡(Sn)≈nσ2 1+ρ1−ρ\operatorname{Var}(S_n) \approx n\sigma^2\,\frac{1 + \rho}{1 - \rho} for large nn. With ρ=0.5\rho = 0.5, error bars computed as if the data were independent are 3≈1.7\sqrt3 \approx 1.7 times too narrow.
  • Rare events. Bin(500,0.004)\text{Bin}(500, 0.004) has mean 2. The exact P(X≥6)=0.0163P(X \ge 6) = 0.0163 and the Poisson(2) approximation gives 0.01660.0166, but the normal with continuity correction gives 0.00660.0066. When npnp is small, use Poisson.
  • Far tails. The CLT controls absolute error, which is uniformly small, but relative error in the tails can be huge. Five-sigma estimates for sums of skewed or fat-tailed returns are unreliable; this is a common way risk models understate crashes.

Knowledge check

A random variable has finite mean and variance but an unknown distribution. What is the best guaranteed upper bound on the probability that it lies 3 or more standard deviations from its mean?

Knowledge check

A Monte Carlo estimate from 10,000 independent samples has standard error 0.02. Roughly how many samples do you need for a standard error of 0.01?

Knowledge check

X1,…,X100X_1, \dots, X_{100} are i.i.d. standard Cauchy. What is the distribution of their average Xˉ\bar X?

Knowledge check

X∼Bin(100,12)X \sim \text{Bin}(100, \tfrac12). Using the normal approximation with continuity correction, P(X≥60)P(X \ge 60) is approximated by which normal probability?

Key takeaways

  • sd⁡(Xˉn)=σ/n\operatorname{sd}(\bar X_n) = \sigma/\sqrt n: four times the data for half the error.
  • Chebyshev ⇒\Rightarrow weak LLN in one line. Chebyshev is distribution-free and loose.
  • CLT: Sn≈N(nμ,nσ2)S_n \approx N(n\mu, n\sigma^2) for i.i.d. finite-variance summands. Use the continuity correction for integer-valued sums.
  • Quick estimates: heads sd n/2\sqrt n/2, dice-sum sd 1.71n1.71\sqrt n, edges need n≈(2σ/edge)2n \approx (2\sigma/\text{edge})^2 to show at two sd.
  • The CLT fails without finite variance (Cauchy, Pareto with α<2\alpha < 2), misleads under dependence, for rare events (use Poisson) and in the far tails.

Practice problems

Finished reading?

Answer the 4 knowledge checks to complete this lesson (0 done).