Example of series solution about ordinary point

Find the series solution about $x=0$ of the equation $$ (1-x^2)y'' - 2xy' + 2y = 0. $$

By Fuchs' theorem, since $x=0$ is an ordinary point, there are two linearly independent power series solution. So let $$ y(x) = \sum_{n=0}^\infty a_n x^n. $$ Computing the derivatives, $$\begin{align*} y' &= \sum_{n=1}^\infty na_n x^{n-1}, \\ y'' &= \sum_{n=2}^\infty n(n-1)a_{n} x^{n-2}, \\ \end{align*}$$ Substituting into the equation, $$\begin{align*} 0&= \sum_{n=2}^\infty n(n-1)a_nx^{n-2} - \sum_{n=2}^\infty n(n-1)a_n x^n - \sum_{n=1}^\infty 2na_n x^n + \sum_{n=0}^\infty 2a_nx^n \\ &= \sum_{n=0}^\infty \big((n+1)(n+2)a_{n+2} - n(n-1)a_n - 2na_n + 2a_n\big) x^n \\ &= \sum_{n=0}^\infty \big((n+1)(n+2)a_{n+2} -(n^2 + n-2)a_n\big) x^n \\ &= \sum_{n=0}^\infty \big((n+1)(n+2)a_{n+2} - (n-1)(n+2)a_n\big) x^n \\ \end{align*}$$ where in the second line, the first term has the index relabelled, and the other terms have the starting index extended by adding zeros.

Equating coefficients, $$\begin{align*} (n+1)(n+2)a_{n+2} &= (n-1)(n+2)a_n \\ a_{n+2} &= \frac{n-1}{n+1} a_n. \end{align*}$$

Note that $a_0$ and $a_1$ are not fixed and so are arbitrary constants. One solution has $a_0=0$ and another has $a_1=0$, and they are linearly independent.

For the first case, since $$ a_3 = \frac{1-1}{1+1}a_1 = 0, $$ subsequent odd elements $a_5 = a_7 = \ldots = 0$, so the solution is $$ y(x) = a_1x. $$

For the second case, note that for even $n$, $$\begin{align*} a_n &= \frac{n-3}{n-1}a_{n-2} \\ &= \frac{n-3}{n-1}\frac{n-5}{n-3}a_{n-4} = \frac{n-5}{n-1} a_{n-4} \\ &= \frac{n-7}{n-1} a_{n-6} \\ &= \ldots \\ &= \frac{-1}{n-1} a_0 \end{align*}$$ so the solution is $$ y(x) = a_0 \Big(1 - x^2 - \frac13x^4 - \frac15x^6 - \ldots\Big). $$ This can be simplified using $\ln(1\pm x) = \pm x - \frac12 x^2 \pm \frac13 x^3 - \ldots$: $$\begin{align*} y(x) &= a_0\Big(1 - x\big(x + \frac13 x^3 +\frac15 x^5 + \ldots\big)\Big) \\ &= a_0\Big(1 - \frac x2\big(\ln(1+x) - \ln(1-x)\big)\Big) \\ &= a_0\Big(1-\frac x2\ln\frac{1+x}{1-x}\Big). \end{align*}$$

Therefore the general solution is $$ y(x) = a_1 x + a_0\Big(1 - \frac x2 \ln\frac{1+x}{1-x}\Big). $$ This in fact satisfies the equation everywhere except at $x=\pm 1$, where only $a_1 x$ is the only series solution.