I want to check if the following improper integral converges or diverges:

$$\int_0^{\infty} x^2e^{-x^2}\space dx$$

Rewriting the integrand:

$$\int_0^{\infty}-\frac{1}{2}x(-2x e^{-x^2}) \space dx$$

Integrating by parts:

$u=-\frac{1}{2}x; \space u'=-\frac{1}{2}; \space v=e^{-x^2}; \space v'=-2xe^{-x^2}$

$$\implies\int_0^{\infty} -\frac{1}{2}x(-2x e^{-x^2}) \space dx=((-\frac{1}{2}xe^{-x^2})_0^\infty-(-\frac{1}{2}e^{-x^2})_0^{\infty}) $$

$$=(\lim_{N \to \infty}(Ne^{-N^2})-0)-(\lim_{N \to \infty}(-\frac{1}{2}e^{-N^2})-(-\frac{1}{2}))=\color{red}{-\frac{1}{2}}$$

As far as I know the answer should be $\frac{1}{4}$ but I can't figure out where I am making a mistake.

  • 4
    $\begingroup$ When you integrate by parts you should end up with another integral... $\int f \frac{dg}{dx} dx = f g - \int \frac{df}{dx} g d x$ $\endgroup$ – johannesvalks Jul 20 '15 at 11:48
  • $\begingroup$ Okay I see where I messed up now. However, how do you integrate $e^{-x^2}$. $\endgroup$ – qmd Jul 20 '15 at 11:55

$$ \begin{eqnarray} \int_0^\infty x^2 e^{-x^2} dx &=& \Big[\frac{1}{2}x e^{-x^2}\Big]_0^\infty x^2 + \frac{1}{2} \int_0^\infty e^{-x^2} dx\\ &=& \frac{1}{4} \int_{-\infty}^\infty e^{-x^2} dx\\ &=& \frac{\sqrt{\pi}}{4} \end{eqnarray} $$

Your question in the comment - how to integrate $e^{-x^2}$... $$ \begin{eqnarray} \int_{-\infty}^\infty e^{-x^2} dx &=& \sqrt{ \left( \int_{-\infty}^\infty e^{-x^2} dx \right)^2 }\\ &=& \sqrt{ \int_{-\infty}^\infty e^{-x^2} dx \int_{-\infty}^\infty e^{-y^2} dy}\\ &=& \sqrt{ \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-x^2-y^2} dx dy}\\ &=& \sqrt{ \int_{0}^\infty \int_0^{2\pi} e^{-r^2} r d\phi dr }\\ &=& \sqrt{ \pi \int_{0}^\infty e^{-r^2} d\phi d(r^2) }\\ &=& \sqrt{ \pi } \end{eqnarray} $$

  • $\begingroup$ Thanks. Can you explain how you went from $\frac{1}{2}\int_0^{\infty}e^{-x^2}$ to $\frac{1}{4}\int_{-\infty}^{\infty}e^{-x^2}$? $\endgroup$ – qmd Jul 20 '15 at 12:00
  • $\begingroup$ @SuH $e^{-x^2}$ is an even function so $\int_{-a}^{a} e^{-x^2}=2\int_0^a e^{-x^2}$ $\endgroup$ – Hasan Saad Jul 20 '15 at 12:02
  • $\begingroup$ @HasanSaad Thanks! That makes sense. $\endgroup$ – qmd Jul 20 '15 at 12:03
  • $\begingroup$ Thanks for editing your to include the answer to my comment. $\endgroup$ – qmd Jul 20 '15 at 12:06
  • 1
    $\begingroup$ @SuH - you are welcome! Thank you for the 'best answere' :) $\endgroup$ – johannesvalks Jul 20 '15 at 12:07

There is a small mistake in the integration by parts.

$$F(x) =\int x^2e^{-x^2}\space dx=-\frac12e^{-x^2} + \int \frac12 e^{-x^2}\space dx=-\frac12e^{-x^2} + \frac{\sqrt{\pi} \cdot \mathrm{erf}(x)}{4}+C$$

Since we have

$$\lim_{x\to\infty} -\frac12e^{-x^2} + \frac{\sqrt{\pi} \cdot \mathrm{erf}(x)}{4} = \lim_{x\to\infty} -\frac12e^{-x^2} + \frac{\sqrt{\pi}}{4} \lim_{x\to\infty} \mathrm{erf}(x) = \frac{\sqrt{\pi}}{4}$$

and $F(0)=0$, the result is $\frac{\sqrt{\pi}}{4}$.

  • $\begingroup$ Thanks! This integral was "harder" than I thought. I have never seen the error function before. $\endgroup$ – qmd Jul 20 '15 at 11:59
  • 1
    $\begingroup$ @SuH It is good to know some properties of the error function and the incomplete gamma functions once you get further in calculus. $\endgroup$ – wythagoras Jul 20 '15 at 12:03

$$\begin{eqnarray*}\int_{0}^{+\infty}-\frac{x}{2}(-2x e^{-x^2})\,dx &=& \left.-\frac{x}{2} e^{-x^2}\right|_{0}^{+\infty}+\frac{1}{2}\int_{0}^{+\infty}e^{-x^2}\,dx\\&=&\frac{1}{2}\cdot\frac{\sqrt{\pi}}{2}=\color{red}{\frac{\sqrt{\pi}}{4}}\end{eqnarray*}$$ or: $$ \begin{eqnarray*}\int_{0}^{+\infty}x^2 e^{-x^2}\,dx = \frac{1}{2}\int_{0}^{+\infty}z^{1/2}e^{-z}\,dz = \frac{\Gamma(3/2)}{2} = \frac{\Gamma(1/2)}{4}=\color{red}{\frac{\sqrt\pi}{4}}.\end{eqnarray*}$$

  • $\begingroup$ Thank you. I didn't/don't know how to integrate $e^{-x^2}$. Is that some sort of special integral I should know? $\endgroup$ – qmd Jul 20 '15 at 12:01
  • 1
    $\begingroup$ @SuH: definitely yes. Just look at here. $\endgroup$ – Jack D'Aurizio Jul 20 '15 at 12:06

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.