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.

Solutions Collecting From Web of "How do I solve this improper integral: $\int_{-\infty}^\infty e^{-x^2-x}dx$?"

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

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

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