<s>[INST] Find a closed form for the generating function for each of these sequences. Find a closed form for the generating function for each
of these sequences. (Assume a general form for the terms
of the sequence, using the most obvious choice of such a
sequence.) 
                                                                                                a) 0, 1, −2, 4, −8, 16, −32, 64, ...
                                                                                                     b) 1, 0, 1, 0, 1, 0, 1, 0, ...
actually I don't know how should I solve this kind of problems. can anyone help?
 [/INST] For the first one, we obtain:
\begin{align*}
f(x) &= 0x^0 + 1x^1 + (-2)x^2 + 4x^3 + (-8)x^4 + 16x^5 + (-32)x^6 + 64x^7+\cdots \\
&= x - 2x^2 + 4x^3 - 8x^4 + 16x^5 - 32x^6 + 64x^7+\cdots 
\end{align*}
This is an infinite geometric series with initial term $a = x$ and common ratio $r = -2x$, so we obtain:
$$
f(x) = \frac{a}{1 - r} = \frac{x}{1+2x}
$$

For the second one, we obtain:
\begin{align*}
g(x) &= 1x^0 + 0x^1 + 1x^2 + 0x^3 + 1x^4 + 0x^5 + 1x^6 + 0x^7+ 1x^8 + \cdots  \\
&= 1 + x^2 + x^4 + x^6 + x^8 + \cdots 
\end{align*}
This is an infinite geometric series with initial term $a = 1$ and common ratio $r = x^2$, so we obtain:
$$
g(x) = \frac{a}{1 - r} = \frac{1}{1-x^2}
$$
</s>