Home

Law of Large Numbers

Simulate the sample mean at various n to visualize convergence of the LLN.

展开更多 ▾
X̄ₙ → E(X) as n→∞
Increasing n to watch the sample mean converge

📖 Tutorial | Law of Large Numbers

1. Definition
Law of Large Numbers (LLN): for i.i.d. X₁,…,Xₙ with mean μ, the sample mean X̄ₙ converges in probability to μ as n grows. The more trials, the more stable the average.
2. Symbols
SymbolMeaning
X̄ₙmean of n samples
μ=E(X)population expectation
nsample size
convergence in prob.larger n ⇒ smaller chance of a large deviation
3. How it works
  • A fixed seed gives reproducible samples;
  • It computes the mean for n=10,100,1000,…;
  • The mean should hug the theory as n grows;
  • Try uniform, Bernoulli or exponential.
4. Steps
  1. Pick a distribution;
  2. Enter a comma-separated list of increasing n;
  3. Click Calculate and read each row;
  4. Check whether the largest n is closest to μ.
5. Example
Example: Uniform U(0,1), mean 0.5. At n=10 the mean may be 0.4–0.6; at n=100000 it usually lands near 0.495–0.505, close to 0.5.
6. Pitfalls
Large n only guarantees closeness “with high probability”, not every run;
A fixed seed is reproducible but the trend is the same with another seed;
The sample mean is random—do not treat one run as a proof.

❓ FAQ | Law of Large Numbers

Why does the mean approach the expectation?
Fluctuations cancel over many independent repetitions, leaving the stable expected term.
Does larger n always mean closer?
Convergence is in probability: very likely closer, but occasional deviation remains.
What are the three expectations?
Uniform U(0,1): 0.5; Bernoulli p=0.5: 0.5; Exponential λ=1: 1.
How is it different from the CLT?
LLN: the mean converges to μ; CLT: the fluctuations of the mean are normal.
Why use a fixed seed?
To make results reproducible for teaching; real Monte Carlo differs but converges the same.