1.3.15Probability & Statistics

Central limit theorem

2,730 words12 min readdifficulty · medium6 backlinks

Definition

WHAT does each piece mean?

  • i.i.d.: Each sample is drawn independently from the same distribution
  • μ\mu: The true population mean we're estimating
  • σ2\sigma^2: The true population variance (spread of individual data points)
  • σ/n\sigma/\sqrt{n}: Standard error of the mean—how much sample means vary around μ\mu

Derivation from First Principles

GOAL: Prove that standardized sample means approach N(0,1)\mathcal{N}(0, 1).

Step 1: Why Standardize?

We want to compare distributions of different scales. Standardization transforms any random variable to zero mean and unit variance: Z=XE[X]Var(X)Z = \frac{X - \mathbb{E}[X]}{\sqrt{\text{Var}(X)}}

WHY this transformation? It makes the comparison "fair"—all variables now live on the same scale.

For the sample mean:

  • E[Xˉn]=E[1ni=1nXi]=1ni=1nE[Xi]=1n(nμ)=μ\mathbb{E}[\bar{X}_n] = \mathbb{E}\left[\frac{1}{n}\sum_{i=1}^{n}X_i\right] = \frac{1}{n}\sum_{i=1}^{n}\mathbb{E}[X_i] = \frac{1}{n}(n\mu) = \mu
  • Var(Xˉn)=Var(1ni=1nXi)\text{Var}(\bar{X}_n) = \text{Var}\left(\frac{1}{n}\sum_{i=1}^{n}X_i\right)

WHY can we pull out 1/n21/n^2? Because Var(cX)=c2Var(X)\text{Var}(cX) = c^2\text{Var}(X): =1n2Var(i=1nXi)= \frac{1}{n^2}\text{Var}\left(\sum_{i=1}^{n}X_i\right)

WHY can we sum the variances? Independence: Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y) when XYX \perp Y: =1n2i=1nVar(Xi)=1n2(nσ2)=σ2n= \frac{1}{n^2}\sum_{i=1}^{n}\text{Var}(X_i) = \frac{1}{n^2}(n\sigma^2) = \frac{\sigma^2}{n}

Therefore: Xˉn\bar{X}_n has mean μ\mu and variance σ2/n\sigma^2/n.

Step 2: Moment Generating Functions (The Proof Engine)

The moment generating function (MGF) of a random variable YY is: MY(t)=E[etY]M_Y(t) = \mathbb{E}[e^{tY}]

WHY use MGFs? Key theorem: If MYn(t)MY(t)M_{Y_n}(t) \to M_Y(t) for all tt, then YndYY_n \xrightarrow{d} Y. MGFs uniquely characterize distributions.

For standard normal: MN(0,1)(t)=et2/2M_{\mathcal{N}(0,1)}(t) = e^{t^2/2}

Step 3: MGF of Standardized Sample Mean

Define standardized variables: Yi=XiμσY_i = \frac{X_i - \mu}{\sigma}

Then E[Yi]=0\mathbb{E}[Y_i] = 0, Var(Yi)=1\text{Var}(Y_i) = 1, and: Zn=Xˉnμσ/n=i=1n(Xiμ)nσ/n=1ni=1nYiZ_n = \frac{\bar{X}_n - \mu}{\sigma/\sqrt{n}} = \frac{\sum_{i=1}^{n}(X_i - \mu)}{n\cdot\sigma/\sqrt{n}} = \frac{1}{\sqrt{n}}\sum_{i=1}^{n}Y_i

WHY this form? We've reduced the problem to standardized variables.

The MGF is: MZn(t)=E[exp(tni=1nYi)]M_{Z_n}(t) = \mathbb{E}\left[\exp\left(\frac{t}{\sqrt{n}}\sum_{i=1}^{n}Y_i\right)\right]

WHY can we split the product? Independence + exponential property ea+b=eaebe^{a+b} = e^a \cdot e^b: =E[i=1nexp(tnYi)]=i=1nE[exp(tnYi)]= \mathbb{E}\left[\prod_{i=1}^{n}\exp\left(\frac{t}{\sqrt{n}}Y_i\right)\right] = \prod_{i=1}^{n}\mathbb{E}\left[\exp\left(\frac{t}{\sqrt{n}}Y_i\right)\right]

Since YiY_i are identically distributed: =[E[etY1/n]]n=[MY1(tn)]n= \left[\mathbb{E}\left[e^{tY_1/\sqrt{n}}\right]\right]^n = \left[M_{Y_1}\left(\frac{t}{\sqrt{n}}\right)\right]^n

Step 4: Taylor Expansion

WHY Taylor series? As nn \to \infty, t/n0t/\sqrt{n} \to 0, so we can approximate the MGF.

For small ss: MY1(s)=E[esY1]=E[1+sY1+s2Y122+s3Y136+]M_{Y_1}(s) = \mathbb{E}[e^{sY_1}] = \mathbb{E}\left[1 + sY_1 + \frac{s^2Y_1^2}{2} + \frac{s^3Y_1^3}{6} + \cdots\right]

=1+sE[Y1]+s22E[Y12]+s36E[Y13]+O(s4)= 1 + s\mathbb{E}[Y_1] + \frac{s^2}{2}\mathbb{E}[Y_1^2] + \frac{s^3}{6}\mathbb{E}[Y_1^3] + O(s^4)

Since E[Y1]=0\mathbb{E}[Y_1] = 0 and E[Y12]=1\mathbb{E}[Y_1^2] = 1: MY1(s)=1+s22+O(s3)M_{Y_1}(s) = 1 + \frac{s^2}{2} + O(s^3)

Substitute s=t/ns = t/\sqrt{n}: MY1(tn)=1+t22n+O(1n3/2)M_{Y_1}\left(\frac{t}{\sqrt{n}}\right) = 1 + \frac{t^2}{2n} + O\left(\frac{1}{n^{3/2}}\right)

Step 5: Taking the Limit

MZn(t)=[1+t22n+O(1n3/2)]nM_{Z_n}(t) = \left[1 + \frac{t^2}{2n} + O\left(\frac{1}{n^{3/2}}\right)\right]^n

WHY does this approach et2/2e^{t^2/2}? Recall the limit definition of exe^x: limn(1+xn)n=ex\lim_{n\to\infty}\left(1 + \frac{x}{n}\right)^n = e^x

Here x=t2/2x = t^2/2: limnMZn(t)=limn(1+t2/2n)n=et2/2\lim_{n\to\infty}M_{Z_n}(t) = \lim_{n\to\infty}\left(1 + \frac{t^2/2}{n}\right)^n = e^{t^2/2}

This is the MGF of N(0,1)\mathcal{N}(0, 1). Therefore ZndN(0,1)Z_n \xrightarrow{d} \mathcal{N}(0, 1). ∎

Figure — Central limit theorem

Examples

Common Mistakes

Active Recall Questions

Recall Feynman Explanation: Teach to a 12-year-old

Imagine you have a bucket of different colored marbles—some red, some blue, some green, all mixed up randomly. If you grab just ONE marble, you have no idea what you'll get. Could be anything!

But here's the magic: If you grab 30 marbles and count how many reds you got, then put them back and do this over and over, something weird happens. Even though the bucket is random chaos, the number of reds you count each time starts to follow a pattern—a bell curve! Most of the time you'll get close to the average, rarely you'll get way too many or way too few.

Why does this matter? It means that even when individual things are totally random and unpredictable, when you look at averages of many things, they become predictable! That's why scientists can trust survey results even though individual people are different. That's why your teacher can grade a test fairly—your class average tells them something real, even though each student is unique.

The Central Limit Theorem is like nature's way of saying: "Chaos + Averaging = Order."

#flashcards/ai-ml

What is the Central Limit Theorem in one sentence? :: The CLT states that the distribution of sample means approaches a normal distribution as sample size increases, regardless of the population's distribution (assuming finite variance).

What are the three requirements for CLT to apply?
1) Samples must be independent, 2) Samples must be identically distributed (same population), 3) Population variance must be finite.

How does the standard error of the mean change with sample size? :: Standard error = σ/√n, so it decreases proportionally to the square root of n. To halve the error, you need 4× the sample size.

If population std dev is σ = 10 and n = 100, what is the standard error?
SE =10/√100 = 10/10 = 1
Why does CLT matter for machine learning?
CLT justifies using gradient descent (noisy gradient estimates converge), confidence intervals for model performance, hypothesis testing, and statistical inference on predictions despite non-normal data.
What distribution does the standardized sample mean follow?
Standard normal distribution N(0, 1) as n → ∞.
What is the formula for standardizing a sample mean?
Z = (X̄ₙ - μ)/(σ/√n)
Does CLT make the underlying data normal?
No! CLT makes the distribution of sample means normal. Individual data points keep their original distribution.
What is the "n ≥ 30" rule and when does it fail?
Common heuristic that CLT approximation is good for n ≥ 30. Fails for heavily skewed or heavy-tailed distributions (need much larger n) and nearly-normal distributions (works for smaller n).
For95% confidence interval, the sample mean is within how many standard errors of μ?
Within ±1.96 standard errors (critical value from standard normal).

Connections

  • Law of Large Numbers: Related but distinct—LN says sample mean converges to population mean; CLT describes the distribution of that convergence
  • Normal Distribution: CLT explains why Gaussians appear everywhere in nature—they're the limit of averaged processes
  • Confidence Intervals: CLT provides theoretical foundation for constructing CIs around sample means
  • Hypothesis Testing: t-tests and z-tests rely on CLT for validity with large samples
  • Stochastic Gradient Descent: CLT explains why noisy mini-batch gradients lead to convergence
  • Bootstrap Methods: Non-parametric alternative when CLT assumptions (independence, finite variance) fail
  • Sample Size Calculation: Uses CLT to determine how much data needed for desired precision
  • Monte Carlo Methods: Simulation accuracy improves via CLT—averaging many random samples
  • Maximum Likelihood Estimation: Asymptotic normality of MLEs is a consequence of CLT
  • Bias-Variance Tradeoff: CLT explains why variance of estimators decreases as O(1/n)

Concept Map

averaged into

has mean mu and variance sigma squared

expected value equals

variance equals

square root gives

used to

converges in distribution

proof engine for

uniquely characterize

foundation of

enables

i.i.d. random variables

Sample mean X-bar_n

Population parameters

Mean mu

Variance sigma squared over n

Standard error

Standardize Z_n

Standard Normal N 0,1

Moment generating functions

Distributions

Statistical inference in ML

t-tests, confidence intervals, gradient methods

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Central Limit Theorem ek bohot powerful idea hai probability mein. Socho ki tumhare pas koi bhi random data hai—chahe wo uniform ho (jaise dice), chahe exponential (jaise customer arrivals), ya phir bilkul ajeb distribution. Abagar tum is data se samples lo aur unka average nikalo, phir ye processbaar baar repeat karo, to kya hoga?

Magic yeh hai ki jaise jaise tumhara sample size badhta hai (zyada dice roll karo ya zyada data points lo), in averages ka distribution ek beautiful bell curve (normal distribution) ban jata hai! Ye chahe original data kitna bhi weird ho. Ye theorem kehta hai ki standard error (yani average kitna fluctuate karega) √n se decrease hoti hai. Matlabagar precision ko double karna hai to 4 guna data chahiye hoga. Machine learning mein ye bohot zaroori hai kyunki gradient descent jaise algorithms noisy estimates use karte hain—CLT guarantee deta hai ki average gradients reliable honge. A/B testing, confidence intervals, hypothesis tests—sab CLT pe depend karte hain. Ye basically kehta hai: chaos + averaging = predictability!

Practical tip: Hamesha check karo ki tumhara data independent hai aur variance finite hai. Agar time series ya heavy-tailed distributions hain to CLT directly apply nahi hoga, bootstrap ya special methods use karne padenge.

Go deeper — visual, from zero

Test yourself — Probability & Statistics

Connections