An experiment with my friends and the birthday paradox!

I am Asiel ツ
4 min readNov 5, 2019

I have three questions for you:

1) How many people you know do you think you can list? Maybe you can list dozens or even hundreds!

2) Among all the people on your list, how many of them do you think share the same birthday? Maybe you can count them with one hand if you happen to remember their birthdays.

Now try to answer the next question with your previous answers in mind.

3) If you create same-size random groups of people from your list, how many people do you think you should include in each group so you can have at least one shared birthday in half of the groups?

I’m sure the answer will surprise you! That’s why we will calculate the probability of repeated birthdays in a group of people and then we will compare it with the experimental case, in which we create random groups of people using my Facebook friends.

The probability of repeated birthdays

Let’s start with the simple case for just two people. Furthermore, let’s assume that their birthdays can happen any of the 365 days of the year and that there are no leap years. From this, we calculate the probability of both of them having the same birthday as shown in the next picture. According to this, there is a probability of 0.27% for both of them to have the same birthday, which means that only one couple in every 370 have both members sharing their birthday. You can also see that the probability of sharing a birthday and not sharing a birthday adds up to 100%.

Maybe it sounds strange, but calculating when lots of people do not share the same birthday becomes easier than when they do. In picture 2, 97 of every 100 groups of 5 people do not have members with the same birthday, therefore, the 3 remaining groups have at least one repeated birthday.

Now that you know how to calculate birthday probabilities, you are now able to give an exact answer to question number 3 I made to you. If you create multiple groups of random people, how many people should you include in each group so half of them can have at least one repeated birthday. In other words, how many people do you need to get a 50% probability. You can find the answer in the next graph, which includes the calculated probabilities for groups from 2 to 104 people. It is clear to understand that the probability of repeated birthdays increases as the size of the group increases but, were you expecting to achieve a probability of 50% for a group of just 23 people? Well, this is the birthday paradox, since most people cannot imagine this result. I guess this happens because they know a lot of people but they don’t really know their birthdays. Although honestly, this is not a paradox, but just a divergence between the correct result and the one most people imagine.

The birthday paradox put to test

The first time I learned about this problem I was impressed with the calculation but didn’t really know if that was the practical case. Fortunately, I now have an experimental way to test the birthday paradox, and it involves to simulate random groups of people among my Facebook friends who have made their birthday public. As you can see, the next graph contains the birthdays of 255 friends. Some of them are repeated for up to 4 people, which is the case of June 22nd, October 1st, and December 1st.

With this information, I created groups of random people without repetition and counted how many groups had at least one repeated birthday. Therefore, the experimental probability was calculated as:

The objective here was to demonstrate whether the calculated and experimental probabilities were in agreement, and as you can see in the graph, they are. However, this is becomes clearer the more the experiment is repeated. In this case, I simulated groups from 2 to 100 people in 10 and 1000 occasions each. As you can see, the experimental probability is not exactly the same as the calculated one but it has the same trend. On the other hand, both probabilities are almost identical when the experiment is simulated 1000 times.

Final thoughts

Finally, our calculation and experiment has converged in the same conclusion and it is understood that there is only a need of 23 people to obtain a 50% probability of having a repeated birthday. However, this becomes clearer as the experiment is repeated lots of times. After all, this is how probability works.

--

--

I am Asiel ツ

My place to enjoy numbers, data, and visualizations about the things I find exciting!