6
$\begingroup$

Is it possible to integrate $$\int_0^{\infty} x^2 e^{-x^2/2}\, \mathrm dx$$ by hand?

The answer is $\frac{1}{2\sqrt{2}}$ My apologies if this does not meet the standards of this blog. I will delete it if requested.

$\endgroup$
4
  • $\begingroup$ Try to do it by parts twice...or even once. $\endgroup$
    – DonAntonio
    Commented Sep 30, 2016 at 18:46
  • $\begingroup$ I think you might be able to compare it to the gamma function? $\endgroup$
    – Jam
    Commented Sep 30, 2016 at 18:47
  • $\begingroup$ ok, I am little rusty with calculus what do we set our u and dv at? $\endgroup$
    – Wolfy
    Commented Sep 30, 2016 at 18:47
  • $\begingroup$ It seems that your answer is wrong: see wolframalpha.com/input/?i=integrate+x^2+e^%28-x^2%2F2%29+from+x%3D0+to+infty $\endgroup$ Commented Sep 30, 2016 at 19:19

6 Answers 6

14
$\begingroup$

By the Feynman trick we have:

$$I = \lim_{a\to 1}\int_0^{+\infty} -2\left(\frac{\text{d}}{\text{d}a} e^{-(a x^2)/2}\right)\ \text{d}x = \lim_{a\to 1}-2\frac{\text{d}}{\text{d}a}\int_0^{+\infty} e^{-(ax^2)/2}\ \text{d}x = \lim_{a\to 1} -2 \frac{\text{d}}{\text{d}a}\sqrt{\frac{\pi}{2a}}$$

Hence

$$I = \lim_{a\to 1}-2\left(-\frac{1}{2} \sqrt{\frac{\pi }{2}} \left(\frac{1}{a}\right)^{3/2}\right)$$

And our integral is simply

$$I = \sqrt{\frac{\pi }{2}}$$

Which is the result of your integral.

$\endgroup$
7
  • $\begingroup$ Very nice trick! $\endgroup$
    – babakks
    Commented Sep 30, 2016 at 19:06
  • 1
    $\begingroup$ @Babak Thank you! I really love that trick too, and finally I could use it :D $\endgroup$
    – Enrico M.
    Commented Sep 30, 2016 at 19:16
  • $\begingroup$ Nitpick: the LHS should not be $I(a)$ but $I$: it does not depend on $a$. Or you want to drop the $\lim_{a\to 1}$ there? $\endgroup$
    – Clement C.
    Commented Sep 30, 2016 at 19:31
  • 1
    $\begingroup$ @FourierTransform +1 Feynman's Trick comes to the rescue for all of the even powered moments. $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 20:00
  • 1
    $\begingroup$ @Lovsovs I forgot it, thanks! Going to edit $\endgroup$
    – Enrico M.
    Commented Sep 30, 2016 at 20:26
7
$\begingroup$

Hint: $u = x$, $dv = xe^{-x^2/2}dx$

$\endgroup$
1
  • $\begingroup$ I do not see how you can integrate by parts here. Can you elaborate ? Thanks. $\endgroup$
    – user996159
    Commented Oct 9, 2023 at 17:45
6
$\begingroup$

No tricks, just the Gamma integral: Substituting $x = \sqrt{2t}$ gives $$\int_0^\infty x^2 e^{-x^2/2} \,dx = \sqrt{2\vphantom{X}} \int_0^\infty t^{1/2} e^{-t} \,dt = \sqrt{2\vphantom{X}}\,\Gamma\Bigl(\frac32\Bigr) = \sqrt{\frac\pi2}.$$

$\endgroup$
5
  • 1
    $\begingroup$ Actually the Gamma function is a trick too :) But I give +1 because I love the Gamma function! $\endgroup$
    – Enrico M.
    Commented Sep 30, 2016 at 19:17
  • $\begingroup$ And how does one evaluate the Gamma function at half integers? Using the functional relationship $\Gamma(x+1)=x\Gamma(x)$ boils it down to evaluating $\Gamma(1/2)$. And would you do that? $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 19:55
  • $\begingroup$ @Dr.MV For this we can evaluate the Gaussian integral $\int_0^\infty e^{-x^2}\,dx = \sqrt\pi/2$ with another method, and then substituting $x = \sqrt{t}$ gives $\int_0^\infty e^{-x^2}\,dx = \Gamma(1/2)/2$. $\endgroup$
    – arkeet
    Commented Sep 30, 2016 at 20:00
  • $\begingroup$ @arkeet Yes, I know that. I just want others to be aware that the evaluation of the integral of interest using the Gamma function requires that one evaluate the Gamma function. $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 20:02
  • $\begingroup$ Yes, that is the point. But if you want to avoid the function, the integral can be reduced to the Gaussian integral more directly by grixor's answer. $\endgroup$
    – arkeet
    Commented Sep 30, 2016 at 20:04
4
$\begingroup$

Using a standard probability distribution:

If you know the Gaussian distribution $\mathcal{G}(\mu,\sigma)$: its pdf is $f_{\mu,\sigma}\colon\mathbb{R}\to\mathbb{R}$ defined by $$ f_{\mu,\sigma}(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x-\mu)^2}{2\sigma^2}} $$ and you want to compute, for $X\sim\mathcal{G}(0,1)$, $$\begin{align*} \int_{0}^\infty x^2e^{-\frac{x^2}{2}}dx &= \frac{1}{2}\cdot\sqrt{2\pi}\int_{-\infty}^\infty x^2f_{0,1}(x)dx = \frac{\sqrt{2\pi}}{2} \mathbb{E}[X^2] = \frac{\sqrt{2\pi}}{2}\left( \mathbb{E}[X^2]-\mathbb{E}[X]^2\right) \\&= \frac{\sqrt{2\pi}}{2}\operatorname{Var}X = \frac{\sqrt{2\pi}}{2}\cdot 1 \\&= \sqrt{\frac{\pi}{2}} \end{align*}$$ where for the first step we used the fact that $x\mapsto x^2e^{-\frac{x^2}{2}}$ is an even function (hence the factor $\frac{1}{2}$ and the change of bounds in the integral).

$\endgroup$
3
  • $\begingroup$ Clement, how are you my friend. This is a fine approach. But it might prompt, of course, one to ask, "how does one calculate the variance (or any moment) of the normal (Gaussian) distribution in terms of the parameters $\mu$ and $\sigma$ of the corresponding density function?" $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 19:59
  • $\begingroup$ Indeed, it is circular (and I fully admit it). But assuming the variance and expectation of a Gaussian are known (which only requires to compute the integral once in a lifetime), this allows one to (re)derive such results very cheaply. $\endgroup$
    – Clement C.
    Commented Sep 30, 2016 at 20:03
  • $\begingroup$ And that is the rationale for my giving a +1, well deservedly! $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 20:04
3
$\begingroup$

$$\begin{align} u&=x^2/2 \\ \mathrm{d}u&=x\mathrm{d}x \\ \int x^2e^{-x^2/2}\,\mathrm{d}x &=\int \frac{x^2e^{-u}}{x}\,\mathrm{d}u \\&=\int \sqrt{2u}e^{-u}\,\mathrm{d}u \\&=\sqrt{2}\int u^{1/2}e^{-u}\,\mathrm{d}u \\\int_0^\infty x^2e^{-x^2/2}\,\mathrm{d}x&=\sqrt{2}\:\Gamma\left(\frac{1}{2}+1 \right)* \\&=\sqrt{2}\frac{\sqrt{\pi}}{2} \\&\quad \text{* where $\Gamma(z)$ is the gamma function $\int_0^\infty u^{z-1}e^u\mathrm{d}u$} \end{align}$$

$\endgroup$
1
  • $\begingroup$ And how does one evaluate the Gamma function at half integers? Using the functional relationship $\Gamma(x+1)=x\Gamma(x)$ boils it down to evaluating $\Gamma(1/2)$. And would you do that? $\endgroup$
    – Mark Viola
    Commented Sep 30, 2016 at 19:55
0
$\begingroup$

As a first step note that $$ I=\int x e^{-\frac{x^2}{2}}dx $$ can be integrated with the substitution $$ -\frac{x^2}{2}=t \quad \rightarrow \quad xdx=-dt $$ and we have: $$ I=-\int e^t dt = -e^t+C=-e^{-\frac{x^2}{2}}+C $$

now you can write your integral as: $$ J=\int_0^{\infty} x^2 e^{-x^2/2}dx=\int_0^{\infty} x d\left(-e^{-\frac{x^2}{2}} \right) $$

and, integrating by part: $$ J=\left[-xe^{-x^2/2}\right]_0^{\infty}+\int_0^{\infty}e^{-x^2/2}dx $$

The first part is obviously $=0$. For the second, using the definition of the Error function, we have: $$ \int_0^{\infty}e^{-x^2/2}dx=\left[\sqrt{\frac{\pi}{2}}\mbox{erf}(x/\sqrt{2})\right] _0^{\infty} $$

and, since $\mbox{erf}(0)=0$ and $\lim _{x\to \infty}\mbox{erf}(x)=1$ we have $J=\sqrt{\frac{\pi}{2}}$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .