## Prove $$\int_{u}^{\infty} x^{-2} \mathrm{e}^{-\mu x^{2}} \mathrm{d}x = \frac{1}{u} \mathrm{e}^{-\mu u^{2}} – \sqrt{\pi \mu} [1 – \mathrm{erf}(u\sqrt{\mu})]$$

How to prove

\int\limits_{u}^{\infty} x^{-2} \mathrm{e}^{-\mu x^{2}} \mathrm{d}x =
\frac{1}{u} \mathrm{e}^{-\mu u^{2}} – \sqrt{\pi \mu} [1 – \mathrm{erf}(u\sqrt{\mu})]

was a question posted at Mathematics Stack Exchange. Here is my solution.

\begin{align}
I(\mu) &= \int\limits_{u}^{\infty} \mathrm{e}^{-\mu x^{2}} \mathrm{d}x \\
&= \frac{1}{\sqrt{\mu}} \int\limits_{u\sqrt{\mu}}^{\infty} \mathrm{e}^{-y^{2}} \mathrm{d}y \\
&= \frac{1}{2}\sqrt{\frac{\pi}{\mu}} \mathrm{erfc}(u\sqrt{\mu}) \\
&= \frac{1}{2}\sqrt{\frac{\pi}{\mu}} – \frac{1}{2}\sqrt{\frac{\pi}{\mu}}\mathrm{erf}(u\sqrt{\mu})
\end{align}
We let $$y^{2} = \mu x^{2}$$.

Integrating with respect to $$\mu$$ we have

\int\limits_{u}^{\infty} \int \mathrm{e}^{-\mu x^{2}} \mathrm{d}\mu \mathrm{d}x
= -\int\limits_{u}^{\infty} x^{-2} \mathrm{e}^{-\mu x^{2}} \mathrm{d}x
\tag{1}
\label{eq:20161017-1}

and

\int \frac{\sqrt{\pi}}{2}\frac{1}{\sqrt{\mu}} \mathrm{d}\mu – \int \frac{\sqrt{\pi}}{2}\frac{1}{\sqrt{\mu}}\mathrm{erf}(u\sqrt{\mu}) \mathrm{d}\mu
= \frac{\sqrt{\pi}}{2}\frac{1}{\sqrt{\mu}} I_{1} – \frac{\sqrt{\pi}}{2}\frac{1}{\sqrt{\mu}} I_{2}
\tag{2}
\label{eq:20161017-2}

I_{1} = \int \frac{1}{\sqrt{\mu}} \mathrm{d}\mu = 2\sqrt{\mu}

\begin{align}
I_{2} &= \int \frac{1}{\sqrt{\mu}} \mathrm{erf}(u\sqrt{\mu}) \mathrm{d}\mu \\
&= \frac{2}{u} \int \mathrm{erf}(x) \mathrm{d}x \\
&= \frac{2}{u} x\, \mathrm{erf}(x) + \frac{2}{u} \frac{1}{\sqrt{\pi}} \mathrm{e}^{-x^{2}} \\
&= 2\sqrt{\mu} \,\mathrm{erf}(u\sqrt{\mu}) + \frac{2}{u} \frac{1}{\sqrt{\pi}} \mathrm{e}^{-\mu u^{2}}
\end{align}

We let $$x=u\sqrt{\mu}$$.

Inserting $$I_{1}$$ and $$I_{2}$$ into equation \eqref{eq:20161017-2}, equating the result with
equation \eqref{eq:20161017-1}, and simplifying, we have our final result

\begin{align}
\int\limits_{u}^{\infty} x^{-2} \mathrm{e}^{-\mu x^{2}} \mathrm{d}x &=
\frac{1}{u} \mathrm{e}^{-\mu u^{2}} – \sqrt{\pi \mu} [1 – \mathrm{erf}(u\sqrt{\mu})] \\
&= \frac{1}{u} \mathrm{e}^{-\mu u^{2}} – \sqrt{\pi \mu} \,\mathrm{erfc}(u\sqrt{\mu})
\end{align}

## Evaluation of Definite Integrals Via the Cauchy-Schlomilch Transformation

The Cauchy-Schlomilch transformation is one of many so called master formulas for evaluating definite integrals. The idea is that such formulas can be used directly on a variety of integrals and also indirectly by various additional transformations such as differentiating with respect to certain parameters, changes in variables, etc. Here, I present the basic Cauchy-Schlomilch transformation as it appeared in the references listed below. Note that in [1] there is a corollary to this result, but I will not present it here.

For $$a,c \gt 0$$

\int\limits_{0}^{\infty} f\Big[\left(cx – \frac{a}{x} \right)^{2} \Big] \mathrm{d} x = \frac{1}{c} \int\limits_{0}^{\infty} f(u^{2}) \mathrm{d}u
\tag{1}
\label{eq:cst1-1}

Proof: Let $$y=a/(cx)$$, so that \eqref{eq:cst1-1} becomes
\begin{align}
I &= \int\limits_{0}^{\infty} f\Big[\left(cx – \frac{a}{x} \right)^{2} \Big] \mathrm{d} x \\
&= -\frac{a}{c} \int\limits_{0}^{\infty} \frac{1}{y^{2}} f\Big[\left(\frac{a}{y}-cy \right)^{2} \Big] \mathrm{d} y \\
&= \frac{a}{c} \int\limits_{0}^{\infty} \frac{1}{x^{2}} f\Big[\left(cx – \frac{a}{x} \right)^{2} \Big] \mathrm{d} x
\tag{2}
\label{eq:cst1-2}
\end{align}

Combining equations \eqref{eq:cst1-1} and \eqref{eq:cst1-2} yields

2I =
\frac{1}{c} \int\limits_{0}^{\infty} \frac{1}{x^{2}} f\Big[\left(cx – \frac{a}{x} \right)^{2} \Big] \left(c+\frac{a}{x^{2}} \right) \mathrm{d} x
\tag{3}
\label{eq:cst1-3}

Now make the substitution $$u=cx-(a/x)$$

2I = \frac{1}{c} \int\limits_{-\infty}^{\infty} f(u^{2}) \mathrm{d}u = \frac{2}{c} \int\limits_{0}^{\infty} f(u^{2}) \mathrm{d}u

Solving for I yields our desired result.

Notice that $$a$$ vanishes.

## Example 1

\begin{align}
\int\limits_{0}^{\infty} \mathrm{exp}\left(-\Big[ax-\frac{b}{x}\Big]^{2n}\right) \mathrm{d}x
&= \int\limits_{0}^{\infty} \mathrm{exp}\left(-\Big[(ax-\frac{b}{x})^{n}\Big]^{2}\right) \mathrm{d}x \\
&= \frac{1}{a} \int\limits_{0}^{\infty} \mathrm{exp}\left(-[y^{n}]^{2}\right) \mathrm{d}y \\
&= \frac{1}{2an} \Gamma\left(\frac{1}{2n}\right)
\end{align}

## Example 2

\int\limits_{0}^{\infty} \mathrm{exp}\left(-\alpha x^{2} – \frac{\beta}{x^{2}}\right) \mathrm{d}x

Notice that if we expand the expression inside of the integrand in equation \eqref{eq:cst1-1} we have

\left(cx – \frac{a}{x} \right)^{2} = c^{2} x^{2} – 2ca + \frac{a^{2}}{x^{2}}

Rearrangement yields

-c^{2} x^{2} – \frac{a^{2}}{x^{2}} = -2ca \,- \left(cx – \frac{a}{x} \right)^{2}

Thus, $$c^{2} = \alpha$$, $$a^{2} = \beta$$, and

-\alpha x^{2} – \frac{\beta}{x^{2}} = -2\sqrt{\alpha \beta} \,- \left(\sqrt{\alpha} x \,- \frac{\sqrt{\beta}}{x}\right)^{2}

Now we apply the Cauchy-Schlomilch transformation to obtain our final result
\begin{align}
\int\limits_{0}^{\infty} \mathrm{exp}\left(-\alpha x^{2} – \frac{\beta}{x^{2}}\right) \mathrm{d}x
&= \mathrm{e}^{-2\sqrt{\alpha \beta}} \int\limits_{0}^{\infty} \mathrm{exp}\left(-\Big[\sqrt{\alpha} x – \frac{\sqrt{\beta}}{x}\Big]^{2}\right) \mathrm{d}x \\
&= \frac{\mathrm{e}^{-2\sqrt{\alpha \beta}}}{\sqrt{\alpha}} \int\limits_{0}^{\infty} \mathrm{e}^{-y^{2}} \mathrm{d}y \\
&= \frac{\mathrm{e}^{-2\sqrt{\alpha \beta}}}{\sqrt{\alpha}} \frac{\sqrt{\pi}}{2} \lim_{y \to \infty} \mathrm{erf}(y) \\
&= \frac{1}{2} \sqrt{\frac{\pi}{\alpha}} \mathrm{e}^{-2\sqrt{\alpha \beta}}
\end{align}
Note that this integral was evaluated with a different method in Example 8.4.1 here.

References

1. T. Amdeberhan, M. L. Glasser, M. C. Jones, V. H. Moll, R. Posey, D. Varela. The Cauchy-Schlomilch Transformation. 2010.
2. G. Boros, V. Moll. Irresistible Integrals: Symbolics, Analysis and Experiments in the Evaluation of Integrals. 2004.
3. M. L. Glasser. A remarkable property of definite integrals. Math. Comp., 40(40):561–563, 1983.

## Problems from Chapter 8 (The Normal Integral) of Irresistible Integrals by Boros and Moll

Here I present worked solutions of select problems from Chapter 8 (The Normal Integral) of Irresistible Integrals by Boros and Moll. This book has a plethora of interesting expositions and problems related to evaluating integrals. It also contains a lot of miscellaneous material that is either not related or only tangentially related to the thesis of the book. Thus I only chose problems of personal interest. Note that most of these problems can be found in Gradshteyn and Ryzhik (G & R), 5th Edition.

I will use the same designations of exercise and example as the authors.

We begin with the normal integral,

\int\limits_{0}^{\infty} \mathrm{e}^{-x^{2}} \mathrm{d} x = \frac{\sqrt{\pi}}{2}
\label{eq:ii8-1}
\tag{1}

Proof, begin with the gamma function

\Gamma(z) = \int\limits_{0}^{\infty} t^{z-1} \mathrm{e}^{-t} \mathrm{d} t
= 2\int\limits_{0}^{\infty} x^{2z-1} \mathrm{e}^{-x^{2}} \mathrm{d} x

Where we let $$t=x^{2}$$. Now let $$z=1/2$$

\Gamma\left(\frac{1}{2}\right) = \sqrt{\pi} = 2\int\limits_{0}^{\infty} \mathrm{e}^{-x^{2}} \mathrm{d} x

rearrangement yields our result.

## Exercise 8.1.2.a:

\int\limits_{0}^{\infty} x^{2n+1}\mathrm{e}^{-px^{2}} \mathrm{d} x = \frac{1}{2p^{\,n+1}}\int\limits_{0}^{\infty}z^{n}\mathrm{e}^{-z} \mathrm{d}z
= \frac{\Gamma(n+1)}{2p^{\,n+1}} = \frac{n!}{2p^{\,n+1}}

We let $$z = px^{2}$$ and $$n \in \mathbb{Z}_{0}^{+}$$ and $$p \gt 0$$.

## Exercise 8.1.2.b: (G & R) 3.461.3

\int\limits_{0}^{\infty} x^{2n}\mathrm{e}^{-px^{2}} \mathrm{d} x = \frac{1}{2p^{\,n+1/2}}\int\limits_{0}^{\infty}z^{n-1/2}\mathrm{e}^{-z} \mathrm{d}z
= \frac{\Gamma(n+1/2)}{2p^{\,n+1/2}} = \frac{(2n!)\sqrt{\pi}}{2^{2n+1}n!p^{\,n+1/2}}

with the same substitution.

## Exercise 8.3.1: (G & R) 3.321.3

\int\limits_{0}^{\infty} \mathrm{e}^{-a^{2}x^{2}} \mathrm{d} x
= \frac{1}{a}\int\limits_{0}^{\infty} \mathrm{e}^{-y^{2}} \mathrm{d} y
= \frac{\sqrt{\pi}}{2a}
\label{eq:ii8-2}
\tag{2}

letting $$x=y/a$$ and using equation \eqref{eq:ii8-1}.

## Exercise 8.3.2: (G & R) 3.323.2

\begin{align}
\tag{a}
\int\limits_{-\infty}^{\infty} \mathrm{e}^{-a^{2}x^{2}+bx} \mathrm{d} x
&= \mathrm{e}^{b^{2}/4a^{2}} \int\limits_{-\infty}^{\infty}
\mathrm{e}^{-a^{2}(x-b/2a^{2})^{2}}\mathrm{d} x \\
\tag{b}
&= \mathrm{e}^{b^{2}/4a^{2}} \int\limits_{-\infty}^{\infty} \mathrm{e}^{-a^{2}z^{2}} \mathrm{d}z \\
&= 2\mathrm{e}^{b^{2}/4a^{2}} \int\limits_{0}^{\infty} \mathrm{e}^{-a^{2}z^{2}} \mathrm{d}z \\
&= \mathrm{e}^{b^{2}/4a^{2}} \frac{\sqrt{\pi}}{a}
\tag{c}
\end{align}
a. Complete the square.
b. Let $$z=x-b/2a^{2}$$.
c. Use equation \eqref{eq:ii8-2}.

## Exercise 8.3.3: (G & R) 3.361.2

\int\limits_{-a}^{\infty} \frac{\mathrm{e}^{-bx}}{\sqrt{x+a}}\mathrm{d} x
= \mathrm{e}^{ba} \int\limits_{0}^{\infty} z^{1/2} \mathrm{e}^{-bz}\mathrm{d} z
= \mathrm{e}^{ba} \Gamma\left(\frac{1}{2}\right)\frac{1}{\sqrt{b}}
= \mathrm{e}^{ba} \sqrt{\frac{\pi}{b}}

we let $$x+a = z$$.

## Exercise 8.3.4: (G & R) 2.33

\begin{align}
\tag{a}
\int \mathrm{exp}(-(ax^{2}+2bx+c)) \mathrm{d} x
&= \mathrm{exp}\left(\frac{b^{2}}{a}-c\right) \int \mathrm{e}^{-a(x+b/a)^{2}} \mathrm{d} x \\
\tag{b}
& = \mathrm{exp}\left(\frac{b^{2}}{a}-c\right) \frac{1}{\sqrt{a}} \int \mathrm{e}^{-z^{2}} \mathrm{d}z \\
\tag{c}
&= \mathrm{exp}\left(\frac{b^{2}}{a}-c\right) \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{erf}(z) \\
&= \mathrm{exp}\left(\frac{b^{2}}{a}-c\right) \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{erf}\left(x\sqrt{a}+\frac{b}{\sqrt{a}}\right) + \mathrm{constant}
\label{eq:ii8-3}
\tag{3}
\end{align}
a. Complete the square.
b. Let $$z^{2} = a(x+b/a)^{2}$$
c. From the definition of the error function

\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}} \int\limits_{0}^{x} \mathrm{exp}(-t^{2}) \mathrm{d} x

we have

\int \mathrm{exp}(-t^{2}) \mathrm{d} x = \frac{\sqrt{\pi}}{2} \mathrm{erf}(x)

Note that the book is missing the exponential term in the answer.

## Exercise 8.3.5: (G & R) 3.462.7

The first step is to use equation \eqref{eq:ii8-3}, setting $$c=0$$ and integrating from 0 to $$\infty$$

\int\limits_{0}^{\infty} \mathrm{exp}(-(ax^{2}+2bx)) \mathrm{d} x
= \frac{1}{2}\sqrt{\frac{\pi}{a}} \,\mathrm{e}^{b^{2}/a} \Big[1-\mathrm{erf}(b/\sqrt{a})\Big]

Now we differentiate both sides with respect to $$a$$

\int\limits_{0}^{\infty} x^{2}\mathrm{exp}(-(ax^{2}+2bx)) \mathrm{d} x
= -\frac{\sqrt{\pi}}{2} a^{-3/2} \mathrm{e}^{b^{2}/a} \Big[1-\mathrm{erf}(b/\sqrt{a})\Big] \left(\frac{1}{2}+\frac{b^{2}}{a} \right)
-\frac{b}{2a^{2}}

this result does match that of Boros and Moll.

## Exercise 8.3.6: (G & R) 3.468.2

\begin{align}
\tag{a}
\int\limits_{0}^{\infty} \frac{x\,\mathrm{exp}(-bx^{2})}{\sqrt{a^{2}+x^{2}}}\mathrm{d} x
&= \frac{1}{2\sqrt{b}} \int\limits_{0}^{\infty} \frac{\mathrm{e}^{-w}}{\sqrt{w+a^{2}b}}\mathrm{d}w \\
\tag{b}
&= \frac{\mathrm{exp}(a^{2}b)}{2\sqrt{b}} \int\limits_{a^{2}b}^{\infty} \mathrm{e}^{-z} z^{-1/2} \mathrm{d}z \\
\tag{c}
&= \frac{\mathrm{exp}(a^{2}b)}{2\sqrt{b}} \Gamma\left(\frac{1}{2},a^{2}b \right)
\end{align}
a. $$w=bx^{2}$$
b. $$z=w+a^{2}b$$
c.

\Gamma(a,x) = \int\limits_{x}^{\infty} t^{a-1} \mathrm{e}^{-t} \mathrm{d}t

is the upper incomplete gamma function. We also have,

\mathrm{erf}(x) = \frac{1}{x}\sqrt{x^{2}} \left(1 -\frac{1}{\sqrt{\pi}}\Gamma\left(\frac{1}{2},x^{2} \right) \right)

for $$x \gt 0$$ and $$x \in \mathbb{R}$$. So that

\Gamma\left(\frac{1}{2},x^{2} \right) = \sqrt{\pi}[1-\mathrm{erf}(x)]

and our result matches that of the book.

## Example 8.4.1: (G & R) 3.325

Prove

\int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x = \frac{1}{2}\sqrt{\frac{\pi}{a}}\mathrm{e}^{-2\sqrt{ab}}

Let

\mathrm{L}(a,b) := \int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x
\label{eq:841-1}
\tag{1}

Making the substitution $$t=x\sqrt{a}$$ yields

\int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x = \frac{1}{\sqrt{a}} \int\limits_{0}^{\infty}
\mathrm{exp}(-t^{2}-\frac{ab}{t^{2}}) \mathrm{d} t
\label{eq:841-2}
\tag{2}

Letting $$ab=c$$ we call the integral in equation \eqref{eq:841-2} $$f(c)$$,

f(c) = \int\limits_{0}^{\infty} \mathrm{exp}(-t^{2}-\frac{c}{t^{2}}) \mathrm{d} t
\label{eq:841-3}
\tag{3}

so that

\mathrm{L}(a,b) = \frac{f(ab)}{\sqrt{a}}
\label{eq:841-4}
\tag{4}

In equation \eqref{eq:841-3} we let $$y=\sqrt{c}/t$$

f(c) = \sqrt{c} \int\limits_{0}^{\infty} \mathrm{exp}(-y^{2}-\frac{c}{y^{2}}) y^{-2} \mathrm{d} y
\label{eq:841-5}
\tag{5}

Combining equations \eqref{eq:841-3} and \eqref{eq:841-5}, we have

f(c) = \frac{1}{2} \int\limits_{0}^{\infty} \mathrm{exp}(-t^{2}-\frac{c}{t^{2}}) \left(1+\frac{\sqrt{c}}{t^{2}} \right) \mathrm{d} t
\label{eq:841-6}
\tag{6}

Now we let $$s = t – \sqrt{c}/t$$

f(c) = \frac{\mathrm{e}^{- 2\sqrt{c}}}{2} \int\limits_{-\infty}^{\infty} \mathrm{exp}(-s^{2}) \mathrm{d} s = \frac{\sqrt{\pi}}{2} \mathrm{e}^{- 2\sqrt{c}} \lim_{z \to \infty} \mathrm{erf}(z) = \frac{\sqrt{\pi}}{2} \mathrm{e}^{- 2\sqrt{c}}
\label{eq:841-7}
\tag{7}

Combining equations \eqref{eq:841-1}, \eqref{eq:841-4}, and \eqref{eq:841-7} yields our result.

I posted this solution and inquired about different solution methods at Mathematics Stack Exchange. There are two very interesting solutions there.

## Exercise 8.4.1

\begin{align}
\label{a}
\int\limits_{0}^{\infty} \mathrm{e}^{-(ax+b/x)} \frac{1}{\sqrt{x}} \mathrm{d}x
&= 2\int\limits_{0}^{\infty} \mathrm{e}^{-(ay^{2}+b/y^{2})} \mathrm{d}y \\
\label{b}
&= \sqrt{\frac{\pi}{a}} \mathrm{e}^{-2\sqrt{ab}}
\end{align}
a. $$x=y^{2}$$
b. Use the result from Example 8.4.1 above.

## Exercise 8.4.2.a

\begin{align}
\tag{a}
\int\limits_{0}^{\infty} \mathrm{exp}\left(-\mu x^{2} – \frac{a}{x^{2}}\right) – \mathrm{exp}(-\mu x^{2}) \mathrm{d}x
&= \frac{1}{2} \sqrt{\frac{\pi}{\mu}} \mathrm{e}^{-2\sqrt{a\mu}} \,-\, \frac{1}{\mu} \int\limits_{0}^{\infty} \mathrm{e}^{-z^{2}} \mathrm{d}z \\
\tag{b}
&= \frac{1}{2} \sqrt{\frac{\pi}{\mu}} \mathrm{e}^{-2\sqrt{a\mu}} \,-\, \frac{1}{2} \sqrt{\frac{\pi}{\mu}}
\end{align}
a. Use the result from Example 8.4.1 above.
b. The integral equals $$\mathrm{erf}(\infty) = 1$$.

## Exercise 8.4.2.b

Differentiate the result from Example 8.4.1 with respect to $$a$$

\int\limits_{0}^{\infty} x^{2} \, \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x
= \frac{\sqrt{\pi}}{2a} \mathrm{e}^{-2\sqrt{ab}} \left( \frac{1}{2\sqrt{a}} + \sqrt{b}\right)

## Exercise 8.4.2.c

Differentiate the result from Example 8.4.1 with respect to $$b$$

\int\limits_{0}^{\infty} x^{-2} \, \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x
= \frac{1}{2} \sqrt{\frac{\pi}{b}} \, \mathrm{e}^{-2\sqrt{ab}}

## Exercise 8.4.2.d

Differentiate the result from Exercise 8.4.2.c with respect to $$b$$

\int\limits_{0}^{\infty} x^{-4} \, \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x
= \frac{\sqrt{\pi}}{2b} \mathrm{e}^{-2\sqrt{ab}} \left( \frac{1}{2\sqrt{b}} + \sqrt{a} \right)

Note that the problems in Exercise 8.4.2 are in G & R Section 3.472.

## Integrate $$\int \mathrm{e}^{-\sqrt{x}}\sin(x) \mathrm{d}x$$

How to evaluate this integral was a question on Mathematics Stack Exchange.

First, we use the exponential form of the sine function, then let $$x=z^{2}$$

\int \mathrm{e}^{-\sqrt{x}}\sin(x) \mathrm{d}x = i \int \left(z\,\mathrm{exp}(-iz^{2}-z) – z\,\mathrm{exp}(iz^{2}-z)\right) \mathrm{d}z
\label{eq:160905-1}
\tag{1}

We begin with
\begin{align}
\tag{a}
\int \mathrm{exp}(ax^{2}-bx) \mathrm{d}x &= \mathrm{exp}(-b^{2}/4a) \int \mathrm{exp}(a(x-b/2a)^{2}) \mathrm{d}x \\
&= \frac{1}{\sqrt{a}} \mathrm{exp}(-b^{2}/4a) \int \mathrm{exp}(z^{2}) \mathrm{d}z \\
&= \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{exp}(-b^{2}/4a) \,\mathrm{erfi}(z) \\
&= \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{exp}(-b^{2}/4a) \,\mathrm{erfi}\left(x\sqrt{a}-\frac{b}{2\sqrt{a}}\right)
\end{align}
a. Complete the square.
Note that $$\mathrm{erfi}(z)$$ is the imaginary error function.

Integrating both sides of the above equation with respect to $$b$$, we have

\int x\,\mathrm{exp}(ax^{2}-bx) \mathrm{d}x
= \frac{\sqrt{\pi}}{2a} \,\mathrm{exp}(-b^{2}/4a) \,\left[ \frac{b}{\sqrt{a}}\mathrm{erfi}\left(x\sqrt{a}-\frac{b}{2\sqrt{a}}\right)
+ \frac{1}{\sqrt{\pi}} \mathrm{e}^{a(x-b/2a)^{2}} \right]

with $$a=i$$ and $$b=1$$

\int x\,\mathrm{exp}(ix^{2}-x) \mathrm{d}x
= \frac{\sqrt{\pi}}{i2} \,\mathrm{exp}(-1/i4) \,\left[ \frac{1}{\sqrt{i}}\mathrm{erfi}\left(x\sqrt{i}-\frac{1}{2\sqrt{i}}\right)
+ \frac{1}{\sqrt{\pi}} \mathrm{e}^{i(x-1/i2)^{2}} \right]
\label{eq:160905-2}
\tag{2}

which is the second part of the integral on the right hand side of equation \eqref{eq:160905-1}.

With
\begin{align}
\tag{a}
\int \mathrm{exp}(-ax^{2}-bx) \mathrm{d}x &= \mathrm{exp}(b^{2}/4a) \int \mathrm{exp}(-a(x+b/2a)^{2}) \mathrm{d}x \\
&= \frac{1}{\sqrt{a}} \mathrm{exp}(b^{2}/4a) \int \mathrm{exp}(-z^{2}) \mathrm{d}z \\
&= \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{exp}(b^{2}/4a) \,\mathrm{erf}(z) \\
&= \frac{1}{2} \sqrt{\frac{\pi}{a}} \,\mathrm{exp}(b^{2}/4a) \,\mathrm{erf}\left(x\sqrt{a}+\frac{b}{2\sqrt{a}}\right)
\end{align}
a. Complete the square.
Note that $$\mathrm{erf}(z)$$ is the error function.

Integrating both sides of the above equation with respect to $$b$$, we have

\int x\,\mathrm{exp}(-ax^{2}-bx) \mathrm{d}x
= -\frac{\sqrt{\pi}}{2a} \,\mathrm{exp}(b^{2}/4a) \,\left[ \frac{b}{\sqrt{a}}\mathrm{erf}\left(x\sqrt{a}+\frac{b}{2\sqrt{a}}\right)
+ \frac{1}{\sqrt{\pi}} \mathrm{e}^{-a(x+b/2a)^{2}} \right]

with $$a=i$$ and $$b=1$$

\int x\,\mathrm{exp}(-ix^{2}-x) \mathrm{d}x
= -\frac{\sqrt{\pi}}{i2} \,\mathrm{exp}(1/i4) \,\left[ \frac{1}{\sqrt{i}}\mathrm{erf}\left(x\sqrt{i}+\frac{1}{2\sqrt{i}}\right)
+ \frac{1}{\sqrt{\pi}} \mathrm{e}^{-i(x+1/i2)^{2}} \right]
\label{eq:160905-3}
\tag{3}

which is the first part of the integral on the right hand side of equation \eqref{eq:160905-1}.

Substituting equations \eqref{eq:160905-2} \eqref{eq:160905-3} into \eqref{eq:160905-1} and changing back to the original variables yields our result.