TITLE: Probability of exactly one empty box when n balls are randomly placed in n boxes.
QUESTION [6 upvotes]: Each of $n$ balls is independently placed into one of $n$ boxes, with all boxes equally likely. What is the probability that exactly one box is empty? (Introduction to Probability, Blitzstein and Nwang, p.36).


The number of possible permutations with replacement is $n^n$
In order to have one empty box, we need a different box having $2$ balls in it. We have $\dbinom{n}{1}$ choices for the empty box, $\dbinom{n-1}{1}$ choices left for the box with $2$ balls, and $(n-2)!$ permutations to assign the remaining balls to the remaining boxes.
Result: $$\frac{\dbinom{n}{1} \dbinom{n-1}{1} (n-2)!}{n^n}$$

Is this correct?

REPLY [4 votes]: 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

Your denominator is correct,
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.
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}$$

REPLY [3 votes]: 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!
$$