Number of empty subway cars I have task: 

There are $9$ passengers and they get into empty $5$-car subway train. What is the probability of the fact, that exactly two cars will be empty?

I know that the power of all possibilities is $5^9$. Then I thought to pick two empty cars that is ${5\choose 2}$ possibilities, then pick three people that get to the rest of the cars, that is $9\cdot 8\cdot 7$ and the rest of the people have $3^6$ possibilities. I checked it on my calculator and it seems that the power of this event is bigger than the power of $\Omega$. What is wrong? 
 A: Yes, we have $\binom{5}{3}=\binom{5}{2}=10$ ways to choose the $3$ not-empty cars. Now you have to multiply this number by the number of surjective maps from $\{1,\dots,9\}$ to $\{1,2,3\}$, i.e. $S(9,3)=3^9-3\cdot 2^9+3=18150$ where
$$S(a,b) = \sum_{k=1}^b (-1)^{b-k} \binom{b}{k} k^a.$$
Such number is strictly less than $9\cdot 8\cdot 7\cdot 3^6$ (you are overcounting the number of cases).
Hence the probability that exactly two cars will be empty is
$$p=\frac{10S(9,3)}{5^9}=\frac{181500}{1953125}=0.092928.$$
A: The three cars must have at least $1$ passenger each. So the cases can be easily calculated:
$$\{1,1,7\} \Rightarrow {9\choose 1}{8\choose 1}3=216\\
\{1,2,6\} \Rightarrow {9\choose 1}{8\choose 2}6=1512\\
\{1,3,5\} \Rightarrow {9\choose 1}{8\choose 3}6=3024\\
\{1,4,4\} \Rightarrow {9\choose 1}{8\choose 4}3=1890\\
\{2,2,5\} \Rightarrow {9\choose 2}{7\choose 2}3=2268\\
\{2,3,4\} \Rightarrow {9\choose 2}{7\choose 3}6=7560\\
\{3,3,3\} \Rightarrow {9\choose 3}{6\choose 3}1=1680\\
$$
The sum is $18150$.
The three cars with passengers can be any of the five: ${5\choose 3}=10$.
Hence, there are $18150\cdot 10=181500$ ways to arrange $9$ passengers in $5$ cars so that exactly $2$ will remain empty. The probability is:
$$P=\frac{181500}{5^9}\approx 0.09.$$
