Gaussian integral evaluation

525 Views Asked by At

Asked a question to evaluate the Gaussian Integral,

$$\dfrac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty x^2 \exp(-x^2/2) dx $$

using the the following approximation,

$J=\Bbb E[X^2] \sim J_N = 1/N \sum_1^NX_n^2 $

where $x_n \sim N(0, 1)$

Examin $J_N$ for different values of $N$ and plot an error graph (difference between exact and numerical values)

I can simulate and generate the approximations but I am stuck at getting the exact value to compare to. As far as I am aware there are no analytical solutions for gaussian integrals. The other way I can generate comparable numbers is to go use numerical integration techniques but those are approximate values too.

Any help will be greatly appreciated!

3

There are 3 best solutions below

2
On

Hint: integrate by parts:$$ x^2\exp (-x^2/2) = x\times x\exp (-x^2/2) $$

details: You get $$ \int_{-\infty}^\infty x^2\exp (-x^2/2) dx = [x\times -\exp (-x^2/2)]_{-\infty}^\infty - \int_{-\infty}^\infty 1\times -\exp (-x^2/2) dx \\ = \int_{-\infty}^\infty \exp (-x^2/2) dx =\sqrt{2\pi} $$


More generally, $$ \int_{-\infty}^\infty x^{s+2}\exp (-x^2/2) dx = (s+1)\int_{-\infty}^\infty x^{s}\exp (-x^2/2) dx $$

3
On

The object that you have there is essentially the definition of the variance of a standard normal, which equals one.

0
On

$$I(a)=\int_{-\infty}^\infty e^{-ax^2}dx\iff-I'(a)=\int_{-\infty}^\infty x^2\cdot e^{-ax^2}dx$$ Now, since we already know that $I(1)=\sqrt\pi$, it is trivial to show, by a simple change in variable, that $I(a)=\sqrt{\dfrac\pi a}$ , in which case our integral is simply $-\dfrac{I'\Big(\tfrac12\Big)}{\sqrt{2\pi}}$ . For more information on this topic, see here.