Birthday Probability
Saturday, October 28th, 2006If there are 23 people in a room, what is the probability that two persons share the same birthday?
Can you believe that the probability is more than 50%? Yes… I am not kidding, 50.7% to be exactly. How come??? There are 365 days in a year and there are only 23 people in a room.
I was very surprise too…. Honestly, I don’t have interest in probability and statistics, but recently I had to learn them to prepare my interview with Google. I have heard that they may ask this kind of questions.
Although I am not an expert in probability, I will try to explain how we get this number.
First, let’s start with a simple problem. We have 3 people in a room. What is the probability that two persons share the same birthday? Let’s take a date for the first person. The second person has probability of 1/365 to share the same birthday (we ignore leap year for simplicity). The third person also has the same probability, 1/365. We end up with 2/365.
Do we miss something? Indeed, yes. There is a probability that the second person shares the same birthday as the third person. Things are getting more complicated for 23 people.
How do we solve this problem then? We all know this formula from our class in high school:
P(two persons share the same birthday) = 1 - P(no two persons share the same birthday).
It’s easier to find the probability of no two person share the same birthday, isn’t it?
Back to our problem, let’s take a date for the first person from 23 people. The probability that the second person doesn’t share the same birthday is 364/365. The probability of the third person is 363/365. The probability of the fourth person is 362/365, and so on. So we end up in the following equation:
P(two persons share the same birthday) = 1 - (364 / 365) * (363 / 365) * … * (343 / 365)
P(two persons share the same birthday) = 50.7%
Update (28-Oct-06): Just additional note, Google didn’t ask me this question during interview. I just heard they may ask this kind of questions during the interview. Read this posting for an example.
you are at a party with a friend and 10 people are present including you and the friend. your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. would you accept the wager?
For my case, they asked computing and programming questions. No brain teaser questions.
