Answer
$y = x^2~(ln~x+C)$
Work Step by Step
A first-order linear differential equation is one that can be put into the form:
$\frac{dy}{dx} + P(x)~y = Q(x)$
We can consider the given equation:
$xy' = x^2+2y$
$y' -\frac{2}{x}y = x$
Let $P(x) = -\frac{2}{x}$
Let $Q(x) = x$
We can find the integrating factor:
$I(x) = e^{\int \frac{-2}{x}~dx} = e^{-2ln~x} = e^{ln~x^{-2}} = \frac{1}{x^2}$
We can multiply by the integrating factor:
$\frac{1}{x^2}~y'-\frac{2}{x^3}~y = \frac{1}{x}$
$\frac{d}{dx}(\frac{1}{x^2}y) = \frac{1}{x}$
We can integrate both sides of the equation:
$\frac{1}{x^2}~y = \int \frac{1}{x}~dx$
$\frac{1}{x^2}~y = ln~x+C$
$y = x^2~ln~x+Cx^2$
$y = x^2~(ln~x+C)$