Answer
$y=\dfrac{1}{x^2}(\sin x+c)$
Work Step by Step
Re-write the given differential equation as: $y'+\dfrac{2y}{x}=\dfrac{\cos x}{x^2}$
The integrating factor is: $e^{\int (2/x) dx}=x^2$
Now, we have $\int [x^2y]' dx=\int \cos x dx$
or, $x^2y=\sin x+c$
Hence, the General solution is:
$y=\dfrac{1}{x^2}(\sin x+c)$