[Math] Possible ways of putting 7 balls into 3 boxes

combinatoricsinclusion-exclusion

We have 7 balls each of different colors (red, orange, yellow, green, blue, indigo, violet) and 3 boxes each of different shapes (tetrahedron, cube, dodecahedron). How many ways are there to place these 7 balls into the 3 boxes such that each box contains at least 1 ball?

I solved it like this:
Assuming that the 3 boxes have got 1 ball each no. of balls left$=4$
Let box $1,2,3$ get $a,b,c$ balls each $0\le a,b,c \le 4$
$$a+b+c=4$$
Possible solutions $={4+2 \choose 2}=15$

Now in the assumption ways of placing 3 balls in 3 boxes=$3!=6$

So total no. of ways $= 6 \times 15=90$

But answer is $1806$!! Where am i wrong?? Please help

Best Answer

The balls are distinguishable and for each ball we have three choices of where to put it. The number of possible ways, without restrictions, is thus $3^7=2187$.

The disallowed ways can be counted by inclusion–exclusion. If the balls are put into two boxes we have three choices for which boxes the balls get put into and two choices per ball, leading to $3×2^7=384$ disallowed ways. We counted the $3×1^7=3$ ways to put all balls into one box twice, so we subtract 3.

Finally, the number of allowed assignments of balls to boxes is $2187-384+3=1806$.

Related Question