Hello, and welcome to FMH!

The way I would work this problem, is to take the given:

\(\displaystyle y=xe^{-\frac{x^2}{2}}\)

And then compute:

\(\displaystyle y'=e^{-\frac{x^2}{2}}-x^2e^{-\frac{x^2}{2}}=(1-x^2)e^{-\frac{x^2}{2}}\)

Next, substitute for \(y\) and \(y'\) into the given ODE:

\(\displaystyle x\left((1-x^2)e^{-\frac{x^2}{2}}\right)=(1-x)\left(xe^{-\frac{x^2}{2}}\right)\)

Divide through by \(x(1-x)e^{-\frac{x^2}{2}}\):

\(\displaystyle x=0\)

Now, we normally expect to obtain an identity when we do this. If we write the ODE as:

\(\displaystyle y'+\frac{x-1}{x}y=0\)

**Note:** we are losing the trivial solution associated with \(x=0\implies y=0\).

Compute the integrating factor:

\(\displaystyle \mu(x)=\exp\left(\int\frac{x-1}{x}\,dx\right)=\frac{e^x}{x}\)

then the ODE becomes:

\(\displaystyle \frac{e^x}{x}y'+\frac{(x-1)e^x}{x^2}y=0\)

\(\displaystyle \frac{d}{dx}\left(\frac{e^x}{x}y\right)=0\)

Integrate:

\(\displaystyle \frac{e^x}{x}y=c_1\)

Hence:

\(\displaystyle y(x)=c_1xe^{-x}\)

Based on this, I wonder if the author of the problem actually intended for you to verify that:

\(\displaystyle y=xe^{-x}\)

is a solution to the given ODE.