The law of large numbers
大数定律
Show what repeated averaging guarantees, prove a finite-variance bound, and distinguish probability convergence from pathwise convergence.
law-large-numbersMore measurements, a steadier average
A fair coin need not produce half heads in ten flips. In fact, the probability that the head fraction differs from one half by at least 0.1 is about 0.754. After one hundred independent flips it is about 0.0569; after two hundred, about 0.00569. These are exact binomial probabilities rounded for display, not simulation results.
The law of large numbers explains why averages concentrate around an expectation under suitable assumptions. It does not promise that the next observation will compensate for previous ones, or that every longer prefix is closer to the mean. The coin has no memory of the imbalance. MIT Introduction to Probability, Lecture 18, slides 6–9
Make “gets closer” precise
Let be independent and identically distributed real random variables, with and mean . Define . The weak law says
This is convergence in probability. Fix an error tolerance first, then ask how likely a sample average is to fall outside it as the sample size grows. The condition on the absolute first moment ensures a finite, well-defined expectation. Finite variance is a stronger sufficient assumption that gives a particularly short proof. MIT 6.436J, Lecture 17, Theorem 3
Assume additionally . Linearity of expectation and independence give
For any nonnegative random variable W, when . Taking expectations proves Markov’s inequality. Set and to obtain Chebyshev’s bound:
The right side tends to zero, proving the finite-variance weak law. For a fair coin, . At n=100 and tolerance 0.1, the bound is 0.25 while the actual probability is about 0.0569. A valid bound can be loose. To make this bound at most , it suffices to choose ; this is a sufficient sample-size rule, not the smallest possible n.
The strong law makes a statement about whole infinite outcome sequences:
It holds under the same i.i.d. and finite-absolute-first-moment assumptions. Almost every sample path eventually stays within each fixed tolerance, though the time at which this happens depends on the path. This is stronger than inspecting one sample size at a time. The proof above establishes the weak law only; proving the strong law needs another argument. Sheffield, Lecture 32, slides 10–12
Count all coin outcomes without listing them
The program computes the exact probability of a deviation at least epsilon for a fair-coin mean. A recurrence generates the integer binomial coefficients, and Fraction keeps the boundary comparison exact. No random seed or simulated path is involved.
from fractions import Fraction as F
def fair_coin_tail(n, epsilon):
if type(n) is not int or not 1 <= n <= 2000 or not isinstance(epsilon,F) or epsilon <= 0:
raise ValueError("integer n in [1,2000] and positive Fraction epsilon required")
count = 0
coefficient = 1
for k in range(n+1):
if abs(F(k,n)-F(1,2)) >= epsilon:
count += coefficient
if k<n:
coefficient = coefficient*(n-k)//(k+1)
exact = F(count,2**n)
bound = min(F(1),F(1,4)/(n*epsilon**2))
return exact,bound
for n in [10,50,100,200]:
probability,bound = fair_coin_tail(n,F(1,10))
assert probability <= bound
print(n,round(float(probability),6),float(bound))
assert fair_coin_tail(10,F(1,10))[0] == F(193,256)
assert fair_coin_tail(100,F(1))[0] == 0
assert fair_coin_tail(5,F(1,2))[0] == F(1,16)
There are n+1 count states instead of ordered sequences. The loop uses integer/rational steps and a constant number of accumulator objects. Those objects are not constant-size machine words: binomial coefficients need bits, and exact arithmetic has additional bit complexity. The n cap keeps this teaching calculation modest.
| Flips n | Exact tail, rounded | Chebyshev upper bound |
|---|---|---|
| 10 | 0.753906 | 1.000000 |
| 50 | 0.202639 | 0.500000 |
| 100 | 0.056888 | 0.250000 |
| 200 | 0.005685 | 0.125000 |
These selected values illustrate concentration. They do not prove that an exact discrete tail decreases at every consecutive n; event boundaries move as the count grid changes.
Averaging cannot remove shared bias
If every measurement equals the same random Z, all observations share its noise and their average remains Z. Independence has failed. For measurements satisfying the stated i.i.d. and finite-absolute-first-moment conditions, adding a fixed calibration bias b shifts the limiting average from the intended mean to that mean plus b. More samples do not fix that target mismatch.
Infinite-variance distributions need not defeat every law of large numbers: i.i.d. variables with a finite absolute first moment still satisfy the laws stated above. What fails is the finite-variance Chebyshev proof and its rate. When the expectation itself is undefined, there may be no finite mean for averages to estimate. Dependent observations can obey other laws under suitable conditions, but the i.i.d. proof cannot simply be reused.
The law describes a sample mean, not the shape of individual observations. A histogram with fixed bins can be studied by applying the law to bin-membership indicators. Letting the number or width of bins change requires additional analysis; a vague histogram resemblance is not the theorem.
What does “enough samples” buy?
- With variance four, tolerance 0.2 and tail bound 0.05, what n suffices by Chebyshev? Answer: .
- If the first nine fair flips are heads, is the next flip more likely tails? Answer: no; independence leaves each probability at one half.
- Does the weak-law proof given here prove almost-sure convergence? Answer: no. It bounds each fixed-n event, without establishing a statement about all sufficiently late n along almost every path.
- Does an infinite variance automatically rule out the i.i.d. strong law? Answer: no; a finite absolute first moment suffices, though the displayed variance bound is unavailable.
From averages to uncertainty estimates
Sample losses, Monte Carlo averages, and empirical frequencies all use this logic. A trustworthy application names the quantity being averaged and checks the sampling assumptions. The central limit theorem studies the distribution of properly rescaled fluctuations; covariance explains why shared variation can prevent the familiar variance reduction.
Make a prediction, then check
The first nine fair-coin flips are heads. What is the probability of tails next?
Learning objectives
- Derive the finite-variance law and a sufficient sample size using Markov and Chebyshev inequalities.
- Distinguish convergence in probability from almost-sure convergence, and random error from shared noise and systematic bias.
Prerequisites & connections
- Expectation and variance
- Independence and conditional independence
- Bernoulli and binomial distributions
References
- Introduction to Probability — Lecture 18: Inequalities, Convergence, and the Weak Law of Large Numbers
John Tsitsiklis; Patrick Jaillet; MIT OpenCourseWare · 2018 - Fundamentals of Probability — Lecture 17: Laws of Large Numbers and Central Limit Theorem
Yury Polyanskiy; MIT OpenCourseWare · 2018 - Probability and Random Variables — Lecture 32: Strong law of large numbers and Jensen’s inequality
Scott Sheffield; MIT OpenCourseWare · 2014
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-05 · Codex multi-agent technical check: primary-source verification, derivation and numerical assertions, bilingual comparison, and review by another agent or the parent; no independent human peer review.
- Enumerated every coin sequence for n=1 through 12 and four rational tolerances, checking tails and boundaries; separately verified variance reduction and Chebyshev bounds with eight exact convolutions.
- Checked weak/strong quantifiers and proof scope; did not copy a lecture typo replacing the strong-law average with Xn, and did not claim monotone convergence of observed averages.
- A second Codex agent independently reviewed the chapter; the fixed-bias example was tightened to retain i.i.d. and integrability assumptions.
- The parent executed all 25 independent probability checks; bilingual code, display equations, main anchors, sources and exercises were additionally compared.
Source locations checked:
- Introduction to Probability — Lecture 18: Inequalities, Convergence, and the Weak Law of Large Numbers · Slides 2–9; slide 6 visually inspected, i.i.d./finite variance and probability convergence
- Fundamentals of Probability — Lecture 17: Laws of Large Numbers and Central Limit Theorem · §3 Theorem 3 and Chebyshev proof, PDF5; finite absolute first moment distinguished from finite variance
- Probability and Random Variables — Lecture 32: Strong law of large numbers and Jensen’s inequality · Slides 10–12; sample-average almost-sure limit and strong-to-weak implication
Related topics