# What is a solution to the differential equation dy/dx=1+2xy?

Jan 22, 2017

$y = \frac{\sqrt{\pi}}{2} {e}^{{x}^{2}} \text{erf} \left(x\right) + A {e}^{{x}^{2}}$

Where $\text{erf} \left(x\right)$ is the Error Function :

$\text{erf} \left(x\right) = \frac{2}{\sqrt{\pi}} {\int}_{0}^{x} {e}^{- {t}^{2}} \setminus \mathrm{dt}$

#### Explanation:

$\frac{\mathrm{dy}}{\mathrm{dx}} = 1 + 2 x y$
$\therefore \frac{\mathrm{dy}}{\mathrm{dx}} - 2 x y = 1$ ..... [1]

This is a First Order Linear non-homogeneous Ordinary Differential Equation of the form;

$\frac{\mathrm{dy}}{\mathrm{dx}} + P \left(x\right) y = Q \left(x\right)$

This is a standard form of a Differential Equation that can be solved by using an Integrating Factor:

$I = {e}^{\int P \left(x\right) \mathrm{dx}}$
$\setminus \setminus = {e}^{\int \setminus - 2 x \setminus \mathrm{dx}}$
$\setminus \setminus = {e}^{- {x}^{2}}$

And if we multiply the DE [1] by this Integrating Factor we will have a perfect product differential;

$\frac{\mathrm{dy}}{\mathrm{dx}} - 2 x y = 1$
$\therefore {e}^{- {x}^{2}} \frac{\mathrm{dy}}{\mathrm{dx}} - 2 x y {e}^{- {x}^{2}} = 1 \cdot {e}^{- {x}^{2}}$
$\therefore \frac{d}{\mathrm{dx}} \left(y {e}^{- {x}^{2}}\right) = {e}^{- {x}^{2}}$

This has converted our DE into a First Order separable DE which we can now just separate the variables to get;

$y {e}^{- {x}^{2}} = \int \setminus {e}^{- {x}^{2}} \setminus \mathrm{dx}$

The RHS integral does not have an elementary form, but we can use the definition of the Error Function :

$\text{erf} \left(x\right) = \frac{2}{\sqrt{\pi}} {\int}_{0}^{x} {e}^{- {t}^{2}} \setminus \mathrm{dt}$

Which gives us:

$y {e}^{- {x}^{2}} = \frac{\sqrt{\pi}}{2} \text{erf} \left(x\right) + A$
$y = \frac{\sqrt{\pi}}{2} {e}^{{x}^{2}} \text{erf} \left(x\right) + A {e}^{{x}^{2}}$