0
$\begingroup$

$N$ boxes are lined up in a sequence. You have $A$ red balls and $B$ blue balls. The red balls (and the blue ones) are exactly the same. You can place the balls in the boxes. It is allowed to put in a box, balls of the two kinds, or only from one kind. You can also leave some of the boxes empty. It's not necessary to place all the balls in the boxes. Count the number of different ways to place the balls in the boxes in the described way.

If there was only $1$ ball the answer would have been $\binom {N+A-1} {N-1}$. But I dont know how to solve it for $2$ balls.

$\endgroup$
1
  • 1
    $\begingroup$ Not all balls need to be distributed. This is equivalent to having an additional box. So the number of ways with only $A$ balls of one type is $\binom{N+A}{N}$, and for your problem the number of ways is $\binom{N+A}{N}\binom{N+B}{B}$. And the idea generalizes. $\endgroup$ – André Nicolas Mar 1 '15 at 15:03
0
$\begingroup$

By Fundamental Principle of Counting, you just have to multiply them to acquire the combinations of simultaneous occurrence. So, your answer simply would be $$\binom{N+A-1}{N-1}\times\binom{N+B-1}{N-1}$$

$\endgroup$
10
  • $\begingroup$ acm.timus.ru/problem.aspx?space=1&num=1114 This is the link to the problem. For the case when N = 2, A = 1 and B = 1, the answer is 9. But this formula gives 4. $\endgroup$ – Stupid Man Mar 1 '15 at 13:08
  • $\begingroup$ $A,B>N$ should be true for this formula to be correct. $\endgroup$ – AvZ Mar 1 '15 at 13:18
  • $\begingroup$ For example, distributing the a single ball to $2$ boxes, there are $3$ ways to do so (Put it in box $1$ or $2$, or don't put it in any box). But the formula will give ${2\choose 1}=2$ which is incorrect. $\endgroup$ – AvZ Mar 1 '15 at 13:24
  • $\begingroup$ Alright, so is it possible to have a general formula for the problem in that link? $\endgroup$ – Stupid Man Mar 1 '15 at 13:27
  • 2
    $\begingroup$ @AvZ: Not all the balls need to be distributed. It is useful to imagine there are $N+1$ boxes, the last one being for items not distributed. Then Stars and Bars and multiplication give $\binom{N+A}{N}\binom{N+B}{B}$. $\endgroup$ – André Nicolas Mar 1 '15 at 14:45

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.