📘 CodingMarble Learn

The Law of Large Numbers

If you repeat the same random experiment many times, the relative frequency of an event gets closer and closer to its probability p. More precisely, for any small distance ε, the chance that the frequency (or the sample mean) is farther than ε from the true value goes to 0 as the number of trials n grows. Chebyshev's inequality gives a bound: P(|X̄ − μ| ≥ ε) ≤ σ² ÷ (nε²).

🎬 Step-by-step story

  1. Flip a coin once. It shows heads or tails. One flip tells us almost nothing about the chance of heads.
  2. Flip it 10 times and count heads. Frequency = heads ÷ flips. It may be 0.3 or 0.7, far from 0.5.
  3. Keep flipping up to 2000 times. The running frequency jumps at first, then settles close to 0.5.
  4. Five different runs with the same coin all squeeze into the band 0.5 ± 0.1 as n grows. This is the law of large numbers.
  5. Chebyshev's inequality says how sure we are: the chance of being outside the band is at most p(1 − p) ÷ (nε²).
  6. Your turn: choose a coin or a die and change n. Watch every run enter the band and the bound shrink.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why can't one flip tell us the probability?

One flip gives frequency 0 or 1, never 0.5. Chance shows itself only over many trials.

Is something wrong if I get 7 heads in 10 tosses?

No. Small samples vary a lot; that is normal. Watch the columns in step 1.

Will heads and tails become exactly equal?

No. The proportion gets close to 0.5, but the counts can still differ by many.

Does every run get close, or just on average?

With large n almost every run ends inside the band; step 3 shows five runs squeezing in.

Why is Chebyshev's answer so much bigger than what we see?

It must work for every distribution, so it is cautious. The true chance is usually far smaller.

Does it work for a die or a biased coin?

Yes, for any p. Try p = 1/6 and p = 0.7 in free play.

Measuring probability by frequency

Toss a coin n times and count the number of heads, h. The relative frequency of heads is f = h ÷ n.

So when we cannot calculate a probability (for example, the chance a drawing pin lands point-up), we can estimate it by doing many trials: p ≈ f. The more trials, the better the estimate.

What the law of large numbers says

Bernoulli's theorem (the law of large numbers for frequencies): in n independent trials with the same probability p of success, for every ε > 0,

P(|f − p| ≥ ε) → 0 as n → ∞.

The general form is about averages. Let X₁, X₂, …, Xₙ be independent random variables with the same mean μ and variance σ². Their sample mean is X̄ = (X₁ + … + Xₙ) ÷ n. Then the chance that X̄ is more than ε away from μ goes to 0 as n grows.

Careful: the law does not say that luck "evens out". After 5 tails in a row, the next toss is still 50 : 50. The difference between heads and tails can even grow; only the proportion settles.

Chebyshev's (Bienaymé–Chebyshev) inequality

For any random variable X with mean μ and variance σ², and any a > 0:

P(|X − μ| ≥ a) ≤ σ² ÷ a².

It works for every distribution, which is why it is called a concentration inequality: it shows the values are concentrated near the mean. It is often rough, but it is always true.

Apply it to the sample mean X̄. Since E(X̄) = μ and V(X̄) = σ² ÷ n:

P(|X̄ − μ| ≥ ε) ≤ σ² ÷ (nε²).

As n grows, the right side goes to 0, which proves the law of large numbers. For frequencies, σ² = p(1 − p) ≤ 0.25, so P(|f − p| ≥ ε) ≤ p(1 − p) ÷ (nε²) ≤ 1 ÷ (4nε²).

Choosing a sample size and testing a claim

Sample size: we want the risk of an error bigger than ε to be at most α. Make σ² ÷ (nε²) ≤ α, so n ≥ σ² ÷ (αε²). For a proportion with unknown p, use σ² ≤ 0.25: n ≥ 1 ÷ (4αε²).

Sampling: a random sample from a large population behaves like repeated trials, so the sample proportion is close to the population proportion when the sample is big and fair.

Simple test: a claim says p = 0.5. If in n trials the frequency is so far from 0.5 that Chebyshev says such a gap would happen with probability below, say, 5%, we have good reason to doubt the claim.

Key formulas and definitions

Worked examples

1. A drawing pin is dropped 400 times and lands point-up 248 times. Estimate the probability of point-up.

f = 248 ÷ 400 = 0.62. Estimate: p ≈ 0.62.

2. A fair coin is tossed 1000 times. Use Chebyshev to bound the chance that the frequency of heads is 0.1 or more away from 0.5.

p(1 − p) = 0.25, nε² = 1000 × 0.01 = 10. Bound = 0.25 ÷ 10 = 0.025. So the chance is at most 2.5%.

3. X has mean 50 and variance 16. Bound P(|X − 50| ≥ 10).

σ² ÷ a² = 16 ÷ 100 = 0.16. So the probability is at most 0.16.

4. A die is rolled 600 times. Bound the chance that the frequency of sixes differs from 1/6 by 0.05 or more.

p(1 − p) = (1/6)(5/6) = 5/36 ≈ 0.139. nε² = 600 × 0.0025 = 1.5. Bound ≈ 0.139 ÷ 1.5 ≈ 0.093.

5. How many people must a survey ask so that the chance of an error of 0.05 or more in a proportion is at most 0.1?

n ≥ 1 ÷ (4αε²) = 1 ÷ (4 × 0.1 × 0.0025) = 1 ÷ 0.001 = 1000 people.

6. A coin is claimed to be fair. In 2000 tosses it shows 1200 heads. Is the claim believable?

f = 0.6, a gap of 0.1. Chebyshev: P(|f − 0.5| ≥ 0.1) ≤ 0.25 ÷ (2000 × 0.01) = 0.0125. A gap this big would happen at most 1.25% of the time for a fair coin, so we doubt the claim.

Common mistakes

Practice quiz

1. As the number of trials grows, the relative frequency of an event:
2. Chebyshev's inequality is P(|X − μ| ≥ a) ≤
3. The variance of the mean of n independent copies of X is:
4. After 6 heads in a row with a fair coin, the chance of tails next is:
5. To halve ε while keeping the same bound, n must be multiplied by:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is the law of large numbers in simple words?

If you repeat a chance experiment many times, the fraction of times an event happens gets very close to its true probability.

What is the difference between the law of large numbers and the gambler's fallacy?

The law is about long-run proportions. The fallacy wrongly claims single future results are pushed to 'balance' past ones.

What is Chebyshev's inequality used for?

To bound how likely a value is to be far from its mean, prove the law of large numbers and choose a safe sample size.

Where this is taught

FranceTerminaleProbability
Russia9 классRandom variables
Russia11 классLaw of large numbers
Russia11 классRandom variables

Learn first

Learn next

Related lessons

All Maths lessons