# Solution of a linear differential equation

Find the general solution of the equation $$\frac{dy}{dx}=1+xy$$

My attempt: Arranging it in standard linear equation form $\frac{dy}{dx}+Py=Q$, we get $$\frac{dy}{dx}+(-x)y=1$$ Hence, the integrating factor(I.F.) = $e^{\int-xdx}=e^{-x^2/2}$ Hence, the solution is $$y(e^{-x^2/2})=\int{e^{-x^2/2}dx}+c$$

How do I solve this integral now?

• this is the error function – Dr. Sonnhard Graubner Aug 4 '17 at 11:53
• the solution is given by $$y(x)=c_1 e^{\frac{x^2}{2}}+\sqrt{\frac{\pi }{2}} e^{\frac{x^2}{2}} \text{erf}\left(\frac{x}{\sqrt{2}}\right)$$ – Dr. Sonnhard Graubner Aug 4 '17 at 11:55

## 2 Answers

As a commenter mentions, the solution is:

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

One thing to note here is that the erf(x) function is sometimes not all that well known. According to wolfram alpha, https://www.wolframalpha.com/input/?i=erf(), the erf() function is defined as:

$$\text{erf(x)}=\frac{2}{\sqrt{\pi}} \int_{0}^{x}{e^{-t^2}dt}$$

Now when you have:

$$\int{e^{-x^2/2}dx}$$

It can be rewritten as:

$$\int{e^{-(x/\sqrt{2})^2}dx}$$

Let's replace $x/\sqrt{2}=t$. This tells us that $dx=\sqrt{2}dt$.

Making the substitution: $$\sqrt{2}\int{e^{-t^2}dt}$$ Since limits are need to be inserted, it can be shown that: $$\int_0^t{e^{-z^2}dz}=\int{e^{-t^2}dt}+C$$ Combining all of that: $$\sqrt{2}(\frac{\sqrt{\pi}}{2}\text{erf(t)}+C)=\sqrt{2}\int{e^{-t^2}dt}$$ This means that: $$y(e^{-x^2/2})=\sqrt{2}(\frac{\sqrt{\pi}}{2}\text{erf}\left(\frac{x}{\sqrt{2}}\right)+C)$$ I trust you can simplify from there.

The incomplete equation is $$\frac {y'}{y}=x$$

thus $$\ln (\frac {y}{\lambda})=\frac {x^2}{2}$$ and $$y_h=\lambda e^{\frac {x^2}{2}}$$

the constante variation method gives

$$\lambda'(x)=e^{\frac {-x^2}{2}}$$

the general solution is

$$y_g=\Bigl(\lambda+\int e^{\frac {-x^2}{2}}dx\Bigr)e^{\frac {x^2}{2}}$$