Solve the differential equation $$(1-x^2)\frac{d^2y}{dx^2}-2x\frac{dy}{dx}+n(n+1)y=0.$$ Show that a polynomial, say $P_n(x)$ is a solution of the above equation, when $n$ is an integer.
I tried solving this, using the method of Frobenius:
Let us assume that $y=\sum_{i=0}^{\infty}c_ix^{i+r}$ and $y'=\sum_{i=0}^{\infty}(i+r)c_ix^{i+r-1}$ and $y''=\sum_{i=0}^{\infty}(i+r)(i+r-1)c_ix^{i+r-2}.$
Substituting these values in the given differential equation we have, $$(1-x^2)\frac{d^2y}{dx^2}-2x\frac{dy}{dx}+n(n+1)y=0\implies \sum_{i=0}^{\infty}(i+r-1)(i+r)c_ix^{i+r-2}-\sum_{i=0}^{\infty}(i+r)(i+r-1)c_ix^{i+r}-2\sum_{i=0}^{\infty}(i+r)c_ix^{i+r}+\sum_{i=0}^{\infty}n(n+1)c_ix^{i+r}=0\implies\sum_{i=0}^{\infty}(i+r-1)(i+r)c_ix^{i+r-2}-\sum_{i=0}^{\infty}(i+r)(i+r-1)c_ix^{i+r}-2\sum_{i=0}^{\infty}(i+r)c_ix^{i+r}+\sum_{i=0}^{\infty}i(i+1)c_ix^{i+r}=0\implies \sum_{i=-2}^{\infty}(i+r+1)(i+r+2)c_{i+2}x^{i+r}-\sum_{i=0}^{\infty}(i+r)(i+r-1)c_ix^{i+r}-2\sum_{i=0}^{\infty}(i+r)c_ix^{i+r}+\sum_{i=0}^{\infty}n(n+1)c_ix^{i+r}=0\implies \sum_{i=0}^{\infty}\big [(i+r+1)(i+r+2)c_{i+2}-(i+r)(i+r-1)c_i-2(i+r)c_i+n(n+1)c_i\big ]x^{i+r}+r(r-1)c_0x^{r-2}+(r+1)(r)c_1x^{r-1}=0.$$
We have the indicial equation, as $r(r-1)=0.$
Let $r=0$, then , we also have, $r(r+1)c_1=0\implies c_1=0.$
If $r=0$, then , the recurrence relation is, $$(i+r+1)(i+r+2)c_{i+2}-(i+r)(i+r-1)c_i-2(i+r)c_i+n(n+1)c_i=0\implies c_{i+2}=c_i\frac{(i+r)(i+r-1)-n(n+1)}{(i+r+2)(i+r+1)}=c_{i+2}=\frac{c_i(i(i+1)-n(n+1))}{(i+2)(i+1)},\forall i\geq 0.$$
Using this, we may conclude,
If $i=0$ then, $c_2=\frac{-nc_0(n+1)}{2}$
If $i=1$ then, $c_3=\frac{c_1(2-n(n+1))}{6}$
If $i=2$ then, $c_4=\frac{-c_0n(n+1)(6-n(n+1))}{24}$ and so on.
Using the values of $c_i's$ and $r,$ the solution of the given differential equation is, $$y=c_0+c_1x-\frac{nc_0(n+1)}{2}x^2+\frac{c_1(2-n(n+1))}{6}x^3-\frac{c_0n(n+1)(6-n(n+1))}{24}+\cdots=c_0(1-\frac{n(n+1)}{2}x^2-\frac{c_0n(n+1)(6-n(n+1))}{24}x^4+\cdots)+c_1(x+\frac{(2-n(n+1))}{6}x^3 +\cdots).$$ This is indeed the general solution.
However, I don't understand, how can we get a polynomial solution from the above solution, if $n$ is an integer. I understand, that the coefficients, in the two series solution(, i.e $$y_1=1-\frac{n(n+1)}{2}x^2-\frac{c_0n(n+1)(6-n(n+1))}{24}x^4+\cdots$$ and $$y_2=x+\frac{(2-n(n+1))}{6}x^3 +\cdots$$ ) say, $\frac{n(n+1)}{2},$ for example in the $y_1$ series, approaches zero as, the denominator becomes too large, for each value of $n$ but how small it is, it will still not vanish. Any clarification regarding this will be very much helpful.
Indeed, the solution of the given differential equation is, $$y=c_0(1-\frac{n(n+1)}{2}x^2-\frac{c_0n(n+1)(6-n(n+1))}{24}x^4+\cdots)+c_1(x+\frac{(2-n(n+1))}{6}x^3 +\cdots),$$ as shown in the final part of the work in the original post.
The validity of the assertion that one of the two series solution, i.e $y_1=1-\frac{n(n+1)}{2}x^2-\frac{c_0n(n+1)(6-n(n+1))}{24}x^4+\cdots$ and $y_2=x+\frac{(2-n(n+1))}{6}x^3 +\cdots$ will terminate if $n$ is a positive integer, can be easily verified, if we take a look at the recurrence relation obtained in the OP.
The recurrence relation, was $$c_{i+2}=\frac{c_i(i(i+1)-n(n+1))}{(i+2)(i+1)},\forall i\geq 0.$$
Now, if $n$ is a fixed positive integer constant, then as $i$ iterates and takes every positive integral values, at some point $i$ must become equal to $n.$
At that point, say, when $i=i'$ we have, $i'=n$ then, $c_{i'+2}=0.$
Here we have, two cases:
If $i'$ is an even integer, then the series solution, $y_1$ terminates at $c_i'x^{i'}.$ All the terms, $c_{i'+p}$ such that $p=2,4,6,...$ are zero or gets vanished.
Similarly, if $i'$ is an odd integer, then the series solution, $y_2$ terminates at $c_i'x^{i'}.$ All the terms, $c_{i'+p}$ such that $p=1,3,5,...$ are zero or gets vanished.
So, we see, that if $n$ is a positive integer either the series $y_1$ terminates or the series, $y_2$ terminates depending upon the parity of $n.$