Friday, 9 May 2014

The Birthday Problem: Round 4

We've looked at the probability of any two people having the same birthday in a group. We've also looked at the probability of two people having a "near match" in a group. We then looked at the probability of the first match or near-match as people join a group one at a time. But what happens when we want to match (or nearly match) a specific birthday (your own for example).

Matches to your birthday will follow a binomial distribution, which has a probability mass function:

Equation 1

where q is the number of trials, r is the number of successes, and p is the probability of success. If we're trying to match your birthday in a random group of people, r is any whole number greater than zero, p is (2k+1)/365 chance of an individual matching your birthday to within k days, and q is one less than the number of people in the group. If we substitute (n-1) = q, (2k+1)/365 = p, and r = 0 into Equation 1, we'll get the probability of NOT matching (or nearly matching) your birthday in a group of n people. That gives us Equation 2 below:

Equation 2

Subtract from 100% to get the probability of at least one match to your birthday within k days among a total of n people. After simplifying, we get Equation 3:

Equation 3
Plotting for different values of k and n (k = 0 if you're looking for a same-day birthday match) gives a graph like this:


It's hard to see the full picture with both k = 0 and k = 30 on the same plot, so here's another one:


We can also make a table showing the minimum size of the group for a corresponding probability that your birthday will be matched or nearly matched:


As you can see, matching your birthday is far less likely than matching any birthday. The results might be surprising though. Recall that we need only 23 people for there to be better than a 50% chance that two people in the group had matching birthdays. But in a group of you and 22 other people, there's only a 5.86% chance that your birthday is shared with someone else in the group. You need at least 253 other people in the group before it is more likely than not that your own birthday is shared with someone else.

We can also repeat the analysis from the third birthday post and figure out, if people entered randomly one at a time, who would be most likely to match your birthday. That perhaps isn't so interesting because the first person to enter after you always has the greatest chance of being the first person to match your birthday. The incremental probability of matching your birthday in a group of n versus n+1 people (i.e. the probability that the next person matches your birthday) is equal to:

Equation 4

It can be shown that Equation 4 is maximized by n = 1, irrespective of k. Therefore, the first random person joining you at the party is the most likely person to match your birthday, with a probability of a match simply equal to:
Equation 5

For completion, here is the plot of equation 4 and the tabulated data to show the probability of the first person entering the group after you matching your birthday.



In short, matching a specific birthday in a random group of people is uncommon and generally requires a large sample, but it's not unusual for any two people in a small group of random people to share a birthday. And now there will be no more talk of birthdays for a long time.

No comments:

Post a Comment