# Solve the differential equation $\frac{dy}{dx} - xy=1$

Solve the differential equation $\frac{dy}{dx} - xy=1$ given $y(0)=1$

The given differential equation is a first order linear differential equation of the form $\frac{dy}{dx} + Py=Q$

The integrating factor is $$e^{\int Pdx}=e^{-\int xdx}=e^{-\frac{x^2}{2}}$$

Solution is $$ye^{-\frac{x^2}{2}}=\int e^{-\frac{x^2}{2}}dx + c$$

But how do I integrate the second term?

• Just call it the error function - en.wikipedia.org/wiki/Error_function – Moo Mar 29 '17 at 13:00
• it is $\int { { e }^{ -{ \frac { { x }^{ 2 } }{ 2 } } } } dx=\sqrt { \frac { \pi }{ 2 } } erf\left( \frac { x }{ \sqrt { 2 } } \right) +C$ – haqnatural Mar 29 '17 at 13:05
• the solution is given by $$\left\{\left\{y(x)\to c_1 e^{\frac{x^2}{2}}+\sqrt{\frac{\pi }{2}} e^{\frac{x^2}{2}} \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right\}\right\}$$ – Dr. Sonnhard Graubner Mar 29 '17 at 13:12

The integral you are considering does not have an elementary antiderivative. Regardless, we can still obtain an exact solution in terms of the error function. The considered integral is: $$\int e^{-\frac{x^2}{2}}~dx$$ Now, substitute $$u=\frac{x}{\sqrt{2}} \implies du=\frac{1}{\sqrt{2}}~dx\implies dx=\sqrt{2}~du$$ This gives an integral which is contained in the definition of the error function: $$\int e^{-\frac{x^2}{2}}~dx=\sqrt{2}\cdot \int e^{-u^2}~du$$ The definition of the error function is:
$$\operatorname*{erf}(x)=\frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}~dt$$
It follows from the definition that: $$\int e^{-u^2}~du=\frac{\sqrt{\pi}}{2}\cdot \operatorname*{erf}(u)+C$$ Can you continue? From solving the integral, you can find the general solution to your ODE, and then find the solution where $y(0)=1$.