Probability of balls in boxes If $12$ balls are thrown at random into $20$ boxes, what is the probability that no box will receive more than $1$ ball?
So my book says the answer is: $\displaystyle \frac{20!}{8!20^{12}}$
However I am having some trouble understanding this result and was hoping for some clarification. 
There's a formula in my book: $\displaystyle p=\frac{n!}{(n-k)!n^k}$ so it's apparent that $n=20$ and $k=12$, but I don't understand the reasoning behind it.
 A: Outline:


*

*Count the number of ways to throw $12$ balls into $20$ boxes

*Count the number of ways to throw $12$ balls into $20$ boxes with at most one ball per box.

*Divide the number of desired ways by the total number of ways.


Ways to throw $12$ balls into $20$ boxes
For each of the $12$ balls, there are $20$ options of where it can be thrown.  (The first ball could be thrown into any of $20$ boxes, the second could be thrown into any of $20$ boxes, etc.)  So, there are:
$$\underbrace{20\cdot20\cdots 20}_{12\text{ times}} = 20^{12}\text{ ways}$$
...that the balls could have been thrown.
Ways with at most one ball per box


*

*For the first ball, we have $20$ options of where to throw it (because all the boxes are empty).  

*For the second ball, we can throw it in any box except the one taken by the first ball, so there are $19$ options for the second ball.  

*For the third ball, we can't throw it in the boxes occupied by the first or second balls, so there are only $18$ options.

*$\quad\vdots$

*For the twelfth ball, we can throw it in any box *except those occupied by balls $1, 2, 3\ldots, 11$.  So, there are $9$ options for the twelfth ball.


All together, then, there are:
\begin{align*}
20\cdot 19 \cdot 18\cdots 9 &= \frac{(20\cdot 19 \cdot 18\cdots 9)\color{red}{(8\cdot 7\cdots2\cdot 1)}}{\color{red}{(8\cdot 7\cdots2\cdot 1)}}\\
&= \frac{20!}{8!}\text{ ways}
\end{align*}
Divide to get probability
The probability (when dealing with equally likely outcomes) is the number of desired outcomes divided by the total number of outcomes.  Here, we desire one ball per box.  So, the probability is:
$$\frac{\frac{20!}{8!}}{20^{12}} = \frac{20!}{8!20^{12}}$$
A: Each of the twelve balls can go into any box, so the total number of outcomes is $20^{12}$. The number of ways such that each box gets at most one ball is the same as chosing wich of the twenty boxes get a ball, where the order is important since we distinguish both, balls and boxes. This is $\underbrace{20\cdot 19\cdot \ldots \cdot 9}_{12 \text{ factors}} = \frac{20!}{8!}$. Thus assuming uniform distribution,
$$P = \frac{\frac{20!}{8!}}{20^{12}} = \frac{20!}{8! 20^{12}}$$
A: I've been toiling over a complete understanding of this problem and all of the other possible outcomes where boxes can have more than one ball. 
In general, suppose $k$ balls are thrown into $n$ boxes. Let $b_t$ represent the number of boxes containing $t$ balls so that we have $$\displaystyle\sum_{j=0}^k b_j=n \quad \text{ and } \quad \displaystyle\sum_{j=0}^n j b_j=k.$$ Given $\{b_t\}_{t\geq0}$, let $a_m$ represent the number of balls in box $m$ for a particular realization of this experiment so that $$\displaystyle\sum_{i=0}^n a_i=k.$$ It does not matter which specific realization we choose for the $\{a_m\}_{m\geq1}$. I prefer to have $a_1\geq a_2 \geq ... \geq a_n$. In other words, the order of the boxes doesn't matter.
We want to know the probability of $\{b_0, b_1, ... b_k\}$ (i.e. that $b_0$ boxes have no balls, $b_1$ boxes have 1 ball each, $b_2$ boxes have 2 balls each, etc.). The desired probability is
$$P\left(\{b_0, b_1, ... b_k\}\right)=
\frac{\left(
\begin{array}{c}
n\\
b_0, b_1, ... b_k
\end{array}
\right)
\left(
\begin{array}{c}
k\\
a_1, a_2, ... a_n
\end{array}
\right)}{n^k}.$$
The question asked in the original post is for $k=12$, $n=20$, $b_0=8$, $b_1=12$, and $b_t=0$ for $1<t\leq 12$. This is from DeGroot and Schervish $\S 1.7$ exercise $\# 7$ (4th ed.). Within the framework outlined above the desired probability is
$$\displaystyle P\left(\{8,12,\underbrace{0,...,0}_{10\text{ zeros}}\}\right)=
\frac{\left(
\begin{array}{c}
20\\
8,12,\underbrace{0,...,0}_{10\text{ zeros}}
\end{array}
\right)
\left(
\begin{array}{c}
12\\
\underbrace{1,...,1}_{12\text{ ones}},\underbrace{0,...,0}_{8\text{ zeros}}
\end{array}
\right)}{20^{12}} 
= \frac{\frac{20!}{8!12!}\frac{12!}{1!1!\cdots 1!}}{20^{12}}= \frac{20!}{8!20^{12}}
$$ 
Just as expected from the above answer.
For an illustration, let's experiment by throwing 5 balls into 6 boxes. What is the probability that one box gets 3 balls and 2 boxes get one ball each?
Since 3 boxes get no balls, $b_0=3$, $b_1=2$, $b_2=0$, $b_3=1$, and $b_4=b_5=0$. Let $a_1=3$, $a_2=a_3=1$, and $a_4=a_5=a_6=0$, without loss of generality (we could re-order the boxes any way we please). The desired probability is
$$P\left(\{3,2,0,1,0,0\}\right)=
\frac{\left(
\begin{array}{c}
6\\
3,2,0,1,0,0
\end{array}
\right)
\left(
\begin{array}{c}
5\\
3,1,1,0,0,0
\end{array}
\right)}{6^5}.$$
Note that the zeros in the multinomial coefficient are redundant, so this simplifies to
$$P\left(\{3,2,0,1,0,0\}\right)=
\frac{\left(
\begin{array}{c}
6\\
3,2,1
\end{array}
\right)
\left(
\begin{array}{c}
5\\
3,1,1
\end{array}
\right)}{6^5}
=
\frac{\frac{6\cdot5\cdot4}{2}\cdot5\cdot4}{6^5}=\frac{200}{6^4}\approx0.1543.$$
Also, note that the number of balls is allowed to be larger than the number of boxes.
I haven't tried to prove this formula yet, but it has worked for all examples I've tried (running numerical simulations). 
A: Model the situation as mappings from the set $\{1,\dots,12\}$ into the set $\{1, \dots, 20\}$. 
The total number of possibilities (mappings) is $20^{12}$.
The requirement amounts  to having an injection. So the number of favourable cases is
$$\frac{20!}{(20-12)!}$$
Thus the probability is $$p=\frac{20!}{8!\,20^{12}}\approx0.0147. $$
