# How do I solve this improper integral: $\int_{-\infty}^\infty e^{-x^2-x}dx$?

I'm trying to solve this integral: $$\int_{-\infty}^\infty e^{-x^2-x}dx$$ WolframAlpha shows this to be approximately $2.27588$. I tried to solve this by integration by parts, but I just couldn't get there. I'd be glad if someone could show me how to do it.

I've included my attempt at the problem below:

Note $\int_{-\infty}^\infty e^{-x^2-x} = \int_{-\infty}^\infty e^{-x^2}e^{-x}dx$. Then we can integrate by parts. Let $u(x) = e^{-x^2}$. Then $u'(x) = -2xe^{-x}$. Let $v'(x) = e^{-x}$. Then $v(x) = -e^{-x}$.

Then $u(x)v'(x) = u(x)v(x) - \int v(x)u'(x)dx$, i.e. $$\int_{-\infty}^\infty e^{-x^2}e^{-x}dx = -e^{-x^2}e^{-x} - \int e^{-x}2xe^{-x}dx = -e^{-x^2-x} - 2\int e^{-2x}xdx$$

Then we integrate $\int e^{-2x}xdx$ by parts. We pick $u(x) = x$, $u'(x) = dx$, $v'(x) = e^{-2x}$, and $v(x) = \int e^{-2x} dx = \frac {-1}{2} e^{-2x}$ by u-substitution. Skipping some steps, it follows that $$\int e^{-2x}xdx = -\frac{1}{4}(e^{-2x})(2x+1)$$ Then $$-e^{-x^2-x} - 2\int e^{-2x}xdx = -e^{-x^2-x} + \frac{1}{2}(e^{-2x})(2x+1)$$ Which, when evaluated numerically, doesn't yield the desired result. So there's a problem here. Maybe someone else knows how to do this.

• $u'(x)=-2xe^{-x^2}$, not $-2xe^{-x}$. – Kola B. May 8 '15 at 4:00
• @KolaB. Good catch, thanks. – Newb May 8 '15 at 4:17

Rewrite the integrand as $$\exp({-x^2 - x}) = \exp({-(x^2 + x + 1/4) + 1/4} ) = \exp(-(x+1/2)^2) \cdot \exp(1/4)$$ It is well known that $$\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}$$ so the above manipulation proves $$\int_{-\infty}^{\infty} e^{-x^2 - x} \, dx = e^{1/4} \sqrt{\pi} \approx 2.2758$$

• I actually didn't know that. Thanks. – Newb May 8 '15 at 4:17
• It's even got its own Wikipedia article :) en.wikipedia.org/wiki/Gaussian_integral – Sameer Kailasa May 8 '15 at 4:18
• Ahh, so this is the famous Gaussian integral! – Newb May 8 '15 at 4:20
• Veri nice @SameerKailasa :) – Lucas May 8 '15 at 6:47

HINT

$$x^2-x=(x-1/2)^2-1/4$$

Then, factor out the term $e^{-1/4}$, make a change of variable $x-1/2\to x$, and use

$$\int_{-\infty}^{\infty}e^{-x^2}dx=\sqrt{\pi}$$

• hmm, exist other example of integral like this? – Lucas May 8 '15 at 13:12
• @Lucas There are many types of integrals. What exactly do you mean by "like this?" For example, do you mean ones for which we can compute a definite integral but cannot find a simple anti-derivative? – Mark Viola May 8 '15 at 13:25

The basic thing to know is that, as the other answers said, $\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}$.

Then, for any reals $a$ and $b$,

$\begin{array}\\ \int_{-\infty}^{\infty} e^{-x^2-ax-b} \, dx &=e^{-b}\int_{-\infty}^{\infty} e^{-x^2-ax} \, dx\\ &=e^{-b}\int_{-\infty}^{\infty} e^{-x^2-ax-a^2/4+a^2/4} \, dx \quad\text{(completing the square)}\\ &=e^{-b+a^2/4}\int_{-\infty}^{\infty} e^{-(x-a/2)^2} \, dx\\ &=e^{-b+a^2/4}\int_{-\infty}^{\infty} e^{-x^2} \, dx\\ &=e^{-b+a^2/4}\sqrt{\pi}\\ \end{array}$

A similar argument would allow you to get a formula for $\int_{-\infty}^{\infty} e^{-ax^2-bx-c} \, dx$ in terms of $a, b, c,$ and $\sqrt{\pi}$.