# How to Solve $y^{\prime \prime}-(\frac{1}{4} + \frac{k}{x})y=0$

Suppose I have the equation

$$y^{\prime \prime}-\left(\frac{1}{4} + \frac{k}{x}\right)y=0.$$

I understand that an equation of this form would normally be solved using the Frobenius Method to obtain a recurrence relation. But in this case, the $$\frac{1}{x}$$ dependence causes the coefficient $$a_n$$ in the recurrence relationship to depend on both $$a_{n-1}$$ and $$a_{n-2}$$ after I "shift up" the summation indices, and so I'm not sure how to continue.

I also tried plugging the equation into Mathematica, which gave a solution for $$y$$ in terms of the hypergeometric function. However, I'll ultimately need to find the value for the constant $$k$$ which causes the nontrivial solution to vanish for both $$x=0$$ and $$x=\infty$$. What method should I use to solve this?

According to Maple, the general solution is $$y \left( x \right) =c_1\,{{M}_{-k,\,1/2}\left(x\right)}+c_2 \,{{ W}_{-k,\,1/2}\left(x\right)}$$ where $$M$$ and $$W$$ are Whittaker M and W functions. We have $$M_{-k,1/2}(0)=0$$. I'm not sure what happens as $$x \to \infty$$ though, other than that $$\infty$$ is an irregular singular point. But from numerical experimentation it looks to me like $$M_{-k,1/2}(x) \to 0$$ as $$x \to \infty$$ if $$k$$ is a negative integer.
Hmm: that Whittaker M solution can be written as $$y(x) = - \frac{x}{k} e^{-x/2} L(-1-k,1,x)$$ where $$L$$ is the Laguerre L function. In particular when $$-1-k$$ is a nonnegative integer (i.e. $$k$$ is a negative integer), $$L(-1-k,1,x)$$ is a generalized Laguerre polynomial, and then $$y(x)$$ does go to $$0$$ as $$x \to \infty$$.
Frobenius Method cannot be applicable directly so tansform the ODE using $$y(x)=xe^{x/2} z(x)$$ then $$y''-(1/4+k/x)y=0 \implies x z''(x)+(2-x)~z(x)-(1+k)~z(x)=0.$$ Now Frob' method cann be applied. Also the z equation is Confluent Hyper geometric equation: $$zW''+(b-ax)W'-W=0 \implies W=A M(a,b,x)+ B U(a,b,x),$$ $$M$$ and $$W$$ are spoecial Kummer functions. See
https://en.wikipedia.org/wiki/Confluent_hypergeometric_function So $$y(x)=x e^{-x/2} A M(1+k,2,x) + B U(1+k,2;x)$$ is the complete solution of the gien ODE. These solutions can also be written in term\ms of Lagurre Polynomials. See