The mathematics of coin flips
A fair coin lands heads half the time, but the pattern over several flips is less intuitive than it seems. Getting exactly 5 heads in 10 flips is the single most likely result, yet it happens only about one time in four. The calculator gives the probability of exactly, at least or at most a number of heads, the chance of all heads, and the expected count. It also accepts a biased coin.
The formulas
The number of heads follows a binomial distribution with n flips and probability p of heads:
- Exactly k heads: C(n, k) × p^k × (1 − p)^(n − k)
- At least k heads: 1 − P(at most k − 1)
- All heads: p^n, or 1 in 2^n for a fair coin
- Expected heads: n × p
With a fair coin, every particular sequence of n flips has the same probability, 1 ÷ 2^n. Some totals are more likely only because more sequences lead to them.
Worked example
You flip a fair coin 10 times. What is the chance of 7 heads?
- There are 2¹⁰ = 1,024 equally likely sequences.
- C(10, 7) = 120 of them contain exactly 7 heads.
- P(exactly 7) = 120 ÷ 1,024 = 11.7%, or about 1 chance in 8.5.
- P(at least 7) = (120 + 45 + 10 + 1) ÷ 1,024 = 17.2%.
- P(10 heads in a row) = 1 ÷ 1,024 = 0.098%.
Ten flips at a glance
| Heads | Exactly | At least |
|---|---|---|
| 0 | 0.10% | 100% |
| 3 | 11.72% | 94.53% |
| 4 | 20.51% | 82.81% |
| 5 | 24.61% | 62.30% |
| 6 | 20.51% | 37.70% |
| 7 | 11.72% | 17.19% |
| 8 | 4.39% | 5.47% |
| 10 | 0.10% | 0.10% |
The gambler’s fallacy
After five heads in a row, many people feel tails is “due”. It is not: the coin has no memory, and the next flip is still 50/50. Long runs are also more common than intuition suggests. In 100 flips, a streak of at least 6 identical results in a row is more likely than not. People asked to write down a “random” sequence usually avoid such streaks, which is one way to tell made-up data from real flips.
Is any coin really fair?
Research by statisticians at Stanford and later a large experiment with hundreds of thousands of flips found that a tossed coin lands on the same side it started on slightly more often than half the time, about 51%. Spinning a coin on a table can be much more biased, depending on its weight distribution. For everyday decisions the effect is negligible; for anything that matters, use a proper random number generator. You can model a biased coin by changing the probability of heads.