Color a board such that each square has exactly two neighbors of the opposite color

coloringcombinatoricscontest-mathdiscrete mathematics

Let $m≥2$, $n≥2$ integers. We want to color the squares of an $m × n$ board with black and white so that each square has exactly two neighbors of the other color. Determine all the values ​​of $m$ and $n$ for which it is possible to do such a coloring.
Clarification: Neighboring squares are those that have a common side.

I found a way to color the square when $m$ and $n$ are both even. I think that if $m$ or $n$ is odd, then it is impossible to color de board. But i can't prove it. Could someone help me, please?

Best Answer

If $m=n$, then $m$ and $n$ are both even or both odd; however, the condition requires an even number of black and white squares, so $mn = m^2$ is even; therefore $m=n$ is even. Now let's deal with rectangles that are not squares. Without loss of generality, $n<m$.

Lemma. Assuming $n < m$, the top $n$ rows form an $n\times n$ sub-board symmetric about its main diagonal.

Proof. Induct on the anti-diagonals, looking at them in the following order:

123456
23456
3456
456 .
56   .
6     .

We begin in the middle of each anti-diagonal:

  • For the odd anti-diagonals, the middle square can be filled arbitrarily.
  • For the even anti-diagonals, the middle two squares are both adjacent to the middle square of the previous anti-diagonal, which (by symmetry) already has two neighbors of one color, so they get the same color.

Then we work outwards, and every step is forced, so the anti-diagonal is symmetric. $\square$

The top $n \times n$ sub-board is symmetric, and its rightmost edge consists of $n$ squares on the edge of the board; its bottom edge (the $n^{\text{th}}$ row of the board), on the other hand, has $n$ squares with more squares below them. However, since the two edges are the same, the coloring condition for them is satisfied just by the $n \times n$ sub-board. Therefore the squares in the $(n+1)^{\text{th}}$ row are identically colored to the squares on the $n^{\text{th}}$ row.

It follows that if we delete the $n \times n$ sub-board, we get an $(m-n)\times n$ board for which the coloring condition also holds.

Now we can finish the claim by induction on the size of the board. The induction hypothesis tells us that both $m-n$ and $n$ must be even; therefore $m$ and $n$ are both even.

Related Question