<s>[INST] Generating Function & Sequence Find the generating functions of the sequences
2, 1, 2, 1, 2, 1, . . . 
I get $\frac{1}{1+x} + \frac{1}{1-x} = \frac{2}{1-x^2}$
But the solution ends up with $\frac{2}{1-x^2} + \frac{x}{1-x^2} = \frac{2+x}{1-x^2}$.
The solutions starts with $\sum_{n\ge 0} (2)x^{2n}+\sum_{n\ge 0} (1) x^{2n+1}$
I couldn't come up with anything like that. I feel like I'm confused with something. 
 [/INST] As an alternative to the other answers, you can simply use a variant of one function, that being
$$\frac{1}{1-x^2}=\sum_{n=0}^{\infty} x^{2n}$$
If you consider that the $2$'s are even indexed (assuming in the sequence $\{a_n\}$ the first term is $a_0$) and the $1$'s are odd indexed, you have that 
$$\frac{2}{1-x^2}$$
will generate the $2$'s and 
$$\frac{x}{1-x^2}$$
will generate the $1$'s.  This is because 
$$\frac{1}{1-x^2}=1+x^2+x^4+...$$
and so
$$\frac{x}{1-x^2}=x(1+x^2+x^4+...)=x+x^3+x^5+...$$
Thus, you sequence will be generated by
$$f(x)=\frac{2+x}{1-x^2}$$
</s>