I have this recurrence relation:
$$\begin{equation} \begin{cases} a_n = 2a_{n-1} + n & (n\geq1)\\ a_0 = 1 \end{cases} \end{equation}$$
Set:
$$f(x) = \sum_{n=0}^\infty a_nx^n$$
I solved in this way:
$$\sum_{n=1}^\infty a_nx^n = 2\sum_{n=1}^\infty a_{n-1}x^n + \sum_{n=1}^\infty nx^n$$ $$f(x)-1 = \frac{2}{x}\big(f(x)-1\big) + \frac{1}{1-x}-1$$ $$f(x)-1 = \frac{2}{x}\big(f(x)-1\big) + \frac{1}{(1-x)^2}-1$$ $$f(x)\big(1-\frac{2}{x}\big) = \frac{-2(1-x)^2+x}{x(1-x)^2}$$
$$f(x) = \frac{-2x^2+5x-2}{(1-x)^2(x-2)}$$
and then I get:
$$f(x) = \frac{A}{1-x}+\frac{B}{(1-x)^2}+\frac{C}{x-2}$$
but the result I get is:
$$\begin{equation} \begin{cases} A = 2\\ B=-1\\C=0 \end{cases} \end{equation}$$
Don't think that $c=0$ is possible, where is the mistake?
I think that mistake is at $\sum_{n=1}^\infty nx^n$:
\begin{eqnarray}\sum_{n=1}^\infty nx^n &=& x\sum_{n=1}^\infty nx^{n-1}\\ &=& x\big(\sum_{n=0}^\infty x^{n}\big)'\\ &=& x\big({1\over 1-x}\big)'\\ &=& {x\over (1-x)^2} \end{eqnarray}