integration of a gaussian with $x^2$

6.5k Views Asked by At

I need to integrate $$\int_{-\infty}^{\infty} x^2 e^{-ax^2} \qquad \text{where } a\in R$$ The book does the following:

image

I don't understand what's happening. I tried solving the integral using integration by parts and this is what I got

$$ \begin{align} \int_{-\infty}^{\infty} x^2 e^{-ax^2} &= x^2\sqrt{\frac{\pi}{a}} - \int_{-\infty}^{\infty} \sqrt{\frac{\pi}{a}} 2x dx && \text{as we are told } \int_{-\infty}^{\infty}dx e^{-ax^2}= \sqrt{\frac{\pi}{a}}\\ &=x^2\sqrt{\frac{\pi}{a}} - 2\sqrt{\frac{\pi}{a}}\frac{x^2}{2} && \text{as } \int xdx = \frac{x^2}{2} \\ &= 0 \end{align} $$

What am I doing wrong?

Actually, I might have found a way of solving this

$$ \begin{align} \int_{-\infty}^{\infty} x^2 e^{-ax^2} dx &= \int_{-\infty}^{\infty} x\cdot x e^{-ax^2} dx \\ &= - \frac{1}{2a} \int_{-\infty}^{\infty} x(-2ax)e^{-ax^2} dx \\ &= -\frac{1}{2a}\left(\left[e^{-ax^2}\right]_{-\infty}^{\infty} - \int_{-\infty}^{\infty} e^{-ax2} dx\right) \\ &= -\frac{1}{2a}\left(0 - \sqrt{\frac{\pi}{a}}\right) \\ &= \frac{1}{2a}\sqrt{\frac{\pi}{a}} \end{align} $$

2

There are 2 best solutions below

0
On BEST ANSWER

note that the derivative of $e^{-ax^2}$ is $-2ax e^{-ax^2}$, so $$ x^2 e^{-ax^2} = \frac{-1}{2a}x \,(-2ax e^{-ax^2}) = \frac{-1}{2a}x\, \frac{d}{dx} e^{-ax^2}$$

Insert this into the integral and integrate by parts.

0
On

Good job for identifying the components used for integration by parts.

If you are familiar with normal distribution, here's an intepretation for $a>0$,

Let $\frac{1}{2\sigma^2}=a$

\begin{align}\int_{-\infty}^\infty x^2 \exp(-ax^2) \, dx &=\sqrt{2\pi \sigma^2}\int_{-\infty}^\infty \frac{1}{\sqrt{2\pi\sigma^2}}x^2 \exp\left(-\frac{x^2}{2\sigma^2}\right) \, dx\\ &= \sqrt{2\pi \sigma^2}\left(\sigma^2+0^2 \right)\\ &=\frac1{2a}\sqrt{\frac{\pi}{a}}\end{align}

where I have used the property that $Var(X)=E(X^2)-E(X)^2$