# probability of 2 person has the same birthday in a class.

problem: there are n persons in a room, what is the probability that no two of them celebrate the same birthday in a year? Here is my thought process, The sample space is $$|\{(b_1,b_2,\dots,b_n): b_1,b_2\in\{1,2,\dots 365\}\}|=(365)^n$$ , and I got stuck at counting the Event, $$|\{(b_1,b_2,\dots,b_n)：b_i\neq b_j \forall i\neq j \}|=365*364*\dots*1$$ but what if n>365? how do I count that?

• Let's ignore leap day for a moment. So working with $365$ days. If $n > 365$ then by the pigeon-hole principal there has to be at least two people that share a birthday. Apr 11, 2022 at 22:43
• If n>365, two people will have the same birthday with probability one. Apr 11, 2022 at 22:43
• If $n \gt 365$, what does the pigeonhole principle tell you about the probability that no two people have the same birthday? Apr 11, 2022 at 22:44
• Hi, thanks for the comments! Totally forgot about the pigeon hole principal, that makes sense now!
– Remu
Apr 12, 2022 at 0:16
• For what it's worth, the probability of no birthday matches, for $n \in \{1,2,\cdots, 365\}$ can be more tersely expressed as $$\frac{(365)!}{[365 - n]!} \times \frac{1}{(365)^n}.$$ As you indicated, the denominator of the 2nd term above represents the sample space, while the first factor represents the number of ways of sampling $n$ birthdays, where the selection is done without replacement. Here, it is easiest to consistently regard the order of selection as pertinent in both the numerator and denominator, since that facilitates the $(365)^n$ expression. Apr 12, 2022 at 1:46

• Your first calculation is $$365$$,
• your second calculation $$365\times 364$$,
• your $$365$$th calculation $$365\times 364\times \cdots\times 1$$,
• and your $$366$$th calculation $$365\times 364\times \cdots\times 1\times 0$$ which is $$0$$.
You can carry on further, but you will always have the $$\times 0$$ term with more people. So whenever you have more people than possible birthdays, you never get them each having a different birthday.