# Solving $y''+xy'+y=0$

So, as a homework question, I am trying to solve $y''+xy'+y=0$.

I checked that this is exact and gives $$(y'+xy)'=0$$ $$y'+xy = C_1$$ Using integrating factor $e^{\int xdx} = e^{x^2/2}$ : $$(ye^{x^2/2})' = C_1 e^{x^2/2}$$ At this point, integrating $e^{x^2/2}$ is needed which can't be done (without using the error function).

I did go ahead to solve it and get $$y=C_1e^{-x^2/2}\int e^{x^2/2}dx + C_2e^{-x^2/2}$$ which doesn't seem to be the solution when subsituted back into the original equation.

Am I doing something wrong here?

• Why do you think that its wrong ? Check again the subsitution back into the original equation. – JJacquelin Feb 21 '14 at 16:14
• @JJacquelin Turns out I did something wrong when differentiating. Thanks for the quick response. – TwiNight Feb 21 '14 at 16:34

$$y = C_{1}\mathrm{e}^{-\frac{x^{2}}{2}}\int \mathrm{e}^{\frac{x^{2}}{2}}dx + C_{2}\mathrm{e}^{-\frac{x^{2}}{2}}= C_{1}\mathrm{e}^{-\frac{x^{2}}{2}}I +C_{2}\mathrm{e}^{-\frac{x^{2}}{2}}$$ if we denote the error integral as $I$ for simplicity we find $$y^{'} = -xC_{1}\mathrm{e}^{-\frac{x^{2}}{2}}I + C_{1}\mathrm{e}^{-\frac{x^{2}}{2}}\left(\mathrm{e}^{\frac{x^{2}}{2}}\right) - xC_{2}\mathrm{e}^{-\frac{x^{2}}{2}}$$ here the derivative of the error function is simple the $\mathrm{e}^{\frac{x^{2}}{2}}$ as you know. Simplifying yields $$y^{'} = -x\left[C_{1}\mathrm{e}^{-\frac{x^{2}}{2}}I +C_{2}\mathrm{e}^{-\frac{x^{2}}{2}}\right] + C_{1} = -xy + C_{1}$$ now using that we can take the derivative $$y^{''} = -y - xy^{'}$$ and re-arranging gives back your original equation $$y^{''} + xy^{'}+y = 0$$