# Find the probability that in a group of 23 people, exactly 3 people have birthdays on the same day [duplicate]

My approach was as follows, select 3 people from 23 and then assign any one of the 365 days, then assign the remaining 20 people any of the 364 days and divide it by the total possibilities, which comes out to be the following :-

$\frac{{23\choose3}*365*^{364}P_{20}}{365^{23}}$

I would like to know what is wrong in my approach, because if you consider the number of people who have their birthday on the same day as a variable and sum the above formula from 2 to 23 it should lead to an answer close to 0.5, which is not happening.

• why do you think that the answer should be close to 0.5? The probability that at least two people have the same birthday is close to 0.5, but you are looking at something else Commented Mar 12, 2018 at 7:46
• Because at least 2 people means sum over 2 to 23 of (exactly x people sharing their birthday) Commented Mar 12, 2018 at 14:21
• @Xi'an I am not asking for the real answer...I'm assuming uniform probability of birthdays in a year..My question is totally different. Commented Mar 12, 2018 at 14:27
• I agree, Vishaal. However, to date we have dozens of posts on variations of the Birthday problem, among which it's easy to find versions that truly are the same as or equivalent to yours: see stats.stackexchange.com/search?q=birthday+is%3Aquestion. It's not completely clear which might be duplicates because your event is ambiguous. For instance, if four people have the same birthday, then three of them share a birthday: would that count? What if three people share one birthday and three others share another?
– whuber
Commented Mar 12, 2018 at 14:50
• @whuber I will tell you what my real problem is, I just want to calculate the answer to birthday problem the other way around. so instead of doing this $1-\frac{^{365}P_{23}}{365^{23}}$ I wanted to compute for each case and sum it up. Commented Mar 13, 2018 at 6:25

I had a mistake in my original answer, here is a corrected version. here is how you can calculate the probability that in a group of $23$ people exactly $3$ have the same birthday and the remaining $20$ persons all have different birthdays (so that there is a total of $21$ different birthdays).

1. There are $23\choose{3}$ possibilities of fixing three people.
2. The probability that three persons have the same birthday is $p_1 = \frac{365}{365^3}$.
3. The probability that the remaining 20 persons have all a different birthday is $p_2 = \frac{364 \cdot \dots \cdot 345}{365^{20}}$.

Therefore we arrive at

$$p = {23\choose 3} \cdot p_1 \cdot p_2 = 0.007395218.$$

I also wrote a small R simulation:

library(dplyr)

bd3 <- function(){
x <- sample(1:365, 23, replace = T)
n1 <- table(x) %>% as.data.frame() %>% filter(Freq==3) %>% nrow()
n2 <- table(x) %>% as.data.frame() %>% filter(Freq==1) %>% nrow()
return(ifelse(n1 == 1 & n2 == 20, 1 ,0))
}

set.seed(118)
replicate(100000, bd3()) %>% mean
[1] 0.0074


So the result of the simulation is close to the theoretical answer.

• Exactly three people should have birthday on the same day. Not two sets of three people who have a birthday on the same day for example. So you should change inequality >= to ==. Commented Mar 12, 2018 at 9:25
• Assume that we have 6 people of which 3 have birthday on january 1st and 3 people on january 2nd. Then exactly 3 people have their birthday on the same day, or not? Commented Mar 12, 2018 at 9:27
• @Cettt Going by your logic the probability of exactly 2 people sharing their birthday > probability of at least 2 people sharing their birthday, which is not possible. Commented Mar 12, 2018 at 14:26
• not really: lets denote the probability of exactly $k$ people having the same birthday with $p_k$. Then it is well known that $$\sum_{k=2}^{23} p_k \approx 0.5.$$ Therefore $p_3$ has to be much smaller than $0.5$, which it is. Commented Mar 12, 2018 at 14:29
• @Cettt $p_2$ > 0.5 that's what I'm saying. Commented Mar 12, 2018 at 14:31