TITLE: In how many ways $n$ dishes around a round table can be colored with 3 colors with adjacent dishes with different colors
QUESTION [5 upvotes]: Consider a round table with $n$ places. In each place there is a colored dish. In how many ways the dishes in this table can be colored with 3 colors, in such a way that adjacent dishes have different colors?

Solution: If $P(n)$ is the number of possibilities for a table with $n$ places, it is true that $$P(n)=P(n-1)+2P(n-2).$$By inspection it is easy to show that $P(2)=6$ and $P(3)=6$, and we can find the solution for any $P(n)$ by substitution using the recursion, or by the solution for the previous difference equation given by:
$$P(n)=2^n+2(-1)^n$$.
My problem: I don't understand why $$P(n)=P(n-1)+2P(n-2)$$ is true, or why, directly, $$P(n)=2^n+2(-1)^n$$ is true. Yes, I know how last equation is obtained from the previous equation, but cannot find a reasonable argument why it makes sense from a combinatoric argument. Any help?

REPLY [2 votes]: Here is a different approach.  Look at the circular pattern of differences between successive colors (in a given order, say: red, green, blue) as you go around the table, so the color sequence R,G,R,B,R... gives rise to the sequence $+1,-1,-1,+1,\ldots$ say, since RG has difference $+1$, GR has difference $-1$, and so on.  The condition that the $n$ differences must satisfy is that they add up to $0 \bmod 3$.  (The cumulative sum of the first $k$ of these numbers tells you the difference in color between the $0$-th  plate and the $k$th; if you follow all the way around the circle the $0$th plate is the $n$th plate, and hence of the same color, so the sum of all $n$ differences should be $0\bmod 3$.)  Let $D_n$ count the number of such difference patterns. The number of colorings is $3D_n$: the starting chair can have any of $3$ colors, then the rest are determined by the difference pattern.
A formula for $D_n$ can be obtained by evaluating an $n$-fold convolution product:   $D_n= f^{*n}(0)$, where $f:\mathbb Z_3\to\mathbb R$ is given by $f(0)=0, f(1)=f(2)=1$. (Convolution with respect to the additive group of integers $\bmod 3$.) Writing $f=\mathbb 1-\delta$, where $\mathbb1$ is the constant function $1$, and $\delta(x)$ is $1$ at $x=0$ and $0$ elsewhere, and using the fact that $\mathbb1*\mathbb1=3 \mathbb1$, we see
\begin{align*}
D_n &= \sum_{k=0}^{n-1} \binom n k (-1)^{n-k}\mathbb1^{*k} (0)+(-1)^n\\
&= \sum_{k=0}^{n-1} \binom n k (-1)^{n-k} 3^{k-1} + (-1)^n\\
&=\frac{ (3-1)^n - (-1)^n}3 + (-1)^n
\end{align*}
so the number of colorings is
$$
3D_n = 2^n +2(-1)^n .$$