# Probability question (Birthday problem)

I was wondering if someone could critique my argument here. The problem is to find the probability where exactly 2 people in a room full of 23 people share the same birthday.

My argument is that there are 23 choose 2 ways times $\displaystyle \frac{1}{365^{2}}$ for 2 people to share the same birthday. But, we also have to consider the case involving 21 people who don’t share the same birthday. This is just 365 permute 21 times $\displaystyle \frac{1}{365^{21}}$. To summarize:

$$\binom{23}{2} \frac{1}{365^2} \frac{1}{365^{21}} P\binom{365}{21}$$

#### Solutions Collecting From Web of "Probability question (Birthday problem)"

The basic idea was right, and a small modification is enough.

Line up the people in some arbitrary order. There are, under the usual simplifying assumption that the year has $365$ days, $365^{23}$ possible birthday sequences. Under the usual assumptions of independence, and that all birthdays are equally likely, all these sequences are equally likely. The assumption “equally likely” is not correct, though it is more correct for people than for eagles.

Now we count how many ways we can have precisely $2$ people have the same birthday, with everybody else having a different birthday, meaning different from each other and also different from the birthday of our birthday couple.

The couple can be chosen in $\binom{23}{2}$ ways. For each of these ways, the couple’s birthday can be chosen in $365$ ways. And the birthdays of the others can be chosen in what is sometimes called $P(364,21)$ ways. (I have always avoided giving it a name.) So the number of birthday assignments that satisfy our condition is
$$\binom{23}{2}(365)P(364,21), \quad\text{that is,}\quad \binom{23}{2}(365)(364)(363)\cdots (344).$$
For the probability, divide by $(365)^{23}$.

Remark: Or else argue this way, which may be closer in spirit to your thinking. Pick two people, $i$ and $j$. What is the probability these two have the same birthday, and all other birthdays are different from this one, and different from each other? Whatever $i$’s birthday is, the probability that $j$’s matches it is $\frac{1}{365}$. By the usual birthday argument, the probability that the birthdays of the other people are different, and different from the birthdays couple’s, is
$$\frac{364}{365}\frac{363}{365}\frac{363}{365}\cdots\frac{344}{365}.$$
Multiply the above expression by $\frac{1}{365}$.
Finally, sum the result over the $\binom{23}{2}$ ways to choose $i$ and $j$, that is, multiply by $\binom{23}{2}$.

A brief simulation using R software permits verification of some
proposed methods and gives answers to some related questions. Below
X is the number of matches (defined as number of people minus
number of redundant birthdays). A million iterations provide about
three place accuracy; smaller values of m run faster, but have
somewhat larger simulation error.

m = 10^6; x = numeric(m); n = 23

for (i in 1:m) {

birthdays = sample(1:365, n, rep=T)

x[i] = n – length(unique(birthdays)) }

mean(x == 0) # Exact P{X = 0} = 0.4927028

[1] 0.493275

mean(x == 1) # Exact P{X = 1} = 0.3634222

[1] 0.362928

mean(x) # Approx E(X)

[1] 0.67928

sd(x) # Approx SD(X)

[1] 0.7921738

The exact probability of no matches is from ‘prod(365:343)/365^23’ or
‘prod(1 – (0:22)/365)’. The exact probability of one match is from
‘choose(23,2)*prod(365:344)/365^23’. The approximation of the PDF of X
from the simulation can be obtained from ‘table(x)/m’, and it is
closer to exact than the Poisson approximation with mean (23*22)/(2*365).
Simulation results above use ‘set.seed(1234)’. A similar simulation is shown
in Suess & Trumbo: “Intro. to Probability Simulation…”, Springer (2010),
pages 4-7. (The Amazon ad permits viewing a few pages, including some
explanation of this R code.)

A slightly modified simulation can approximate the more realistic case
in which not all birthdays are equally likely (and can include Feb. 29).
The modest day-to-day variation in birthday frequencies in the US seems to
affect the second decimal places of P{X = 0} and E(X) by about one digit.

Bruce Trumbo

This question has been asked in more ways than there are Buddhas. Try looking here https://math.stackexchange.com/search?q=birthday+problem