Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can we find a closed form for this definite integral: $$ \int\nolimits_{- \infty}^{\infty} \frac{\exp\left(-(a+bx)^2\right)}{1+\exp(x)}\mathrm dx $$

share|cite|improve this question
Please be sure to put put the entire problem in the body of the message. Also, if you right-click on the integral, and select "view source", you can see the $\TeX$ code. – JavaMan Sep 23 '11 at 4:15
Chao: Did you make this question up yourself or did you get it from somewhere? – Srivatsan Sep 24 '11 at 9:14
I got this integral when I was trying to calculate the mean of a random variable. – Chao Sep 27 '11 at 21:17

The integral has a closed form when $a = 0$ and $b \neq 0$. (The integral diverges if $b=0$.) We have $$ I = \int_{-\infty}^{\infty} \frac{e^{-b^2x^2}}{1+e^x} dx. $$ Making the substitution $x \to -x$, we can rewrite it as $$ I = \int_{-\infty}^{\infty} \frac{e^{-b^2x^2}}{1+e^{-x}} dx = \int_{-\infty}^{\infty} \frac{e^{-b^2x^2} \cdot e^x}{1+e^{x}} dx. $$ Adding the two integrals and dividing by $2$, $$ I = \frac{1}{2} \int_{-\infty}^{\infty} e^{-b^2x^2} dx = \frac{1}{2 |b|} \int_{-\infty}^{\infty} e^{-y^2} dy, $$ through the substitution $y =|b|x$. Thus we end up with the familiar Gaussian integral, which evaluates to $\sqrt{\pi}$. Thus the given integral is equal to $$ I = \frac{\sqrt{\pi}}{2|b|}. $$

For general $a$, of course, this trick does not work. I think it should be difficult to compute the integral.

Note. The same idea can be used to show that if $f(x)$ is a continuous even function and $c > 0$, then $$ \int_{-c}^c \frac{f(x)}{1+e^x} dx = \frac{1}{2} \int_{-c}^c f(x) dx = \int_0^c f(x) dx. $$

share|cite|improve this answer

Split integration region and expand $(1+\mathrm{e}^x)^{-1}$: $$ (1+\mathrm{e}^x)^{-1} = \left\{ \begin{array}{ll} \sum_{k \ge 0} (-1)^k \mathrm{e}^{-(k+1)x} & x > 0 \\ \sum_{k \ge 0} (-1)^k \mathrm{e}^{k x} & x \le 0 \end{array} \right. $$ and then integrate term-wise, assuming $b>0$: $$ \int_0^\infty \mathrm{e}^{-(a+b x)^2} \mathrm{e}^{-(k+1) x} \, \mathrm{d} x = \frac{\sqrt{\pi}}{2 b} \exp \left( \frac{(k+1)(k+1+4 a b)}{4 b^2} \right) \mathrm{erfc}\left( a + \frac{k + 1}{2 b} \right) $$ and $$ \int_{-\infty}^0 \mathrm{e}^{-(a+b x)^2} \mathrm{e}^{k x} \, \mathrm{d} x = \frac{\sqrt{\pi}}{2 b} \exp\left( \frac{k(k-4 a b)}{4 b^2} \right) \mathrm{erfc}\left( \frac{k}{2b} -a\right) $$

share|cite|improve this answer
...but there's no known form for an infinite sum of error functions, right? :( – J. M. Sep 23 '11 at 4:56
Yes, I am afraid. – Sasha Sep 23 '11 at 4:58

Wolfram Alpha gives a result with $a=0$ of $\frac{\sqrt{\pi}}{2b}$ (note my $a$ is your $b^2$) but chokes when $a$ is nonzero.

share|cite|improve this answer

The result of Srivatsan $$\frac{\sqrt{\pi}}{2|b|} = \int_{-\infty}^{\infty} \frac{e^{-b^2x^2}}{1+e^{x}} dx = \int_{-\infty}^{\infty} \frac{e^{-b^2x^2} \cdot e^x}{1+e^{x}} dx$$ gives the case $a=-\frac{1}{2b}$ because this is $$ = e^\frac{1}{4b^2}\int_{-\infty}^\infty\frac{e^{-(-\frac{1}{2b}+bx)^2}}{1+e^{x}} dx. $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.