Probability of exactly one empty box when n balls are randomly placed in n boxes.

This question already has an answer here:

  • Probability: $n$ balls into $n$ holes with exactly one hole remaining empty [duplicate]

    4 answers

Solutions Collecting From Web of "Probability of exactly one empty box when n balls are randomly placed in n boxes."

Your approach (although nice) has a flaw in the second bullet. The problem is that there you count two different things: on the one hand ways to choose a box and on the other hand ways to choose a ball and this results to a confusion. In detail

  1. Your denominator is correct,
  2. Your numerator is missing one term that should express the number of ways in which you can choose the $2$ balls out of $n$ that you will put in the choosen box with the $2$ balls. This can be done in $\dbinom{n}{2}$ ways.
  3. The other terms in your numerator are correct. Note that your numerator can be written more simple as $$\dbinom{n}{1}\dbinom{n-1}{1} (n-2)!=n\cdot(n-1)\cdot(n-2)!=n!$$

Adding the ommitted term, gives the correct result which differs from yours only in this term (the highlighted one)
$$\frac{\dbinom{n}{1}\color{blue}{\dbinom{n}{2}} \dbinom{n-1}{1} (n-2)!}{n^n}=\frac{\dbinom{n}{2}n!}{n^n}$$

You can think of the number of favorable arrangements in the following way: choose the empty box in $\binom{n}{1}$ ways. For each such choice, choose the box that will have at least $2$ balls (there has to be one such box) in $\binom{n – 1}{1}$ ways. And for this box, choose the balls that will go inside in $\binom{n}{2}$ ways. Now permute the remaning balls in $(n – 2)!$ ways.

Thus, the number of favorable arrangements is:

$$
\binom{n}{1} \binom{n – 1}{1} \binom{n}{2} (n – 2)! = \binom{n}{2} n!
$$