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

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$$

• 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

## 4 Answers

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.$$

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)$$

• ...but there's no known form for an infinite sum of error functions, right? :( – J. M. is a poor mathematician 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.

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.$$