Is my generating function correct so far for this recurrence?

48 Views Asked by At

Trying to teach myself generating functions.

Recurrence: $a_n = 18a_{n-1} - 80a_{n-2}$ where $a_0 = 1$ and $a_1 = 9$.

Attempt at using generating functions:

$$G(x) = \sum_{n=0}^{\infty} a_nx^n \\ G(x)-1 = \sum_{n=1}^{\infty} (18a_{n-1} - 80a_{n-2})x^n \\ G(x)-1 = 18\sum_{n=1}^{\infty} a_{n-1}x^n - 80\sum_{n=1}^{\infty}a_{n-2}x^n \\ G(x)-1 = 18x\sum_{n=0}^{\infty} a_{n}x^{n} - 80x^2\sum_{n=1}^{\infty}a_{n-2}x^{n-2} \\ G(x)-1 = 18xG(x) - 80x^2\sum_{n=-1}^{\infty}a_{n}x^{n} \\ G(x)-1 = 18xG(x) - 80x^2\sum_{n=0}^{\infty}a_{n}x^{n} \\ G(x)-1 = 18xG(x) - 80x^2G(x) \\ G(x) = \frac{1}{1 - 18x + 80x^2} $$

Is this correct so far? I am not really sure where to go from here.

Edit: Another attempt:

$$G(x) = \sum_{n=0}^{\infty} a_nx^n \\ G(x)-1 = \sum_{n=1}^{\infty} (18a_{n-1} - 80a_{n-2})x^n \\ G(x)-1 = 18\sum_{n=1}^{\infty} a_{n-1}x^n - 80(9x + \sum_{n=2}^{\infty}a_{n-2}x^n) \\ G(x)-1 = 18x\sum_{n=1}^{\infty} a_{n-1}x^{n-1} - 80(9x + x^2\sum_{n=2}^{\infty}a_{n-2}x^{n-2}) \\ G(x)-1 = 18x\sum_{n=0}^{\infty} a_{n}x^{n} - 80(9x + x^2\sum_{n=0}^{\infty}a_{n}x^{n}) \\ G(x)-1 = 18xG(x) - 80(9x + x^2G(x)) \\ G(x) = \frac{1-720x}{1 -18x + 80x^2} $$

1

There are 1 best solutions below

0
On BEST ANSWER

I'm a little disturbed by $\displaystyle\sum_{n=1}^\infty(18a_{n-1}-80a_{n-2})x^n$ on your 2nd line in both calculations. When $n=1$ you've got an $a_{-1}$ term! In the 3rd line (2nd attempt), you craftily remove this $a_{-1}x$ term and replace it with $a_1x=9x$ :-).

You can always check your results:

$$\text{if }~~~~~~G(x) = \dfrac{1-720x}{1-18x+80x^2}\\\ \text{then }~~~~~~G(x)(1-18x+80x^2) = 1-720x\\ (a_0+a_1x+a_2x^2+\cdots)(1+18x+80x^2) = 1-720x\\ \begin{array}{rrrrrr}a_0&-18a_0x&+~80a_0x^2\\&+~a_1x&-~18a_1x^2&+~80a_1x^3\\&&+~a_2x^2&-~18a_2x^3&+~80a_2x^4\\&&&\cdots\end{array} = 1 - 720x$$

All the LHS terms for $x^2, x^3, \cdots$ cancel since $a_n-18a_{n-1}+80a_{n-2} = 0$ by the recurrence, leaving $$a_0 - 18a_0x+a_1x = 1-720x\\ 1-9x = 1-720x$$. Oops! It's wrong. But it's close enough to tell you the correct answer is $G(x) = \dfrac{1-9x}{1-18x+80x^2}$.

It would have worked out better if you'd taken two terms over the LHS initially as follows: (I've deliberately left $a_0, a_1$ unevaluated tip the end since my arithmetic is terrible and it also makes it easier to solve the same problem with different $a_0, a_1$)

$$\begin{array}{rl}G(x) &= \displaystyle\sum_{n=0}^\infty a_nx^n\\ G(x) - a_0 - a_1x &= \displaystyle\sum_{n=2}^\infty a_nx^n\\ &= \displaystyle\sum_{n=2}^\infty(18a_{n-1}-80a_{n-2})x^n\\ &= 18\displaystyle\sum_{n=2}^\infty a_{n-1}x^n - 80\displaystyle\sum_{n=2}^\infty a_{n-2}x^n\\ &= 18\displaystyle\sum_{n=1}^\infty a_nx^{n+1} - 80 \displaystyle\sum_{n=0}^\infty a_nx^{n+2}\\ &= 18x\displaystyle\sum_{n-1}^\infty a_nx^n - 80x^2\displaystyle\sum_{n=0}^\infty a_nx^n\\ &= 18x(G(x)-a_0) - 80x^2G(x)\\ \text{so }G(x)(80x^2-18x+1) &= -18a_0x + a_0 + a_1x\\ &=-18x+1+9x\\ &=1-9x\end{array}$$