# First order non-linear ODE with error function

I have to solve $$y'(x)=-2xy(x)+ey^2(x)$$.

Using $$z=y^{-1}$$ and $$-z^{'}=\frac{y^{'}}{y^{2}}$$ i arrive to prove that $$z^{'}=-2xz+e$$, but when i apply the variation of constants method i obtain $$z_0(x)=Ce^{A(x)}, A(x)=x^2\Rightarrow Ce^{x^2}$$ and, unfortunately:

$$z_p(x)=e^{A(x)}B(x), B(x)=\int -e\cdot e^{-A(x)}=\int-e \cdot e^{-x^2}=\int-e^{1-x^2}$$

How must i behave now? How can i arrive to the solution with Riemann's integral? How to use definite integrals to solve the EDO?

Thanks for any help!

• Use mathematica DSolve method: DSolve[y'[x] == -2 xy[x] + Ey[x]^2, y[x], x] – William Sep 24 '18 at 16:53

## 1 Answer

$$y'(x)=-2xy(x)+ey^2(x)$$ Substitute $$z=\frac 1 y$$ $$-z'=-2xz+e \implies z'-2xz=-e$$ Use integrating factor $$\mu=e^{-x^2}$$ $$(ze^{-x^2})'=-ee^{-x^2}$$ Integrate $$ze^{-x^2}=-e\int e^{-x^2}dx+C$$ $$ze^{-x^2}=-e \frac {\sqrt {\pi}}2\text{erf(x)}+C$$ $$\frac y {e^{-x^2}}=\frac 1 {-e\frac {\sqrt {\pi}}2\text{erf(x)}+C}$$ $$y =\frac {2e^{-(x^2+1)}} {C- {\sqrt {\pi}}\text{erf(x)}}$$

• Thanks Isham for your answer. So, using the error function i obtain $y=\frac{1}{e^{x^{2}}(c-e\frac{\sqrt{\pi }}{2}erf(x)))}$. However, my question was: how can i use definite integrals to solve the integral? WolframAlpha says that the solution is $y(x)=\frac{2}{e^{c+x^{2}}+e}$, so i think it's possible to solve it without error function. – Marco Pittella Sep 24 '18 at 17:31
• @MarcoPittella Are you sure for WA answer ? I don't think you can solve this differential equation without error function – Isham Sep 24 '18 at 17:36
• y're welcome @MarcoPittella – Isham Sep 24 '18 at 17:47
• You're right: i've added an $x$ to the text. Thanks again! – Marco Pittella Sep 24 '18 at 17:47
• Do you think it's possible to solve it with definit integrals? – Marco Pittella Sep 24 '18 at 17:48