[Math] Solve the recurrence relation $a_n = 2a_{n-1} + 2^n$ with $a_0 = 1$ using generating functions

combinatoricsgenerating-functionsrecurrence-relations

Here is what I have so far, or what I know how to do, rather:

I am given this equation: $a_n = 2a_{n-1} + 2^n$ with $a_0 = 1$

So, with the $2a_{n-1}$, I know I can do the following.

We change the $a_n$ to $x^n$, so then we have $x^n = 2^{n-1}$. When we take away $n-1$ from both sides, we get $x = 2$, and the root is 2.

Then when have $a_n = A_12^n$, with $a_0 = 1$, to which then we do:

$1= a_0 = A_12^0 = A_1 = 1$, and $a_n = 1*2^n$.

But, that is not the correct answer, and I am not sure what to do with the $2^n$ part, which is necessary to get the answer. Could anybody help me? Any help is greatly appreciated.

Best Answer

Let $f(x)=\sum a_nx^n$. Then $$\begin{align} f(x)&=1+\sum_{n=1}^\infty (2a_{n-1}+2^n)x^n\\ &=1+2xf(x) + \frac{2x}{1-2x}\\ &=2xf(x)+\frac{1}{1-2x} \end{align}$$

Solve for $f(x)$ to get a closed form for your generating function, and you should be able to figure out a closed formula for $a_n$ from there.