TITLE: Gaussian type integral $\int_{-\infty}^{\infty} \frac{\mathrm{e}^{-a^2 x^2}}{1 + x^2} \mathrm{d}x$
QUESTION [7 upvotes]: When working a proof, I reached an expression similar to this:
$$\int_{-\infty}^{\infty} \frac{\mathrm{e}^{-a^2 x^2}}{1 + x^2} \mathrm{d}x$$
I've tried the following:
1. I tried squaring and combining and converting to polar coordinates, like one would solve a standard Gaussian.  However, this yielded something which seems no more amenable to a solution:
$$\int_{\theta=0}^{\theta=2\pi} \int_{0}^{\infty} \frac{r \mathrm{e}^{-a^2 r^2}}{(1 + r^2 \sin^2(\theta))(1 + r^2 \cos^2(\theta))} \mathrm{d}r \mathrm{d}\theta$$
2. I tried doing a trig substitution, t = tan u, and I have no idea what to do from there.
$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \mathrm{e}^{-a^2 \tan^2(u)} \mathrm{d}u$$
3. I looked into doing $u^2 = 1 + x^2$ but this gives us a ugly dx that I don't know how to handle, and moreover, I think I'm breaking my limits of integration (because Mathematica no longer solves it.):
$$u^2 = 1 + x^2$$
$$2 u \mathrm{d}u = 2 x \mathrm{d}x$$
$$\mathrm{d}x = \frac{u}{\sqrt{u^2 - 1}}$$
$$\mathrm{e}^{a^2} \int_{-\infty}^{\infty} \frac{\mathrm{e}^{-a^2 u^2}}{u \sqrt{u^2 - 1}} \mathrm{d}u$$
4. I looked into some form of differentiation under the integral, but that didn't seem to yield anything that looked promising.  (I checked parameterizing x^2 to x^b in both places, and in either place, and nothing canceled cleanly.)
I have a solution from Mathematica, it's:
$$\pi  e^{a^2} \text{erfc}(a)$$
But I'd like to know how to arrive at this.  I'm sure it's something simple I'm missing.

REPLY [2 votes]: Here is another approach where we first make use of an auxiliary function. 
Before proceeding we recall the definitions for the error function $\text{erf}(x)$ and the complementary error function $\text{erfc}(x)$:
$$\text{erf}(x) = \frac{2}{\sqrt{\pi}} \int^x_0 e^{-t^2} \, dt$$
and
$$\text{erfc}(x) = \frac{2}{\sqrt{\pi}} \int^\infty_x e^{-t^2} \, dt,$$
respectively such that
$$\text{erf}(x) = 1 - \text{erfc}(x).$$
The idea here is to consider an auxiliary function, related to our
function of interest $f(a)$, but which turns our to be a constant
function for all $a$ in its domain. 
Start by considering the following auxiliary function
\begin{equation}
  I(a) = \left (\int^a_0 e^{-t^2} \, dt \right )^2 + \int^1_0
  \frac{e^{-a^2 (t^2 + 1)}}{1 + t^2} \, dt, \,\, a > 0.
  \tag1
\end{equation}
Note the term appearing between the brackets is nothing more than the error function. On differentiating the auxiliary function with respect to $a$ we obtain
$$I'(a) = 2 e^{-a^2} \int^a_0 e^{-t^2} \, dt - 2a e^{-a^2} \int^1_0
e^{-a^2 t^2} \, dt.$$
In obtaining this result, Leibniz' rule for differentiating under the
integral sign has been used. In the second integral, if a substitution
of $u = at$ is made, the result $I'(a) = 0$ quickly follows showing
the auxiliary function is indeed constant for all $a > 0$. To find the value for this constant, letting $a \to 0^+$ gives
$$I(a) \to \int^1_0 \frac{dt}{1 + t^2} = \frac{\pi}{4},$$
so that $I(a) = \pi/4$ for all $a > 0$. 
As the first of the integrals appearing in (1) can be written in terms of the error function we have 
\begin{equation}
  \int^1_0 \frac{e^{-a^2 (t^2 + 1)}}{1 + t^2} \, dt = \frac{\pi}{4}
  \left (1 - \text{erf}^2 (a) \right ).
  \tag2
\end{equation}
A similar thing can be done for the complementary error function. In this case we start by considering the following auxiliary function
\begin{equation}
  J(a) = \left (\int^\infty_a e^{-t^2} \, dt \right )^2 -
  \int^\infty_1 \frac{e^{-a^2 (t^2 + 1)}}{1 + t^2} \, dt, \,\, a > 0.
  \tag3
\end{equation}
Again observe the term appearing between the brackets in nothing more than the complementary error function. On differentiating with respect to $a$ we have
$$J'(a) = -2 e^{-a^2} \int^\infty_a e^{-t^2} \, dt + 2a e^{-a^2}
\int^\infty_1 e^{-a^2 t^2} \, dt.$$
A substitution of $u = at$ in the second integral once again reduces
the derivative of the auxiliary function to zero, showing $J(a)$ is constant. Letting $a \to \infty$ in (3) we see 
$J(a) \to 0$. Thus $J(a) = 0$ for all $a > 0$. Writing the
first of the integrals in (3) in terms of the
complementary error function, one finds
\begin{equation}
  \int^\infty_1 \frac{e^{-a^2 (1 + t^2)}}{1 + t^2} \, dt =
  \frac{\pi}{4} \text{erfc}^2 (a).
  \tag4
\end{equation}
Adding (2) to (4) yields
\begin{align*}
\int^\infty_0 \frac{e^{-a^2(1 + t^2)}}{1 + t^2} \, dt &= \frac{\pi}{4} \left [\text{erfc}^2 (a) + 1 - \text{erf}^2 (a) \right ]\\
&= \frac{\pi}{4} \left [\text{erfc}^2 (a) + 1 - (1 - \text{erfc}(a))^2 \right ]\\
&= \frac{\pi}{2} \text{erfc} (a).
\end{align*}
Rearranging gives
$$e^{-a^2} \int^\infty_0 \frac{e^{-a^2 t^2}}{1 + t^2} \, dt = \frac{\pi}{2} \text{erfc}(a),$$
or
$$\int^\infty_0 \frac{e^{-a^2 t^2}}{1 + t^2} \, dt = \frac{\pi}{2} e^{a^2} \text{erfc}(a).$$ 
So for $f(a)$ we finally have
$$f(a) = 2 \int^\infty_0 \frac{e^{-a^2 t^2}}{1 + t^2} \, dt = \pi e^{a^2} \text{erfc}(a), \quad a > 0.$$