[Math] Find the number of ways in which $7$ different balls can be distributed into 4 identical boxes, so that no box remains empty

balls-in-binscombinatoricspermutationsstirling-numbers

How to find the number of ways in which $7$ different balls can be distributed into $4$ identical boxes so that no box remains empty?

In this question, I started by finding the number of ways of selecting any $4$ balls and putting them in the identical boxes in one way, and then the remaining balls could be placed in $3^4$ ways.
Can you please help me solving this?

Best Answer

First assume that the boxes are distinct. Then the number of ways of distributing 7 distinct balls into these boxes so that none is empty is, by Principle of Inclusion Exclusion, $$4^7 - \binom{4}{1}3^7 + \binom{4}{2}2^7 - \binom{4}{3} 1^7 = 8400$$ Now the naming of the boxes can be done in $4! = 24$ ways, the required number is $\dfrac{8400}{24} = 350$.

In fact if we want to distribute $n$ distinct objects into $k$ identical boxes so that no box is empty, the number of ways is given by the Stirling number $S(n,k)$ and $$S(n,k) = \frac{1}{k!}\sum_{i=0}^{k-1} \binom{k}{i}(k-i)^n$$