Expected value of a Gaussian 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! 
 A: 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$.
A: You're integrating the sum of two functions:
$$
e^{-\frac{1}{2\sigma^2}z^2}z + e^{-\frac{1}{2\sigma^2}z^2}\mu
$$
The function 
$$e^{-\frac{1}{2\sigma^2}z^2}z$$
is odd, so $\int_{-\infty}^\infty e^{-\frac{1}{2\sigma^2}z^2}z = 0$
and so overall
$$
E[x] = \int_{-\infty}^\infty \frac{1}{(2\pi\sigma^2)^{1/2}}e^{-\frac{1}{2\sigma^2}z^2}\mu \,dz
$$
A: 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$$
