Solving a recurrence equation using $\mathcal{Z}$-transform The question is: solve $x_{n+1}-2x_{n} = 2n$ where $x(0) = 1$.
I'm trying to solve this equation, here is where I got stuck:
$zX(z)-x(0).z-2X(z)=\frac{2z}{(z-1)^2}$
$ X(z)[z-2]=\frac{2z}{(z-1)^2}+z$
$X(z)=\frac{2z}{(z-1)^2(z-2)}+\frac{z}{(z-2)}$
I know we should do inverse $\mathcal{Z}$-transform next to find $x(n)$ but I don't know how.
What is solution of the recurrence equation.
Thank you
 A: Let $$X(z) = \sum_{n = 0}^{\infty}x[n]z^{-n}$$We have $$\mathcal{Z}\{x[n+1]\} = zX(z) - zx[0]$$
Also we have $$\mathcal{Z}\{n\} = \sum_{n = 0}^{\infty}nz^{-n} = \frac{z}{(z-1)^2}, \ \ \ |z|\gt1$$
Applying $\mathcal{Z}-$transform to the equation we have $$zX(z) - zx[0] -2X(z) = \frac{2z}{(z-1)^2}$$We know that $x[0] = 1$, so we have $$X(z) = \frac{2z}{(z-1)^2(z-2)} + \frac{z}{z-2}$$Using partial fraction decomposition $$\frac{z}{(z-1)^2(z-2)} = \frac{A}{z-2} + \frac{B}{z-1} + \frac{C}{(z-1)^2}$$
We get $$A= 4 , B=-4 , C = -2$$So we have $$X(z) = \frac{6}{z-2} + \frac{-4}{z-1} + \frac{-2}{(z-1)^2} + 1$$
We know that $\mathcal{Z}\{a^n u[n]\} = \frac{1}{1-az^{-1}}$ when $|z|\gt |a|$ and $\mathcal{Z}\{x[n-1]\} = z^{-1}X(z) + x[-1]$. The result is $\mathcal{Z}\{a^{n-1} u[n-1]\} = \frac{1}{z-a}$. Another property is $\mathcal{Z}\{nx[n]\} = -z\frac{dX(z)}{dz}$ which implies $\mathcal{Z}\{a^{n} u[n]n\} = \frac{az}{(z-a)^2}$ and then $$\mathcal{Z}\{a^{n-1} u[n-1](n-1)\} = \frac{a}{(z-a)^2}$$ Obviously we have $\mathcal{Z}\{\delta[n]\} = 1$. Combining the mentioned results we get $$x[n] = 6(2^{n-1}u[n-1])-4(u[n-1])-(2u[n-1](n-1)) + \delta[n] = u[n-1](-2n-2+3\times2^{n}) + \delta[n]$$
We can check that using WA which gives $$x[n] = -2n + 3\times2^n - 2$$
To see that both answers agree, note that $x[0] = y[0] = 1$ and if $n \ge 1$
$$x[n] = y[n] = -2n + 3\times2^n - 2$$
