# Solving a differential equation

I need to solve the integral $$\int^x \frac{1}{t^2}e^{t^2}dt.$$ The answer should be $$\sqrt{\pi}\left(\text{erfi}(x)\right)-\frac{e^{x^2}}{x} + C$$

What does $\text{erfi}(x)$ mean? Can anybody explain how to solve this integral step-by-step? Thanks!

I need to solve the 2nd order differential equation $$y'' -2xy'+2y=0$$ using that $y_1=Cx$. The solution of $y_2$ should then be \begin{align}y_2 &=y_1\int^x\frac{1}{{y_1(t)}^2}\exp \left(-\int^t{-2s}\,ds\right) \,dt\\ &=Cx\int^x\frac{1}{(Ct)^2}\exp \left(\int^t{(2s)}\,ds\right) \,dt\\ &=\frac{x}{C}\int^x\frac{1}{t^2} \exp \left(\int^t{(2s)}\,ds\right) \,dt\\ &= \frac{x}{C}\int^x\frac{1}{t^2}e^{t^2}\, dt \end{align}

-
That "answer" looks pretty fishy: how come $\,t\,$ appears in it?? – DonAntonio Dec 2 '12 at 13:31
Off course it should be x instead of t – Applied mathematician Dec 2 '12 at 13:34
One type of error function that's called the Imaginary Erf: $\operatorname{erfi}(z)=-i \operatorname{erf}(iz)$ – Frenzy Li Dec 2 '12 at 13:45
tnx. My ultimate goal is to write down the solution of this differential equation as correct as possible :-) – Applied mathematician Dec 2 '12 at 13:58

You are correct, $y_2=\frac{x}{C}\int\frac{e^{x^2}}{x^2}\, dx$. This indefinite integral can't be written in terms of elementary functions (polynomials, exponential, trigonometric functions and their inverses). It is useful however to express it in terms of power series. Indeed since $$e^t=\sum_{n=0}^{\infty}\frac{t^n}{n!}$$ we easily see that $$\int\frac{e^{x^2}}{x^2}\, dx=\int\frac{1}{x^2}\sum_{n=0}^{\infty}\frac{(x^2)^n}{n!}\, dx=\int\sum_{n=0}^{\infty}\frac{x^{2n-2}}{n!}\, dx=\sum_{n=0}^{\infty}\int\frac{x^{2n-2}}{n!}\, dx=\sum_{n=0}^{\infty}\frac{x^{2n-1}}{n!(2n-1)}\, dx$$ Therefore, $$y_2=\frac{x}{C}\int\frac{e^{x^2}}{x^2}\, dx=\frac{1}{C}\sum_{n=0}^{\infty}\frac{x^{2n}}{n!(2n-1)}\, dx$$ In order to study such sums (and especially integrals with terms like $e^{x^2}$) that are very improtant for probability and statistics, we defined the error function $erf$ and the imaginary error function $erfi$. The Wikipedia entry for Error Function might be of interest to you. In the course of differential equations, you shall encounter other differential equations, the solutions of which may not elementary functions but can be expressed as a power series.
But, There is a hint I could use, in the assignment: "You might want to make use of the imaginary error function $$erfi(x):= 2 \int_0^x e^{t^2} dt /{\sqrt{\pi}}$$ – Applied mathematician Dec 2 '12 at 17:06