# integral: $\int_{-\infty}^{\infty} \frac{e^{ax^{2}}}{1+e^{x}} dx$ with a<0

I've encountered the following integral

$$\int_{-\infty}^{\infty} \frac{e^{ax^{2}}}{1+e^{x}} dx\; \; with\; a<0$$

Is this integrable? I have seen similar topics asked before was solved with contour method but do not know whether, and how can contour method works for this one.

Any help would be appreciated!

• Mathematica gives: $$\mathscr{I}=\frac{\sqrt{\pi}}{2\sqrt{-\text{a}}}$$ Where $\Re\left(\text{a}\right)<0$ Commented May 23, 2017 at 9:44
• Can detailed proof or resources be provided Jan? and what do you mean by $R(a)<0$
– t.hu
Commented May 23, 2017 at 10:03
• Can I use Mathematica to get two following integrals by using Mathematica as well? $$\int_{-\infty}^{\infty} \frac{e^{ax}}{1+e^{x}} dx\; \; with\; a<0$$ $$\int_{-\infty}^{\infty} \frac{e^{ax}}{1+e^{x}} dx\; \; with\; 0<a<1$$ Thanks for any information!!!
– t.hu
Commented May 23, 2017 at 10:07
• It means the real part of $\text{a}$, but the problem is: the integral is defined outside the region $\Re\left(\text{a}\right)<0$, so when $\text{a}\ge0$ Commented May 23, 2017 at 10:13
• integrate this using contour looks way too complicated. try this instead: $$\frac{1}{1+e^x} + \frac{1}{1+e^{-x}} = 1\implies\int_{-\infty}^\infty \frac{e^{ax^2}}{1+e^x} dx = \frac12 \int_{-\infty}^{\infty} e^{ax^2}dx\implies\cdots$$ Commented May 23, 2017 at 11:25

Indeed, the integral converges since the integrand behaves like $e^{ax^2}$ as $x\to-\infty$ and like $e^{x^2(a-1/x)}$ as $x\to+\infty$, and $a<0$.

Here is also a calculation which, however, does not use the contour method. Let us split the integral as $$I=\int_{-\infty}^\infty \frac{e^{ax^2}}{1+e^x}dx = \int_{0}^\infty \frac{e^{ax^2}}{1+e^x}dx+ \int_{-\infty}^0\frac{e^{ax^2}}{1+e^x}dx=I_1+I_2\,.$$ Then, using the formula for the geometric series $$I_1=\int_0^\infty \frac{e^{ax^2}}{1+e^{-x}}e^{-x}dx =\sum_{n=0}^\infty (-1)^n \int_0^\infty e^{ax^2-(n+1)x}dx=-\sum_{n=1}^\infty (-1)^n \int_0^\infty e^{ax^2-nx}dx$$ whereas $$I_2= \int_{0}^\infty \frac{e^{ax^2}}{1+e^{-x}}dx =\sum_{n=0}^\infty (-1)^n \int_0^\infty e^{ax^2-nx}dx\,.$$ In the sum $I_1+I_2$ all terms cancel out except for $n=0$, thus $$I=\int_0^\infty e^{ax^2}dx=\frac{1}{2}\int_{-\infty}^\infty e^{ax^2}dx=\frac{\sqrt{\pi}}{2\sqrt{-a}}\,,$$ for $a<0$.

EDIT: In fact, as pointed out by Achille Hui in the comments, there is no need for geometric series $$I = \int_0^\infty e^{ax^2}\left( \frac{1}{1+e^x}+\frac{1}{1+e^{-x}}\right) dx =\int_0^\infty e^{ax^2} dx = \frac{\sqrt{\pi}}{2\sqrt{-a}}\,.$$

On the path of Brightsun and Achille Hui (to achieve the computation)

\begin{align}I&=\displaystyle \int_{-\infty}^{\infty} \frac{e^{ax^{2}}}{1+e^{x}} dx\\ &=\int_{-\infty}^{0} \frac{e^{ax^{2}}}{1+e^{x}} dx+\int_{0}^{\infty} \frac{e^{ax^{2}}}{1+e^{x}} dx \end{align}

Perform the change of variable $y=-x$ in the first integral,

\begin{align}I&=\int_{0}^{\infty} \frac{e^{ax^{2}}}{1+e^{-x}} dx+\int_{0}^{\infty} \frac{e^{ax^{2}}}{1+e^{x}} dx\\ &=\int_0^1\left(\dfrac{1}{1+e^{-x}}+\dfrac{1}{1+e^{x}}\right)e^{ax^{2}}dx\\ &=\int_{0}^{\infty} e^{ax^{2}}dx\\ \end{align}

$a<0$, perform the change of variable $y=\sqrt{|a|}x$,

\begin{align} I&=\dfrac{1}{\sqrt{|a|}}\int_{0}^{\infty} e^{-x^{2}}dx\\ &=\dfrac{\sqrt{\pi}}{2\sqrt{|a|}} \end{align}