I was interested to see how the problem found on this link (Probability of n balls in n cells, one remaining empty) would be solve if we wanted to know the probability of two cells being empty.
1 Answers
How many ways can we select $2$ of $n$ cells (to be empty)? $\qquad\color{pink}{\binom{n}{2}}$
How many distinct ways can we arrange $n$ distinct balls in $n-2$ cells such that:
- One cell contains three balls, all others hold one ball? $\qquad\color{pink}{\frac{n!}{3!}\binom{n-2}{1}}$
- Two cells each contain two balls, all the others one ball? $\qquad\color{pink}{\frac{n!}{2!2!}\binom{n-2}{2}}$
How many ways can $n$ distinct balls each be assigned one of $n$ cells in total? $\qquad\color{pink}{n^n}$
Add, multiply, divide, and then simplify: $$\begin{align} \mathsf P(M=2) & = \frac{\dbinom{n}{2}\left(\dfrac {n!}{3!}\dbinom{n-2}{1}+\dfrac{n!}{2!2!}\dbinom{n-2}{2}\right)}{n^n} \\[2ex] & = \underline\qquad \end{align}$$
Or by the "glue them together" method: We need to 'glue' either three balls, or two lots of two balls, then add one or two identical invisible balls (respectively) and arrange these $n$ objects among the $n$ cells.
$$\dfrac{\dbinom{n}{3}n! + \dbinom{n}{4}\dbinom{4}{2}\dfrac {n!}{2!}}{n^n}$$

- 129,094