Probability Lab
Flip a coin or roll a die thousands of times and watch the empirical frequency converge on the theoretical probability. The law of large numbers, animated.
Offline ● Works without internet after loading After the first page load, no network connection is needed.Tap to run one trial
This simulation needs a modern browser with canvas support. The measurements and formula below still describe the physics.
Controls
Live measurements
Graph
Formula
P(face 1) = 1 / n
Type your own values to solve the formula. The simulation follows along.
- P Theoretical P
- —
Observations
What's happening
Real-world examples
The wild start
Run 10 flips: frequencies like 0.7 or 0.3 are completely normal. Streaks dominate small samples.
The long settle
Leave it at 60 trials a second for a minute and watch the green line hug the dashed theoretical line.
Loaded question
Switch to a 6-sided die: face 1 now converges to 1/6, about 0.167, one sixth of the coin value.
One tap at a time
Pause and tap the canvas to run single trials, exactly like flipping by hand but with the tally kept for you.
Common Questions
What is the law of large numbers?
It is the theorem that the empirical frequency of an outcome approaches its theoretical probability as the number of independent trials grows. Flip a fair coin forever and the fraction of heads heads to 0.5. Crucially it says nothing about any single flip and nothing about short runs: it is a statement about long-run averages, which the convergence graph in this lab shows happening in real time.
What is the difference between empirical and theoretical probability?
Theoretical probability comes from counting outcomes: a fair coin has 2 equally likely faces, so P(heads) = 1/2. Empirical probability comes from experiments: flip 100 times, count 47 heads, and the empirical frequency is 0.47. The theoretical value is fixed; the empirical value wobbles around it and settles closer as trials accumulate. The lab shows both at once so the difference is visible rather than abstract.
After five heads in a row, is tails more likely?
No. Each flip is independent: the coin has no memory, so the probability of tails stays exactly 1/2. Expecting a correction is the gambler's fallacy. What the law of large numbers actually does is dilute streaks under thousands of newer flips, not cancel them. Run the lab after a visible streak and watch the frequency drift back without any compensating streak of tails.
How many trials do I need before the estimate is trustworthy?
More than intuition suggests. The wobble of an empirical frequency shrinks roughly with the square root of the trial count, so to halve the noise you need four times the trials. Ten flips can show 0.7 without anything being wrong; a thousand flips lands within a few hundredths of 0.5 in the vast majority of runs. Watch the gap readout: it falls fast at first, then grinds slowly, which is exactly the square-root behavior.
Is the randomness in this lab real?
It uses a seeded pseudo-random generator, the same kind games and simulations use. The sequence is statistically fair (every face equally likely, no usable pattern) but reproducible: press Reset and the identical sequence replays, which is deliberate so an experiment can be repeated exactly while still behaving like chance.
What is the probability of rolling a specific number on a die?
For a fair six-sided die, each face has probability 1/6, about 0.167, because six outcomes are equally likely and exactly one counts. The same logic gives 1/n for any fair n-sided object, which is the theoretical line the lab draws. Switch the sides slider to 6, let it run, and watch face 1 settle toward 0.167 while every short stretch of rolls still looks streaky.
What is the difference between probability and odds?
Probability compares successes to ALL outcomes; odds compare successes to failures. A fair coin has probability 1/2 of heads but odds of 1 to 1; rolling a 6 has probability 1/6 but odds of 1 to 5. The two encode the same information, so convert with odds = p / (1 - p). Casinos and bookmakers quote odds, textbooks quote probability, and mixing the two is a classic source of wrong answers.
What is the probability of getting heads twice in a row?
One half times one half: 1/4. Independent events multiply, so a run of k heads has probability (1/2)^k, which is why five in a row (1/32) feels rare but shows up regularly in a few hundred flips. The multiplication rule is also why streaks in the lab are normal rather than evidence of a broken coin: with thousands of trials, improbable runs get plenty of chances to happen.
Does the lab upload anything or need an account?
No. Every trial runs in your browser on the HTML canvas. Nothing is sent anywhere, there is no account, and the lab keeps working offline once loaded.