I am trying to find the expected value of a univariate gaussian distribution. After trying to calculate the integral by hand I noticed that my calculus is not good enough for it yet. (I would need switches in to polar coordinates I guess).
Fact is, I know that there is another trick for it which I do not fully understand. It has to do with the integration over even and/or odd functions.
The gaussian is:
$$ \frac{1}{(2\pi\sigma^2)^{1/2}} e^{- \frac{1}{2\sigma^2}(x-\mu)^2} $$ the expected value then is: $$ E[x]=\int\limits_{-\infty}^{\infty}\frac{1}{(2\pi\sigma^2)^{1/2}} e^{- \frac{1}{2\sigma^2}(x-\mu)^2} x dx $$ If I now substitute $z=x-\mu$ I get: $$ E[x]=\int\limits_{-\infty}^{\infty}\frac{1}{(2\pi\sigma^2)^{1/2}} e^{- \frac{1}{2\sigma^2}(z)^2} (z+\mu) dz $$ So far I understand everything. Now comes the next step in reasoning that I do not understand. In the book, it is explained like this:
We now note that in the factor (y + μ) the first term in y corresponds to an odd integrand and so this integral must vanish.
Can anyone please explain this to me? I know that integrating over odd functions should make them vanish as the negative parts/terms should be equal to the positive parts/terms, right? But then I will get zero for z, but what about the terms in the exponent then? Will they integrate to 1 or also vanish? Could anyone give me a hint or a nice explanation? My calculus is quite rusty obviously.
Thanks in advance!
The point is this: If you use your substitution, you have the following, $$ E[X] = \frac{1}{(2\pi \sigma^2)^{1/2}}\int_{-\infty}^{\infty} (z+\mu) e^{-\frac{z^2}{2\sigma^2}}dz = \frac{1}{(2\pi \sigma^2)^{1/2}}\int_{-\infty}^{\infty} z e^{-\frac{z^2}{2\sigma^2}}dz + \mu \left(\frac{1}{(2\pi \sigma^2)^{1/2}}\int_{-\infty}^{\infty} e^{-\frac{z^2}{2\sigma^2}}dz\right) $$ As you pointed out, the first of these two integrals evaluates to $0$ because the integrand is an odd function. However, the second inside the parentheses evaluates to $1$ (why!?), so you're left with $E[X]=\mu$.