TITLE: Expected value of a Gaussian
QUESTION [8 upvotes]: 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!

REPLY [3 votes]: If you want a more detailed explanation of why
$$\int_{-\infty}^{\infty} dz \, z \, e^{-z^2/(2 \sigma^2)} = 0$$
simply split the integral up as follows:
$$\int_{-\infty}^{0} dz \, z \, e^{-z^2/(2 \sigma^2)} + \int_{0}^{\infty} dz \, z \, e^{-z^2/(2 \sigma^2)}$$
or
$$\frac12 \int_{-\infty}^{0} d(z^2) \, e^{-z^2/(2 \sigma^2)} + \frac12\int_{0}^{\infty} d(z^2) \, e^{-z^2/(2 \sigma^2)}$$
These integrals are easy to evaluate:
$$-\frac12 2 \sigma^2 \left [e^{-z^2/(2 \sigma^2)} \right ]_{-\infty}^0 -\frac12 2 \sigma^2 \left [e^{-z^2/(2 \sigma^2)} \right ]_0^{\infty} = -\sigma^2 - \left (-\sigma^2 \right ) = 0$$