I had this task a while ago; let's say I have 15 balls (5 in three different colors) and 3 identical boxes, in how many different ways can I place the balls in the boxes?

What I thought of was just following the formula for combinations with repetition like:

(n+k-1) choose k

but I got the wrong answer. Instead I was supposed to use something like:

(n+k-1) choose (k-1)

to calculate x1+x2+x3=15 but I don't understand the difference in these approches.

Sorry if I sound unclear somehow but I find it really hard to explain since I'm so confused as well.

Thanks in advance!

  • $\begingroup$ the first box is arbitrary $\endgroup$ – tired Dec 20 '16 at 13:28
  • $\begingroup$ Do you need to have an equal number of balls in the three identical boxes? $\endgroup$ – Michael R Dec 20 '16 at 13:29
  • 1
    $\begingroup$ It depends what your $n$ and your $k$ are. If $n$ is balls and $k$ is boxes, then the second one is correct. You're choosing $k\mathord-1$ dividers between the boxes among the balls+dividers ($n+k-1$). $\endgroup$ – Joffan Dec 20 '16 at 13:30
  • $\begingroup$ "5 identical balls (5 in three different colors)"? So how exactly are they identical????? $\endgroup$ – barak manos Dec 20 '16 at 13:31
  • $\begingroup$ @barakmanos he wrote 15. But actually it would have sufficed to ask for 3 identical balls of each color $\endgroup$ – b00n heT Dec 20 '16 at 13:32

Ignoring the mention of colors...

Imagine that, instead of $k$ boxes, you are putting separators in between the $n$ balls. At each location you can put a ball or a separator. But you don't need $k$ separators - only $k\mathord-1$ - to separate the balls into $k$ classes (=boxes). See stars and bars.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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