Compute integral $\int_{-\infty}^{\infty} x^{4n} e^{-x^2/2} \, dx$ While solving a more general problem, I came across the following integral
$$I= \int_{-\infty}^{\infty} x^{4n} e^{-x^2/2} \, dx$$
To start off, I defined $t:=x^2/2$ to get
\begin{align*}
I= \int_{-\infty}^\infty x^{4n} e^{-x^2/2} \, dx &= 2\int_0^\infty x^{4n} e^{-x^2/2} \, dx \\
&= 2 \int_0^\infty (\sqrt{2t})^{4n} e^{-t} \frac{dt}{\sqrt{2t}} \\
&= 2 (\sqrt{2})^{4n - 1} \int_0^\infty t^{2n - 1/2} e^{-t} \, dt 
\end{align*}
This seems to be a gamma function integral. I would start integrating by parts
\begin{align*}
\int_0^{+\infty} t^{2n-\frac{1}{2}}e^{-t} \, dt&=[ -t^{2n-\frac{1}{2}}e^{-t}]_0^{+\infty} - (-)(2n-\frac{1}{2})\int_0^{+\infty}t^{2n-\frac{1}{2}-1}e^{-t} \, dt \\
    &=(2n-\frac{1}{2})\int_0^{+\infty}t^{2n-\frac{1}{2}-1}e^{-t} \, dt
\end{align*}
But how to proceed further?
I looked up in a table and the result should be
$$I=2 (\sqrt{2})^{4n - 1} \Gamma\left(2n+ \frac 1 2 \right)$$
PS: Alternative methods avoiding the gamma function are very welcomed! :)
EDIT: I think that what Yves suggested was the following
$$I= \int_{-\infty}^\infty x^{4n} e^{-x^2/2}= (2n-\frac{1}{2}) (2n-\frac{3}{2}) (2n-\frac{5}{2})\cdots\frac{3}{2}\frac{1}{2} \int_0^{+\infty}t^{-\frac{1}{2}}e^{-t}\,dt=(2n-\frac{1}{2}) (2n-\frac{3}{2}) (2n-\frac{5}{2})\cdots\frac{3}{2}\frac{1}{2}\ \ 2\int_0^{+\infty}e^{-t} \, d(\sqrt{t})$$
Alrigtht! I see that $(2n-\frac{1}{2}) (2n-\frac{3}{2}) (2n-\frac{5}{2})\cdots\frac{3}{2}\frac{1}{2} = \Gamma\left(2n+ \frac 1 2 \right)$
NAIVE question though: how to see that $\int_0^{+\infty}e^{-t} \, d(\sqrt{t})=2 (\sqrt{2})^{4n - 1}$?
 A: Note that
$$I(a)= \int_{-\infty}^{\infty} e^{-a x^2} \, dx=\sqrt{\frac \pi a}
$$
Then
$$\int_{-\infty}^{\infty} x^{4n} e^{-x^2/2} \, dx
= \frac{d^{2n} I(a)}{da^{2n}}\bigg|_{a=\frac12}= \sqrt{\pi}\cdot \frac{d^{2n} (a^{-\frac12})}{da^{2n}}\bigg|_{a=\frac12}
= \frac{(4n-1)! \sqrt{2\pi}}{2^{2n-1}(2n-1)!} 
$$
A: You're really done after the first integration by parts: as $\displaystyle \Gamma(z) = \int_0^\infty x^{z-1} e^{-x}\,dx,$
$\displaystyle 2 (\sqrt{2})^{4n - 1} \int_{0}^{\infty} t^{2n -\frac{1}{2}} e^{-t} dt  =2 (\sqrt{2})^{4n - 1} \int_{0}^{\infty} t^{2n + \frac{1}{2}-1} e^{-t} dt =2 (\sqrt{2})^{4n - 1} \Gamma\left(2n+ \frac 1 2 \right).$
In other words, your integral is the gamma function with $z = 2n+\frac{1}{2}$.
Regarding the other method, you have:
You've shown that if $\displaystyle I_n = \int_0^{\infty} t^{2n-\frac{1}{2}}\,{dt} $ then $I_n = \left(2n-\frac{1}{2}\right)I_{n-1}$ so that $$I_n =(2n-\frac{1}{2}) \cdot (2n-\frac{3}{2}) \cdot (2n-\frac{5}{2})\cdots\frac{3}{2} \cdot I_1 $$
Where $\displaystyle I_1 = \int_0^{+\infty}t^{\frac{1}{2}}e^{-t}\,dt$, then  $t = x^2$ shows that
$$\displaystyle I_1 = 2 \int_0^{\infty} x^2 e^{-x^2}\,{dx}. $$
Which evaluates to $\displaystyle \frac{1}{2}\sqrt{\pi}$ (see here). Therefore
$$\begin{aligned} I &= \sqrt{\pi} \cdot (2n-\frac{1}{2}) \cdot (2n-\frac{3}{2}) \cdot (2n-\frac{5}{2})\cdots\frac{3}{2} \cdot \frac{1}{2}\\& =\frac{\sqrt{\pi}}{2^{2n}}(4n-1) (4n-3) (4n-5)\cdots  3 \cdot 1 \\& =\frac{\sqrt{\pi}}{2^{2n}}\frac{(4n-1)(4n-2) (4n-3)(4n-4) (4n-5)\cdots 1}{(4n-2) (4n-4)  \cdots 2 }  \\& =\frac{\sqrt{\pi}}{2^{2n}}\frac{(4n-1)(4n-2) (2n-3)(2n-4) (2n-5)\cdots 3 \cdot \cdot 2 \cdot 1}{2^{2n} (2n-1) (2n-2) \cdots  1 }  \\& = \frac{(4n)!\sqrt{\pi}}{2^{4n}(2n)!}.\end{aligned}  $$
Therefore your original integral is $\displaystyle I =2 (\sqrt{2})^{4n - 1} \frac{(4n)!\sqrt{\pi}}{2^{4n}(2n)!}.$
This agrees with $\displaystyle I = 2 (\sqrt{2})^{4n - 1} \Gamma\left(2n+ \frac 1 2 \right)$ as $\displaystyle \Gamma\left(2n+ \frac 1 2 \right) = \frac{(4n)!\sqrt{\pi}}{2^{4n}(2n)!}$
(see here).
A: you can use the known formula (in any case very easy to prove) of the odd simple moments of the Standard Gaussian
$$\mathbb{E}[X^{2n}]=\frac{(2n)!}{2^n\cdot n!}$$
Thus you integral results to me
$$\frac{\sqrt{2\pi}(4n)!}{4^n\cdot(2n)!}$$
To prove that this result match with the one you expected, just observe that
$$\frac{\sqrt{2\pi}(4n)!}{4^n\cdot(2n)!}=2^{2n+1/2}\cdot\Gamma\left(2n+\frac{1}{2}\right)$$

Your integral is the following
$$I=\sqrt{2\pi}\int_{-\infty}^{\infty} x^{2m}\phi(x)dx$$
where

*

*$m=2n$


*$\phi(x)$ is the density of a Standard Gaussian, that is a Gaussian distribution with mean zero and variance 1.


*now you have only to apply the known formula for the simple odd moments I showed. The proof is available in many basic Statistics Textbook and it is very easy: it is enough to calculate the Taylor expansion of MGF and get the derivatives in $t=0$
