Solution (source code)

= Solution

Expanding the general <Sturm-Liouville form> gives
$$
Ly=-\frac pw y''-\frac{p'}w y'+\frac qw y.
$$
Matching the second-derivative coefficients requires $p/w=x^{-4}$. Matching the first-derivative coefficients then gives $p'/p=-2/x$. Up to a common positive normalization of $p,q,w$, one may therefore take
$$
\boxed{p(x)=x^{-2},\qquad w(x)=x^2,\qquad q(x)=-ax^2.}
$$
Indeed $-x^{-2}(x^{-2}y')'-ay=-x^{-4}y''+2x^{-5}y'-ay$. The left endpoint is singular in these coordinates. Its <self-adjoint> interpretation is supplied by the regular transformed problem in part (ii), rather than by assuming that $p(0)$ is finite.