# Number of ways to distribute balls in three different boxes.

The number of ways to distribute 5 red,6 black and 7 green balls equally in three different boxes such that all the boxes get balls of all the three colours. (assume balls of same colour are identical)

My attempt:

Assume the three boxes get $x_1$, $x_2$, and $x_3$ red balls respectively.

Then, $x_1$ + $x_2$ + $x_3$=5 where $x_i > 1$.

Similarly I solved the multinomial for all the black and green balls and multiplied them. But how do I take care of the condition that each box contains 6 balls(equal number)?

• Why is $x_i >1$ instead of $x_i \geq 1$? Feb 7, 2018 at 19:58

Hint:

You know that the boxes MUST contain:

[RRGB..], [RGB...], [RGB...]

because there must be an R, a G and a B in each box, and then one of the remaining Rs must go into SOME box (which we can call the first box).

This leaves R, B, B, B, G, G, G, G to be placed in the unfilled "slots."

There are only two distinguishable slots for the sole remaining R, producing:

[RRRGB.], [RGB...], [RGB...]

or

[RRGB..], [RRGB..], [RGB...]

For each of these two conditions you have the remaining B, B, B, G, G, G, G to fill the empty slots.

Continue along this reasoning...

Put a ball of each color into each box. There are $2$ red, $3$ blue, and $4$ green balls left over. We now have to put three additional balls of any color into each box.

We can put both red balls in the same box in three ways, leaving box capacities $3+3+1$. Then we can put the $3$ blue balls into the same box in $2$ ways, two blue balls into the same box and one blue ball into another box in $4$ ways; and finally we can put the three blue balls into three different boxes in $1$ way. We obtain $3\cdot(2+2\cdot2+1)=21$ allocations of this kind.

We can put the two red balls into two different boxes in $3$ ways, leaving box capacities $3+2+2$. Then we can put the three blue balls into the same box in $1$ way, two blue balls into the same box and one blue ball into another box in $6$ ways; and finally we can put the three blue balls into three different boxes in $1$ way. We obtain $3\cdot(1+6+1)=24$ allocations of this second kind.

It follows that there are $45$ admissible distributions of the $18$ balls in the $3$ boxes.

let's first put RBG;RBG;RBG in all three boxes to get rid from color constraint

now we are left with "RR BBB GGGG" many balls (aka,2Red ,3Black,4Green balls) and we have to put 3 balls in each box to fulfill second constraint of 6 balls in each boxes.

now,in first box we can put 3 balls in 9 ways as : $(i) RBG (ii)RRB (iii)RBB (iv)BBB (v)GGG (vi)RRG (vii)RGG (viii)GBB (ix)BGG$ after putting three balls in 1st box we still have 6 balls left to distribute into 2nd and 3rd boxes respectively

now, for each of 9 above ways we'll again distribute 3 balls in to the second box and the rest balls automatically go to 3rd box in 1 way so let's count

for (i) way i.e, RBG in 1st box we are left with R BB GGG balls which can be put in 2nd box in 6 ways (i.e,RBB,RGG,RBG,GGG,BBG,GGB)

for (ii) way i.e,RRB in 1st box we are left with BB GGGG balls which can be put in 2nd box in 3 ways (i.e,GGG,BBG,GGB)

for (iii) way i.e,RBB in 1st box we are left with R B GGGG balls which can be put in 2nd box in 4 ways (i.e,GGG,GGR,GGB,GBR)

for (iv) way i.e,BBB in 1st box we are left with RR GGGG balls which can be put in 2nd box in 3 ways (i.e,GGG,GGR,GRR)

for (v) way i.e,GGG in 1st box we are left with RR BBB G balls which can be put in 2nd box in 6 ways (i.e,GBB,GRR,RBB,RBG,BRR,BBB)

for (vi) way i.e,RRG in 1st box we are left with BBB GGG balls which can be put in 2nd box in 4 ways (i.e,BBB,GBB,GGG,GGB)

for (vii) way i.e,RGG in 1st box we are left with R BBB GG balls which can be put in 2nd box in 6 ways (i.e,RBG,RGG,RBB,GGB,BBG,BBB)

for (viii) way i.e,GBB in 1st box we are left with RR B GGG balls which can be put in 2nd box in 6 ways (i.e,BGG,BRR,RBG,RRG,GGG,GGR)

for (ix) way i.e,BGG in 1st box we are left with RR BB GG balls which can be put in 2nd box in 7 ways (i.e,GBB,RBB,BRR,GRR,RGG,BGG,RBG)

so answer should be=sum of all above ways=(6+3+4+3+6+4+6+6+7)=45 ways