How do I compute the generating function for this number sequence?

65 Views Asked by At

I am trying to compute the generating function for the number sequence given by $a_n = (-1)^n$. I know that the solution is $A(x) = \frac{1}{1+x}$ but when I try to solve it using the procedure of finding the formal power series and then computing the generating function I don't even know where to begin. I hope someone can help.

2

There are 2 best solutions below

0
On

The main point is to write a recurrence for the sequence $a_n$: $$ a_{n+1}=-a_n, \qquad a_0=1 $$ The shift from $n$ to $n+1$ is reflected in $A(x)$ as multiplication by $x$.

Therefore, if $A(x)= \sum a_n x^n$, then $xA(x)=1-A(x)$. Now solve for $A(x)$.

0
On

Suppose the generating function is $f(x)$. Then you have $$f(x)=1-x+x^2-x^3+\dots$$

Hence $$xf(x)=x-x^2+x^3-\dots$$

Adding these two we get $f(x)+xf(x)=1$, so $$f(x)=\frac{1}{1+x}$$