Tuesday, 8 March 2011

Evaluating the integral of a Gaussian

Okay, so I thought I'd take a step back from the quite technical blog about finding the Volume of an n-sphere and look at some of the (often overlooked) techniques that were used.

First, is evaluating the following integral of a gaussian - which occurs very commonly in branches of physics and engineering;

$$I=\int_{-\infty}^{\infty} e^{-x^2} dx$$

Let's now have a look at what $$I^2$$ looks like;
$$I^2=\left(\int_{-\infty}^{\infty} e^{-x^2} dx\right)^2=\int_{-\infty}^{\infty} e^{-x^2}dx \cdot \int_{-\infty}^{\infty} e^{-x^2}dx$$
Now, using a dummy variable y in the second integral , we get;
$$I^2=\int_{-\infty}^{\infty} e^{-x^2}dx \cdot \int_{-\infty}^{\infty} e^{-y^2}dy$$
Note: We can use dummy variables since they are exactly that; a variable which is only used to integrate over and (presumably) does not appear in the evaluated integral.
We can bring the exponents together - the integrals are independent.
$$I^2=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} e^{-(x^2+y^2)}dxdy$$

Now we use a change of variable from cartesian coordinates to polar with;
$$x=rcos(\theta)$$ and
With the determinant of the Jacobian matrix being $$r d\theta dr$$ and noting the change of terminals of integration.

Hence $$I^2=\int_{0}^{2\pi}\int_{0}^{\infty} e^{-r^2} r dr d\theta$$
Noting that nothing in the integrand depends on theta.
Now, letting $$u=r^2$$ we get $$\frac{du}{dr}=2r$$ so $$dr=\frac{du}{2r}$$
We get $$I^2= 2\pi \int_{u=0}^{u=\infty} e^{-u} r \frac{du}{2r}$$

Finally; $$I^2= \frac{2\pi}{2} \left[-e^{-u}\right]_{u=0}^{u=\infty}=\pi \left[-\left(e^{-\infty}-e^0\right)\right]=\pi$$

Hence $$I^2=\pi \rightarrow I=\sqrt{\pi}$$

Note: This isn't really a strict or rigorous derivation - as I just dealt with the Improper Integrals without taking limits and checking their convergence. This was intended just to get the general idea across.

To be continued...


  1. It's been a long time since I did any complex maths.
    You know what they say, use it or lose it.

  2. @Raw: That is so true :x I remember some parts, but only barely..

  3. If all your posts will be like this, I might get addicted to your blog.

  4. Wow, a couple of years ago this would have made perfect sense to me.

  5. Agreed with everyone else, I've lost this part of my brain.