I have an exercise of solving the equation above using MATLAB, with a hint to set $ v(x)=(y'+y)e^{-x^{2}} $. I tried to do with my hand and get the following: $ v'+2xy=x $, but I don't know what to do next, I'm stuck there.
My teacher asked to not using the "dsolve" function, so I'm stuck with MATLAB too.
Anyone can do this problem? Thank you so much.
You did well so far. You found $v'(x)=x-2xy(x)$. The substitution given in the hint can be transformed to $y'=v(x)e^{x^2}-y(x)$. This now constitutes a system of two coupled differential equations.
You may want to compare the numerical solution of this compact system to the one generated from the system using the standard substitution $v(x)=y'(x)$.