Maths Olympiad Prep

Track / Stage 6 / 100 of 400 #1580 of 2444

Problem 1580

National Olympiad, first round
Combinatorics Difficulty 6.1 Prove it Brazilian Math Olympiad · Brazil

In how many ways one can color the cells of a n×nn \times n table, each with one of four colors, such that no cells that share a side have the same color and all four colors appear in every 2×22 \times 2 square formed by neighboring cells?

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

Answer: 32n+2243 \cdot 2^{n+2} - 24.
Suppose there are at least three different colors A,B,CA, B, C in the first row. Then they occur consecutively, say in the order ABCABC. Then the cell below the BB has the fourth color DD, and all other cells are determined by the first row, because three cells in a 2×22 \times 2 square determine the other one, and we can fill the board from right to left and left to right, beginning at the DD. Notice that the cells below ABCABC are CDACDA, so the next row always has three different colors and can be filled. Finally, notice that the colors alternate in the columns in between A,CA, C and B,DB, D, so all columns have two different colors. There are (42)=6\binom{4}{2} = 6 ways to choose the two colors for the top two cells in the first column and 2n2^n ways to choose the two colors for the top two cells in each next column: if we chose {A,B}\{A, B\} for the first column, then we can choose (A,B)(A, B) or (B,A)(B, A) for the first column, (C,D)(C, D) or (D,C)(D, C) for the next column, (A,B)(A, B) or (B,A)(B, A) for the next column, and so on. We only need to exclude the cases where there are only two colors in the first row: in this case, we still have 6 choices for the first column, and 2 choices for each of the first two columns orders. The other orders are determined to be the same as the preceding ones, so to repeat the pattern. So we must exclude 622=246 \cdot 2 \cdot 2 = 24 cases.
Now we deal with the case in which there are only two colors in the first row. There are 434 \cdot 3 ways to choose the colors in the first row. Then each following row has the other two colors, alternated in one of two ways. So in this case we have 122n112 \cdot 2^{n-1} colorings.
So the grand total is 62n24+122n1=32n+2246 \cdot 2^n - 24 + 12 \cdot 2^{n-1} = 3 \cdot 2^{n+2} - 24.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty, ordering) added by this project.