The Math Behind Everything All games

The birthday problem

People in the room

0

Chance of a match

0%

How long until two match?

People walk into a room one at a time. How many until two share a birthday?

How it works
  1. People walk into an empty room one at a time, each with a random birthday.
  2. Their birthday lights up on the calendar.
  3. The moment two people share a birthday, the game stops.
How the math works

Why ?

    Chance that two people share a birthday

    It climbs fast because every new person can match anyone already in the room. With people there are already pairs.

    Test it on 1,000 rooms

    Fill 1,000 rooms the same way the game does and count how many people each one took.

    The math assumes 365 equally likely birthdays and leaves out February 29. Real birthdays cluster a little (more in September, fewer on holidays), which makes a match slightly more likely, not less.

    Want a game like this for your brand? Work with me

    Why only 23 people?

    The question

    Picture an empty room. People walk in one at a time. How many have to be inside before it's more likely than not that two of them share a birthday?

    A common guess is around 183. That's about half of the 365 days in a year, so it feels right: fill half the calendar and a match should be likely. The real answer is 23. With 23 people in the room, the chance that at least two share a birthday is 50.7%, a little better than a coin flip.

    The setup

    To keep the math clean, assume every birthday falls on one of 365 days, each equally likely, and leave out February 29. Each person's birthday is random and has nothing to do with anyone else's. Real birthdays aren't spread perfectly evenly. Some months have more than others, and fewer people are born on holidays. That unevenness makes a match slightly more likely, so the even calendar gives the hardest version of the problem.

    You're not looking for your own birthday

    The guess of 183 answers a different question. If you walk in and ask whether anyone shares your birthday, you really do need a crowd. But the birthday problem asks about any two people. Every person in the room can match every other person, not just you.

    The number of pairs grows much faster than the number of people. With 23 people, only 22 pairs include you. Count every pair in the room and there are 23 × 22 ÷ 2 = 253. That's 253 chances for a match, which is why the answer is so much smaller than half a year.

    Count the rooms where nobody matches

    Working out the chance of a match directly is messy, because a match can come from any of those 253 pairs, and several can happen at once. It's easier to find the chance that nobody matches, then subtract it from 1.

    The first person can have any birthday. The second person has to miss the first person's birthday, which leaves 364 of 365 days. The third has to miss both birthdays already taken, so 363 of 365. Each new person has one fewer open day than the one before. The 23rd person has to miss 22 birthdays, leaving 343 of 365.

    Because the birthdays are independent, you multiply those chances together:

    364/365 × 363/365 × … × 343/365 ≈ 49.3%

    That's the chance that all 23 birthdays are different. The chance that at least two match is everything else:

    1 − 49.3% = 50.7%

    Each fraction on its own is close to 1, so no single person changes much. But 22 of them multiplied together drag the total below half.

    How fast it climbs

    Past 23, the chance keeps rising quickly, because every new person brings a whole row of new pairs with them.

    In a room of 70, finding no shared birthday would be the surprise. To make a match certain you'd need 366 people, since there are only 365 days to go around. But you get to near certainty with a small fraction of that, which is the part that catches people off guard. Our sense of "how likely" tracks the number of people, while the math tracks the number of pairs.

    Try it yourself

    The game at the top of this page fills a room the same way. Make your guess first, then add people one at a time and watch their birthdays light up on the calendar until two land on the same day. Some rooms match within a handful of people, and some run well past 23. The number 23 is where a match becomes more likely than not, not the number every room hits. To see the spread, press "Fill 1,000 rooms" above. It runs a thousand rooms at once and shows how many people each one took.

    For education and entertainment. Found a mistake in the math? Email me and I'll fix it.