The equation can be written into dy/dx + xy = e^(-x^2/2) or y' + xy = e^(-x^2/2). This is a non-homogeneous linear differential equation. The integration factor is
u(x) = e^(int(x))=e^(x^2/2), where int(x) is the integral of x.
Next, we multiply e^(x^2/2) throughout on sides and simplify it to get the following:
e^(x^2/2) y' + xe^(x^2/2) y = 1; the left hand side can be combined:
(e^(x^2/2) y)' = 1; integrating both sides with respect to x yields
e^(x^2/2)y = x+C, that is y=xe^(-x^2/2) + Ce^(-x^2/2).