General Solution to Differential Equation

Find the general solution of a differential equation $\frac d{dr}[r^2 \frac{dR}{dr}]-l(l+1)R=0$. (Hint: Assume an infinite series $R(r)=\sum_{n= -\infty}^{+\infty} a_n r^n$ as the solution)

I don't get how we can solve this problem. Some help would be nice.

All sums are over $n\in\mathbb{Z}$.

If $$R(r)=\sum a_nr^n\text{,}$$ then you have $$\frac{dR}{dr}=\sum na_nr^{n-1}\qquad\frac{d^2R}{dr^2}=\sum n(n-1)a_nr^{n-2}\text{.}$$ So

\begin{align} \frac{d}{dr}\left[r^2 \frac{dR}{dr}\right]-\ell(\ell+1)R &=0\\ 2r\frac{dR}{dr}+r^2\frac{d^2R}{dr^2}-\ell(\ell+1)R &=0\\ 2r\sum na_nr^{n-1}+r^2\sum n(n-1)a_nr^{n-2}-\ell(\ell+1)\sum a_nr^n &=0\\ \sum 2na_nr^{n}+\sum n(n-1)a_nr^{n}-\sum \ell(\ell+1)a_nr^n &=0\\ \sum (2n+n(n-1)-\ell(\ell+1))a_nr^{n}&=0\\ \end{align}

So we have, for all $n$, \begin{align} \left(2n+n(n-1)-\ell(\ell+1)\right)a_n &=0\\ \left(n(n+1)-\ell(\ell+1)\right)a_n &=0 \end{align}

So if $n=\ell$ or $n=-\ell-1$, then $\left(n(n+1)-\ell(\ell+1)\right)$ will be $0$, and $a_n$ can be anything. For all other $n$, $\left(n(n+1)-\ell(\ell+1)\right)$ will be nonzero, and $a_n$ must be $0$.

So the solution is $$R(r)=a_\ell r^\ell+a_{-\ell-1}r^{-\ell-1}$$ where $a_\ell$ and $a_{-\ell-1}$ can be any constants. (Note that the initial assumption was that $R$ had a Laurent series in $r$. But now we can see that even for non-integer $\ell$, this still works as a solution.)

First differentiate so we can write the ODE in a more workable form: $$r^2R'' + 2rR' - l(l+1)R=0.$$ Assuming $R(r) = \sum_{n\in\mathbb Z}a_nr^n$, we compute \begin{align} R'(r) &= \sum_{n\in\mathbb Z}(n+1)a_{n+1}r^n\\ R''(r) &= \sum_{n\in\mathbb Z}(n+1)(n+2)a_{n+2}r^n. \end{align} Hence we have $$r^2\sum_{n\in\mathbb Z}(n+1)(n+2)a_{n+2}r^n + 2r\sum_{n\in\mathbb Z}(n+1)a_{n+1}r^n - l(l+1)\sum_{n\in\mathbb Z}a_nr^n = 0,$$ which implies that the coefficient of $r^n$ in the above is zero. It follows that $$r^2(n+1)(n+2)a_{n+2} + 2r(n+1)a_{n+1} - l(l+1)a_n=0,$$ which can be written as $$a_{n+2} = \frac{-2(n+2)}ra_{n+1}+\frac{l(l+1)}{r^2(n+1)(n+2)}a_n,\quad n\in\mathbb Z.$$ I'm not sure how to find a closed form for $a_n$, though, considering $R$ is a Laurent series and I am not familiar with complex analysis).