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

  • 4
    $\begingroup$ Try completing the square in the exponent. $\endgroup$ – Thomas Belulovich Jun 28 '12 at 10:34
  • 1
    $\begingroup$ $\exp(-x^2+2x)=\exp(-(x-1)^2)/e$, and substituting with $u=x-1$. $\endgroup$ – Yai0Phah Jun 28 '12 at 10:35
  • $\begingroup$ Thank you both for your comments, I've just figured it out. $\endgroup$ – James Jun 28 '12 at 10:37
  • $\begingroup$ 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://… $\endgroup$ – 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{ #}$$

  • $\begingroup$ 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? $\endgroup$ – 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}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.