# 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
Please ask your question first, then get into the motivation. Readers are trying to figure out if they can help you, and having to read a long paragraph about you doesn't help them help you in the least. – Thomas Andrews Jul 15 '13 at 18:00

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.

I am not sure what your final question is asking.

-
That's a very good answer. Okay, let me put it to you this way. I was having a discussion with a friend of mine, who noted with surprise that she could name seven of her friends whose birthdays fell in the period August-September and five of them had birthdays in February. And I started to think about this and I wondered to myself: well, if the probability of two people sharing a birthday in a group of 23 is 50%, how many people would you need for a probability of 50% of them sharing a birthday in the same week, then in the same month. – Au101 Jul 15 '13 at 17:56
With regard to my last question. I thought: well, imagine she has met 500 people whom she has had a chance to get to know well. I then wondered to myself, just how remarkable is it that seven of them have a birthday between August and September. What I was struggling to do is to frame a mathematical question which would allow me to answer the question: how big would your group of randomly selected people have to be until you could be sure that they would share a birthday in the same two months and, also, suppose you have a group of 500, what are the odds of seven have birthdays in this range – Au101 Jul 15 '13 at 17:58
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
Okay thanks everyone, I'm really sorry, I don't have a very statistical brain and I was struggling to word the question clearly. Let me try again (sorry for the vagueness): Suppose you have a group of - let's say 30 people - what is the probability that seven of those 30 have a birthday within 50 days (i.e. less than two months)? – Au101 Jul 15 '13 at 18:02