# GATE | Gate IT 2008 | Question 24

In how many ways can b blue balls and r red balls be distributed in n distinct boxes?
(A) [(n+b-1)!(n+r-1)!]/[(n-1)!b!(n-1)!r!]
(B) [(n+(b+r)-1)!]/[(n-1)!(n-1)!(b+r)!]
(C) n!/(b!r!)
(D) [(n+(b+r)-1)!]/[n!(b+r-1)!]

Explanation:

You have to distribute k balls x 1 ,x 2….. x k that correspond to the number of balls that will be placed in boxes 1, 2, 3 …..k respectively. Since, they should add up to n, you want to determine the number of solutions to the equation:
x 1 +x 2 +x 3 +x 4 +……+x k =n
solution for the given equation is : (n+k-1)C k = (n+k-1)!/k!(n-1)!
For distributing the b blue balls into n distinct boxes, equation will be  x 1 +x 2 +x 3 +….x b = n and solution of the equation will be (n+b-1)C b = (n+b-1)!/b!(n-1)!
For distributing the r red balls into n distinct boxes, equation will be x 1 +x 2 +x 3 +….x r = n and solution of the equation will be (n+r-1)C r = (n+r-1)!/r!(n-1)!
And For every way of distributing the b blue balls, there are r ways to distribute the red balls, so our total is br.
i.e. (n+b-1)! (n+r-1)! / b!(n-1)!r!(n-1)!  which is answer A.

Reference:
Wikipedia: Stars_and_bars_combinatorics
Related:
http://www.careerbless.com/aptitude/qa/permutations_combinations_imp8.php

This solution is contributed by Nitika Bansal.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.