The Great Birthday Problem

You walk into a room with a group of people in it and make the following wager, "I'll bet $50 that there ( are / are not ) two people in this room with the same birthday." How many people should be in the room before you bet that two share the same birthday?

Now, some answers are obvious. If you walk into a room with only one person in it, don't bet that at least two people share the same birthday. And if you walk into a room with 366 people in it, although it is theoretically possible that they don't share the same birthday, logic tells us that the chance they do is pretty high.

But where is the break even point? Where does the probability change from being in the favor of not sharing to sharing?

Type of Simulation

What we're asked to do here is to find a probability. When this is the case, we want to conduct an experiment and record the outcome as a success or failure. Then we will repeat this process many, many times (the more the better) and then divide the total number of successes by the total number of trials. This will give us a relative frequency which is the empirical probabilty.

The Simulation

We will decide how many people we have in the room (call this number n). Then we will generate n random numbers between 1 and 365 (ignoring leap day, sorry February 29 people) and see if any number is duplicated. If the number is duplicated, then we will record this trial as a "yes" or "success" and repeat the process. We will do this several times and then divide the number of successes by the number of trials.

Note: We are not interested in the number of duplicates, either "yes" there are duplicates or "no" there are not duplicates.

This is an experiment that lends itself nicely to computers because they can generate random numbers and then sort them for us so we can see if there are any duplicates.

Enter the number of people in the room and then hit the simulate button. Repeat the process several times with the same sample size to get an approximation.

Number in room
Birthdates
Sorted
Results

Success

Trials
Probability

The Answer

The theoretical answer is that if there are 22 or less in the room, then bet that two won't share a birthday and if there are 23 or more in the room, then bet that two will share a birthday.

Try simulating 22 people in the room and see if your probability is just under 0.5. Then try simulating 23 people in the room and see if your probability is just over 0.5.


Return to Simulation Page