Do two of them share a birthday?
The Birthday Paradox
This paradox in statistics has always been one of my favorites, so I thought it would be fun to put together an app that demonstrates it. As unintuitive as it seems, if you are in a room with 29 other random people, there is a roughly 70 percent chance that at least two people in the room share a birthday.
The math for this is actually relatively easy to explain.
In statistics, when you want to determine the probability of something like this, it is often easier to determine the probability of it not happening and subtract that from 1. That is the case here. In the simple version of this game, we will pretend that February 29th does not exist.
Imagine you have N people, and each of them draws a date out of a bag at random and puts it back. That date is their birthday. The first person is guaranteed to draw a unique date, since no one has drawn before them. The second person can draw any of 364 different days and get a unique date, and has only a 1/365 chance of drawing the first person’s day. Assuming the second person got lucky and drew one of the 364 unique days, the third person then has 363 unique days to choose from.
That is, the probability that every person draws a unique birthday is a product of conditional probabilities, as shown here for N people:
A′ = every birthday in the room is unique
Our original question, though, is: what are the chances that at least two people share a birthday? Well, that is 1 minus the probability that everyone has a unique birthday. This way, we do not need to calculate every scenario of shared birthdays.
A = at least two people share a birthday
There are, of course, more complicated scenarios that can be considered. For example, how many people are needed for a 50% probability that every person shares a birthday with at least one other person? Or how many are needed for a 50% probability that at least three people share a birthday? If this is interesting to you, I encourage you to poke around the Wikipedia page for this paradox! (Those questions are beyond the scope of what I want to include in this application.)