# Integrate $$\int_{0}^{\infty} \mathrm{e}^{x^{2}} (1 + \mathrm{e}^{x^{2}})^{-2} \mathrm{d}x$$

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

We begin by considering:

\begin{align}
\left(1 + a\mathrm{e}^{x^{2}}\right)^{-1}
&= \frac{1}{a}\mathrm{e}^{-x^{2}} \frac{1}{1+(a\,\mathrm{exp}(x^{2}))^{-1}} \\
&= \frac{1}{a}\mathrm{e}^{-x^{2}} \sum\limits_{n=0}^{\infty} (-1)^{n} \left( \frac{1}{a}\mathrm{e}^{-x^{2}}\right)^{n} \\
&= \sum\limits_{n=0}^{\infty} (-1)^{n} \frac{1}{a^{n+1}} \mathrm{e}^{-(n+1)x^{2}} \\
\end{align}

Now integrate the exponential function

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

Now we have

\int\limits_{0}^{\infty} \left(1 + a\mathrm{e}^{x^{2}}\right)^{-1} \mathrm{d}x =
\frac{\sqrt{\pi}}{2} \sum\limits_{n=1}^{\infty} (-1)^{n-1} \frac{1}{n^{1/2}} \frac{1}{a^{n}}

Taking the derivative of both sides with respect to $$a$$:

\int\limits_{0}^{\infty} \mathrm{e}^{x^{2}} \left(1 + a\mathrm{e}^{x^{2}}\right)^{-2} \mathrm{d}x =
\frac{\sqrt{\pi}}{2} \sum\limits_{n=0}^{\infty} (-1)^{n-1} \frac{1}{n^{-1/2}} \frac{1}{a^{n+1}}

Taking $$\lim_{a \to 1}$$
\begin{align}
\int\limits_{0}^{\infty} \mathrm{e}^{x^{2}} \left(1 + \mathrm{e}^{x^{2}}\right)^{-2} \mathrm{d}x &=
\frac{\sqrt{\pi}}{2} \sum\limits_{n=1}^{\infty} (-1)^{n-1} \frac{1}{n^{-1/2}} \\
&= \frac{\sqrt{\pi}}{2} \eta(-1/2) \\
&\approx 0.336859119
\end{align}

$$\eta(s)$$ is the Dirichlet eta function.