# How to solve the Cauchy problem $y'+xy=1+x$; $y(3/2)=0$

Given

$$y'+xy=1+x; \text{ } y(3/2)=0$$

I am able to solve the non homogeneous linear differential equation to find:

$$y=e^{-\frac{x^{2}}{2}}(\int e^{\frac{x^{2}}{2}}dx+1+C)$$

However, I don't understand how to compute the initial value problem.

Notes:

I am not supposed to know the value of the integral on the right side of the equation. I believe it has something to do with the integration limits, but I am not sure.

Solution of problem $$$$y'+xy=f(x), \quad y(3/2)=0$$$$ is $$y=e^{-x^2/2}\int_{3/2}^xf(t)e^{t^2/2}dt$$
• How do you find that? Why is the constant $C=0$? – IchVerloren Sep 11 '18 at 11:14
Let us consider your differential equation: $$\frac{dy(x)}{dx}+x\cdot y(x)=1+x$$ Multiply on both sides by $e^{x^2/2}$: $$e^{x^2/2}\cdot\frac{dy(x)}{dx}+e^{x^2/2}\cdot x\cdot y(x)=e^{x^2/2}+e^{x^2/2}\cdot x$$ Recognize that $e^{x^2/2}\cdot x=\frac{d}{dx}(e^{x^2/2})$: $$e^{x^2/2}\cdot\frac{dy(x)}{dx}+\frac{d}{dx}(e^{x^2/2})\cdot y(x)=e^{x^2/2}+\frac{d}{dx}(e^{x^2/2})$$ Regarding the l.h.s., apply the reverse product rule: $$\frac{d}{dx}\left(e^{x^2/2}\cdot y(x)\right)=e^{x^2/2}+\frac{d}{dx}(e^{x^2/2})$$ Integrate on both sides with respect to $x$: $$\int \frac{d}{dx}\left(e^{x^2/2}\cdot y(x)\right)dx=\int e^{x^2/2}\ dx+\int \frac{d}{dx}(e^{x^2/2})\ dx$$ It follows that $$e^{x^2/2}\cdot y(x)=\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{x}{\sqrt{2}}\right)+e^{x^2/2}+C$$ Note (i): $\text{erfi}(z)$ is the imaginary error function and is related to the (regular) error function, $\text{erfi}(z)=-i\cdot \text{erf}(i\cdot z)$. (for more information, check the links http://mathworld.wolfram.com/Erfi.html and http://mathworld.wolfram.com/Erf.html)
Multiply on both sides by $e^{-x^2/2}$: $$y(x)=\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{x}{\sqrt{2}}\right)\cdot e^{-x^2/2}+1+C\cdot e^{-x^2/2}$$ Note (ii): Notice that you yourself were almost there, except that you didn't know the primitive of $e^{x^2/2}$.
Note (iii): One small thing though. In your expression appears a $e^{-x^2/2}\cdot 1=e^{-x^2/2}$. The exponentials should cancel out to result in $1$, i.e. $e^{-x^2/2}\cdot e^{x^2/2}=1$.
Apply the condition $y(3/2)=0$: $$\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{3}{2\sqrt{2}}\right)\cdot e^{-9/8}+1+C\cdot e^{-9/8}=0$$ It follows that $$C=-\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{3}{2\sqrt{2}}\right)-e^{9/8}$$ Substitution yields $$y(x)=\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{x}{\sqrt{2}}\right)\cdot e^{-x^2/2}+1+\left(-\sqrt{\frac{\pi}{2}}\cdot \text{erfi}\left(\frac{3}{2\sqrt{2}}\right)-e^{9/8}\right)\cdot e^{-x^2/2}$$ Expanding and rearranging the terms gives the solution to your initial value problem: $$y(x)=\left(\sqrt{\frac{\pi}{2}}\cdot \left(\text{erfi}\left(\frac{x}{\sqrt{2}}\right)-\text{erfi}\left(\frac{3}{2\sqrt{2}}\right)\right)-e^{9/8}\right)\cdot e^{-x^2/2}+1$$