5 balls of different colors are to be placed in 3 different boxes (each box contains atleast 1 ball) What is the number of ways of doing this? I worked it out as 3,1,1 arrangements and 2,2,1 arrangements for each of the three boxes and their respective combinations. Getting it to be 150 ways in total. But this is a kind of a long method. Would there be a shorter and better way to do it? 
 A: You can use Inclusion/Exclusion.  That  can also be computationally tedious. But for this type of problem it works very nicely.
There are $3^5$ functions from the set of balls to the set of boxes, that is, $3^5$ assignments of boxes to the balls.  
We must take away the bad functions, the functions that fail the "at least one in each box" condition. 
So let us remove the $2^5$ functions that leave a box A empty. Do the same for B and C. So we remove $\binom{3}{1}2^5$.
But we have removed too many times the functions that leave two boxes empty. For in the previous step we removed twice, for example, the functions that leave A and B empty. The same thing happened for every pair of boxes.  So we must pit back $\binom{3}{2}1^5$.  We end up with
$$3^5-\binom{3}{1}2^5+\binom{3}{2}1^5.$$
A: 
Would there be a shorter and better way to do it?

Behold the Stirling numbers of the second kind:
$$ 3! \ S(5,3) = 6 \times 25 = 150 $$
The factor $3!$ appears here because the Stirling numbers of the second kind count the combinations considering the boxes are unlabelled (undistinguishable).
