I am looking for a closed form expression for the generating function of the sequence $$a_0 = 1, a_{n+1} = 3a_n + 4$$
My idea was look at $a_{n+1} = 3a_n + 4$ and multiplicate both side with $x^{n+1}$ but this seems not be a good idea.. Is there a better way?
EDIT: Now why the answer below, I search a formula for the closed form expression for the terms, I should see that $3$ and $1$ are roots of it and than because $$\frac{1+3x}{(1-x)(1-3x)}=\frac{2}{1-3x} - \frac{1}{1-x}$$ it should be $a_k=(2*3^k-1)$ but already for $k=1$ it is wrong... Do you see my misstake?
You started out correctly. Let $f(x)=\sum\limits_{n=0}a_nx^n=a_0+a_1x+a_2x^2+\dotsb$. \begin{align*} a_{n+1}&=3a_{n}+4\\ a_{n+1}x^{n+1}&=3x\cdot a_{n}x^n+4x^{n+1}\\ \sum_{n=0}a_{n+1}x^{n+1}&=3x\sum_{n=0}a_{n}x^n+4\sum_{n=0}x^{n+1}\\ f(x)-a_0&=3x \cdot f(x)+\frac{4x}{1-x}\\ f(x)-1&=3x \cdot f(x)+\frac{4x}{1-x}\\ (1-3x)f(x)&=\frac{1+3x}{1-x}\\ f(x)&=\frac{1+3x}{(1-x)(1-3x)}. \end{align*}