Solution (source code)

= Solution

On either connected half-line, the <homogeneous linear differential equation> is
$$
y'+\left(\frac2x-\frac1{x^2}\right)y=0.
$$
Integration gives $\boxed{y_h=Cx^{-2}e^{-1/x}}$, including the zero solution. For the inhomogeneous equation choose the positive <integrating factor>
$$
\mu(x)=\exp\left(2\log|x|+\frac1x\right)=x^2e^{1/x}.
$$
It satisfies $\mu'/\mu=2/x-1/x^2$. Multiplication gives the exact derivative
$$
(\mu y)'=\frac1{1+x^2}.
$$
Hence all solutions on either half-line are
$$
\boxed{y(x)=\frac{e^{-1/x}}{x^2}\bigl(C+\arctan x\bigr).}
$$
For $a\ne0$, impose $y(a)=b$ to obtain $C=a^2e^{1/a}b-\arctan a$. The complete <initial value problem> solution is therefore
$$
\boxed{y(x)=\frac{e^{-1/x}}{x^2}\left(a^2e^{1/a}b+\arctan x-\arctan a\right),\qquad ax>0.}
$$
It is smooth throughout the maximal connected interval $(0,\infty)$ if $a>0$, and $(-\infty,0)$ if $a<0$.