# Solving the Gaussian Integral

Lord Kelvin wrote of this integral: “A mathematician is one to whom that is as obvious as that twice two makes four is to you. Liouville…

Lord Kelvin wrote of this integral: “A mathematician is one to whom that is as obvious as that twice two makes four is to you.”

Enjoy ;)

# Preliminaries and strategy

OK, so I’m going to assume you know some basic integration and differentiation. The following will add some intuition to clever tricks which come later. Don’t worry if some of it is slightly baffling, just try to get a feel for what is happening.

The strategy here will be to make a clever substitution. But we will do a substitution *in two variables*. You can visualise the current problem as calculating the area under a curve

But we will show that the problem can be turned into one of calculating a *volume.*

To calculate the volume, we use a slightly different change of variable formula to what you use in normal integrals. We will use polar co-ordinates. This expresses the x and y co-ordinates in terms of their radius and their angle. Geogebra have a nice interactive way of seeing it here

Then we will use the magical change of base formula for polar coordinates.

When calculating the area under the curve, we had the element ‘dx’ which represents a small distance along the x axis. When calculating a volume, we have dx dy, which is like a small rectangle with side length dx and dy. We then use these bases to create a series of boxes which estimate the volume. This is easiest to see with the visualisation below. The integral is the limit of these approximations.

When, instead, we use the polar coordinate system, we have a slightly different area element underneath. Below, dA is the area element. With small changes in the angle and the radius, this area element can be increasingly well approximated by a rectangle with side lengths dr and r*dtheta respectively. If you are comfortable with some geometry, for small theta sin(theta) is approximated very well by theta and you can then prove the result below.

# Solving the integral

First we give a name to our integral. We call it I.

Note that x is just a ‘dummy variable’. The area exists regardless of what variable name we use. So, we can also write the following two equations

Now, as I is just a constant, albeit one we don’t know the value of yet, we can use our normal rules for bringing a constant inside an integral

So far we haven’t done much substantive. Now we think hard about what the integral means. We take integrals of *functions*. If two functions take the same value everywhere, they are the same, and have the same area. With that in mind, we can make the following manipulations, if we view I*exp(-x²) as a function of x, i.e. something which takes in values of x as an input, and gives a number as an output.

Ok, that was a lot to take in. In the first line, we just rewrote I in its integral form with a different variable name. In the second line, treating I*exp(-x²) as a function, we realised that we can bring the exp(-x²) *inside *the dy integral, and this would still give the same output value for any input value of x. Finally, we used the rules of exponentiation.

Writing this out in full, we now have

Next comes the killer insight. Above we messed around with variable names and how to represent a function. Now we shift our perspective: this expression also represents the integral of exp(-(y²+x²)) over the whole 2D plane, with area element dA = dx dy. I.e. dx dy is a small rectangle on a plane, and exp(-(y²+x²)) is the height above that rectangle.

Next, we use the polar coordinate insights from earlier

As sin² + cos² = 1, after plugging everything in, we get

r ranges from 0 to infinity and theta ranges from 0 to 2*pi, because this covers the entire 2D plane: any point has a radius less than infinity, and an angle between 0 and 2pi radians.

We can evaluate the inner integral using the chain rule

And, into the promised land we now find ourselves:

*I’m Ethan, a maths student at Cambridge. Let me know what you think or any questions you have in the comments, and you can follow me on twitter, username **ethan_the_mathmo*