Solving recurrences using generating functions

442 Views Asked by At

I have the following solution for solving a recurrence using a generating function and I have a question on why it is multiplied by (1-z) and why this causes the second summand to disappear. enter image description here

1

There are 1 best solutions below

2
On

After correcting the typos, we have

$$\begin{align*} A(z)&=2+z\sum_{n\ge 1}a_{n-1}z^{n-1}+z\sum_{n\ge 1}2^{n-1}z^{n-1}\\ &=2+z\sum_{n\ge 0}a_nz^n+z\sum_{n\ge 0}2^nz^n\\ &=2+zA(z)+z\sum_{n\ge 0}2^nz^n\;, \end{align*}$$

since $A(z)=\sum_{n\ge 0}a_nz^n$. Now just subtract $zA(z)$ from both sides to get

$$(1-z)A(z)=A(z)-zA(z)=2+z\sum_{n\ge 0}2^nz^n\;.$$