# integral of $x^2e^{-x^2}~dx$ from $-\infty$ to $+\infty$

I know that the

$$\int^{+\infty}_{-\infty}e^{-x^2}~dx$$ is equal to $\sqrt\pi$

It's also very clear that $$\int^{+\infty}_{-\infty}xe^{-x^2}~dx$$ is equal to 0;

However, I cannot manage to calculate this really similar integral.

$$\int^{+\infty}_{-\infty}x^2e^{-x^2}~dx$$

I know that the result is $\frac{\sqrt\pi}{2}$ but I don't know how to get to this result. I tried different substitution, but it doesn't seem to help. Any idea?

Thank you very much.

• Try integration by parts. Dec 4, 2013 at 18:10
• $x^2e^{-x^2} = \frac x2\cdot 2xe^{-x^2}$ Dec 4, 2013 at 18:14
• use parts,it is helpfull Dec 5, 2013 at 11:06

I'm surprised no one has given this answer. We have of course by $u$-substitution $$\int_{-\infty}^{\infty} e^{-\alpha x^2} dx = \sqrt{\frac{\pi}{\alpha}}.$$ Take a derivative of each side with respect to $\alpha$ to get $$-\int_{-\infty}^\infty x^2 e^{-\alpha x^2} dx = -\frac{1}{2} \frac{\sqrt{\pi}}{\alpha^{3/2}}.$$ Substitute $\alpha = 1$ and cancel negative signs.

EDIT: I see that Felix Marin does essentially the same thing, but I think this is a better explanation.

• This is really a beautiful answer indeed. Thank you. Dec 6, 2013 at 13:22
• I still remember the day when one of my classmates showed me this and told me he learned this particular trick from one of my favorite professors. Dec 6, 2013 at 14:08

\begin{align} \int_{-\infty}^\infty x^2e^{-x^2}\text dx&=2\int_0^\infty x^2e^{-x^2}\text dx\\ &=\int_0^\infty \sqrt ue^{-u}\text du\\ &=\Gamma\left(\frac32\right)\\ &=\frac12\Gamma\left(\frac12\right)\\ &=\frac12\int_0^\infty\frac{e^{-u}}{\sqrt u}\text du\\ &=\int_0^\infty e^{-x^2}\text dx\\ &=\frac{\sqrt \pi}2 \end{align}

• Can you show how to get there without using the gamma function? Dec 4, 2013 at 19:24
• Is that more acceptable? Dec 4, 2013 at 20:30

$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}% \newcommand{\dd}{{\rm d}}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\fermi}{\,{\rm f}}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\half}{{1 \over 2}}% \newcommand{\ic}{{\rm i}}% \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\ol}[1]{\overline{#1}}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$

1. \begin{align} \int_{-\infty}^{\infty}x^{2}\expo{-x^{2}}\,\dd x &=\left.-\,\partiald{}{\mu}\int_{-\infty}^{\infty}\expo{-\mu x^{2}}\,\dd x \right\vert_{\,\mu\ =\ 1} = \left.-\,\partiald{}{\mu}\pars{\mu^{-1/2}\int_{-\infty}^{\infty}\expo{-x^{2}}\,\dd x} \right\vert_{\,\mu\ =\ 1} \\[3mm]&= \left.-\pars{-\,\half}\mu^{-3/2}\right\vert_{\,\mu\ =\ 1}\ \underbrace{\quad\int_{-\infty}^{\infty}\expo{-x^{2}}\,\dd x\quad} _{\ds{=\ \root{\pi}}} \end{align} $$\color{#0000ff}{\large% \int_{-\infty}^{\infty}x^{2}\expo{-x^{2}}\,\dd x = {\root{\pi} \over 2}}$$
2. \begin{align} \color{#0000ff}{\large\int_{-\infty}^{\infty}x^{2}\expo{-x^{2}}\,\dd x} &=\int_{-\infty}^{\infty}\pars{-\,\half}x\,\totald{\expo{-x^{2}}}{x}\,\dd x =\overbrace{\left.-\,\half\,x\expo{-x^{2}}\right\vert _{-\infty}^{\infty}}^{\ds{=\ 0}} + {1 \over 2}\int_{-\infty}^{\infty}\expo{-x^{2}}\,\dd x \\[3mm]&= \color{#0000ff}{\large{\root{\pi} \over 2}} \end{align}
• I think the first line is missing an '=' sign, is that right? I was going to edit it myself until I saw your $L_AT_EX$ hell... Dec 5, 2013 at 10:41
• @TonyK I just added the $\large =$ sign. Thanks. Dec 6, 2013 at 2:27

The standard solution requires a trick using polar coordinates. If the value of your $\int_{-\infty}^{\infty}$ is $V$, then $$V^{2} = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-x^{2}}e^{-y^{2}}dx dy = \int_{0}^{2\pi}\int_{0}^{\infty}e^{-r^{2}}rdrd\theta=2\pi\int_{0}^{\infty}e^{r^{2}}rdr=\pi.$$ So $V = \int_{-\infty}^{\infty}e^{-x^{2}}dx=\sqrt{\pi}$. Integrating by parts finishes the problem as: \begin{align} \int_{-\infty}^{\infty}x^{2}e^{-x^{2}}dx&=\int_{-\infty}^{\infty}x\frac{d}{dx}\left[-\frac{1}{2}e^{-x^{2}}\right]dx = \left.x\left[-\frac{1}{2}e^{-x^{2}}\right]\right|_{-\infty}^{\infty}+\frac{1}{2}\int_{-\infty}^{\infty}e^{-x^{2}}dx\\ &= \frac{1}{2}\int_{-\infty}^{\infty}e^{-x^{2}}dx=\frac{\sqrt{\pi}}{2}.\end{align}

• You integrated $e^{-x^2}$ he wants $x^2 e^{-x^2}$. Dec 4, 2013 at 18:54

Same trick as T.A.E. but without integrating by parts: \begin{align} \left(\int_{-\infty}^\infty x^2\,e^{-x^2}\,\mathrm{d}x\right)^2 &=\int_{-\infty}^\infty\int_{-\infty}^\infty x^2y^2\,e^{-x^2}e^{-y^2}\,\mathrm{d}x\,\mathrm{d}y\\ &=\int_0^\infty\int_0^{2\pi}r^4\cos^2(\theta)\sin^2(\theta)\,e^{-r^2}\,r\,\mathrm{d}\theta\,\mathrm{d}r\\ &=\int_0^\infty r^4e^{-r^2}\,r\,\mathrm{d}r\int_0^{2\pi}\cos^2(\theta)\sin^2(\theta)\,\mathrm{d}\theta\\ &=\frac18\int_0^\infty s^2e^{-s}\,\mathrm{d}s\int_0^{2\pi}\sin^2(2\theta)\,\mathrm{d}\theta\\ &=\frac18\cdot2!\cdot\pi\\ &=\frac\pi4 \end{align} Therefore, $$\int_{-\infty}^\infty x^2\,e^{-x^2}\,\mathrm{d}x=\frac{\sqrt\pi}{2}$$ One might use integration by parts to get $\int_0^\infty s^2e^{-s}\,\mathrm{d}s=2$ if one didn't recognize it as $2!$.

For $n\geq 0$ let $A_n = \int_{-\infty}^{\infty} x^{2n}e^{-x^2} dx$. Then

$$A_n = \sqrt{\pi}\frac{{2n \choose n}n!}{4^n}.$$

Indeed, $$\sum_{n=0}^\infty A_n t^n/n! = \int_{-\infty}^\infty \sum_{n=0}^\infty e^{-x^2}(tx^2)^n dx/n! = \int_{-\infty}^\infty e^{-x^2(1-t)}dx = \frac{\sqrt \pi}{\sqrt{1-t}}.$$

Comparing coefficients of $t$ on both sides we find the above formula (using the fact that $1/\sqrt{1-4t} = \sum_{n=0}^\infty {2n \choose n}t^n$).

Given that you know $\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$:

First, we note it's easy to integrate $x e^{-x^2}$ ( by substitution $u=x^2$) $$\int x e^{-x^2}dx= -\frac{1}{2}e^{-x^2}$$

Then, we can apply integration by parts:

$$\int x \,x e^{-x^2}\text dx= -\frac{x}{2}e^{-x^2} + \frac{1}{2}\int e^{-x^2}dx$$

Therefore

$$\int_{-\infty}^\infty x^2 e^{-x^2}\text dx= -\frac{x}{2}e^{-x^2}\bigg|_{-\infty}^\infty+\frac{1}{2}\int_{-\infty}^\infty e^{-x^2}dx=0-0+\frac{1}{2}\sqrt{\pi}=\frac{\sqrt{\pi}}{2}$$