How to do integral $\int_{-\infty}^{\infty} x^4 e^{-x^2/2}dx$ Can someone show me a simple way to do integral 
$\int_{-\infty}^{\infty} x^4 e^{-x^2/2}dx$?
I am working on something related to the moments of normal distribution and require the evaluation of the above integral. I can get the answer from W/A or Mathematica but I want to learn how to do this manually.
 A: After scaling it suffices to compute $$\int^{\infty}_{-\infty} x^{2n} \exp(-x^2) dx $$ for $n$ even (for even powers the integrand is odd so the integral is zero. To do this, recall that 
$$ \int^{\infty}_{-\infty} \exp(-zx^2) dx = \sqrt{ \frac{\pi}{z} }$$
and see what repeatedly differentiating both sides with respect to $z$ gives you.
A: The change of variables $y=\frac{x^2}{2}$ transforms the integral in terms of the gamma function 
$$ \int_{-\infty}^{\infty} x^4 e^{-x^2/2}dx= 2\int_{0}^{\infty} x^4 e^{-x^2/2}dx=2^{\frac{5}{2}}\int_{0}^{\infty} y^{\frac{3}{2}} e^{-y}dx = 2^{\frac{5}{2}}\Gamma\left(\frac{5}{2}\right)=3\sqrt{2}\,\pi, $$
where 
$$\Gamma(z) = \int_0^\infty t^{z-1} e^{-t}\,{\rm d}t. $$
A: Recall that
$$I(a) = \int_{-\infty}^{\infty} e^{-ax^2}dx = \sqrt{\dfrac{\pi}a}$$
$$I'(a) = \int_{-\infty}^{\infty} (-x^2) e^{-ax^2}dx = -\dfrac12 \dfrac{\sqrt{\pi}}{a^{3/2}}$$
$$I''(a) = \int_{-\infty}^{\infty} x^4 e^{-ax^2}dx = \dfrac12 \dfrac32 \dfrac{\sqrt{\pi}}{a^{5/2}}$$
Setting $a=1$, we get
$$\int_{-\infty}^{\infty} x^4 e^{-x^2}dx = \dfrac{3\sqrt{\pi}}4$$
From this you get that, in general,
$$\int_{-\infty}^{\infty} x^{n} e^{-x^2} dx = \begin{cases} 0 & \text{If } n \text{ is odd.}\\ \dfrac12 \cdot \dfrac32 \cdot \dfrac52 \cdots \dfrac{n-1}{2}\sqrt{\pi} = \dfrac{n! \sqrt{\pi}}{2^n (n/2)!}  & \text{If }n \text{ is even.}\end{cases}$$
A: I would normally do this as Mhenni did, using the Gamma function, but since he has shown that approach, I thought it might be useful to post a more elementary approach.
We can use integration by parts twice to get
$$
\begin{align}
\int_{-\infty}^\infty x^4e^{-x^2/2}\,\mathrm{d}x
&=-\int_{-\infty}^\infty x^3\,\mathrm{d}e^{-x^2/2}\\
&=\left[\vphantom{\int}-x^3e^{-x^2/2}\right]_{-\infty}^{+\infty}+3\int_{-\infty}^\infty x^2e^{-x^2/2}\,\mathrm{d}x\\
&=-3\int_{-\infty}^\infty x\,\mathrm{d}e^{-x^2/2}\\
&=\left[\vphantom{\int}-3xe^{-x^2/2}\right]_{-\infty}^{+\infty}+3\int_{-\infty}^\infty e^{-x^2/2}\,\mathrm{d}x\\[9pt]
&=3\sqrt{2\pi}
\end{align}
$$
To evaluate the last integral above, we can set
$$
I=\int_{-\infty}^\infty e^{-x^2/2}\,\mathrm{d}x
$$
Then convert from rectangular to polar coordinates
$$
\begin{align}
I^2
&=\int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)/2}\,\mathrm{d}x\,\mathrm{d}y\\
&=\int_0^{2\pi}\int_0^\infty e^{-r^2/2}\,r\,\mathrm{d}r\,\mathrm{d}\theta\\
&=-\int_0^{2\pi}\int_0^\infty\,\mathrm{d}e^{-r^2/2}\,\mathrm{d}\theta\\
&=\int_0^{2\pi}1\,\mathrm{d}\theta\\[9pt]
&=2\pi
\end{align}\\
$$
A: Rep 6 from Blogging Hazleton: http://blogginghazleton.blogspot.com $\renewcommand{\d}[1]{\operatorname{d}\!{#1}}$
Here is another example.
$$\int_{-\infty}^{+\infty}\Omega^6e^{-\Omega^2}\d\Omega$$
\begin{align}
u&=\Omega^5&\d v&=\Omega e^{-\Omega^2}\\
\d u&=5\Omega^4\d\Omega&v&=-\frac12e^{-\Omega^2}
\end{align}
\begin{align}
\int_{-\infty}^{+\infty}\Omega^6e^{-\Omega^2}\d\Omega&=\Omega^5\left[-\frac12e^{-\Omega^2}\right]_{-\infty}^{+\infty}+\int_{-\infty}^{+\infty}\frac12\cdot5\Omega^4e^{-\Omega^2}\d\Omega\tag{1}\\
&=0+\frac52\frac34\sqrt\pi\tag{2}
\end{align}
To go from $(1)$ to $(2)$, see Rep 4.
Get more examples here:
http://blogginghazleton.blogspot.com

This wasn't my post. Someone else (Sean M. Donahue, I think) posted this, but with clunky images instead of LaTeX, so it got deleted. This is my LaTeX'd version of it. If anyone wants to LaTeX up his other post here — this one — they are more than welcome.

This is a Community Wiki post.
