TExcelTAD
Home › Probability Theory › The Central Limit Theorem

The Central Limit Theorem

The central limit theorem (CLT) is the reason the normal distribution is everywhere. It says that the sum of many independent random variables, whatever their individual distribution, is approximately normal. Dice, waiting times, measurement errors: add enough of them and the bell curve appears.

Statement

Let X1,X2,…X_1, X_2, \ldots be independent with the same distribution, mean μ\mu and finite variance σ2>0\sigma^2 > 0. Let Sn=X1+⋯+XnS_n = X_1 + \cdots + X_n. Then for all a<ba < b,

Pr⁡[a≤Sn−nμσn≤b]  ⟶  Φ(b)−Φ(a)as n→∞\Pr\left[a \le \frac{S_n - n\mu}{\sigma\sqrt{n}} \le b\right] \;\longrightarrow\; \Phi(b) - \Phi(a) \quad \text{as } n \to \infty

Equivalently, the average Xˉn\bar{X}_n is approximately normal with mean μ\mu and standard deviation σ/n\sigma/\sqrt{n}. The law of large numbers says Xˉn→μ\bar{X}_n \to \mu; the CLT says the error is about σ/n\sigma/\sqrt{n} times a standard normal.

The Bernoulli case is the special case where each XiX_i is 0 or 1. A proof for the general case uses moment generating functions: the MGF of the standardized sum tends to et2/2e^{t^2/2}, the MGF of the standard normal.

Watching it happen

Start from a very non-normal distribution, the exponential (skewed, all mass on one side), and standardize sums of nn copies. Compare quantiles with those of the standard normal:

python · try it yourself
import numpy as np

rng = np.random.default_rng(1)
normal_q = np.array([-1.645, -1.0, 0.0, 1.0, 1.645])      # 5%, 16%, 50%, 84%, 95% quantiles
print("normal quantiles:      ", normal_q.tolist())
for n in [1, 5, 30, 200]:
    S = rng.exponential(1.0, size=(100_000, n)).sum(axis=1)
    Z = (S - n) / np.sqrt(n)                               # mean n, sd sqrt(n)
    q = np.quantile(Z, [0.05, 0.16, 0.5, 0.84, 0.95])
    print(f"n={n:3d} sum quantiles:  ", np.round(q, 3).tolist())
normal quantiles:       [-1.645, -1.0, 0.0, 1.0, 1.645]
n=  1 sum quantiles:   [-0.949, -0.824, -0.309, 0.819, 1.978]
n=  5 sum quantiles:   [-1.357, -0.964, -0.159, 0.953, 1.846]
n= 30 sum quantiles:   [-1.526, -0.981, -0.055, 0.986, 1.739]
n=200 sum quantiles:   [-1.604, -0.996, -0.018, 0.991, 1.676]

For n=1n = 1 the quantiles are far from normal (the median is below the mean, the left tail is cut off at −1-1). By n=30n = 30 they are close, and by n=200n = 200 very close. Skewed distributions need larger nn than symmetric ones; the uniform is close to normal already at n=12n = 12 (Sums of Continuous Variables).

The CLT for the mean of any data

The CLT applies to sample means of any data source with finite variance, which is why the sampling distribution of the mean is approximately normal even for skewed populations. The Statistics course uses this for confidence intervals and tests.

python · try it yourself
import numpy as np

rng = np.random.default_rng(2)
# a weird population: 70% zeros, 20% values around 5, 10% values around 50
def draw(size):
    u = rng.random(size)
    return np.where(u < 0.7, 0.0, np.where(u < 0.9, rng.normal(5, 1, size), rng.normal(50, 10, size)))

pop = draw(1_000_000)
mu, sigma = pop.mean(), pop.std()
n = 100
means = draw((50_000, n)).mean(axis=1)
z = (means - mu) / (sigma / np.sqrt(n))
print("population mean and sd:", round(mu, 3), round(sigma, 3))
print("sd of sample means:", round(means.std(), 4), " sigma/sqrt(n):", round(sigma / np.sqrt(n), 4))
print("P(|Z| < 1.96) for sample means:", round(np.mean(np.abs(z) < 1.96), 4), " normal: 0.95")
population mean and sd: 6.004 15.149
sd of sample means: 1.5151  sigma/sqrt(n): 1.5149
P(|Z| < 1.96) for sample means: 0.9515  normal: 0.95

When the CLT fails

  • Infinite variance: sums of Cauchy or Pareto variables with α<2\alpha < 2 are not asymptotically normal; they converge to other "stable" laws, with heavy tails.
  • Strong dependence: sums of correlated variables can behave differently; the CLT has versions for weakly dependent sequences, but not for all.
  • Small nn with skew: the approximation can be poor in the tails, which matters for rare events.

In software

The CLT justifies normal-based error bars on benchmarks (average many runs), confidence intervals in A/B tests, and the use of Gaussian noise models. It is also why the averaged gradient of a large mini-batch is roughly normal around the true gradient, a fact used in the theory of stochastic gradient descent.

Exercises

Exercise 1: Sum of dice

Approximate the probability that the sum of 100 dice is at least 370.

Answer

About 0.12.

Solution

Mean 350, standard deviation 100⋅35/12≈17.08\sqrt{100 \cdot 35/12} \approx 17.08. With continuity correction, z=(369.5−350)/17.08≈1.14z = (369.5 - 350)/17.08 \approx 1.14, and 1−Φ(1.14)≈0.1271 - \Phi(1.14) \approx 0.127.

Exercise 2: Waiting times

A process has 50 independent stages, each exponential with mean 2 seconds. Approximate the probability that the total exceeds 120 seconds.

Answer

About 0.08.

Solution

Total mean 100, variance 50⋅4=20050 \cdot 4 = 200, standard deviation 14.1414.14. z=20/14.14=1.41z = 20/14.14 = 1.41, and 1−Φ(1.41)≈0.0791 - \Phi(1.41) \approx 0.079. (The exact gamma probability is about 0.084: the right tail is a little heavier than normal.)

Exercise 3: Check Exercise 2 (code)

Simulate the total of 50 exponential stages 200,000 times and estimate the probability of exceeding 120.

Answer

About 0.085 (the exact value is 0.0844), slightly above the normal approximation.

Solution
python · try it yourself
import numpy as np

rng = np.random.default_rng(3)
T = rng.gamma(shape=50, scale=2.0, size=200_000)      # sum of 50 exponentials with mean 2
print(round((T > 120).mean(), 4))
0.0856

Test yourself

The CLT requires the summed variables to have…

  1. a normal distribution
  2. finite variance (and be independent, identically distributed)
  3. a symmetric distribution
  4. integer values

The average of nn i.i.d. variables with standard deviation σ\sigma is approximately normal with standard deviation…

  1. σ\sigma
  2. σ/n\sigma/n
  3. σ/n\sigma/\sqrt{n}
  4. σn\sigma\sqrt{n}