Regarding probability and the birthday paradox I have a question which states that
"In a group of 23 people what is the probability that there are two people with the same birthday? Assume there are 365 days in a year. Ignore leap years and such complications. Assume there is an equal probability of a person being born on each day of the year.". I solved it using the complement. I first computed the number of ways in which we can assign the birthdays to 23 people out of 365 days (without replacement). That gave 365 * (365-1).. (365-k+1). Then I divided this by 365^k. Then I subtracted the result from 1. But, the probability which I have now got may also contain 3 people having the same birthday or 4 people having the same birthday, etc. I want to know the probability of exactly two people having the same birthday. In short, what I have computer is, " what's the probability that AT LEAST TWO PEOPLE HAVE SAME BIRTHDAY" and what I'm looking for is "WHAT IS THE PROBABILITY OF EXACTLY TWO PEOPLE HAVING THE SAME BIRTHDAY".How do I compute that probability?
 A: The denominator is still going to be $365^k$.
In the numerator, we have:

*

*$365$ ways to choose the repeated birthday;

*$\binom{364}{k-2}$ ways to choose the birthdays that are not repeated;

*$\frac12 k!$ ways to permute the resulting days, dividing by $2$ because the two repeated birthdays can be swapped.

So we get a probability of $$\frac{365  \cdot\binom{364}{k-2} \cdot \frac12 k!}{365^k} = \frac{k! \binom{364}{k-2}}{2 \cdot 365^{k-1}}.$$
Set $k=23$ to get the probability you want.

Another option for the numerator, which will get an equivalent answer. First, there are $\binom k2$ ways to choose which two people have the same birthday. Then, we can take the same product $365 \cdot 364 \cdot 363 \cdots$ to fill in the birthdays, but there is one difference. Once we pick the birthdays of one person in the repeated pair, we get the other one for free. So instead of having the $k$-factor product $365 \cdot 364 \cdots (365-k+1)$, we get the $(k-1)$-factor product $365 \cdot 364 \cdots (365-k+2)$.
The result is
$$
   \frac{\binom k2 \cdot 365 \cdot 364 \cdots (365-k+2)}{365^k}.
$$
A: If by exaclty you mean any two peaople having same birthday and all the rest having different birthday, then we can do it for ingeneral having $i$ peaople out of $k$ with same birthday as follows:
For each fixed day of 365 days there are $\binom{k}{i}$ ways of chosing $i$ people having that day as birthday, by wich there are $364(364-1)(364-2)\ldots(364-k+i+1)$ ways of the rest $k-i$ people having different birthday, so the probability of exactly $i$ having the same birthday is
$$P(i)=\frac{365\binom{k}{i}364(364-1)(364-2)\ldots(364-k+i+1)}{365^k}$$
