Search

Search papers and lessons

Law of Large Numbers

Level 2 · 9 min read

The average of many independent samples settles near the true expected value, and the more samples you take, the closer it tends to get.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Sign in to see your progress

TL;DR

If you repeatedly draw independent values from the same distribution and average them, the average settles down. As the number of draws grows, the sample mean gets close to the expected value of a single draw, and the chance that it is far away shrinks toward zero.

This is why casinos profit, why polls work, and why simulation can stand in for a hard calculation. It does not say the average is right after a few draws, and it does not say that a streak of bad results is "owed" a correction.

Where you'll see it: in Monte Carlo estimation of integrals, in A/B tests that run until the averages are stable, and in the reason that the empirical frequency of heads in a long run of coin flips approaches one half.

Intuition

Averages need a crowd

Flip a fair coin once and you get 0 or 1, never one half. Flip it ten times and you might see seven heads, a 70 percent rate, which looks lopsided. Flip it ten thousand times and the rate will almost always sit very close to 50 percent. Each flip is unpredictable, but their average is far more stable than any single flip.

The reason is that each draw pushes the average a little, and the pushes are independent. Some go up and some go down, and over many draws they cancel. Early on the luck of a few draws can dominate. With many draws, each new value moves the average less and less, because it is only one share among many.

200400600800100000.20.40.60.81number of flipsfraction heads so far
  • true mean 0.5
  • running average of coin flips
The running fraction of heads wanders early and flattens out near one half. The data here is an illustrative sequence, not a recorded experiment.

The math

Setup

Let X1,X2,…X_1, X_2, \dots be random variables that are independent (see Statistical Independence) and identically distributed, each with expected value μ=E[Xi]\mu = \mathbb{E}[X_i]. Define the sample mean after nn draws as

Xˉn=1n∑i=1nXi.\bar{X}_n = \frac{1}{n} \sum_{i=1}^{n} X_i.

Here Xˉn\bar{X}_n is itself a random variable, because it depends on the draws. The law of large numbers says what happens to it as nn grows.

Weak law

The weak law states that for every fixed tolerance ε>0\varepsilon \gt 0,

lim⁡n→∞Pr⁡(∣Xˉn−μ∣≥ε)=0.\lim_{n \to \infty} \Pr\big(|\bar{X}_n - \mu| \geq \varepsilon\big) = 0.

In words: the chance the sample mean is farther than ε\varepsilon from μ\mu goes to zero. This is called convergence in probability.

If each XiX_i has finite variance σ2\sigma^2, the weak law follows from a short calculation. The variance of a sum of independent variables is the sum of their variances (this is where independence is used), so Var(Xˉn)=σ2/n\mathrm{Var}(\bar{X}_n) = \sigma^2 / n. Chebyshev's inequality then gives

Pr⁡(∣Xˉn−μ∣≥ε)≤σ2nε2.\Pr\big(|\bar{X}_n - \mu| \geq \varepsilon\big) \leq \frac{\sigma^2}{n \varepsilon^2}.

The right side goes to zero as nn grows, with ε\varepsilon fixed. That is the whole proof.

Strong law

The strong law states that Xˉn→μ\bar{X}_n \to \mu with probability 1. That is a stronger claim: the set of outcomes where the sample mean fails to converge has probability zero. It says that for almost every infinite sequence of draws, the running average really does settle. The weak law only says that at each large nn, a bad average is unlikely.

Rate

The weak law says nothing about speed. The central limit theorem fills that in: the typical size of Xˉn−μ\bar{X}_n - \mu is about σ/n\sigma / \sqrt{n}. To cut the typical error in half you need four times as many draws.

Worked examples

Example
How many rolls make the average close enough

A fair six-sided die has μ=3.5\mu = 3.5. Its variance is σ2=16(1+4+9+16+25+36)−3.52=916−12.25≈2.917\sigma^2 = \frac{1}{6}(1 + 4 + 9 + 16 + 25 + 36) - 3.5^2 = \frac{91}{6} - 12.25 \approx 2.917.

  1. Take n=100n = 100 rolls and tolerance ε=0.5\varepsilon = 0.5. The bound is 2.917100×0.25=0.117\frac{2.917}{100 \times 0.25} = 0.117.
  2. So the chance that the average of 100 rolls is off from 3.5 by at least 0.5 is at most about 12 percent.
  3. Take n=10,000n = 10{,}000 rolls and ε=0.1\varepsilon = 0.1. The bound is 2.91710000×0.01=0.029\frac{2.917}{10000 \times 0.01} = 0.029.
  4. So with 10,000 rolls, the chance of being off by 0.1 or more is at most about 3 percent.

Interpretation: the bound is loose, because Chebyshev's inequality works for any distribution. The real probabilities are smaller. The useful part is the scaling: multiplying nn by 100 cuts the bound by a factor of 100 at fixed ε\varepsilon and σ\sigma.

Example
Estimating pi by throwing darts

This is the simplest Monte Carlo calculation. Pick a point uniformly at random in the unit square [0,1]×[0,1][0, 1] \times [0, 1]. Let X=1X = 1 if the point lies inside the quarter circle of radius 1, and X=0X = 0 otherwise.

  1. The quarter circle has area π/4\pi/4 and the square has area 1, so μ=E[X]=π/4≈0.7854\mu = \mathbb{E}[X] = \pi/4 \approx 0.7854.
  2. Each indicator has variance μ(1−μ)≈0.7854×0.2146≈0.1685\mu(1 - \mu) \approx 0.7854 \times 0.2146 \approx 0.1685.
  3. The estimate of pi is 4Xˉn4 \bar{X}_n. Its standard error is 40.1685/n4\sqrt{0.1685 / n}.
  4. For n=10,000n = 10{,}000 points, the standard error is 4×0.1685/10000≈0.0164 \times \sqrt{0.1685 / 10000} \approx 0.016.
  5. So a typical run lands within about 0.03 of π\pi, which is roughly two standard errors.
  6. To get the error down to 0.001 you would need about (0.0164/0.001)2≈270(0.0164 / 0.001)^2 \approx 270 times as many points, around 2.7 million.

Interpretation: the law of large numbers guarantees the estimate converges to π\pi. The standard error tells you how fast, and it shows why Monte Carlo is useful for high-dimensional problems where grids would be impossible, but slow for high precision.

Tradeoffs and failure modes

The law is powerful, but its conditions matter.

SituationWhat goes wrongBetter choice
Draws are not independent (correlated time series)The average can converge to something other than μ\mu, or converge slowlyModel the dependence, for example with a [[markov-chain
Expected value does not exist (heavy tails, such as the Cauchy distribution)The sample mean does not settle at allUse the median, or a different scale
Too few draws for the questionEarly averages look stable but are notLook at the standard error, not the point estimate
Believing in "the law of averages" as a correctionAfter five heads, tails is not more likely next flipRemember the law concerns the long-run ratio, not compensation
Biased samplingAverages converge to the wrong value confidentlyFix the sampling process, since more samples cannot remove bias

The most common error is the gambler's fallacy. The law says the ratio of heads to flips approaches one half. It does not say the excess heads get paid back by future tails. The coin has no memory, so the absolute gap typically grows even as the ratio shrinks.

History

Jakob Bernoulli proved the first version, for coin-like events, and it was published posthumously in his Ars Conjectandi in 1713. He called it his "golden theorem" and hoped it could turn observed frequencies into estimates of probabilities. Siméon Denis Poisson gave the result its French name, "loi des grands nombres", in the 1830s.

Pafnuty Chebyshev proved a general version in the 1860s using the inequality that now bears his name. The modern forms came in the early twentieth century: Aleksandr Khinchin proved the weak law for independent identically distributed variables that need only a finite mean, and Andrey Kolmogorov proved the strong law in the early 1930s. These results made it possible to justify simulation and statistical estimation rigorously, and they are the reason the sample mean is trusted everywhere in data work.

Check yourself

QuestionA coin is fair. After 50 flips you have 30 heads. Does the law of large numbers say the next flips will be mostly tails?Show answer

No. The law concerns the long-run fraction of heads, and each flip is independent of the previous ones. The next flip is still heads with probability one half. The fraction 30/50 = 0.6 will drift toward 0.5 only because later flips add a large number of ordinary, unbiased results, not because tails are owed.

QuestionA variable has mean 10 and variance 4. Using Chebyshev's bound, how large an n do you need so that the probability the sample mean is off by 1 or more is at most 0.01?Show answer

The bound is σ2/(nε2)=4/(n×1)=4/n\sigma^2 / (n \varepsilon^2) = 4 / (n \times 1) = 4 / n. Setting 4/n≤0.014 / n \leq 0.01 gives n≥400n \geq 400. Four hundred independent draws are enough for this guarantee, though it is conservative.

QuestionCompute E[Xˉn]\mathbb{E}[\bar{X}_n] for draws with mean μ=7\mu = 7, and explain why it is not the reason the average converges.Show answer

By linearity of expectation, E[Xˉn]=1n∑E[Xi]=7\mathbb{E}[\bar{X}_n] = \frac{1}{n} \sum \mathbb{E}[X_i] = 7 for every nn, so the expected sample mean is always 7 and never moves toward anything new. Convergence is about the spread of Xˉn\bar{X}_n around 7, which shrinks as σ2/n\sigma^2 / n. Expected value alone does not show the average is stable.

QuestionYou want a Monte Carlo estimate of an integral to within 0.01 with a standard error of about that size. Roughly how does the number of samples scale as you halve the target error?Show answer

The standard error scales as σ/n\sigma / \sqrt{n}, so halving the error requires four times as many samples. Each halving of the error costs a factor of four in compute, which is why very high precision by plain Monte Carlo is expensive.

QuestionWhy is independence needed for the simple proof of the weak law, and what would break without it?Show answer

The proof uses Var(∑Xi)=∑Var(Xi)\mathrm{Var}(\sum X_i) = \sum \mathrm{Var}(X_i), which holds when the covariances vanish. Independence guarantees that. Without it, correlated draws can add their deviations together, so the variance of the sample mean may not fall like 1/n1/n, and the average can settle slowly or to the wrong value.

Sources