# How do you solve y'=-xy+sqrty given y(0)=0?

Apr 1, 2018

$y = y \left(0\right) = \frac{1}{4} \pi {e}^{- \frac{1}{2} {x}^{2}} {\text{erfi}}^{2} \left(\frac{1}{2} x\right)$

#### Explanation:

We have $y ' = - x y + \sqrt{y}$ or $\frac{\mathrm{dy}}{\mathrm{dx}} = {y}^{\frac{1}{2}} - x y$.

Let $v = {y}^{\frac{1}{2}}$ and $\frac{\mathrm{dv}}{\mathrm{dx}} = \frac{1}{2} {y}^{- \frac{1}{2}} \frac{\mathrm{dy}}{\mathrm{dx}}$

Now

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

so

$\frac{\mathrm{dv}}{\mathrm{dx}} = \frac{1}{2} \left(1 - v x\right) = \frac{1}{2} - \frac{1}{2} v x$

$\Rightarrow \frac{\mathrm{dv}}{\mathrm{dx}} + \frac{1}{2} v x = \frac{1}{2}$

This is now a linear first-order ordinary differential equation of the form

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

We solve this using an integrating factor:

$\mu = {e}^{\int \frac{1}{2} x \mathrm{dx}} = {e}^{\frac{1}{4} {x}^{2}}$

So the general solution is

$v {e}^{\frac{1}{4} {x}^{2}} = \int \frac{1}{2} {e}^{\frac{1}{4} {x}^{2}} \mathrm{dx} = \frac{1}{2} \left(\sqrt{\pi} \text{erfi"(1/2x)+"c}\right)$

Solving for $v$

$v = \frac{1}{2} {e}^{- \frac{1}{4} {x}^{2}} \left(\sqrt{\pi} \text{erfi"(1/2x)+"c}\right)$

But $v = \sqrt{y}$ so

$\sqrt{y} = \frac{1}{2} {e}^{- \frac{1}{4} {x}^{2}} \left(\sqrt{\pi} \text{erfi"(1/2x)+"c}\right)$

and

$y = \frac{1}{4} {e}^{- \frac{1}{2} {x}^{2}} {\left(\sqrt{\pi} \text{erfi"(1/2x)+"c}\right)}^{2}$

Now, we have the condition $y \left(0\right) = 0$

So

$y \left(0\right) = \frac{1}{4} {e}^{0} {\left(\sqrt{\pi} \text{erfi"(0/2)+"c}\right)}^{2} = 0$

$\Rightarrow \frac{1}{4} {c}^{2} = 0 \Rightarrow c = 0$

So the final solution is

$y = y \left(0\right) = \frac{1}{4} \pi {e}^{- \frac{1}{2} {x}^{2}} {\text{erfi}}^{2} \left(\frac{1}{2} x\right)$