# Combinatorics Problem involving separating different colored balls

You want to arrange $$5$$ identical white balls, $$4$$ identical red balls and $$3$$ identical blue balls in a row.

a) In how many different ways can this be done?

b) What if we are required that all white balls are placed to the left of any red ball?

c) What if we are required not to have a white and a red ball sit next to each other? (Hint: think of blue balls as separators/slashes)

d) What if no two white balls may sit next to each other?

e) What if every two blue balls are separated by at least three non-blue balls?

Here is what I have done so far:

a) I took the total number of balls with a factorial divided by the number of balls per each type each with a factorial: $$\dfrac{11!}{5!4!3!}$$

b) I'm not really sure how to do this...I was going to make the White balls and the Red balls a block of balls in which the whites precede the reds but I'm not so sure how to develop the multiple cases in which the blues are in between the whites and the reds...etc.

c) I attempted to treat the blues as a divider between the whites and the reds and then ultimately I treated the reds and the blues as a divider of the whites. So I had: Red Blue White Blue Red Blue White where whites can be placed where it says white and reds and blues can be placed where it says red and blue. This way blues serve as a divider and reds and whites are never consecutive. Thus I could place five whites in two spots and would have: $${5+2\choose 2}$$ = $${7\choose 2}$$ and the reds I would have: $${4+2\choose 2}$$ = $${6\choose 2}$$. I'm wondering if then I should multiply these two choose functions or if this is correct at all...

d) I took the total number of cases and subtracted the number of bad cases to get the number of desired cases:

Total number of cases: $$\dfrac{12!}{5!4!3!}$$

Put two Ws next to each other: $$\dfrac{11!}{3!4!3!}$$

Put three Ws next to each other: $$\dfrac{10!}{2!4!3!}$$

Put four Ws next to each other: $$\dfrac{9!}{4!3!}$$

Put five Ws next to each other: $$\dfrac{8!}{4!3!}$$

So we would have: $$\dfrac{12!}{5!4!3!}$$ - $$\dfrac{11!}{3!4!3!}$$ - $$\dfrac{10!}{2!4!3!}$$ - $$\dfrac{9!}{4!3!}$$ - $$\dfrac{8!}{4!3!}$$ ways

e) I started by separating the blue balls by three other balls however I'm not sure because it says only three balls at the least separate the blue balls so I'm unsure how to go about including more than three balls separating the blue balls...

Just answering part b, but this is too long for a comment.

For “b) What if we are required that all white balls are placed to the left of any red ball?”:

You are right to consider the white balls (there are $$5$$) and the red balls (there are $$4$$) together. Call them pink. Given an arrangement of $$9$$ pink balls and $$3$$ blue balls, you can make the first $$5$$ pink balls white and the last $$4$$ pink balls red to obtain an arrangement of the balls where the white balls all come before the red balls. Every arrangement of the red, white, and blue balls with all white balls left of any red ball can be obtained uniquely in this way, so there is a one-to-one correspondence between the “whites before reds” arrangements and the “pinks and blues” arrangements. Thus the number you seek is the same as the number of arrangements of $$9$$ pink and $$3$$ blue balls.

In how many ways can five white, four red, and three blue balls be arranged in a row if balls of the same color are indistinguishable?

Your answer is correct. We can choose five of the twelve positions for the white balls, four of the remaining seven positions for the red balls, and all three of the remaining three positions for the blue balls in $$\binom{12}{5}\binom{7}{4}\binom{3}{3} = \frac{12!}{5!7!} \cdot \frac{7!}{4!3!} \cdot \frac{3!}{3!0!} = \frac{12!}{5!4!3!}$$ ways.

In how many ways can five white, four red, and three blue balls be arranged in a row if the all white balls are placed to the left of any red ball?

We have twelve positions to fill. Choose three of them for the blue balls. Once we have done so, there is only one way to place the red balls and white balls in the remaining positions so that every white ball is to the left of the red balls. Hence, there are $$\binom{12}{3}$$ such arrangements.

In how many ways can five white, four red, and three blue balls be arranged in a row if no two white balls are adjacent?

We arrange the red and blue balls in a row. There are $$\binom{7}{4}$$ ways to choose which four of the nine positions will be occupied by the red balls. This creates ten spaces, eight between successive balls and two at the ends of the row. For instance, one possible arrangement is $$\square R\square R \square R \square R \square B \square B \square B \square$$ To ensure the white balls are separated, we must select three of these eight spaces in which to place a white ball, which can be done in $$\binom{8}{3}$$ ways. Hence, the number of admissible arrangements is $$\binom{7}{4}\binom{8}{3}$$

In how many ways can five white, four red, and three blue balls be arranged in a row if there are at least three non-blue balls between each pair of blue balls?

First, we select positions for the non-blue balls, then we arrange the balls in those positions.

Let $$x_1$$ be the number of non-blue balls to the left of the first blue ball; let $$x_i$$, $$2 \leq i \leq 3$$, be the number of non-blue balls between the $$i$$th and $$(i + 1)$$st blue ball; let $$x_4$$ be the number of non-blue balls after the third blue ball. Since there are a total of nine non-blue balls, $$x_1 + x_2 + x_3 + x_4 = 9 \tag{1}$$ Since there must be at least three non-blue balls between each pair of blue balls, we require that $$x_1, x_4 \geq 0$$, $$x_2, x_3 \geq 3$$. Let $$x_2' = x_2 - 3$$, $$x_3' = x_3 - 3$$. Then $$x_1, x_2', x_3', x_4$$ are nonnegative integers. Substituting $$x_2' + 3$$ for $$x_2$$ and $$x_3' + 3$$ for $$x_3$$ for $$x_4$$ in equation 1 yields \begin{align*} x_1 + x_2' + 3 + x_3' + 3 + x_4 & = 9\\ x_1 + x_2' + x_3' + x_4 & = 3 \tag{2} \end{align*} Equation 2 is an equation in the nonnegative integers. A particular solution of equation 2 corresponds to the placement of three addition signs in a row of three ones. For instance, $$1 + + 1 1 +$$ corresponds to the solution $$x_1 = 1$$, $$x_2 = 0$$, $$x_3 = 2$$, $$x_4 = 0$$. The number of such solutions is $$\binom{3 + 4 - 1}{4 - 1} = \binom{6}{3}$$ since we must select which three of the six positions required for three ones and three addition signs will be filled with addition signs.

The number of solutions of the equation $$x_1 + x_2 + x_3 + \cdots + x_n = k$$ in the nonnegative integers is $$\binom{k + n - 1}{n - 1}$$ since we must select which $$n - 1$$ of the $$k + n - 1$$ positions required for $$k$$ ones and $$n - 1$$ addition signs will be filled with addition signs.

Once the nine positions have been selected for the non-blue balls, we can select which four of those positions will be filled with red balls in $$\binom{9}{4}$$ ways.

Hence, the number of admissible arrangements is $$\binom{6}{3}\binom{9}{4}$$

In how many ways can five white, four red, and three blue balls be arranged in a row if a red ball cannot be adjacent to a white ball?

Each run of red balls must be separated from a run of white balls by at least one blue ball. Since there are only three blue balls, there can be at most four runs. The cases are:

1. Two runs, one of red balls and one of white balls, with at least one blue ball between them.
2. Three runs, two of red balls bracketing one of white balls, with at least one blue ball between each pair of runs.
3. Three runs, two of white balls bracketing one of red balls, with at least one blue ball between each pair of runs.
4. Four runs, two of red balls and two of white balls alternating by color, with at least one blue ball between each pair of runs.

Two runs, one of red balls and one of white balls, with at least one blue ball between them: Choose whether the red balls are to the left or right of the white balls. This creates ten spaces. For instance, if the red balls are to the left of the white balls, we have $$\square R \square R \square R \square R \square W \square W \square W \square W \square W \square$$ If we let $$x_i$$, $$1 \leq i \leq 10$$, be the number of blue balls in the $$i$$th space, then $$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} = 3 \tag{3}$$ Since there must be at least one blue ball between the run of red balls and the run of white balls, $$x_5 \geq 1$$. Let $$x_5' = x_5 - 1$$. Substituting $$x_5' + 1$$ for $$x_5$$ in equation 3 yields $$x_1 + x_2 + x_3 + x_4 + x_5' + x_6 + x_7 + x_8 + x_9 + x_{10} = 2 \tag{4}$$ which is an equation in the nonnegative integers with $$\binom{2 + 10 - 1}{10 - 1} = \binom{11}{9}$$ solutions. Hence, the number of admissible solutions in this case is $$\binom{2}{1}\binom{11}{9}$$

Two runs of red balls bracketing one of white balls: Since each run of red balls must contain a positive number of red balls, there are either $$1$$, $$2$$, or $$3$$ red balls in the first run with the remainder in the second run. This creates ten spaces. For instance, if there is one red in the first run, we have $$R \square W \square W \square W \square W \square W \square R \square R \square R \square$$ If we let $$x_i$$, $$1 \leq i \leq 10$$, be the number of blue balls in the $$i$$th space, then $$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} = 3 \tag{5}$$ Since there must be at least one blue ball between the run of red balls and the run of white balls, $$x_2, x_7 \geq 1$$. Let $$x_2' = x_2 - 1$$; let $$x_7' = x_7 - 1$$. Substituting $$x_2' + 1$$ for $$x_2$$ and $$x_8'$$ for $$x_8$$ in equation 5 and simplifying yields $$x_1 + x_2' + x_3 + x_4 + x_5 + x_6 + x_7' + x_8 + x_9 + x_{10} = 1 \tag{6}$$ which is an equation in the nonnegative integers with $$10$$ solutions. Hence, the number of admissible arrangements in this case is $$\binom{4 + 2 - 1}{2 - 1}\binom{1 + 10 - 1}{10 - 1} = \binom{3}{1}\binom{10}{9}$$

I leave the remaining cases to you.

• For the third part (c) we are asked to separate the whites and the reds not the blues from each other so I'm not sure if that answer works – Mathaholic24 Oct 17 '18 at 6:47
• I misread part (d), which I have fixed. Notice that I answered part (c) last. – N. F. Taussig Oct 17 '18 at 9:26