I have solved dozens of those problems before which makes it even more confusing.
The recursive sequence is defined as follows: $a_0=0$
$a_n=3a_{n-1}+1$
If I define $F(x)=$$\sum_{n=0}^{\infty} a_nx^n$, I get:
$F(x)=3xF(x)+\frac{1}{1-x}$
$F(x)=\frac{1}{(1-x)(1-3x)}=\frac{3}{2(1-3x)}-\frac{1}{2(1-x)}$
And now:
$F(x)=\frac{3}{2}\sum_{n=0}^{\infty} 3^nx^n-\frac{1}{2}\sum_{n=0}^{\infty} x^n$
$F(x)=\sum_{n=0}^{\infty} \frac{3^{n+1}-1}{2}x^n$
Which gives $a_n=\frac{3^{n+1}-1}{2}$.
The corrent answer is $a_n=\frac{3^{n}-1}{2}$, which means something went wrong along the way, where is my error?
You have to be careful with the first term of the series. I think $F(x)=3xF(x)+\frac x {1-x}$.