Ways to solve the Gaussian Integral

Introduction

Assalamualaikum! It's been a while since my last post (approximately 7 months ago lol). A lot of things happens in the past 7 months! Started my MSc Statistics last September and now I am already in my second semester, Alhamdulillah!

In this post, I will talk about a famous integral, which I am pretty sure most Maths BSc student encounter this in their first or second-year statistics course, the Gaussian Integral. I will show you two ways to solve this integral. The first method involves some calculus (which was my initial approach when I first encountered this integral back in my first year) while the second method is probably more intuitive.

Before I start, let's look back at the form of this integral:

\[ \int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx\]

The integral above is equal to \(\sqrt{2\pi}\). Let's us show this two different ways. I used to prefer the first method since it's just evaluating integral and some calculus, but now I think the second method is much more clever (using some probability theory).

Method 1

The first method involves some calculus, specifically using Double Integrals in Polar Coordinates. That is, \[\int\int_{\mathbb{R}}f(x,y)dxdy=\int_{\theta_{1}}^{\theta_{2}}\int_{r_{1}}^{r_{2}}f(r)rdrd\theta\]

Now using this method, let us denote the Gaussian Integral as \(I=\int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx\). Then,

\[I^2=\int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx\int_{-\infty}^{\infty}e^{-\frac{y^2}{2}}dy\] \[I^2=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-\frac{x^2+y^2}{2}}dxdy\]

Using the polar coordinates, where \(r^2=x^2+y^2\), this is actually a circle. This means that \(\theta \in [0, 2\pi]\). Hence, using the Double Integrals in Polar Coordinates method, \(I^2\) can be expressed as: \[I^2=\int_{0}^{2\pi}\int_{0}^{\infty}e^{-\frac{r^2}{2}}rdrd\theta\]

Set \(u=\frac{r^2}{2}\) and hence \(du=rdr\),

\[I^2=\int_{0}^{2\pi}\int_{0}^{\infty}e^{-u}dud\theta\] \[I^2=\int_{0}^{2\pi}d\theta=2\pi\]

This gives \(I=\sqrt{2\pi}\). Shown!

More explanation from this video: https://www.youtube.com/watch?v=l27xKSNad2Y

Method 2

The second method is simpler (imo). First, let's recall which probability distribution contains the gaussian integral?

The answer is standard normal distribution, which has a probability density function of:

\[f(x)=\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}, \forall x\in \mathbb{R}\]

Recall that the pdf of any continuous distribution, when integrated over its entire domain, the result will equal to 1, that is \(\int_{\mathbb{R}}f(x)dx=1\). In this case, the domain is all real numbers, which range from \(-\infty\) to \(\infty\).

\[\int_{\mathbb{R}}f(x)dx=\int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}dx=1\]

Now, if we move the constant \(\frac{1}{\sqrt{2\pi}}\) to the right hand side...

\[\int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx=\sqrt{2\pi}\]

The left hand side is the Gaussian Integral... and it is shown by this method that it is equal to \(\sqrt{2\pi}\). Wow!

Extras...

Now, suppose that while you are doing your calculus or probability exercises, you are required to solve this integral:

\[ \int_{0}^{\infty}e^{-\frac{x^2}{2}}dx\]

How are you going to solve this? Here, the domain is no longer the same with the Gaussian Integral (Notice that the integral now has limits from \(0\) to \(\infty\)). So how?

Chill! By method 2, recall that the Gaussian Integral comes from the pdf of the standard normal distribution. Since the standard normal distribution is symmetric around 0 (see the image below - sorry for my bad drawing, but generally that's the shape of a standard normal distribution), we can use symmetry to evaluate the integral.

Now, if we look at the standard normal distribution only starting from 0 to \(\infty\), this is basically looking at the distribution halved. Hence,

\[\int_{0}^{\infty}f(x)dx=\frac{1}{2}\] \[\int_{0}^{\infty}\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}dx=\frac{1}{2}\]

Again, just move the constant to the right hand side:

\[\int_{0}^{\infty}e^{-\frac{x^2}{2}}dx=\frac{\sqrt{2\pi}}{2}\]

This result is also the same if we take the integral from \(-\infty\) to 0 (by symmetry).

Okay, that's the end of this post. Hope you will find this useful!

Comments

Post a Comment

Popular posts from this blog

Finding the MLE of Multiple Linear Regression