Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
sorry what does mean this one tge? – dato datuashvili Jan 17 '13 at 8:56
Wasn't 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. $$

share|cite|improve this answer

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. $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.