# Generating Function

1. Sep 26, 2012

### Punkyc7

Find the OGF for the recurrence

a$_{n}$= 6 * a$_{n-1}$+ a$_{n-2}$ a$_{0}$=2, a$_{1}$=1

So here is what I did

I said let A = $\sum$$_{2>=n}$a$_{n}$x$^{n}$

then I got

A = 6x (A+x) + x$^{2}$(A +x+2)

which gets me

A= $\frac{6x^2+x^{3} +2x}{1-6x - x^2}$

ButI should get $\frac{2-x}{1-6x - x^2}$

Can any one tell me what I am doing wrong ?

2. Sep 26, 2012

### SammyS

Staff Emeritus
This gets you a different A.
Congrats on your 400th post !

3. Sep 26, 2012

### Punkyc7

Thank you on the congratulations. But I do not see how that get me a different A. Did I define what A is right. Usually the generating function start at zero but with this problem that gives you bad subscripts.

4. Sep 26, 2012

### Ray Vickson

I usually find it safer, to write things out a bit more:
$$A = a_2 x^2 + a_3 x^3 + a_4 x^4 + \cdots = (6a_1 + a_0)x^2 + (6a_2 + a_1)x^3 + (6a_3 + a_2)x^4 + \cdots\\ = (6+2)x^2 + x^3 + 6x A + x^2 A = x^3 + 8x^2 + (x^2 + 6x)A.$$
This will give you a different A from what you obtained.

Besides that difference, maybe the answer was for a GF starting at a_0*x^0, or at a_1*x^1. However, I checked that, and could not get the posted answer for any three variants of the problem. Just to be sure, I used Maple to get a solution, and got an answer in agreement with a_0 + a_1 x + A. Here is the Maple command, but I won't give the output, since that would deprive you of the fun of getting it yourself.
> rsolve({a(n)=6*a(n-1)+a(n-2),a(1)=1,a(0)=2},a,'genfunc'(x));

RGV