[Math] Coloring of an $1\times n$ board using 4 colors

combinatorics

How can I find the number of ways to color an $1\times n$ board using the colors red, blue, green and orange if:

# of red squares is even

# of green squares is even

We did the tilings of a $1\times n$ board using squares and dominos in class, but I'm not sure how to do the coloring with more than two options

Thanks for any help!

Best Answer

Let $\mathrm{Even}(n)$ be the number of colorings of the $1\times n$ board in which the number of red and of green squares is each even. Let $\mathrm{Odd}(n)$ be the number of colorings of the $1\times n$ board in which the number of red and green squares is each odd.

For $n\geq 2$, color the initial $1\times (n-2)$ board any which way; there are $4^{n-2}$ ways of doing it. Now, if the number of red tiles and the number of green tiles are both even (which happens in $\mathrm{Even}(n-2)$ of the colorings), then we can complete the coloring by either coloring both remaining tiles green, both red, or each of them either blue or orange. This gives six different colorings with the same "base" coloring on the initial $1\times (n-2)$ board.

If the number of red tiles and the number of green tiles are both odd (which happens in $\mathrm{Odd}(n-2)$ of the colorings), then we must color the remaining two tiles one red and one green, in some order. That's two different colorings with the same "base" coloring.

If one of the number of red tiles and of green tiles is even and the other is odd (which occurs in $4^{n-2} - (\mathrm{Odd}(n-2)+\mathrm{Even}(n-2))$ of the colorings), then one of the two remaining tiles must be the deficient color, and the other tile can be either blue or orange. That gives 4 possible completions (select which tile is either blue or orange, select the color).

A similar computation holds for $\mathrm{Odd}(n)$, since we are trying to preserve parity.

So we have the recursion $$\begin{align*} \mathrm{Even}(n) &= 6\mathrm{Even}(n-2) + 2\mathrm{Odd}(n-2) + 4\bigl(4^{n-2}-\mathrm{Odd}(n-2)-\mathrm{Even}(n-2)\bigr)\\ &= 4^{n-1} + 2\mathrm{Even}(n-2) - 2\mathrm{Odd}(n-2)\\ &= 4^{n-1} + 2\Bigl(\mathrm{Even}(n-2) - \mathrm{Odd}(n-2)\Bigr).\\ \mathrm{Odd}(n) &= 6\mathrm{Odd}(n-2) + 2\mathrm{Even}(n-2) + 4\bigl(4^{n-2}-\mathrm{Odd}(n-2) - \mathrm{Even}(n-2)\bigr)\\ &= 4^{n-1} + 2\Bigl(\mathrm{Odd}(n-2) - \mathrm{Even}(n-2)\Bigr). \end{align*}$$

Thus, we have: $$\mathrm{Even}(n) - \mathrm{Odd}(n) = 4\Bigl(\mathrm{Even}(n-2)-\mathrm{Odd}(n-2)\Bigr).$$

We also have $\mathrm{Odd}(0) = 0$, $\mathrm{Even}(0)=1$; and $\mathrm{Odd}(1)=0$ and $\mathrm{Even}(1)=2$.

From this, it should be easy to get a formula for $\mathrm{Even}(k) - \mathrm{Odd}(k)$, and from there a formula for $\mathrm{Even}(n)$ for all $n\geq 1$.

Related Question