Friday, 25 April 2014

More Fun with Probability and Birthdays

In my previous post I examined the probability of there being a shared birthday in a random group of n people. Let's take this analysis a little further and look at the probability of there being birthdays within a certain proximity to each other, say for example within 4 days time. After all, it is common to hold birthday celebrations on a weekend when they're more convenient, so two people with a birthday within 4 days of each other could conceivably choose to celebrate their birthdays on the same day. This problem gets a little more complicated than the same-day birthday. The probability of two randomly selected people having a birthday within 4 days of each other is 9/365 (about 2.47%), because B could have his birthday on the same day as A, or in any of the four days before, or in any of the four days after. Just as before, it is simpler to calculate the probability of there being no shared birthday as we increase our group size and then subtract from 100%. When we add a third person we now have two possibilities. One possibility is that A and have their birthdays at least 9 days apart, in which case there are 18 days where C can't have his birthday. A second possibility is that A and have their birthday more than 4 days apart but less than 9 days apart, in which case there is some overlap and there could be as few as 14 days eliminated for C. This brackets the probability of there being no birthdays close together in a group of three people to somewhere between 6.20% and 7.28% (exact solution is 7.26%; formula is given a few lines down). Adding a fourth similarly means there are as few as 19 and as many as 27 days eliminated, bracketing the probability of there being no birthdays close together in a group of four people to between 11.09% and 14.13% (exact solution is 14.08%).

There is an exact solution that accounts for the probability of the overlaps in the spacing between birthdays, but the explanation of how that's accomplished would be a little math intensive and there's already more than enough math in this post. Just take my word for it that the total possible permutations of n people's birthdays spaced at least k days apart from each other is equal to:
which, in factorial notation, looks like this:

With this result we can move on to calculating the probability that no birthdays in a group of random people are within k days of each other. Subtract that from 1 and you get the the probability that there is at least one birthday in the group within k days of another person's. That equation looks like this:

It looks more complicated than the formula for probability of same-day birthdays, but the general form is the same. It converges to 1 pretty rapidly as n increases. And the larger k is, the faster it converges. If we take k = 0, the equation reduces to the earlier expression for birthdays on the same day. In the graph and table below you can see the results for yourself.

As you can see, among just 10 people there's a pretty good chance there are two or more birthdays in the same week. What I think is pretty cool is the huge difference between k = 0 and k = 1. For instance, in a group of 25 people, there's about 57% probability that two people have the same birthday, but almost 93% probability that two people have birthdays within one day of each other (i.e. on the same day or on consecutive days). Test it out among your co-workers or a sample of your Facebook friends and see for yourself. If you're clever, you might even be able to use this knowledge to make some bets and relieve a few naive people of their money.


  1. Hi Adam,

    I am a grade 12 IB student from Canada. I am doing a math project on this problem, and I would like to find out what the explanation is to this problem, even though you say it is "math intensive". I know it will be hard, but I want to at least give it a shot. Can you help me out?


    1. Read the short paper on the subject by Abramson & Moser entitled "More Birthday Surprises". You read it for free at JSTOR, you just need to create a registration.

      See also DasGupta's review of this and other variations of the Birthday problem in his paper "The matching, birthday and the strong birthday problem: a contemporary review".

    2. Thanks for the links! I now see why you did not include the explanation..

    3. You're welcome. Good luck on your project.