The birthday problem and the gambler's fallacy: why does our intuition fail?
In a class of 23, the chance that two people share a birthday is over 50 per cent. After five heads in a row, are tails now due? We work through two classic examples that fool our sense of probability, with the calculations.
By Kuazara Bilim EkibiPublished: Updated: 10 min read

Photo: Gaelle Marcel / Unsplash
In this article · 4 sections
- The birthday problem: are 23 people enough?
- Thinking in reverse
- Where does our intuition go wrong?
- Try it in class
- The gambler's fallacy: a coin has no memory
- When a sequence looks special
- What the law of large numbers says, and what it doesn't
- That famous evening in Monte Carlo
- The opposite can be a fallacy too
- Why do we get it wrong like this?
- How can we train our intuition?
The human brain is remarkably good at finding patterns. But when it comes to chance and probability, the same brain can go wrong in systematic ways. Two people in a class sharing a birthday feels like “an incredible coincidence”; when a coin lands heads five times in a row, we think “tails has to come up now”. In this article we look at two classic examples where our sense of probability fails, the birthday problem and the gambler’s fallacy, and work through them step by step. The aim is not to belittle intuition, but to train it with maths so that it becomes more reliable.
The birthday problem: are 23 people enough?
Here is the question: how many people need to be in a room for the probability that at least two of them share a birthday to exceed 50 per cent?
Most people’s first guess is quite large. Because there are 365 days in a year, they say 183, or at least something around 100. The correct answer is only 23. In a group of 23 people, the probability that at least two share a birthday is about 50.7 per cent.
Before calculating, let’s state our simplifying assumptions clearly. We ignore 29 February in leap years, we assume every day is equally likely to be a birthday, and we assume birthdays are independent of one another, so, for example, there are no twins in the group. Real birth dates are not spread perfectly evenly through the year; but that unevenness does not lower the chance of a match, it actually raises it slightly.
Thinking in reverse
“At least two people born on the same day” can happen in many different ways: two people, three people, two separate pairs and so on. Counting these one by one is hard. It is much easier to calculate the opposite: the probability that everyone’s birthday is different.
Let’s bring people into the room one at a time:
- Person 1 can have been born on any day: probability .
- Person 2 must have been born on a different day from person 1: .
- Person 3 must have been born on a different day from the first two: .
- ...
- For person : .
Multiplying these probabilities gives the probability that everyone was born on a different day:
The probability of at least one match is its complement:
For the product comes to about . So the probability of a match is , or about 50.7 per cent. As the group grows, the probability rises quickly:
| Number of people | Probability of at least one match (approx.) |
|---|---|
| 10 | 11.7% |
| 23 | 50.7% |
| 30 | 70.6% |
| 50 | 97.0% |
| 70 | 99.9% |
Where does our intuition go wrong?
Our intuition usually swaps the question for a different one: “Will someone have the same birthday as me?” That is a much smaller probability. In a group of 23 including you, the chance that one of the other 22 people was born on your day is only about 5.9 per cent:
But the real question is about any two people matching. Let’s look at how many pairs can be formed from 23 people:
There are 253 different pairs, and each one is a chance for a match. While the number of people grows linearly, the number of pairs grows roughly with its square. Our intuition counts people; the maths counts pairs.
We can also express this with a neat approximate formula. Since each pair has a chance of matching:
For the exponent is , and . This shows elegantly why 23 is the “magic” number.
As an interesting coincidence, for the chance that someone shares your birthday to pass 50 per cent, you need about 253 other people with you. Once you put your own birthday at the centre, the picture looks completely different.
Try it in class
For teachers, this problem makes a great classroom activity. First ask students for their guesses, then write their birthdays (day and month only) on the board. In a class of 25 to 30 there is a good chance of a match; even if there isn’t one, it is a good opportunity to discuss that probability is not certainty. When results from several classes are combined, you can see them approach the proportions in the table.
The gambler’s fallacy: a coin has no memory
Now for the second example. You toss a fair coin and get heads five times in a row. What is the probability of tails on the sixth toss?
Many people think “tails is more likely now”. The correct answer does not change: 50 per cent. The coin knows nothing about previous tosses; each toss is independent of the one before. This mistaken belief is called the gambler’s fallacy.
When a sequence looks special
Five heads in a row looks “special”. But any particular sequence of five is equally likely:
The reason we find “HHHHH” striking is that we recognise it as a regular pattern. “HTHHT” looks random, but it is just as likely. After five heads, the sequences “HHHHHH” and “HHHHHT” on the sixth toss are again equally likely: each is .
What the law of large numbers says, and what it doesn’t
One thing that feeds the gambler’s fallacy is a misunderstanding of the law of large numbers. This law says that as the number of tosses increases, the proportion of heads will get closer to 50 per cent. But it does not do this by “correcting” past imbalance; it does it by new tosses diluting the old ones.
Here is a thought experiment. Suppose the first 10 tosses give 8 heads and 2 tails. The proportion of heads is 80 per cent. Now suppose exactly half of the next 990 tosses are heads (495 heads, 495 tails). In total there are heads and tails. The proportion of heads is:
The proportion is now very close to 50 per cent; but the gap of 6 between heads and tails has not closed at all. The coin made up for nothing; the first 10 tosses simply became insignificant within the total.
That famous evening in Monte Carlo
The most often told example of the gambler’s fallacy is an evening in 1913 at a casino in Monte Carlo, when the ball on a roulette wheel landed on black 26 times in a row. As the story goes, players bet ever larger sums on red, thinking “red has to come up now”, and lost heavily. This is why the gambler’s fallacy is also known in English as the “Monte Carlo fallacy”.
A European roulette wheel has 37 pockets, 18 of which are black. The probability of black on all of 26 particular spins is:
That is about 1 in 137 million; a truly tiny probability. But the key point is the same here: after 25 blacks, the probability of black on the 26th spin is still . A long streak being unlikely does not affect the next step of the streak.
The opposite can be a fallacy too
Sometimes people think the reverse: “If it came up heads five times, the coin is inclined towards heads, so it will be heads again.” If the coin really is fair, this is also wrong. But there is an important subtlety here: if we are not sure the coin is fair, very long streaks can count as evidence that it may actually be biased. Five heads is weak evidence for that; ninety heads in a hundred tosses would be very strong evidence. A large part of statistics teaches exactly this distinction: can the observed result be explained by chance, or should we look for another cause?
Why do we get it wrong like this?
In their work in the 1970s, the psychologists Amos Tversky and Daniel Kahneman studied the mental shortcuts people use when making decisions under uncertainty, known as heuristics. One of these is the representativeness heuristic: we think a small sample should “represent” all the features of the larger process. Because we know a fair coin should give roughly half heads and half tails in the long run, we expect a short sequence to look balanced too. Five heads breaks that expectation, and our brain looks for an outcome that will “restore” the balance.
In the birthday problem, the trouble is that we cannot estimate the number of possible matches intuitively. Many of the “incredible coincidences” we meet in everyday life can be explained in a similar way: the chance of an event happening to you may be very small, but in a world with millions of people and countless possible events, something happening to someone is almost inevitable.
How can we train our intuition?
- Calculate the opposite: For questions involving “at least one”, finding the probability of “none” and subtracting it from one is often the easiest route.
- Be clear about what is being counted: Are we counting people or pairs, one particular event or any event?
- Question independence: Are the events really independent of each other? Coin tosses are; drawing cards from a deck is not (unless you put the cards back).
- Study a classic trap: In the 17th century the Frenchman Chevalier de Méré believed that getting at least one 6 in 4 rolls of a single die and getting at least one double 6 in 24 rolls of two dice were equally likely. Calculating the opposite gives for the first and for the second. This question is one of the problems discussed in the famous correspondence between Blaise Pascal and Pierre de Fermat, and it holds an important place in the birth of probability theory.
- Experiment and simulate: Tossing a coin hundreds of times, or running a computer simulation, makes the gap between intuition and calculation concrete.
Probability turns up everywhere, from our everyday decisions to scientific research. For more examples, have a look at our maths articles and maths topics. In Kuazara’s interactive probability lessons you can simulate thousands of tosses in seconds to test your intuition and understand probability without memorising it.
Frequently asked
4 questionsWhy are only 23 people enough in the birthday problem?
In a group of 23, what is the probability that someone was born on the same day as me?
What is the gambler's fallacy?
Does the law of large numbers make up for past imbalance?
Sources
3 sources- 1.Tversky, A., Kahneman, D. (1974) — Judgment under Uncertainty: Heuristics and Biases, Science, 185(4157)
- 2.Feller, W. — An Introduction to Probability Theory and Its Applications, Vol. 1, Wiley
- 3.OpenStax, Introductory Statistics
- #probability
- #birthday problem
- #gambler's fallacy
- #statistics
- #cognitive biases


