# How do you derive the variance of a Gaussian distribution?

##### 1 Answer
Nov 26, 2015

Suppose $x$ has a probability density function $f \left(x\right)$. The variance of $x$ is calculated by ${\int}_{-} {\infty}^{\infty} {\left(x - \mu\right)}^{2} f \left(x\right) \mathrm{dx}$, where $\mu$ is the expected value of $x$ and is calculated by $\mu = {\int}_{-} {\infty}^{\infty} x f \left(x\right) \mathrm{dx}$.

#### Explanation:

The graph of a Gaussian is a characteristic symmetric "bell curve" shape.

The simplest case of a normal distribution is known as the standard normal distribution , described by the probability density function: $g \left(z\right) = \frac{1}{\sqrt{2 \pi}} {e}^{- \frac{{z}^{2}}{2}}$.

Since the area under the curve is given by ${\int}_{-} {\infty}^{\infty} g \left(z\right) \mathrm{dz}$, The factor $\frac{1}{\sqrt{2 \pi}}$ in this expression ensures that the total area under $g \left(z\right)$ is equal to $1$, as should all PDF.

The mean of $z$ is given by:

$\text{E} \left(z\right) = {\int}_{-} {\infty}^{\infty} z g \left(z\right) \mathrm{dz}$

$= {\int}_{-} {\infty}^{0} z g \left(z\right) \mathrm{dz} + {\int}_{0}^{\infty} z g \left(z\right) \mathrm{dz}$.

$= 0$

($g$ is an even function, so the first half of the integral is equal to the negative of the second half of the integral. Since $g \left(- z\right) = g \left(z\right)$, substituting $u = - z$ for the second integral should do the trick.)

The variance of $z$ is given by:

"Var"(z) = int_-oo^oo (z-"E"(z))^2g(z) dz

$= {\int}_{-} {\infty}^{\infty} {z}^{2} g \left(z\right) \mathrm{dz}$

$= {\int}_{-} {\infty}^{\infty} \frac{{z}^{2}}{\sqrt{2 \pi}} {e}^{- \frac{{z}^{2}}{2}} \mathrm{dz}$

$= 1$

(There are special techniques involved in computing integrals of this kind. The details are not shown but the result can be easily verified with a calculator.)

Substituting $x = \sigma z + \mu$, we get the probability density of the Gaussian distribution:

$f \left(x | \sigma , \mu\right) = \frac{1}{\sigma \sqrt{2 \pi}} {e}^{- \frac{{\left(x - \mu\right)}^{2}}{2 {\sigma}^{2}}}$.

$\mu$ determines the location of the maximum and $\sigma$ determines how narrow/tall the maximum should be.

The variance is given by

$\text{Var"(x) = "Var} \left(\sigma z + \mu\right)$

$= {\sigma}^{2} \text{Var} \left(z\right)$

$= {\sigma}^{2} \left(1\right)$

$= {\sigma}^{2}$