13
$\begingroup$

I was recently looking at this post where the following formula is shown: $$ \int_{-\infty}^{\infty} \frac{E(x)}{1+\mathcal{E}(x)^{O(x)}}\mathrm{d}x= \int_0^{\infty} E(x) \mathrm{d}x $$ where $E(x), \mathcal{E}(x)$ are even functions and $O(x)$ is an odd function. One nice application of this formula would be the integral $$ \int_{-\infty}^{\infty} \frac{e^{-x^2}}{1+e^{-x}}\mathrm{d}x = \frac{\sqrt{\pi}}{2} $$ where the problem reduces to the evaluation of the Gaussian integral. I then wondered what would happen if I made slight alterations to the above integral, like changing $x^2\to (x+1)^2$. WA evaluates said integral as:

$$ \int_{-\infty}^{\infty} \frac{e^{-(x+1)^2}}{1+e^{-x}}\mathrm{d}x = \frac{\left(2\sqrt[4]{e} -1 \right)\sqrt{\pi}}{2e} $$


The even/odd formula can't be applied since the $+1$ makes the function not even anymore. Recalling that $\int^\infty_{-\infty} e^{-(ax^2 + bx+c)}\mathrm{d}x=\sqrt{\frac{\pi}{a}}e^{\frac{b^2}{4a}-c} $ I attempted to evaluate the integral using geometric series $$ \int_{-\infty}^{\infty} \frac{e^{-(x+1)^2}}{1+e^{-x}}\mathrm{d}x = \sum_{n\ge 0}(-1)^n \int_{-\infty}^{\infty}e^{-(x^2+(n+2)x+1)}\, \mathrm{d}x = \frac{\sqrt{\pi}}{e} \sum_{n\ge 0}(-1)^n e^{\frac{(n+2)^2}{4}} $$ but the resulting series is divergent, so this method won't work. Does anyone have any ideas on how to evaluate this integral? Thank you!

$\endgroup$
2
  • 1
    $\begingroup$ Your series is wrong anyway because you can't expand $1/(1+e^{-x})$ as a power series when $x<0$. $\endgroup$
    – J.G.
    Sep 25, 2022 at 20:38
  • 4
    $\begingroup$ Hint: use $\int_{-\infty}^{\infty}\frac{f\left(x\right)}{1+e^{-x}}dx=\int_{0}^{\infty}\frac{f\left(x\right)+e^{-x}f\left(-x\right)}{1+e^{-x}}dx$ to rewrite your integral as$$\frac{\int_{0}^{\infty}e^{-x^{2}}\left(e^{x}-1+e^{-x}\right)dx}{e}=\frac{\int_{-\infty}^{\infty}e^{-x^{2}-x}dx-\frac{\sqrt{\pi}}{2}}{e}.$$ $\endgroup$
    – J.G.
    Sep 25, 2022 at 20:49

5 Answers 5

7
$\begingroup$

$$I=\int_{-\infty}^\infty \frac{e^{-(1+x)^2}}{1+e^{-x}}dx=\frac1e\int_{-\infty}^\infty\frac{\color{blue}{e^{-x^2-x}}}{1+e^{x}}dx\overset{x\to -x}=\frac1e\int_{-\infty}^\infty\frac{\color{red}{e^{-x^2+2x}}}{1+e^{x}}dx$$

$$\Rightarrow 2I=\frac1e\int_{-\infty}^\infty \frac{(\color{blue}{1}+\color{red}{e^{3x}})e^{-x^2-x}}{1+e^x}dx$$

$$\frac{1+x^3}{1+x}=1-x+x^2\Rightarrow I=\frac1{2e}\int_{-\infty}^\infty (1-e^x+e^{2x})e^{-x^2-x}dx$$


$$I=\frac{1}{2e}\int_{-\infty}^\infty \left(e^{-x^2-x}+\color{blue}{e^{-x^2+x}}\right)dx-\frac{1}{2e}\int_{-\infty}^\infty e^{-x^2}dx$$

$$\overset{\color{blue}{x\to -x}}=\frac{1}{e}\int_{-\infty}^\infty e^{-x^2-x}dx-\frac{\sqrt \pi}{2e}=\boxed{\frac{\sqrt[4]e\sqrt \pi}{e}-\frac{\sqrt\pi}{2e}}$$

$\endgroup$
3
  • 1
    $\begingroup$ Very simple as always! Thank you, @Zacky $\endgroup$
    – Robert Lee
    Sep 25, 2022 at 22:31
  • $\begingroup$ Shouldn't the exponent of the second integral be $-x^2-2x$ from $-(1+x)^2=-x^2-2x-1$? Or is that just a typo since the following integral seems ok? $\endgroup$ Sep 25, 2022 at 23:59
  • $\begingroup$ @martycohen The way I typed might be misleading. I also used that $\frac{1}{1+e^{-x}}=\frac{e^x}{1+e^{x}}$ and the numerator got combined with the exponent. $\endgroup$
    – Zacky
    Sep 26, 2022 at 6:31
6
$\begingroup$

Combining J.G.'s and Zacky's answers, I've found a generalization for a family of special cases which includes the integral in question. Let $I = \int_{-\infty}^{\infty} \frac{e^{-(ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x$ then \begin{align} 2I& = \int_{-\infty}^{\infty} \frac{e^{-(ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x + \int_{-\infty}^{\infty} \frac{e^{-(ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x \\ & \overset{\color{darkblue}{x \to -x}}{=}\int_{-\infty}^{\infty} \frac{e^{-(ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x + \int_{-\infty}^{\infty} \frac{\color{darkblue}{e^{-x}}e^{-(\color{darkblue}{-}ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x\\ & = e^{-b^2} \int_{-\infty}^{\infty} e^{-a^2x^2-(2ab-1)x} \frac{1+e^{(4ab-1)x} }{1+e^{x}}\, \mathrm{d}x \end{align} So if $2ab \in \mathbb{N} \setminus \{0\}$, recalling that $$ \int_{-\infty}^{\infty} e^{-\alpha x^2 -\beta x}\mathrm{d}x \overset{\color{darkblue}{x\to \frac{x}{\sqrt{\alpha}} -\frac{\beta}{2\alpha}}}{=}\frac{e^{\frac{\beta^2}{4\alpha}}}{\sqrt{\alpha}}\int_{-\infty}^{\infty} e^{-x^2}\mathrm{d}x =\sqrt{\frac{\pi}{\alpha}}e^{\frac{\beta^2}{4\alpha}} $$ we get \begin{align} 2I& = e^{-b^2} \int_{-\infty}^{\infty} e^{-a^2x^2-(2ab-1)x}\sum_{k=0}^{4ab-2}(-1)^k e^{kx}\, \mathrm{d}x\\ & = e^{-b^2} \sum_{k=0}^{4ab-2}(-1)^k\int_{-\infty}^{\infty} e^{-a^2x^2-(2ab-k-1)x}\, \mathrm{d}x\\ & = \frac{\sqrt{\pi}e^{-b^2}}{|a|} \sum_{k=0}^{4ab-2}(-1)^ke^{\frac{(2ab-k-1)^2}{4a^2}} \end{align} Thus

$$ \int_{-\infty}^{\infty} \frac{e^{-(ax+b)^2}}{{1+e^{-x}}}\, \mathrm{d}x =\frac{\sqrt{\pi}}{2|a|e^{b^2}} \sum_{k=0}^{4ab-2}(-1)^ke^{\frac{(2ab-1-k)^2}{4a^2}}, \quad \ 2ab \in \mathbb{N} \setminus \{0\} $$

And after substitution $x\to -x$, this gives the complementary formula

$$ \int_{-\infty}^{\infty} \frac{e^{-(ax-b)^2}}{{1+e^{-x}}}\, \mathrm{d}x =\frac{\sqrt{\pi}}{2|a|e^{b^2}} \sum_{k=0}^{4ab}(-1)^ke^{\frac{(2ab-k)^2}{4a^2}}, \quad \ 2ab \in \mathbb{N} \cup \{0\} $$


Some other interesting integrals that can be evaluated using the previous formula are

  • $$\int_{-\infty}^{\infty} \frac{e^{-(\frac{x}{a}+a)^2}}{{1+e^{-x}}}\, \mathrm{d}x = \frac{\sqrt{\pi} |a| }{2 e^{a^2}} \left(2 e^{\frac{a^2}{4}} - 1\right), \qquad a \neq 0$$
  • $$\int_{-\infty}^{\infty} \frac{e^{-(x-1)^2}}{{1+e^{-x}}}\, \mathrm{d}x = \frac{\sqrt{\pi}}{2e}\left(1-2\sqrt[4]{e} +2e \right) $$
  • $$\int_{-\infty}^{\infty} \frac{e^{-(\frac{x}{2}+3)^2}}{{1+e^{-x}}}\, \mathrm{d}x = \sqrt{\pi}\left(e^{-9} -2 e^{-8} +2 e^{-5} \right)$$
  • $$\int_{-\infty}^{\infty} \frac{e^{-2(x+1)^2}}{{1+e^{-x}}}\, \mathrm{d}x =\sqrt{\frac{\pi}{8}} \left(2e^{-\frac{7}{8}} - 2e^{-\frac{3}{2}} + 2 e^{-\frac{15}{8}} -e^{-2}\right)$$
$\endgroup$
6
$\begingroup$

Note that

$$\frac{e^{-(x+1)^2}}{1+e^{-x}}=e^{-x^2-1}\left(e^{-x}-\frac1{1+e^x}\right) $$

Then, with $\int_{-\infty}^{\infty} \frac{e^{-x^2}}{1+e^{x}}dx=\frac{\sqrt{\pi}}2$ \begin{align} \int_{-\infty}^{\infty} \frac{e^{-(x+1)^2}}{1+e^{-x}}{d}x &= \frac1e\int_{-\infty}^{\infty} e^{-x^2-x}dx -\frac1e \int_{-\infty}^{\infty} \frac{e^{-x^2}}{1+e^{x}}dx = \frac{\sqrt{\pi}}e{e^{\frac14}}- \frac{\sqrt{\pi}}{2e} \end{align}

$\endgroup$
3
$\begingroup$

$\begin{align} \int_{-\infty}^{\infty}\frac{e^{-(x+1)^2}}{1+e^{-x}}dx &=\int_{0}^{\infty}\frac{e^{-(x+1)^2}+e^{-x}e^{-(-x+1)^2}}{1+e^{-x}}dx\\ &=\int_{0}^{\infty}\frac{e^{-x^2-1}(e^{-2x}+e^{x})}{1+e^{-x}}dx\\ &=\int_{0}^{\infty}\frac{e^{-x^2-1}(e^{\frac{3}{2}x}+e^{-\frac{3}{2}x})}{e^{\frac{1}{2}x}+e^{-\frac{1}{2}x}}dx\\ &=\int_{0}^{\infty}e^{-x^2-1}(e^x-1+e^{-x})dx\\ &=\int_{0}^{\infty}e^{-x^2-x-1}dx+\int_{0}^{\infty}e^{-x^2+x-1}dx-\int_{0}^{\infty}e^{-x^2-1}dx\\ &=\int_{0}^{\infty}e^{-x^2-x-1}dx+\int_{-\infty}^{0}e^{-x^2-x-1}dx-\frac{\sqrt{\pi}}{2e}\\ &=\int_{-\infty}^{\infty}e^{-x^2-x-1}dx-\frac{\sqrt{\pi}}{2e}\\ &=\sqrt{\pi}e^{\frac{1}{4}-1}-\frac{\sqrt{\pi}}{2e}\\ &=\frac{\sqrt{\pi}}{2e}(2\sqrt[4]{e}-1)\\ \end{align}$

$\endgroup$
2
$\begingroup$

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ Hereafter, $\ds{\on{H}}$ is the $\ds{Heaviside\ Step\ Function}$. \begin{align} & \bbox[5px,#ffd]{\int_{-\infty}^{\infty}{\expo{-\pars{x + 1}^{\,\,\,2}} \over 1 + \expo{-x}}\,\dd x} = \int_{-\infty}^{\infty}\expo{-\pars{x + 1}^{\,\,\,2}} \bracks{\on{H}\pars{x} - {\on{sgn}\pars{x} \over \expo{\verts{x}} + 1}}\dd x \\[5mm] = & \ \int_{0}^{\infty}\bracks{\expo{-\pars{x + 1}^{\,\,\,2}} - {\expo{-\pars{x + 1}^{\,\,\,2}} - \expo{-\pars{-x + 1}^{\,\,\,2}}\over \expo{x} + 1}}\dd x \\[5mm] = & \ \int_{0}^{\infty}\expo{-x^{2}\ -\ 1} \pars{-1 + \expo{x} + \expo{-x}}\dd x = {1 \over 2\expo{}}\int_{-\infty}^{\infty}\expo{-x^{2}} \pars{-1 + \expo{x} + \expo{-x}}\dd x \\[5mm] = & \ {1 \over 2\expo{}}\bracks{-\int_{-\infty}^{\infty}\expo{-x^{2}} \dd x + \int_{-\infty}^{\infty}\expo{-\pars{x - 1/2}^{\,\,\,2}\,\, + 1/4} \,\,\dd x \int_{-\infty}^{\infty}\expo{-\pars{x + 1/2}^{\,\,\,2}\,\, + 1/4}\,\, \dd x} \\[5mm] = & \ {1 \over 2\expo{}}\pars{-1 + \expo{1/4} + \expo{1/4}} \int_{-\infty}^{\infty}\expo{-x^{2}}\,\,\dd x = \bbx{{2\expo{1/4} - 1 \over 2\expo{}}\root{\pi}} \approx 0.5112 \end{align}

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .