Answer
$y=\frac{c}{x}+\sin (x) + \frac{\cos (x)}{x}$
Work Step by Step
We are given:
$y'+x^{-1}y=\cos x$
Intergrating factor:
$I=e^{-\int \frac{1}{x}dx}(c+\int e^{\int \frac{1}{x}dx}\cos x dx)$
where $c$ is the constant of integration.
So:
$y=e^{-\ln x}(c+\int e^{\int \ln x}\cos x dx)$
$y=\frac{1}{x}(c+\int x\cos x dx)$
Simplify:
$y=\frac{c}{x}+\sin x + \frac{\cos x}{x}$