Skip to content
All apps

Law of large numbers

About this app

Coin, die, biased coin and Cauchy: the running mean enters the ε-tube around μ, with the exact probability of lying inside next to the Chebyshev bound.

The statistics

The (weak) law of large numbers says that for independent, identically distributed trials with mean μ, the running mean x̄ₙ lies within the band μ ± ε with a probability that tends to 1, however narrow ε is. For coin tosses x̄ₙ is the relative frequency of heads and μ = p. Chebyshev’s inequality gives a bound that holds for every distribution with variance σ²: P(|x̄ₙ − μ| ≥ ε) ≤ σ²/(nε²). Without a mean, as with the Cauchy distribution, the law does not hold.

What you see

One run plots the mean x̄ₙ against the number of trials n, with an ε-band around μ. You can choose a coin, a die, a biased coin with adjustable p, or the Cauchy distribution. An ensemble of 120 further runs shows how many means behave at once. The lower chart puts the exact probability of lying in the band next to the Chebyshev bound and the share of the ensemble inside the band. A values panel lists n, x̄ₙ, σ², the bound and the n₀ from which Chebyshev guarantees 95 %.

Things to try

Start with the coin and jump straight to n = 10, 100, 1000 and 10⁵: the swings get smaller and more ensemble runs stay inside the band. Narrow ε and compare how much later the exact curve reaches 95 % and how much later still Chebyshev does. Set the biased coin to p = 0.7 and watch the mean head towards 0.7. Switch to Cauchy: single huge values keep throwing the mean off course, and the share inside the band does not grow.

Frequently asked questions

What does the law of large numbers say?
The law of large numbers says that the mean of many independent repetitions of a random experiment approaches the expected value. For coin tosses the relative frequency of heads approaches the probability p. It does not say that individual deviations have to even out.
What is the gambler’s fallacy?
The gambler’s fallacy is the belief that after a run of heads, tails is “due”. With independent tosses the probability stays the same on every toss. The relative frequency approaches p because early deviations are diluted by the growing number of tosses, not because they are cancelled out.
What is Chebyshev’s inequality?
Chebyshev’s inequality bounds how likely a random variable is to stray far from its mean: P(|X − μ| ≥ k) ≤ σ²/k². Applied to the mean of n trials it gives σ²/(nε²). The bound holds for every distribution with finite variance but is usually loose.
What can I set in the law of large numbers app?
You choose coin, die, biased coin or Cauchy, set p and the half-width ε, start a run at three speeds or jump straight to n = 10 up to 10⁵. An ensemble of 120 runs and the Chebyshev panel show how reliably the mean ends up in the band.

Subject: Statistics

More from Statistics

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps