In how many ways can 6 purple balls and 6 green balls be placed into a grid of boxes such that every row and column contains two balls of one color and one ball of the other color? Only one ball may be placed in each box, and rotations and reflections of a single configuration are considered different.
Solution
In each row or column, exactly one box is left empty. There are ways to choose the empty spots. Once that has been done, there are 6 ways to choose which two rows have 2 purple balls each. Now, assume without loss of generality that boxes , , and are the empty ones, and that rows 1 and 2 have two purple balls each. Let , and denote the squares in the top left, top right, bottom left, and bottom right corners, respectively (so is formed by the first two rows and first two columns, etc.). Let , and denote the number of purple balls in , and , respectively. Then , and , so . Now suppose we are given the numbers and , satisfying . Fortunately, the numbers of ways to color the balls in , and are independent of each other. For example, given and , there are 2 ways to color and 1 way to color and, no matter how the coloring of is done, there are always 2 ways to color and 3 ways to color . The numbers of ways to choose the colors of all the balls is as follows: In each square above, the four factors are the number of ways of arranging the balls in , , and , respectively. Summing this over all pairs satisfying gives a total of 36. The answer is therefore .