Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
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$. –  Frank Science 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

2 Answers 2

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

share|improve this answer

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

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