# What is the solution of the differential equation? :  y'-2xy = 1 \ \  with  \ \ y(0)=y_0

Feb 7, 2018

$y = \left(\sqrt{\frac{\pi}{2}} e r f \left(x\right) + {y}_{0}\right) {e}^{{x}^{2}}$

#### Explanation:

We can use an integrating factor when we have 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)$

We have:

$y ' - 2 x y = 1 \setminus \setminus$ with $\setminus \setminus y \left(0\right) = {y}_{0}$ ..... 

This is a First Order Ordinary Differential Equation in Standard Form. So we compute and integrating factor, $I$, using;

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

And if we multiply the DE  by this Integrating Factor, $I$, we will have a perfect product differential;

$\frac{\mathrm{dy}}{\mathrm{dx}} {e}^{- {x}^{2}} - 2 x y {e}^{- {x}^{2}} = {e}^{- {x}^{2}}$

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

This has transformed our initial ODE into a Separable ODE, so we can now "separate the variables" to get::

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

We now encounter a problem, as the RHS integral is not one that can be evaluated using standard elementary functions, and so we introduce the error function (or Gauss error function ):

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

From which we get:

$y {e}^{- {x}^{2}} = \sqrt{\frac{\pi}{2}} e r f \left(x\right) + C$
$\therefore y = \left(\sqrt{\frac{\pi}{2}} e r f \left(x\right) + C\right) {e}^{{x}^{2}}$

And, if we apply the initial condition, $y \left(0\right) = {y}_{0}$ we get:

${y}_{0} = \left(\sqrt{\frac{\pi}{2}}\right) \times 0 + C \implies C = {y}_{0}$

$\therefore y = \left(\sqrt{\frac{\pi}{2}} e r f \left(x\right) + {y}_{0}\right) {e}^{{x}^{2}}$