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