How to evalutate this exponential integral

Is there an easy way to compute $$\int_{-\infty}^\infty\exp(-x^2+2x)\mathrm{d}x$$ without using a computer package?

• Try completing the square in the exponent. – Thomas Belulovich Jun 28 '12 at 10:34
• $\exp(-x^2+2x)=\exp(-(x-1)^2)/e$, and substituting with $u=x-1$. – Yai0Phah Jun 28 '12 at 10:35
• Thank you both for your comments, I've just figured it out. – James Jun 28 '12 at 10:37
• I judt ran into this. Found a solution in larsons problem solving through problems. Problem 1 ,4 ,4. He squares entire integral. google.com/url?sa=t&source=web&rct=j&url=https://… – Marcus Watt Jul 21 '18 at 6:51

In general \begin{align} \int_{x=0}^\infty e^{-(ax^2+bx)}\,dx&=\int_{x=0}^\infty \exp\left(-a\left(\left(x+\frac{b}{2a}\right)^2-\frac{b^2}{4a^2}\right)\right)\,dx\\ &=\exp\left(\frac{b^2}{4a}\right)\int_{x=0}^\infty \exp\left(-a\left(x+\frac{b}{2a}\right)^2\right)\,dx\\ \end{align} Let $u=x+\frac{b}{2a}\;\rightarrow\;du=dx$, then \begin{align} \int_{x=0}^\infty e^{-(ax^2+bx)}\,dx&=\exp\left(\frac{b^2}{4a}\right)\int_{x=0}^\infty \exp\left(-a\left(x+\frac{b}{2a}\right)^2\right)\,dx\\ &=\exp\left(\frac{b^2}{4a}\right)\int_{u=0}^\infty e^{-au^2}\,du.\\ \end{align} The last form integral is Gaussian integral that equals to $\frac{1}{2}\sqrt{\frac{\pi}{a}}$. Hence $$\int_{x=0}^\infty e^{-(ax^2+bx)}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{a}}\exp\left(\frac{b^2}{4a}\right).$$ In your case, \begin{align} \int_{-\infty}^\infty e^{-x^2+2x}\,dx&=2\int_0^\infty e^{-(x^2-2x)}\,dx\\ &=2\cdot\frac{1}{2}\sqrt{\frac{\pi}{1}}\exp\left(\frac{(-2)^2}{4\cdot1}\right)\\ &=e\sqrt{\pi}. \end{align}
$$\text{# }\mathbb{Q.E.D.}\text{ #}$$
• I don't understand why the lower limit $x = 0$ does not change to $u = \frac{b}{2a}$ up on the change of variables. Indeed wolfram alpha shows your answer is not correct, likely due to this limit change? – Señor O Nov 21 '17 at 4:48
This is a Gaussian integral. In general you can use the formula $\int_{-\infty}^{\infty} \exp(-x^2+bx+c)\mathrm{d}x=\sqrt{\pi}~\exp(b^2/4+c)$. This formula, as suggested by Thomas, can be derived by completing the square in the exponent, and using $\int_{-\infty}^{\infty} \exp(-x^2)\mathrm{d}x=\sqrt{\pi}$.