# Number of combinations in numbered, colored balls combinatorics problem

6 red, 7 blue, and 10 white balls labeled by numbers from 1 - 23 are given. In how many different ways can these balls be arranged in a row so that every red ball is between blue and white ball and no blue ball is next to a white ball?

The solution from a book is as follows:

$6!7!10!\Big({6\choose 3}{9\choose 2}+{6\choose 2}{9\choose 3}\Big)$

The $6!7!10!$ part i understand as being number of ways to rearrange every order of the balls, number of permutations of each group of balls that is.

If I arrange 6 red balls in a row like this $-R-R-R-R-R-R-$ i have 7 places for the remaining balls to fit in. Since the red ball must be between blue and white ball i choose which ball goes in first and I thought that's why the in-parentheses part has 2 parts, the one where blue goes first and one where white goes first.

If blue goes first then it has 4 slots to fit in, and white has 3 slots to fit in. That would fit in the form of ${7\choose 4}{10\choose 3}$. Similar is for the case where white goes first. And that doesn't agree with the solution. Could you explain the solution in terms of permutations, combinations or variations? Providing a simple illustration perhaps.

• In the problem statement, should "white" be "yellow"? – Andrew Woods Jun 28 '18 at 15:19
• @AndrewWoods I edited so that it's white everywhere. – edward_d Jun 28 '18 at 15:22

Having put the red balls in order you have seven spaces to put blue and yellow balls. Because of the conditions each space can only hold one color of balls and the colors have to alternate. If the space to the left is blue you need to distribute $7$ blue balls among $4$ spaces. There are $6$ places to put the breakpoints and you need to choose $3$ of them, so there are $6 \choose 3$ ways to place the blue balls by stars and bars. Having done that, you need to place the $10$ yellow balls in three places, which gives the $9 \choose 2$. The other term comes when the yellow balls are on the ends.