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?

• What is your idea? Commented Jan 7, 2014 at 5:08
• What did you try up to now ? Commented Jan 7, 2014 at 5:10
• For the first one it looks like $(-1)^n2^n$, for $n=0,1,2,...$ (oops, and there is a zero at the beginning). For the second it looks like $1/2+(-1)^{n}/2$, for $n=0,1,2,...$. Now, there is a mathematical terminology that is called generating function of a sequence (en.wikipedia.org/wiki/Generating_function) that might or might not be what you are asking. Is this what you were asking or only the formulas at the beginning?
– user119256
Commented Jan 7, 2014 at 5:15
• Well, you could look them up: oeis.org/A131577 and oeis.org/A000035 Commented Jan 7, 2014 at 5:44

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}$$