Evaluating the definite integral $\int_{-\infty}^{+\infty} \mathrm{e}^{-x^2}x^n\,\mathrm{d}x$

The function $x\mapsto x^n e^{-x^2}$ is absolutely integrable on the real line. If $n$ is odd, the integrand is odd, and we have $$\int_0^\infty x^n e^{-x^2}\, dx = 0$$

Now consider the even case. We first use symmetry to get the integral onto $[0,\infty)$ and then use the subsitution $x \rightarrow \sqrt{x}$ as follows $$\int_{-\infty}^\infty x^n e^{-x^2}\, dx= 2\int_0^\infty x^n e^{-x^2}\, dx = 2\int_0^\infty x^{n/2} e^{-x}{dx\over2\sqrt{x}} = \Gamma\left({n + 1\over 2}\right).$$

Invoking the factorial property of the $\Gamma$ function relates this solution to the other posted solution.


Let $I_n:=\int_{-\infty}^{+\infty}e^{-x^2}x^ndx$. If $n$ is odd then $I_n=0$ and for $p\geq 1$: \begin{align} I_{2p}&=\int_0^{+\infty}e^{-x^2}x^{2p}dx+\int_{-\infty}^0e^{-x^2}x^{2p}dx\\ &=\int_0^{+\infty}e^{-t^2}t^{2p}dt+\int_0^{+\infty}e^{-t^2}(-t)^{2p}dt\quad (\mbox{left: } t=x,\mbox{right: } t=-x)\\ &=2\int_0^{+\infty}e^{-t^2}t^{2p}dt\\ &=2\int_0^{+\infty}e^{-s}s^p\frac 1{2\sqrt s}ds \quad (s=t^2)\\ &=\int_0^{+\infty}e^{-s}s^{p-1/2}ds\\ &=\left[-e^{-s}s^{p-1/2}\right]_0^{+\infty}+\int_0^{+\infty}e^{—s}\left(p-\frac 12\right)s^{p-1-1/2ds}\\ &=\left(p-\frac 12\right)I_{2(p-1)}. \end{align} Finally we get $I_{2p+1}=0$ and $I_{2p}=\sqrt \pi\prod_{j=1}^p\left(j-\frac 12\right)$ for all $p\geq 0$.