Skip to content
All apps

Coin flips: law of large numbers

About this app

Many coin-flip runs at once: the relative frequency runs into the narrowing 95 % funnel, while the absolute heads surplus widens it — with exact values, the binomial distribution and the gambler's fallacy after 10 heads.

What the law of large numbers says

Flip a fair coin n times and count hₙ heads: the relative frequency rₙ = hₙ/n tends to ½. Its spread is ½/√n and shrinks as n grows. This is the law of large numbers in Bernoulli’s form. It does not mean that the absolute counts even out. The surplus of heads hₙ − n/2 has a spread of ½·√n and typically gets larger. An exact tie even becomes rarer; its probability falls roughly like √(2/(πn)).

What you see

Each line is one run of fair coin flips: 20, 100 or 300 runs with 100, 1,000 or 10,000 flips each. The deviation can be shown in three views: relative as rₙ, absolute as surplus of heads, and scaled per √n. An exact 95 % funnel marks where runs typically lie. Next to it, the distribution of all runs at the current flip is drawn against the exact binomial distribution. A panel compares the simulated spread, share inside the funnel and frequency of ties with exact values.

Testing the gambler’s fallacy

In the “Catch-up?” panel you can switch on a head start: every run begins with 10 heads, after which flipping continues fairly. Notice that the 11th flip still shows heads about half the time and that the lead stays at +5 on average. rₙ still approaches ½ because 5/n goes to 0. Also switch between the relative and absolute views: the funnel narrows or widens depending on what is being measured.

Frequently asked questions

What does the law of large numbers state?
The law of large numbers states that the relative frequency of an event approaches its probability over many independent repetitions. For a fair coin, the share of heads therefore tends to ½. The deviation of that share shrinks roughly like 1/√n.
Do heads and tails even out in the long run?
Only the proportion approaches ½. The absolute difference between heads and tails typically grows like √n. An exact tie actually becomes rarer as the number of flips increases.
What is the gambler’s fallacy?
The gambler’s fallacy is the belief that after a streak of heads, tails is now “due”. A coin has no memory, so every flip is again 50 : 50. An early lead persists on average and is only diluted by many further flips.
What can I try in this app?
You choose the number of runs and flips, switch between relative, absolute and √n-scaled views, and toggle between a linear and a logarithmic x axis. The “10 heads first” option lets you test the gambler’s fallacy. Clicking a run highlights it and shows it as a row of coins.

Subject: Probability & statistics

More from Probability & statistics

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