How can we guess one solution of the equation $y''+\frac{2}{x}y'+y=0$? I want to solve the equation $$\frac{1}{x^2} \, \frac{d}{dx}\left(x^2\frac{dy}{dx}\right)=-y.$$ I converted it to this equation $y''+\frac{2}{x}y'+y=0$. How can we guess one solution of the equation $y''+\frac{2}{x}y'+y=0$? Is there any way to solve it generally?

Assume a solution with power series and derivatives
$$y(x) = \sum_{n\ge0} a_n x^n \implies y'(x) = \sum_{n\ge0} (n+1) a_{n+1} x^n \implies y''(x) = \sum_{n\ge0} (n+1) (n+2) a_{n+2} x^n$$
Putting these into the ODE yields
$$\begin{align*}
0 &= y'' + \frac2x y' + y \\[1ex]
&= xy'' + 2y' + xy \\[1ex]
&= \sum_{n\ge0} (n+1)(n+2) a_{n+2} x^{n+1} + 2 \sum_{n\ge0} (n+1) a_{n+1} x^n + \sum_{n\ge0} a_n x^{n+1} \\[1ex]
&= \sum_{n\ge1} n(n+1) a_{n+1} x^n + 2 \sum_{n\ge0} (n+1)a_{n+1} x^n + \sum_{n\ge1} a_{n-1}x^n \\[1ex]
&= 2a_1 + \sum_{n\ge1} \bigg((n+2)(n+1) a_{n+1} + a_{n-1}\bigg) x^n \\[1ex]
\end{align*}$$
Let $a_0=A$. The coefficients are governed by the recurrence
$$\begin{cases}a_0 = A \\ 2a_1 = 0 \\ (n+2)(n+1)a_{n+1} + a_{n-1} = 0 & n\ge1\end{cases} \iff \begin{cases}a_0 = A \\ a_1 = 0 \\ a_n = -\frac{a_{n-2}}{n(n+1)} & n\ge2\end{cases}$$
and we have for $k\in\Bbb N$,
$$\begin{cases} a_{2k-1} = 0 \\ a_{2k} = \frac{(-1)^k}{(2k+1)!} A\end{cases}$$
so that a fundamental solution to the ODE is
$$y_1(x) = \sum_{k\ge0} \frac{(-1)^k}{(2k+1)!} x^{2k} = \boxed{\frac{\sin(x)}x}$$

Reduce the order to find another solution. Let $y_2(x)=z(x)y_1(x)$. Substitute into the ODE and solve the subsequent linear equation.
$$\begin{align*}
0 &= x \left(z'' y_1 + 2z'{y_1}' + z{y_1}''\right) + 2 \left(z' y_1 + z {y_1}'\right) + x z y_1 \\[1ex]
&= z'' \sin(x) + 2z' \cos(x)\\[1ex]
&= w' \sin(x) + 2w \cos(x) & w(x) = z'(x) \\[1ex]
&= w' \sin^2(x) + w \sin(2x) \\[1ex]
&= \left(w \sin^2(x)\right)' \\[2ex]
\implies w(x) &= C_1 \csc^2(x) \\[2ex]
\implies z(x) &= C_1 \cot(x) + C_2
\end{align*}$$
Then the other fundamental solution is
$$y_2(x) = \cot(x) \cdot \frac{\sin(x)}x = \boxed{\frac{\cos(x)}x}$$
