Answer
$\displaystyle y = (1)e^{x^2/2}+1$
Work Step by Step
$\displaystyle f'(x)=xf(x)-x$ is the same thing as $y'=xy-x$
$\displaystyle \frac{dy}{dx} = x(y-1)$
Separation of variables:
$\displaystyle \frac{dy}{y-1} = x\cdot dx$
Integrate with respect to each variable
$\displaystyle \int\frac{dy}{y-1} = \int x\cdot dx$
$\displaystyle \ln|y-1|=\frac{x^2}{2}+C$
$e^{\ln|y-1|} = e^{x^2/2+C} = e^C\cdot e^{x^2/2}$
$\displaystyle y-1 = Ce^{x^2/2}$
The reason that $e^C$ can be expressed as just $C$ is because $C$ has not taken on an initial value yet. Now plug in the initial condition and solve for $C$
$\displaystyle (2)-1 = Ce^{(0)^2/2}$
$\displaystyle 1 = C(1) = C$
Plug the value for $C$ that we just found back into the equation and isolate $y$
$\displaystyle y-1 = (1)e^{x^2/2}$
$\displaystyle y = (1)e^{x^2/2}+1$