8

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!

Adam
  • 181
  • The calculations can be found in the answer to this post, http://math.stackexchange.com/questions/518281/how-to-derive-the-mean-and-variance-of-a-gaussian-random-variable/519631#519631 No polar coordinates needed. – Alecos Papadopoulos Oct 29 '13 at 16:08

3 Answers3

9

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

Tom
  • 10,118
  • 2
    This makes it very clear to me! Thank you! The second one evaluates to one because it is a pdf, and this is one of the properties of a pdf, right? – Adam Oct 30 '13 at 10:15
  • You're very welcome. And you got it! The integral over $(-\infty, \infty)$ of a pdf results in 1 (which intuitively makes perfect sense, since when you integrate a pdf over an interval, you are calculating the probability that the random variable lands in that interval, so when you integrate a pdf over $(-\infty, \infty)$ you are calculating the probability that the random variable takes on any value, which must be 1). – Tom Oct 30 '13 at 11:27
3

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

BaronVT
  • 13,751
3

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

Ron Gordon
  • 141,538