Gaussian integral

Required math: calculus

Required physics: none

Many mathematicians have remarked that the simple formula

\displaystyle  e^{i\pi}=-1 \ \ \ \ \ (1)

is amazing since it relates four of the fundamental constants of mathematics that, at first glance, would seem to have no relation to each other at all.

Perhaps not quite on the same level as this formula, but still remarkable, is another relatively simple formula, known as the Gaussian integral:

\displaystyle  \int_{-\infty}^{\infty}e^{-x^{2}}dx=\sqrt{\pi} \ \ \ \ \ (2)

Although it contains only two of the fundamental constants ({e} and {\pi}), it relates these two constants in another unexpected way.

It is known as the Gaussian integral since it integrates the Gaussian function {e^{-x^{2}}}, which is the standard bell-shaped curve found in many mathematical and physical applications, especially in statistics, where the Gaussian or normal distribution is one of the common distributions of random data.

We’ll leave its applications for another post. Here we are interested in how such a remarkable formula can be proved. Many students learning calculus have tried (unsuccessfully) to find the indefinite integral of {e^{-x^{2}}}. It seems that it should be possible, since the function {e^{-x}} has a simple indefinite integral ({\int e^{-x}dx=-e^{-x}+C}). However, despite the many hours spent on the problem by frustrated undergraduates, the unfortunate answer is that there is no simple formula for the integral of {e^{-x^{2}}}. So we can’t just find the indefinite integral and then plug in the limits to find the answer.

There are several ways to evaluate the integral but probably the easiest to understand uses a change of coordinate system. Suppose that instead of calculating the integral in one dimension as in 2, we calculate a similar integral in two dimensions. That is, we want to find

\displaystyle  I_{2}\equiv\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(x^{2}+y^{2})}dx\;dy \ \ \ \ \ (3)

This seems counter-intuitive since it looks like we have just made the problem harder. However, we can decouple the two integrals like this:

\displaystyle   I_{2} \displaystyle  \equiv \displaystyle  \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(x^{2}+y^{2})}dx\;dy\ \ \ \ \ (4)
\displaystyle  \displaystyle  = \displaystyle  \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-x^{2}}e^{-y^{2}}dx\;dy\ \ \ \ \ (5)
\displaystyle  \displaystyle  = \displaystyle  \int_{-\infty}^{\infty}e^{-x^{2}}dx\int_{-\infty}^{\infty}e^{-y^{2}}dy\ \ \ \ \ (6)
\displaystyle  \displaystyle  = \displaystyle  \left(\int_{-\infty}^{\infty}e^{-x^{2}}dx\right)^{2} \ \ \ \ \ (7)

Now for the coordinate transformation. The original integral {I_{2}} integrates a function over the entire {xy} plane. We can use polar coordinates {(r,\theta)} to do the same integral. The area element {dxdy} transforms to {rdrd\theta} in polar coordinates, and the limits of integration are {0\rightarrow\infty} for {r}, and {0\rightarrow2\pi} for {\theta}. Furthermore, since {x=r\cos\theta} and {y=r\sin\theta}, the quantity in the exponent becomes {x^{2}+y^{2}=r^{2}}. Thus the integral transforms to

\displaystyle   I_{2} \displaystyle  \equiv \displaystyle  \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(x^{2}+y^{2})}dx\;dy\ \ \ \ \ (8)
\displaystyle  \displaystyle  = \displaystyle  \int_{0}^{\infty}\int_{0}^{2\pi}e^{-r^{2}}rd\theta dr\ \ \ \ \ (9)
\displaystyle  \displaystyle  = \displaystyle  2\pi\int_{0}^{\infty}re^{-r^{2}}dr\ \ \ \ \ (10)
\displaystyle  \displaystyle  = \displaystyle  2\pi(-e^{-r^{2}}/2)\big|_{0}^{\infty}\ \ \ \ \ (11)
\displaystyle  \displaystyle  = \displaystyle  \pi \ \ \ \ \ (12)

The extra factor of {r} that occurs in the area element allows the integral to be done. Since we saw above that this result is the square of the integral that we want, we get the final result:

\displaystyle  \int_{-\infty}^{\infty}e^{-x^{2}}dx=\sqrt{\pi} \ \ \ \ \ (13)

Since {e^{-x^{2}}} is an even function (it is symmetric about the {y}-axis), we also have the formula

\displaystyle  \int_{0}^{\infty}e^{-x^{2}}dx=\sqrt{\pi}/2 \ \ \ \ \ (14)

As a footnote, we can note that the Gaussian integral is a special case of the error function, which is defined as

\displaystyle  erf(x)\equiv\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{-t^{2}}dt \ \ \ \ \ (15)

Although this integral cannot be evaluated in a closed form, it can be approximated by expanding the exponential as a Taylor series and integrating term-by-term. In light of our earlier results, we can also see why the factor of {2/\sqrt{\pi}} occurs in the definition of {erf(x)}: it cancels the factor of {\sqrt{\pi}/2} that turns up in the Gaussian integral, so we get {erf(\infty)=1}.

Variants of the Gaussian integral are not that difficult to find. For example

\displaystyle  \int_{-\infty}^{\infty}e^{-ax^{2}}dx \ \ \ \ \ (16)

where {a} is a complex number, can be found by a substitution {u=\sqrt{a}x}. We get

\displaystyle  \int_{-\infty}^{\infty}e^{-ax^{2}}dx=\frac{1}{\sqrt{a}}\int_{-\infty}^{\infty}e^{-u^{2}}du=\sqrt{\frac{\pi}{a}} \ \ \ \ \ (17)

Note that in order for this substitution to work, the upper limit in 11 has to be zero, so the real part of {u} must tend to {+\infty} at the upper limit. This means that {\sqrt{a}} must have a positive real part. If we write {a} in modulus argument form, we have

\displaystyle  a=\left|a\right|e^{i\theta} \ \ \ \ \ (18)


\displaystyle  a^{1/2}=\begin{cases} \left|\sqrt{a}\right|e^{i\theta/2}\\ \left|\sqrt{a}\right|e^{i\left(\pi+\theta/2\right)} \end{cases} \ \ \ \ \ (19)

In order that {a^{1/2}} has a positive real part, we can choose {-\pi<\theta<\pi} to specify the argument, and then take the first square root above, so that {-\frac{\pi}{2}<\frac{\theta}{2}<\frac{\pi}{2}}. Thus for any complex number except one with a negative real part and zero imaginary part (that is, a real, negative number), we can satisfy the condition, provided that the {\sqrt{a}} that appears in the denominator of 17 is given by {\left|\sqrt{a}\right|e^{i\theta/2}}. In particular, if {a} is pure imaginary (zero real part), then

\displaystyle  a^{1/2}=\begin{cases} \left|\sqrt{a}\right|e^{i\pi/4} & \mbox{if }\Im\left(a\right)>0\\ \left|\sqrt{a}\right|e^{-i\pi/4} & \mbox{if }\Im\left(a\right)<0 \end{cases} \ \ \ \ \ (20)

Another common Gaussian integral is

\displaystyle  I_{2n}\left(a\right)=\int_{-\infty}^{\infty}x^{2n}e^{-ax^{2}}dx \ \ \ \ \ (21)

We can evaluate these by treating {a} as a variable and taking the derivative. For example, using 17

\displaystyle   I_{2}\left(a\right) \displaystyle  = \displaystyle  -\frac{\partial}{\partial a}I_{0}\left(a\right)\ \ \ \ \ (22)
\displaystyle  \displaystyle  = \displaystyle  \frac{\sqrt{\pi}}{2a^{3/2}} \ \ \ \ \ (23)

and so on for higher values of {n}. [Note that {I_{2n+1}\left(a\right)=0} since the integrand is the product of an odd function {x^{2n+1}} with an even one {e^{-ax^{2}}} integrated over an interval symmetric about {x=0}.]

Finally, we can evaluate integrals containing a general quadratic as the exponent:

\displaystyle  I_{0}\left(a,b\right)=\int_{-\infty}^{\infty}e^{-ax^{2}+bx}dx \ \ \ \ \ (24)

The trick here is to complete the square in the exponent:

\displaystyle   -ax^{2}+bx \displaystyle  = \displaystyle  -a\left(x^{2}-\frac{b}{a}x\right)\ \ \ \ \ (25)
\displaystyle  \displaystyle  = \displaystyle  -a\left(x-\frac{b}{2a}\right)^{2}+\frac{b^{2}}{4a} \ \ \ \ \ (26)


\displaystyle   I_{0}\left(a,b\right) \displaystyle  = \displaystyle  e^{b^{2}/4a}\int_{-\infty}^{\infty}e^{-a\left(x-b/2a\right)^{2}}dx\ \ \ \ \ (27)
\displaystyle  \displaystyle  = \displaystyle  e^{b^{2}/4a}\int_{-\infty}^{\infty}e^{-au^{2}}du\ \ \ \ \ (28)
\displaystyle  \displaystyle  = \displaystyle  e^{b^{2}/4a}\sqrt{\frac{\pi}{a}} \ \ \ \ \ (29)

where in the second line we used the substitution

\displaystyle   u \displaystyle  = \displaystyle  x-\frac{b}{2a}\ \ \ \ \ (30)
\displaystyle  du \displaystyle  = \displaystyle  dx \ \ \ \ \ (31)

Since both limits are infinite, they remain the same when we integrate with respect to {u}.