Birthday problem expectation
I am self-learning basic calculus-based undergrad probability. I'd like someone to verify if my work checks out and the mathematical expectation is correct.
[BH 4.35] A group of $50$ people are comparing their birthdays (as usual, assume heir birthdays are independent, are not on February 29). Find the expected number of pairs of people with the same birthday, and expected number of days in the year on which atleast two of these people were born.
Solution.(My Attempt)
Let $A_j$ be the event that the $j$th pair shares their birthday and let $I_{A_j}$ be the indicator function of $A_j$.
\begin{align*} P(A_j) = \frac{1}{365} \end{align*}
Let $X$ be the number of pairs of people with the same birthday.
\begin{align*} X &= I_{A_1} + I_{A_2} + \ldots + I_{A_{50 \choose 2}}\\ E(X) &= \sum_{j=1}^{50 \choose 2} E(I_{A_j}) = {50 \choose 2}\frac{1}{365} \end{align*}
The probability that no person is born on a pre-specified day of the year is,
\begin{align*} \frac{364^{50}}{365^{50}} = \left(1 - \frac{1}{365}\right)^{50} \end{align*}
The probability that exactly $1$ person is born on a prespecified day of the year is,
\begin{align*} \frac{{50 \choose 1} (364)^{49}}{365^{50}} \end{align*}
Let $B_j$ be the event "Atleast $2$ of these people are born on a pre-specified day $j$ of the year", and let $I_{B_j}$ be the indicator function of the event.
\begin{align*} P(B_j) = 1 - \frac{364^{50} + 50\cdot 364^{49}}{365^{50}} \end{align*}
Let $Y$ be the number of days of the year on which atleast $2$ or more people are born. Then,
\begin{align*} Y &= \sum_{j = 1}^{365} I_{B_j}\\ E(Y) &=365 \left(1 - \frac{364^{50} + 50\cdot 364^{49}}{365^{50}}\right) \end{align*}
Solution 1:
Yes, your work is perfectly correct. When there are $n$ people in the group, the expectations are
$$\operatorname{E}[X] = \binom{n}{2}\frac{1}{365} = \frac{n(n-1)}{730},$$ and $$\operatorname{E}[Y] = 365 \left( 1 - \frac{364^{n-1}(n + 364)}{365^n}\right).$$ Of note, the probability $\Pr[B_j]$ is expressible as $\Pr[W_j \ge 2]$ where $W_j \sim \operatorname{Binomial}(n, p = 1/365)$ counts the number of people born on day $j$. So we can write $$\Pr[B_j] = 1 - \Pr[W_j \le 1] = 1 - \binom{n}{0} p^0 (1-p)^n - \binom{n}{1} p^1 (1-p)^{n-1}.$$ And in general, if we wanted to compute the expected number of birthdays that are shared by at least $m$ people, this would be $$\operatorname{E}[Y_m] = 365 (1 - \Pr[W_1 \le m-1]) = 365 \left( 1 - \sum_{k=0}^{m-1} \binom{n}{k} p^k (1-p)^{n-k} \right).$$ One should also observe that the events $B_i$ and $B_j$ are not independent for $i \ne j$; however, independence is not required in order to apply the linearity of expectation. Then because their marginal distributions are identically distributed, the desired sum is simply $365$ times the probability for a single prespecified day.