-3

If an infinite amount of people enter a room one by one, what is the expected number of people in the room when you first find two that share the same birthday? (Assuming no leap years and every birthday is equally likely).

StubbornAtom
  • 17,932
Bruce
  • 31
  • 3
    There isn't enough information. There could be two, there could be a billion. No way to tell. Did you have some sort of prior assumption regarding the number of people in the room? – lulu Jan 26 '21 at 21:31
  • Yeah there's definitely not enough information here to say much – Riemann'sPointyNose Jan 26 '21 at 21:39
  • @Riemann'sPointyNose, I've tried to clarify the question. Is there enough information now? – Bruce Jan 26 '21 at 21:45
  • 1
    Yes, the question is very different now. Can you compute the probability that the first duplicate oocurs when person $n$ enters? – lulu Jan 26 '21 at 21:47
  • 1
    What have you tried, first of all? – Riemann'sPointyNose Jan 26 '21 at 21:52
  • @lulu I'm not entirely sure what you're asking. When person n enters the room, the probability they share a birthday with someone else (since we have had no shared birthdays so far) is given by $ \frac{n-1}{365}$. – Bruce Jan 26 '21 at 21:53
  • I am asking for the probability that the first duplicate occurs when the $n^{th}$ person enters. Thus, you need the first $n-1$ birthdays to be distinct and then you need the $n^{th}$ to match one of those $n-1$. Calling this $p_n$ we easily see that $p_2=\frac 1{365}$ for example. As a check, once you have a formula for it, you should be able to confirm that $\sum_{n=1}^{365}p_n=1$. – lulu Jan 26 '21 at 21:54
  • @lulu I've come up with $p_n = \frac{n-1}{365}$ but $\sum_{n=1}^{365} p_n \neq 1$ for that formula. – Bruce Jan 26 '21 at 22:05
  • Well, that means your formula for $p_n$ is wrong. Just compute $p_3$ carefully to see that your formula isn't right even in that case. – lulu Jan 26 '21 at 22:07
  • @lulu I'm unable to come up with anything else. Shouldn't $p_3 = \frac{2}{365}$ since of the 365 birthdays the 3rd person could have, two would result in a duplicate? – Bruce Jan 26 '21 at 22:15
  • In order for the third person to be the first duplicate, you need the first two people not to be duplicates. Think about it, your formula says that the probability that the $365^{th}$ person is the first duplicate is nearly $1$. But that would be an absurdly rare event. – lulu Jan 26 '21 at 22:33
  • Why not try an easier problem? If you are tossing a fair coin, what's the expected number of tosses until you see a duplicate? Same thing for a fair die. – lulu Jan 26 '21 at 22:35
  • here is a duplicate of your question. But you should try the simpler problems I proposed before looking up the answer. – lulu Jan 26 '21 at 22:44
  • @lulu sorry I misunderstood what you were asking. I thought we were basing $p_n$ off of the assumption that we had no duplicates so far. Once I find $p_n$, how would I approach calculating my expected value? – Bruce Jan 26 '21 at 22:49
  • 1

2 Answers2

2

Whenever $N$ is a random variable which takes values in the non-negative integers $\{0,1,2,3,\ldots\}$, there's a nice formula for the expected value $\mathbb{E}[N]$ of $N$: $$\mathbb{E}[N] = \sum_{n=1}^\infty \mathbb{P}(N \geq n) = \sum_{n=0}^\infty \mathbb{P}(N > n)$$

In this case, the second expression is the nicest, because if $N$ is the number of the first person who enters with a birthday matching a birthday in the room, then $$\begin{align*}\mathbb{P}(N > n) &= \text{ Probability that none of the first } n \text{ people has a birthday in common with another} \\ &= \left(\frac{365}{365}\right)\left(\frac{364}{365}\right)\cdots\left(\frac{366-n}{365}\right) \\ &= \frac{365!}{365^n(365-n)!} \qquad \text{ if } 0\leq n \leq 365 \text{ and zero otherwise}\end{align*}$$

Then $$\mathbb{E}[N] = \sum_{n=0}^{365} \frac{365!}{365^n(365-n)!} \approx 24.616586$$

Note that this is close to, but not equal, the well-known median of $23$. In fact, if you scroll down that page to here, you'll see the same formula we derived along with the same result we've found for the expected value.

  • Maybe I'm wrong but as far as I see your probability is wrong since based on what I said (which is plain clear) you're actually saying that the number of n-tuples with elements from 1 to 365 is equal to $\frac{365^n}{n!}$ but this is clearly wrong since you're ignoring a lot of cases. (not every tuple is counted $n!$ times) – ARYAAAAAN Jan 27 '21 at 05:26
  • @AryanHemmati Use ordered selection. There are $\binom{365}{n}n!$ permutations of length $n$ from ${1,2,\ldots,365}$ and $365^n$ $n$-tuples with entries from ${1,2,\ldots,365}$. If you use some concept of an unordered $n$-tuple, as you are trying to do in your comment, then not all of these "unordered $n$-tuples" will be equally likely, so you cannot compute the probability as you have attempted to do. – Brian Moehring Jan 27 '21 at 05:57
  • Yes you're right – ARYAAAAAN Jan 27 '21 at 06:00
  • Thanks a lot‌... – ARYAAAAAN Jan 27 '21 at 06:03
0

According to Pigeonhole Principle the number of people in the room shall at least be 366 to ensure what you're saying. However it "is" possible for less people in the room but this is the number you can be sure that at least two of the people share their birthday

ARYAAAAAN
  • 1,709
  • Supposing infinitely many people enter a room one-by-one, shouldn't it be possible to calculate what, on average, the amount of people in the room would be when a shared birthday is found? The same way one could calculate the expected number of coin flips to get x consecutive heads? – Bruce Jan 26 '21 at 21:43
  • What do you mean of "average"? Are you asking for a probability of existing two people in the room that have the same birthday for $n$ people inside the room? – ARYAAAAAN Jan 26 '21 at 21:45
  • @AryanHemmati. No, I know how to find the probability for n people. I'm trying to find what the expected value of n is once I find a shared birthday (assuming we are incrementing n until a shared birthday is found). – Bruce Jan 26 '21 at 21:49
  • ah, is that a valid way of finding expected values? Would it just be $\frac{n-1}{365} \geq \frac{1}{2}$ or $n=184$? – Bruce Jan 26 '21 at 21:56
  • @Bruce Finding the median is a useful exercise, but no, it's not the same as the expected value, nor can you compute either like that... – Brian Moehring Jan 26 '21 at 22:07
  • There is no ambiguity at all in the phrase "expected value". – lulu Jan 26 '21 at 22:36