Finding a recurrence relation, first few terms of power series solution to differential equation I'm attempting to find a recurrence relation and the first few terms of a power series solution for the differential equation:
$$(1-x^2)y'' - 2xy' + \lambda y = 0$$
Where $\lambda$ is some integer. 
So I've assumed a solution $y = \sum_{n=0}^\infty a_nx^n$, and so forth for $y'$ and $y''$.
However, whenever I plug in and try to derive the recurrence relation, I'm not able to reduce it nicely, and as such I can't figure the first few terms of the series.
I'm sort of new to differential equations in general so please bear with my naiveté.
 A: For the differential equation $(1-x^{2}) y'' - 2 x y' + \lambda y = 0$ it is seen that if $y$ is of the form $\sum a_{n} x^{n}$ the following holds.
\begin{align}
y(x) &= \sum_{n=0}^{\infty} a_{n} \, x^{n} \\
y'(x) &= \sum_{n=0}^{\infty} n \, a_{n} \, x^{n-1} \\
y''(x) &= \sum_{n=0}^{\infty} n(n-1) \, a_{n} \, x^{n-2}
\end{align}
\begin{align}
0 &= (1 - x^{2} ) \, \sum_{n=0}^{\infty} n(n-1) \, a_{n} x^{n-2} - 2 x \, \sum_{n=0}^{\infty} n \, a_{n} \, x^{n-1} + \lambda \sum_{n=0}^{\infty} a_{n} \, x^{n} \\
&= \sum_{n=2}^{\infty} n(n-1) \, a_{n} \, x^{n-2} - \sum_{n=0}^{\infty} (n(n+1) - \lambda) \, a_{n} \, x^{n} \\
&= \sum_{n=0}^{\infty} (n+2)(n+1) \, a_{n+2} \, x^{n} - \sum_{n=0}^{\infty} (n(n+1) - \lambda) \, a_{n} \, x^{n} \\
&= \sum_{n=0}^{\infty} \left[ (n+2)(n+1) \, a_{n+2} - (n(n+1) - \lambda) \, a_{n} \right] \, x^{n} 
\end{align}
From this equation the coefficient equation can be obtained. It is
\begin{align}
a_{n+2} = \frac{n(n+1) - \lambda}{(n+1)(n+2)} \, a_{n} \hspace{10mm} n \geq 0.
\end{align}
Now that the recurrence relation has been obtained. Try a few values of $n$ to obtain the first few terms. The first two terms are defined as $a_{0}, a_{1}$ and the remaining are to follow.
\begin{align}
a_{2} &= \frac{- \lambda }{2!} \, a_{0} \\
a_{3} &= \frac{2-\lambda}{2 \cdot 3} \, a_{1} = \frac{(-1) (\lambda - 2)}{3!} \, a_{1} \\
a_{4} &= \frac{6 - \lambda}{3 \cdot 4} \, a_{2} = \frac{(-1)^{2} \lambda (\lambda - 6)}{4!} \, a_{0} 
\end{align}
and so on. The solution for $y(x)$ is of the form
\begin{align}
y(x) &= a_{0} \left[1 - \frac{\lambda}{2!} \, x^{2} + \frac{(-1)^{2} \lambda (\lambda -6)}{4!} \, x^{4} + \frac{(-1)^{3} \lambda (\lambda -6)(\lambda -20)}{6!} \, x^{6} + \cdots  \right] \\
& \hspace{5mm} + a_{1} \left[x + \frac{(-1)(\lambda - 2)}{ 3!} \, x^{3} + \frac{(-1)^{2} (\lambda - 2)(\lambda - 12)}{5!} \, x^{5} + \cdots  \right] 
\end{align}
A: You have $$y = \sum_{n=0}^\infty a_nx^n$$ $$y' = \sum_{n=0}^\infty n a_nx^{n-1}$$ $$y'' = \sum_{n=0}^\infty n(n-1) a_nx^{n-2}$$ $$(1-x^2)y''  - 2xy' + \lambda y =y'' -x^2y''-2xy' + \lambda y =0$$ Now, replace $y,y',y''$by their expression for the last right hand side. So, $$\sum_{n=0}^\infty n(n-1) a_nx^{n-2}-\sum_{n=0}^\infty n(n-1) a_nx^{n}-2\sum_{n=0}^\infty n a_nx^{n}+\lambda\sum_{n=0}^\infty a_nx^n=0$$ Now, write the term for a given power $m$ of $x$. This will give $$(m+2)(m+1)a_{m+2}-m(m-1)a_m-2ma_m+\lambda a_m=0$$
I am sure that you can take from here.
