# 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.

-
Here are some possible approaches: 1. Use integration by parts repeatedly, reducing the degree of the polynomial term. 2. Use Gamma function. –  sos440 Mar 12 '13 at 2:59
If I had asked you to solve $\displaystyle\int_{-\infty}^{\infty} \! e^{-x^2 / 2} \, dx$, could you solve it? If not, then you may want to look into the solution of that integral. If so, then you should be able to spam IBP to get your answer. –  meh Mar 12 '13 at 3:00
You might, once and for all, calculate the moment generating function of the standard normal. –  André Nicolas Mar 12 '13 at 3:07

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}$$

-

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.

-

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.$$

-

Rep 6 from Blogging Hazleton: http://blogginghazleton.blogspot.com

Here is another example, absent the fancy math font.

Get more examples here: http://blogginghazleton.blogspot.com

-

You can also do it by parts. Doing so is not as the eloquent as the solution provided by user 1776 "The Second". His/ her answer is sophisticated but you aren't going to remember it in a pintch. In a pinch, you are going to have to use less sophisticated bruit force. That's just the way it works.

Rep 4 from Blogging Hazleton: http://blogginghazleton.blogspot.com

You can find more on my blog; http://blogginghazleton.blogspot.com. Doing it the long way is just a matter of going through reps. Still, answer 18 is the most sophisticated approach, if sophistication is your thing. But if you at in a pinch, you need a standard operating procedure and the long way adds a warm and fuzzy feeling because you made sure it was correct.

-
Typing the maths in LaTeX would drastically improve your answer. –  Olivier Bégassat Mar 30 at 18:04
Why are you concerned with font? That said, how do you use said font on a handheld device, like an android? –  Sean M. Donahue Mar 30 at 18:18