Published · · Last reviewed · · 6 min read
English · 한국어
The birthday problem: why 23 people are enough
A classroom has 23 students. What is the chance that two of them share a birthday? Intuition says a single-digit percentage: a year has 365 days and 23 people seem far too few. The answer is 50.7%, a little better than a coin flip. The result is called the "birthday paradox", but it is not a paradox in the sense of a contradiction; it is a case where intuition is wrong. This page shows why intuition fails, how to calculate it exactly, and where the same mathematics appears in lotteries.
Try it
Change the number below to check. Entering a group size gives the theoretical value, and the button builds 20,000 imaginary groups and counts how often a shared birthday actually occurs.
With 23 people the theoretical value is 50.73% and the simulation hovers around 50%, differing a little each time. The simulation is not identical on every run because 20,000 groups leave a margin of chance (about ±0.7 points at 95%).
The calculation: find the chance that all are different
Counting "at least one pair matches" directly is hard: two matching, three matching and several pairs matching all overlap. So we use the opposite event, that all birthdays differ, and subtract from 1.
- The first person's birthday can be anything: 365/365.
- The second must differ from the first: 364/365.
- The third must differ from both: 363/365.
- Continue to the 23rd person, whose factor is 343/365.
The probability that all are different is 365/365 × 364/365 × 363/365 × … × 343/365 ≈ 0.4927. So the probability that at least one pair matches is 1 − 0.4927 = 0.5073, or 50.7%. That is the whole calculation. One assumption is built in: that all 365 days are equally likely (leap days are ignored).
Probability by group size
| People | Probability | Pairs being compared |
|---|---|---|
| 5 | 2.71% | 10 |
| 10 | 11.69% | 45 |
| 15 | 25.29% | 105 |
| 20 | 41.14% | 190 |
| 23 | 50.73% | 253 |
| 30 | 70.63% | 435 |
| 40 | 89.12% | 780 |
| 50 | 97.04% | 1,225 |
| 57 | 99.01% | 1,596 |
| 70 | 99.92% | 2,415 |
The last column holds the key to why intuition fails.
Why intuition fails: pairs are compared, not people
We unconsciously imagine "someone sharing my birthday". That chance really is small: among the 22 others, the chance that someone matches me is 1 − (364/365)22 ≈ 5.9%, and it takes 253 other people to reach 50%. The birthday problem asks something else: is there any matching pair? With 23 people there are 23 × 22 ÷ 2 = 253 pairs being compared. Each pair matches with probability about 1/365, but with so many pairs, the chance that some pair matches becomes large. As the group grows, pairs grow roughly as the square. From 23 to 57 people is a 2.5-fold increase, but pairs rise 6.3-fold to 1,596.
A simple approximation shows this: the probability is about 1 − e−n(n−1)/730. For n = 23 this is 1 − e−0.693 ≈ 0.5000. The exponent is the number of pairs divided by 365 (253 ÷ 365 ≈ 0.693 = ln 2), giving the rule that the chance reaches 50% when the number of pairs reaches 365 × ln 2, about 253. The formula carries over to a different number of days.
Applied to duplicate lottery numbers
The same mathematics appears in lotteries. Replace 365 days with the 8,145,060 combinations of Lotto 6/45. If different people each pick one combination at random, how many tickets are needed for a 50% chance that at least two share the same numbers? By the approximation the number of pairs must reach about 8,145,060 × ln 2 ≈ 5,646,000, which means about 3,361 tickets. The exact product also reaches 50.0% at 3,361 tickets.
| Tickets | Chance of a repeated combination |
|---|---|
| 1,000 | 5.95% |
| 3,000 | 42.44% |
| 3,361 | 50.0% |
| 10,000 | 99.78% |
Out of eight million possibilities, just 3,361 tickets give even odds that two are identical. A round sells over a hundred million tickets, so repeated combinations are expected. This is the most basic reason for several first-prize winners in one round. The calculation assumes everyone picks uniformly at random; in reality human-chosen numbers cluster, so duplication is even more frequent (see the winner-count analysis).
Real birthdays are not uniform
The calculation assumes all 365 days are equally likely. Real birth dates are known to vary by weekday and season, so the real probability is slightly higher than the theoretical value. We did not verify specific figures for that distribution, so we do not quantify the effect. It is a feature of this problem that the assumption does not overturn the conclusion: uneven birthdays make matches easier, so the result that 23 people exceed 50% stands.
Extension: three people with the same birthday
What if we ask for three people with the same birthday instead of two? The exact formula is complicated, so this site ran a simulation of 400,000 groups per size. At 87 people the chance is about 49.96% and at 88 about 51.2%, so the 50% mark is near 88 people (experimental error about ±0.1 points). That is nearly four times the 23 needed for two. Raising "how many overlap" by one increases the group needed enormously, and the contrast shows how easily "somebody overlaps with somebody" happens.
What this problem teaches
- "Someone like me" and "anyone matching anyone" are entirely different questions. Most coincidences we remember are of the second kind, which is why "what a coincidence" is such a common reaction.
- Pairs grow as a square. When there are many things to compare, rare events happen.
- Find the opposite event. For "at least one", computing the probability of none and subtracting from 1 is usually easier.
Limits: the values here are theoretical, resting on 365 equally likely days, no leap day and independence. The simulator uses random numbers and differs from run to run. The next article, The Monty Hall problem, deals with the same kind of intuition failure, how probability changes once a condition is given.
Following it by hand
Work out the case of 5 people yourself. The chance that all are different is 365/365 × 364/365 × 363/365 × 362/365 × 361/365. The first factor is 1, so the product 0.99726 × 0.99452 × 0.98904 × 0.98630 comes to about 0.9729, and the chance that at least one pair matches is 1 − 0.9729 = 2.71%, the same as the table's 5-person value. With few people the chance is small, but as pairs multiply the product keeps shrinking until it passes below 0.5. Multiplying in the 23rd factor is exactly that point.
Practice questions
- In a class of 30, what is the chance that two people share a birthday? (Read it from the table.)
- In a class of 30, what is the chance that someone shares my birthday?
- Among a family of 4, roughly what is the chance that two share a birthday?
Answers: (1) 70.63%. (2) Among the 29 others, the chance that at least one matches me is 1 − (364/365)29 ≈ 7.6%. In the same class, "anyone matching anyone" is 70.6% while "someone matching me" is 7.6%, nearly ten times smaller. (3) With 4 people there are 6 pairs and the chance is about 1 − (364/365 × 363/365 × 362/365) ≈ 1.6%. A birthday overlap inside a family is uncommon but not truly odd.
The answer to question 2 is this page's central distinction. In the same class, changing the question changes the probability almost tenfold.
Sources and verification
- LottoFlick methodology (calculation checks) — computed by LottoFlick
- Lotto 6/45 game guide (8,145,060 combinations) — computed by LottoFlick