Solving a second-order homogeneous differential equation I got into this ODE which looks simple but I have a hard time figuring out how to solve:
$$a\frac{d^2 y}{dx^2}+\frac{da}{dx}\frac{dy}{dx}-\frac{l(l+1)}{x^2}y(x)=0$$
where $a=(1-k/x)^2$, $l\geq 0$, and $k>0$. Can anyone help me? I just want the general solution. I tried using series solution but I guess there must be a simpler way. Thanks!
 A: Let $z'(x)=y'(x)\,a(x).$ Then $z''(x)=y''(x)\,a(x)+y'(x)\,a'(x).$ This allows us to write the DE as $z''-l(l+1)y/x^2=0.$ Now
$a(x)=(1-k/x)^2=(x-k)^2/x^2;$ our goal is to write $y/x^2$ in terms of $z$ and $x,$ if possible. We have
\begin{align*}
z'&=y'a \\
\frac{z'}{a}&=y' \\
\int\frac{z'}{a}\,dx&=y \\
z''-l(l+1)\,\frac{1}{x^2}\,\int\frac{z'}{a}\,dx&=0.
\end{align*}
Next, we would like to differentiate this expression to get rid of the integral, but we don't want to use the quotient rule, because that would leave the integral intact. We multiply through by $x^2$ to obtain
\begin{align*}
x^2\,z''-l(l+1)\int\frac{z'}{a}\,dx&=0 \\
x^2\,z'''+2xz''-l(l+1)\,\frac{z'}{a}&=0.
\end{align*}
There is an obvious substitution to reduce the order: $w=z',$ to obtain
$$x^2\,w''+2xw'-l(l+1)\,\frac{w\,x^2}{(x-k)^2}=0. $$
This is exactly solvable:
$$w(x)=\frac{c_1 (k-x)^{\frac{1}{2}-\frac{1}{2} |2
    l+1|}}{x}-\frac{c_2 (k-x)^{\frac{1}{2} |2
    l+1|+\frac{1}{2}}}{|2 l+1|\,x}. $$
Now $w=y'a,$ so that we must perform
\begin{align*}
y'\,\frac{(x-k)^2}{x^2}&=\frac{c_1 (k-x)^{\frac{1}{2}-\frac{1}{2} |2
    l+1|}}{x}-\frac{c_2 (k-x)^{\frac{1}{2} |2
    l+1|+\frac{1}{2}}}{|2 l+1|\,x} \\
y'&=\frac{c_1 x(k-x)^{\frac{1}{2}-\frac{1}{2} |2
    l+1|}}{(x-k)^2}-\frac{c_2 x(k-x)^{\frac{1}{2} |2
    l+1|+\frac{1}{2}}}{|2 l+1|\,(x-k)^2}\\
y&=\frac{2c_1 (k-x)^{-\frac{1}{2} \left| 2 l+1\right| -\frac{1}{2}} (x \left| 2
    l+1\right| -2 k+x)}{\left| 2 l+1\right| ^2-1}
+\frac{2c_2 (k-x)^{\frac{1}{2} (\left| 2 l+1\right| -1)} (x \left| 2 l+1\right|
    +2 k-x)}{\left| 2 l+1\right|  \left(\left| 2 l+1\right| ^2-1\right)}.
\end{align*}
