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. 

And if you want to generate
$(a_i)_{i=1}^m$ repeatedly,
the i-th term is generated by
$a_ix^i$,
and for this to repeat every $m$
this needs
$\dfrac{a_ix^i}{1-x^m}
$
so the final result is
$\sum_{i=1}^m\dfrac{a_ix^i}{1-x^m}
$.
In your case,
with $(1, 2)$
repeated,
this is
$\dfrac{x}{1-x^2}+\dfrac{2x^2}{1-x^2}
=\dfrac{x+2x^2}{1-x^2}
$.
This starts the first term at $x^1$.
To start it at the constant term,
just reduce the exponents
of the $x^i$ by one giving
$\sum_{i=1}^m\dfrac{a_ix^{i-1}}{1-x^m}
$,
so this gives,
in this case
$\dfrac{1}{1-x^2}+\dfrac{2x}{1-x^2}
=\dfrac{1+2x}{1-x^2}
$.
