<s>[INST] Showing a series is a solution to a differential equation I am attempting to show that the series $y(x)\sum_{n=0}^{\infty} a_{n}x^n$ is a solution to the differential equation $(1-x)^2y''-2y=0$ provided that $(n+2)a_{n+2}-2na_{n+1}+(n-2)a_n=0$
So i have:
$$y=\sum_{n=0}^{\infty} a_{n}x^n$$
$$y'=\sum_{n=0}^{\infty}na_{n}x^{n-1}$$
$$y''=\sum_{n=0}^{\infty}a_{n}n(n-1)x^{n-2}$$
then substituting these into the differential equation I get:
$$(1-2x+x^2)\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n-2}-2\sum_{n=0}^{\infty} a_{n}x^n=0$$
$$\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n-2}-2\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n-1}+\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n}-2\sum_{n=0}^{\infty} a_{n}x^n=0$$
relabeling the indexes: 
$$\sum_{n=-2}^{\infty}(n+2)(n+1)a_{n+2}x^{n}-2\sum_{n=-1}^{\infty}n(n+1)a_{n+1}x^{n}+\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n}-2\sum_{n=0}^{\infty} a_{n}x^n=0$$
and then cancelling the $n=-2$ and $n=-1$ terms:
$$\sum_{n=0}^{\infty}(n+2)(n+1)a_{n+2}x^{n}-2\sum_{n=0}^{\infty}n(n+1)a_{n+1}x^{n}+\sum_{n=0}^{\infty}n(n-1)a_{n}x^{n}-2\sum_{n=0}^{\infty} a_{n}x^n=0$$
but this doesn't give me what I want (I don't think) as I have $n^2$ terms as I would need
$(n^2+3n+2)a_{n+2}-(2n^2+n)a_{n+1}+(n^2-n-2)a_{n}=0$
I'm not sure where I have gone wrong?
Thanks very much for any help
 [/INST] Everything seems correct. Before you expand out powers of $n$, notice that equating like powers of $x^n$ in your last sum gives:
$(n+2)(n+1)a_{n+2}-2n(n+1)a_{n+1}+[n(n-1)-2]a_n=0$
Notice that $[n(n-1)-2]=n^2-n-2=(n+1)(n-2)$, so since $n\geq 0$, you can divide the recurrence equation by $(n+1)$ to get the desired result.
</s>