TITLE: Coloring of an $1\times n$ board using 4 colors?
QUESTION [5 upvotes]: 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!

REPLY [5 votes]: I just want to point out that exponential generating functions serve as a good approach here. Let $g(x)$ be the exponential generating function of the sequence $h_0, h_1, h_2,\ldots$, where $h_n$ is the number of acceptable colorings of a $1\times n$ board. So $h_n$ is the coefficient of $x^n$ in $g(x)$. 
Then 
$$
g(x)=\left(1+\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)^2\left(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}\cdots\right)^2
$$
where the first squared term comes from the fact that red and green tiles must occurs in even numbers, so we only consider even powers, and the second squared term comes from the fact that orange and blue tiles can occur in any number. 
The first series is just the even terms of the series for $e^x$, so bisecting the series into its even terms, one sees $g(x)$ simplifies to
$$
\begin{align*}
g(x) &= \left(\frac{e^x+e^{-x}}{2}\right)^2\cdot(e^x)^2 \\
     &= \frac{1}{4}(e^{2x}+2+e^{-2x})\cdot(e^{2x})\\
     &= \frac{1}{4}(e^{4x}+2e^{2x}+1)\\
     &= \frac{1}{4}+\frac{1}{4}\left(\sum_{n\geq 0}\frac{(4x)^n}{n!}+2\sum_{n\geq 0}\frac{(2x)^n}{n!}\right)\\
     &= \frac{1}{4}+\frac{1}{4}\left(\sum_{n\geq 0}\frac{(4^n+2\cdot 2^n)x^n}{n!}\right)
\end{align*}
$$
Since there is a $\frac{1}{4}$ hanging out outside the sum, we calculate $h_0=\frac{1}{4}+\frac{1}{4}(3)=1$. Then for the coefficient of nonconstant terms, we see
$$
h_n=\frac{1}{4}(4^n+2\cdot 2^n)=4^{n-1}+2^{n-1}
$$
as noted in user9325's answer.