Skip to content
BIASED

The central limit theorem

Why the average of many independent variables is nearly normal, where the $\sqrt n$ scale comes from, error bars, the normal approximation to the binomial with the continuity correction, the rate of convergence, and when the theorem fails.

What the law left out

The topic The law of large numbers showed where an average goes: Xˉn→μ\bar X_n \to \mu. It also told us how far off the average typically is. For i.i.d. terms with variance σ2\sigma^2 the variances add, so

Var⁡(Xˉn)=σ2n,\operatorname{Var}(\bar X_n) = \frac{\sigma^2}{n},

and Xˉn\bar X_n usually misses μ\mu by something of the order of σ/n\sigma/\sqrt n. This number is the standard error.

What the law does not tell us is the shape of the misses. Chebyshev's inequality only promises that a miss of two standard errors or more has probability at most 1/41/4. In practice such a miss happens about once in twenty runs. To turn "about σ/n\sigma/\sqrt n" into honest probabilities, we need the whole distribution of Xˉn\bar X_n, not just its mean and variance.

Dice show what that distribution looks like. One fair die is flat: each face has probability 1/61/6. The sum of two dice is a triangle with its peak at 7, because the distribution of a sum of independent variables is the convolution of theirs (see the topic Joint distributions and independence). Three dice already give a rounded hump, and ten dice give something very close to a bell. Coins, waiting times and per-example losses do the same. This topic explains why, how fast, and when it breaks.

The theorem

Let X1,X2,…X_1, X_2, \dots be i.i.d. with mean μ\mu and finite variance σ2>0\sigma^2 > 0. Write Sn=X1+⋯+XnS_n = X_1 + \dots + X_n for the sum and Xˉn=Sn/n\bar X_n = S_n/n for the average. Subtract the mean of the average and divide by its standard error:

Zn=Xˉn−μσ/n.Z_n = \frac{\bar X_n - \mu}{\sigma/\sqrt n} .

This standardized average has mean 00 and variance 11 for every nn, so only its shape can still change. Let Φ\Phi be the CDF of N(0,1)\mathcal N(0, 1). The central limit theorem (CLT) says that for every zz

P(Zn≤z)→Φ(z)as n→∞.P(Z_n \le z) \to \Phi(z) \quad \text{as } n \to \infty .

Undoing the standardization gives the working form. For large nn

Xˉn≈N(μ,σ2n),Sn≈N(nμ,nσ2).\bar X_n \approx \mathcal N\Big(\mu, \frac{\sigma^2}{n}\Big), \qquad S_n \approx \mathcal N(n\mu, n\sigma^2) .

The assumptions are independence, identical distribution and a finite variance. Nothing is assumed about the shape: the terms may be discrete or continuous, symmetric or skewed. A single Exp⁡(1)\operatorname{Exp}(1) waiting time is strongly skewed. Yet the largest gap between the CDF of ZnZ_n and Φ\Phi is 0.1590.159 for one term, 0.0940.094 for two, 0.0600.060 for five and 0.0240.024 for thirty.

This is why the normal distribution is everywhere in ML. The error rate of a classifier on a test set, an average validation loss, a click count in an A/B test: each is a sum of many independent pieces, so each is nearly normal whatever the pieces look like.

Convergence in distribution

The CLT says nothing about the values of ZnZ_n, only about its CDF. This kind of convergence has its own name. A sequence YnY_n converges in distribution to YY if

P(Yn≤y)→P(Y≤y)P(Y_n \le y) \to P(Y \le y)

at every point yy where the CDF of YY is continuous. (The exception matters only for jumps: the constants 1/n1/n converge to 00, yet P(1/n≤0)=0P(1/n \le 0) = 0 for every nn, while P(0≤0)=1P(0 \le 0) = 1.)

The topic The law of large numbers met two stronger kinds: convergence in probability and almost surely. Each of them implies convergence in distribution, and not the other way round. Convergence in distribution is the weakest because it never compares the variables themselves. Take X∼N(0,1)X \sim \mathcal N(0, 1) and Yn=−XY_n = -X for every nn. By symmetry each YnY_n has exactly the distribution of XX, so Yn→XY_n \to X in distribution. But ∣Yn−X∣=2∣X∣\lvert Y_n - X \rvert = 2\lvert X \rvert never shrinks.

The standardized averages behave the same way. ZnZ_n does not settle on any particular value as data arrives: the correlation of ZnZ_n and Z2nZ_{2n} is 1/21/\sqrt 2 for every nn. What settles is the histogram of the values ZnZ_n could take.

Why root n, and why the bell

Why divide by n\sqrt n? The centred sum Sn−nμS_n - n\mu has mean 00 and variance nσ2n\sigma^2. Divide it by nan^a, and the variance becomes

Var⁡(Sn−nμna)=σ2n1−2a.\operatorname{Var}\Big(\frac{S_n - n\mu}{n^a}\Big) = \sigma^2 n^{1 - 2a} .

With a=1a = 1 we get Xˉn−μ\bar X_n - \mu, whose variance goes to 00: the law of large numbers, everything collapses to a point. With a=0a = 0 the spread grows without bound. Only a=1/2a = 1/2 keeps the spread fixed, and that is the only scale on which a shape can be seen.

Why the bell? Split 2n2n terms into two halves of nn. Each half gives its own standardized average, ZnZ_n and Zn′Z_n', and they are independent. A short computation shows

Z2n=Zn+Zn′2.Z_{2n} = \frac{Z_n + Z_n'}{\sqrt 2} .

So if the shape of ZnZ_n settles down, the limit must survive "add two independent copies and divide by 2\sqrt 2". The normal does: for independent Z,Z′∼N(0,1)Z, Z' \sim \mathcal N(0, 1) the sum is normal with variance 22 (see the topic The multivariate Gaussian), and (Z+Z′)/2(Z + Z')/\sqrt 2 is N(0,1)\mathcal N(0, 1) again. Among distributions with a finite variance it is the only one. A full proof uses characteristic functions and is beyond this course.

Every doubling also dilutes whatever made the terms special. The skewness E[(X−μ)3]/σ3\mathbb E[(X - \mu)^3]/\sigma^3 of a sum of nn terms is the skewness of one term divided by n\sqrt n: for Exp⁡(1)\operatorname{Exp}(1) it falls from 22 to 0.370.37 at n=30n = 30. Discreteness and bounded support fade the same way. Only μ\mu and σ2\sigma^2 survive, because the standardization uses them.

Error bars

The CLT turns the standard error into probabilities. For Z∼N(0,1)Z \sim \mathcal N(0, 1), P(∣Z∣≤1.96)=0.95P(\lvert Z \rvert \le 1.96) = 0.95. Since Xˉn≈N(μ,σ2/n)\bar X_n \approx \mathcal N(\mu, \sigma^2/n),

P(∣Xˉn−μ∣≤1.96 σn)≈0.95.P\Big(\lvert \bar X_n - \mu \rvert \le 1.96\, \frac{\sigma}{\sqrt n}\Big) \approx 0.95 .

The interval Xˉn±1.96 σ/n\bar X_n \pm 1.96\, \sigma/\sqrt n is the usual 95% error bar. Chebyshev's inequality would need 20≈4.47\sqrt{20} \approx 4.47 standard errors for the same guarantee, a bar 2.32.3 times wider. Chebyshev holds for every nn; the CLT is an approximation, but a much sharper one.

An accuracy is an average of 00/11 indicators, so σ2=p(1−p)\sigma^2 = p(1 - p). The true pp is unknown, and we plug in the observed accuracy; the topic Confidence intervals and the bootstrap will justify this. A classifier that scores 0.90.9 on 10001000 independent test examples has the error bar

±1.960.9⋅0.11000=±0.019.\pm 1.96 \sqrt{\frac{0.9 \cdot 0.1}{1000}} = \pm 0.019 .

An A/B test compares two averages. Say the conversion rates are 0.0200.020 and 0.0230.023, with 20 00020\,000 users in each group. The groups are independent, so the variances add, and the difference has standard error

0.02⋅0.9820 000+0.023⋅0.97720 000=0.00145.\sqrt{\frac{0.02 \cdot 0.98}{20\,000} + \frac{0.023 \cdot 0.977}{20\,000}} = 0.00145 .

The observed difference 0.0030.003 is 2.072.07 standard errors from zero. Whether that is convincing is the subject of the topic Hypothesis tests and A/B testing.

The binomial as a normal

A binomial count is a sum of nn independent Bern⁡(p)\operatorname{Bern}(p) indicators, so the CLT applies to it directly:

Bin⁡(n,p)≈N(np, np(1−p)).\operatorname{Bin}(n, p) \approx \mathcal N\big(np,\, np(1 - p)\big) .

This is the de Moivre–Laplace theorem from the 18th century, the first version of the CLT.

Take 100100 flips of a fair coin and the event "6060 heads or more". The mean is 5050 and the standard deviation 100⋅0.25=5\sqrt{100 \cdot 0.25} = 5. The exact probability is 0.02840.0284. The plain approximation P(Z≥(60−50)/5)=P(Z≥2)=0.0228P(Z \ge (60 - 50)/5) = P(Z \ge 2) = 0.0228 is noticeably off. The reason is that a count lives on integers: the value 6060 is a bar of width 11 that covers [59.5,60.5][59.5, 60.5]. Starting from the left edge of that bar,

P(Z≥59.5−505)=P(Z≥1.9)=0.0287,P\Big(Z \ge \frac{59.5 - 50}{5}\Big) = P(Z \ge 1.9) = 0.0287 ,

which almost removes the error. This shift by half a unit is the continuity correction, standard for counts.

The approximation needs the count to be far from its walls at 00 and nn. A common rule of thumb asks for npnp and n(1−p)n(1 - p) of at least about 1010. For Bin⁡(1000,0.001)\operatorname{Bin}(1000, 0.001) the mean is 11, P(X=0)=0.368P(X = 0) = 0.368, and the corrected normal gives 0.3080.308. For rare events the Poisson approximation from the topic Discrete distributions is the right tool.

How fast

The theorem is a limit, and nn is always finite. How wrong is the normal at a given nn? The Berry–Esseen theorem bounds the worst gap between the CDFs:

sup⁡z∣P(Zn≤z)−Φ(z)∣≤C E∣X−μ∣3σ3n,C≤0.4748.\sup_z \big\lvert P(Z_n \le z) - \Phi(z) \big\rvert \le \frac{C\, \mathbb E\lvert X - \mu \rvert^3}{\sigma^3 \sqrt n}, \qquad C \le 0.4748 .

In words: the error falls like 1/n1/\sqrt n, and its size is set by one number that grows with asymmetry and heavy tails. For a fair coin that number is 11. For Exp⁡(1)\operatorname{Exp}(1) it is about 2.412.41, and for a rare event with p=0.01p = 0.01 it is almost 1010.

The exponential sums from the first block follow this law closely. Their gaps 0.1590.159, 0.0940.094, 0.0600.060, 0.0240.024 at n=1,2,5,30n = 1, 2, 5, 30 are all close to 0.13/n0.13/\sqrt n.

The tails converge slowest. For a sum of 3030 exponentials P(Zn>2)=0.032P(Z_n > 2) = 0.032, while the normal says 0.0230.023: a 40% relative error, although the bell near the centre already looks perfect. So the popular "n=30n = 30 is enough" is not a theorem. How large nn must be depends on the distribution of the terms and on which probability you need.

When the theorem fails

The theorem has conditions, and each of them can fail in practice.

Infinite variance. The Cauchy distribution with density 1/(π(1+x2))1/(\pi(1 + x^2)) has tails so heavy that neither its mean nor its variance exists. The average of nn standard Cauchy variables is again standard Cauchy: averaging does not help at all. Tails like P(X>x)≈x−αP(X > x) \approx x^{-\alpha} with 1<α<21 < \alpha < 2 have a finite mean but an infinite variance. Their sums do settle after centring, but the scale is n1/αn^{1/\alpha} instead of n\sqrt n, and the limit is a heavy-tailed stable distribution, not the normal.

One term dominates. For independent terms that are not identically distributed, the CLT still holds as long as no single term carries a noticeable share of the total variance (the Lindeberg condition). A sum of one huge measurement error and many small ones has the shape of the huge one.

Dependence. Several test examples from the same user, several pages from the same document: such data are clustered. The effective number of independent observations is smaller than nn, and the real standard error is larger than σ/n\sigma/\sqrt n. Weakly dependent sequences, such as the Markov chains later in the course, still obey a CLT, but with a larger variance.

Not a sum. The theorem is about sums and averages. The maximum of nn variables, for example, tends to an extreme-value distribution, not to the normal.

This closes the probability half of the course. So far the distribution was known, and we asked how averages of its samples behave. Statistics turns the question around: given the data, what can we say about the unknown distribution? The average Xˉn\bar X_n is already our first estimator of μ\mu, and the CLT describes its error. The next topic, Estimators: bias and variance, asks what makes an estimator good in general, and measures it with bias, variance and mean squared error.

Check your understanding

The same questions as in Pulse. Answers are shared between modes.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • CLT histogram of sample meansoptional

    Sample means of size n; match std to σ/√n and a Normal shape.

    ~20 min · easier on a computer · The matching course topic has been read.

    Self-check in the notebook — not part of mastery or the certificate.

Full notes

Answers are saved on the server and tied to this browser until you sign in.