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.
As $\frac{1}{1-x}$ is the generating series for $1,1,1,\dots$ and $\frac{1}{1-x}$ is the generating series for $1,-1,1,-1,\dots$, the series for which you are calculating the generating function for is $2,0,2,0,\dots$.
But we can get the result you want by noticing that $2,1,2,1,\dots$ is actually $\frac{3}{2},\frac{3}{2},\frac{3}{2},\dots$ plus $\frac{1}{2},-\frac{1}{2},\frac{1}{2},-\frac{1}{2},\dots$.
We know the first series has generating function $\frac{3/2}{1-x}$ and the second has generating function $\frac{1/2}{1+x}$. Thus, the function you are looking for is$$\frac{\frac{3}{2}}{1-x}+\frac{\frac{1}{2}}{1+x}=\frac{\frac{3}{2}(1+x)+\frac{1}{2}(1-x)}{(1-x)(1+x)}=\frac{2+x}{1-x^2}$$ which is the result you were given.