# The Birthday Problem

I've been reading about the birthday problem which, as I'm sure many of you will know, is a statistical problem which aims at finding out the how many people you would need in a random group to be certain that two of them shared a birthday. I've read the wikipedia article and am happy with the concept and the answers to this problem. What I'm interested in doing is expanding the principle. I've been trying to work out the answer to a similar problem, but where you simply wanted to know the probability that two people were born in the same week and in the same month. I'm not really sure how to go about this, though, so my first question is: is there a general equation I can use to extend the problem to these cases? But, I know there are many articles and stackexchange questions on this, so I wouldn't ask unless I had a specific problem, which is this:

Suppose a person has met 500 people in their lifetime. What is the probability that seven of those 500 share a birthday in the same two month period?

I think the answer to my last question is that it's certain. But could I ask what is the smallest number of people you would need for the probability that - in a group of 500 people - the probability of them sharing a birthday in a two month period is less that 50%? If that makes sense?

Okay, thank you everybody, edited to tidy up:

Question 1: What is the smallest group of randomly selected people required such that the probability that two of them share a birthday within one week of each other is at least 75%?

Question 2: What is the smallest group of randomly selected people required such that the probability that two of them share a birthday within thirty days of each other is at least 75%?

Question 3: What is the smallest group of randomly selected people required such that the probability that seven of them share a birthday within sixty days of each other is at least 75%?

Question 4: In a group of 30 randomly selected people, what is the probability that seven of them will share a birthday with fifty days?

I hope that's a lot clearer. I had no idea how to word these questions until I posted this and am grateful to everyone who's contributed for helping me do so :)

• The typical Birthday problem is something along the lines "What is the probability of two people share a birthday in a group of 23 people?", "Determine the size of the group, such that the probability exceeds 50% (or 90%)". You will not get certainity unless the group has more people than the year has days. Please specify, what you are looking for exactly. – Tomas Jul 15 '13 at 17:55
• I would delete the motivation altogether, as it wastes our time, contributes nothing, and hence discourages us from helping. – David G. Stork Apr 23 '19 at 17:21

As suggested by Henry, questions 1 and 2 are answered by one generalization Wikipedia gives for the birthday problem, for near-misses. Take $m=365$, $k=7$ or $k=30$ respectively, and determine the smallest $n$ where $$p(n,k,m)=1-\frac{(m-nk-1)!}{m^{n-1}(m-n(k+1))!}$$ is greater than $0.75$.

If you wanted to count 7 people sharing the same birthday, there is another generalization that is relevant, for multiple collisions.

However questions 3 and 4 are combining both generalizations, asking for a "multiple near-miss". This seems rather tricky, and I don't know if it's been solved exactly in general.

• Okay, for question 1: Wolfram|Alpha spits out four values of $n$. One is negative and two are in the nineties, but $n \approx 8.35709466412574\dots$ is good. And if I try it with $n = 9$, I get $P = 0.81$ (3sf) which seems to work. For question 2: I get a very low value of $n$ with $k = 30$, specifically $n \approx 0.00783908832757675\dots$ which I'm not really sure how to interpret. (I should clarify I merely set the equation above equal to 0.75 and filled in the values of $m$ and $k$, thus giving the exact value of $n$ that would give a probability of 75%) – Au101 Jul 15 '13 at 20:53
• But you want integer $n$; just try $n=8, 9$ to see what happens in q1. Same for q2, just try $n=1,2,3,4,\ldots$. – vadim123 Jul 15 '13 at 21:01
• Question 1 I can completely understand. If I try $n = 9$ I get $P(9,7,365) = 0.81$ (3sf). So, from that, we can see that if we randomly select 9 people, the probability that two of them will share birthdays within 7 days of each other is 0.81. Which is really cool. – Au101 Jul 15 '13 at 21:11
• For question 2: If I set $n = 1$ $P = 1$ (well, not quite, but W|A gives the answer as so close to 1 it makes no difference. Well, this is odd, I don't really understand what this result means, but $n = 2$ gives an answer fantastically close to 1 again, so I can only assume that even with just 2 people, their birthdays are almost certainly within a month of each other. This is plainly false? – Au101 Jul 15 '13 at 21:12
• I think you mistyped the formula. For $n=5$ I get $0.885$, while for $n=4$ I get $0.705$. – vadim123 Jul 15 '13 at 21:15

You may need to be more careful with your wording.

"To be certain that two of them shared a birthday" you need $367$ people (or $366$ if you ignore 29 February) by the pigeon-hole principle

Since $\frac{500}{6} \gt 83$, you can be certain that at least $84$ of the $500$ have birthdays within some two month period, which is rather more than seven.

• Wikipedia gives $7$ people for the probability that a pair of them have birthdays separated by six days or fewer to exceed $0.5$. – Henry Jul 15 '13 at 17:59
• @Au101: if you read the Wikipedia article you should be able to figure out weeks and months, if you make some simplifying assumptions. Weeks can overlap, unlike days, and months have different numbers of days. If you assume people are equally likely to be born any given month, you need 5 to have better than $50\%$ chance (actually you have $63\%$ chance) that two share a birth month. – Ross Millikan Jul 15 '13 at 18:00