# Gaussian Notes

## Understanding The Curve Formula

### An intuitive look...

The gaussian is a bell shaped curve who's basic shape is defined by the following equation. $$y = e^{-x^2}$$ The familiar bell-shaped curve is plotted below. Most of the plots on this page are done using the amazing MPLD3 JS library, with data saved from IPython matplotlib MPLD3 plots. This means you should be able to interactively zoom in and pan the graphs if you like...

Below is an exponential curve $e^x$. It is easy to see that as $x$ increases the $y$ value increases at an exponential rate. This kinda looks like one of the sides of a gaussian curve... if we could add the mirror image in and make a smooth "join" between the two, we'd be getting there...

The exponential will just tend to infinity. Note that it hits a $y$-value of 1 when $x$ is zero. Note that the guassian above hits a value of 1 at the some point. So, what if we made the input to the exponential function a series of $x$ values that increased up towards zero and then decreased in a mirror image fashion? The input to our exponention could be defined as $-|x|$, ie., we'd plot $$e^{-|x|}$$ This would give us the following graph...

The green curve is the exponential. The blue is the input we've given the exponential function. Now the $x$-range is always negative, and taking the exponent of the negative number produces a small number which exponentially increases to 1 when as $x$ approaches 0. That's why we see a graph increasing from zero to one and then decreasing in the mirror image...

It's beginning to look a little like a gaussian but the peak is somewhat discontinuous right at the top... it ends in a pin head as $x$ increases linearly towards zero.

To smooth this pin head out we need to exponentially increase in the middle of the curve on either side of centre but as we apprach center we want to decrease our rate of increase. In other words as x approaches zero the input to the exp function needs to increase less than linearly, to the point where the rate of increase at $x=0$ is zero and we smoothly accellerate in and out of this point.

We've transformed our input to the exponential function from a basic $x$ series to something that helps produce a steeple-like curve. Can we transform this further so that for each element in the $x$ series the distance between each pair of values decreacreases towards zero as $x$ approaches zero?

Have a look at an inverted parabola...

It's clear to see that for values of $x$ closer to zero the rate of increase in $y$ is far less. Thus at large absolute values of $x$ the rate of increase in $y$ is large and as we get closer to $x = 0$ the rate of increase in $y$ approaches zero. So, the $y$ values can become our input to the exponential function as they still have this property of symmetry about zero and being all negative. They also have the extra property we're looking for... the smoothness at $x = 0$.

So, this is how we get to our Gaussian function! $$y = e^{-x^2}$$

The green curve is the exponential. The blue is the input we've given the exponential function.

### Some Properties Of This Curve

The integral of the above function, $e^{-x^2}$, is $\sqrt\pi$. Therefore, if we divide the function by $\sqrt\pi$ we get a curve under which the area is 1, and doing this gives us something that almost looks like the Guassian probability function! $$P(x) = \frac{1}{\sqrt\pi} \cdot e^{-x^2}$$ If we added in terms to adjust the mean of the function and the standard deviation we'd get the final function... $$P(x) = \frac{1}{\sigma\sqrt{2\pi}} \cdot e^{-{(x-\mu)^2}/{2\sigma^2}}$$ The above is called the normal distribution. For any normal distribution the following applies:

• About 68% of the data will fall within one standard deviation, $\sigma$, of the mean $\mu$,
• About 95% of the data will fall within two standard deviations, $\sigma$, of the mean $\mu$,
• Over 99% of the data will fall within three standard deviations, $\sigma$, of the mean $\mu$.