Arrangements for multi-colored balls on a grid.

In how many ways can 3 identical red balls, 3 identical green balls, and 3 identical blue balls be arranged in a 3 by 3 grid, such that each row and each column of the grid contains 1 ball of each color?

I am stuck, I had gotten 108 but that was not the answer. I got it by: I got 108 by drawing a grid with 3 choices for the top left corner, 2 for the ones on the right and the one below. After that, there are 2 choices for the one in the middle. This gives 3*2*2*2 = 24. You can then rearrange these possibilities to get a total of 108.

• Do you have any experience with group theory by chance? It happens to be quite relevant. – Don Thousand Oct 9 '18 at 21:54
• Welcome to MathSE. Please edit your question to show what you have attempted. This tutorial explains how to typeset mathematics on this site. – N. F. Taussig Oct 9 '18 at 21:56

Suppose that the balls in the first row are R,G,B in that order. The two remaining red balls must either go in the $$(2,2)$$ and $$(3,3)$$ positions, or they must go in the $$(2,3)$$ and $$(3,2)$$ positions. In either event, there is exactly one way to fill in the remaining positions. Now we can permute the colors to get $$6\cdot2=12$$ arrangements.

Pick red balls first. Then there are $$\frac{9\cdot4\cdot1}{3!} = 6$$ ways of placing them so that in each row and column, there is only one red ball (we divide the multiplication by $$3!$$ because the balls are identical). Now there are $$6$$ places left, $$2$$ in each row and column. Pick blue balls. Then there are $$\frac{6\cdot 2\cdot 1}{3!} = 2$$ ways of placing them. And for the green balls, there is only $$1$$ way. So the answer should be

$$6\cdot2\cdot1 = 12$$

Fix the first row in one of the 6 possible permutations.
then the second shall be a permutation not having fixed points with the first, i.e a derangement.
The third can then be composed in only one way.

We need each of the $$3$$ colors to appear once in the first row. There are $$3! = 6$$ permutations of $$(R,G,B)$$ that can satisfy this. For any way we choose to fill our first row, we have $$2$$ choices for the first entry in our second row. It is not difficult to see that this forces what the other two entries in the second row must be. This leaves $$1$$ choice for the first entry in our third row, and it is not difficult to see that we can always see it as well. This gives $$6\cdot2\cdot1 = 12$$ ways.

Let A be the color on position (1,1), B on position (1,2) and C on (1,3).

In the second row there are 2 places where color A can go ((2,2) and (2,3)) and 1 place, where the color from the selected row can go (it can't go to the first column, because then the remaining color would stay on it's place), therefore there are 2 possible arrangements of second row.

The third row can be set in only one way, depending on how we set the second one.

Now we have to consider all possible bijections $$\{R,G,B\} \to \{A,B,C\}$$. Of couuse there are $$3!=6$$ possible arrangements of these colors.

Therefore there are $$2*6=12$$ possible arrangements of RGB in this array.

• The second row must be a derangement of the first. There are only two derangements of a sequence of three elements. For instance, if the first row is $(B, G, R)$, then the possible permutations are $(\color{red}{B}, \color{red}{G}, \color{red}{R})$, $(\color{red}{B}, R, G)$, $(G, B, \color{red}{R})$, $(G, R, B)$, $(R, B, G)$, $(R, \color{red}{G}, B)$. Only $(G, R, B)$ and $(R, B, G)$ are admissible since the other four permutations have fixed points. – N. F. Taussig Oct 10 '18 at 8:31
• @N.F.Taussig I've edited my answer – Jaroslaw Matlak Oct 10 '18 at 8:37