7 balls with different colors, there are 4 identical boxes. the box can be empty. how many ways to distribute the balls?
what kind of counting problem is this? how do we count it?
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.Sign up to join this community
We have $7$ objects (let each be elements of a set) and we want to partition these objects into $4$ subsets. We can have $1$ nonempty subset (and the other $3$ consequently empty), $2$ nonempty subsets (and the rest empty), $3$ nonempty subsets (and the rest empty), or $4$ nonempty subsets. We can't have $0$ nonempty subsets because that would mean we have no balls in all of the boxes.
The striling number of the second kind $S(n,k)$ counts the number of ways to partition a set of $n$ objects into $k$ non-empty subsets. So the answer is as you claim,
From set A (the m balls) to set B (the n boxes), the number of onto functions is $n!S(m,n)$. If the boxes are identical, the order does not matter anymore. Therefore, there are $n!S(m,n)/n! = S(m,n) $ ways to distribute the 7 balls.
We can use, 4 boxes, 3 boxes, 2 boxes or 1 box.