# In how many ways can 7 distinct balls be packed in 16 boxes, where 7 of boxes are unlabeled and green and 9 of boxes are unlabeled yellow.

I have 16 boxes, 7 of which are unlabelled green and 9 of which are unlabelled yellow. Also I have 7 distinct balls. Then the question is - how many ways can I pack the balls in the boxes?

-
sorry what does mean this one tge? – dato datuashvili Jan 17 '13 at 8:56
Wasn't math.stackexchange.com/questions/280598 enough? – mrf Jan 17 '13 at 9:00
@mrf: It makes a difference whether it's the balls that are distinct and the boxes undistinguishable, or the other way around, because balls and boxes don't have equivalent roles (since we consider assignments of balls to boxes and not of boxes to balls). – joriki Jan 17 '13 at 10:30

Assuming that the balls are labelled and that each box can hold any number of balls, the answer is that you must first choose a way to partition the balls into subsets, each of which is placed in one box, and then choose whether to place each subset in a green or yellow box. If there are $k$ subsets, there are $S(7,k)$ ways to partition the balls and $2^k$ ways to choose green or yellow, where $S(n,k)$ is a Stirling number of the second kind. Therefore, the number of ways is $$\sum_{1\le k\le 7} S(7,k) 2^k=14214.$$
Another approach would be to first choose $k$ balls that go in green boxes, then multiply the two Bell numbers that count the ways of partitioning the balls in green and yellow boxes:
$$\sum_{k=0}^7\binom7kB_kB_{7-k}=14214.$$