# Variance of Gaussian Distribution

## Theorem

Let $X \sim N \paren {\mu, \sigma^2}$ for some $\mu \in \R, \sigma \in \R_{> 0}$, where $N$ is the Gaussian distribution.

Then:

$\var X = \sigma^2$

## Proof 1

From the definition of the Gaussian distribution, $X$ has probability density function:

$f_X \left({x}\right) = \dfrac 1 {\sigma \sqrt{2 \pi} } \, \exp \left({-\dfrac { \left({x - \mu}\right)^2} {2 \sigma^2} }\right)$
$\displaystyle \operatorname{var} \left({X}\right) = \int_{-\infty}^\infty x^2 f_X \left({x}\right) \rd x - \left({\mathbb E \left[{X}\right]}\right)^2$

So:

 $\ds \operatorname{var} \left({X}\right)$ $=$ $\ds \frac 1 { \sigma \sqrt{2 \pi} } \int_{-\infty}^\infty x^2 \exp \left({- \frac {\left({x - \mu}\right)^2} {2 \sigma^2} }\right) \rd x - \mu^2$ Expectation of Gaussian Distribution $\ds$ $=$ $\ds \frac {\sqrt 2 \sigma} { \sigma \sqrt{2 \pi} } \int_{-\infty}^\infty \left({\sqrt 2 \sigma t + \mu}\right)^2 \exp \left({-t^2}\right) \rd t - \mu^2$ substituting $t = \dfrac {x - \mu} {\sqrt 2 \sigma}$ $\ds$ $=$ $\ds \frac 1 {\sqrt \pi} \left({2 \sigma^2 \int_{-\infty}^\infty t^2 \exp \left({-t^2}\right) \rd t + 2 \sqrt 2 \sigma \mu \int_{-\infty}^\infty t \exp \left({-t^2}\right) \rd t + \mu^2 \int_{-\infty}^\infty \exp \left({-t^2}\right) \rd t}\right) - \mu^2$ $\ds$ $=$ $\ds \frac 1 {\sqrt \pi} \left({2 \sigma^2 \int_{-\infty}^\infty t^2 \exp \left({-t^2}\right) \rd t + 2\sqrt 2 \sigma \mu \left[{-\frac 1 2 \exp \left({-t^2}\right)}\right]_{-\infty}^\infty + \mu^2 \sqrt \pi}\right) - \mu^2$ Fundamental Theorem of Calculus, Gaussian Integral $\ds$ $=$ $\ds \frac 1 {\sqrt \pi} \left({2 \sigma^2 \int_{-\infty}^\infty t^2 \exp \left({-t^2}\right) \rd t + 2\sqrt 2 \sigma \mu \cdot 0}\right) + \mu^2 - \mu^2$ Exponential Tends to Zero and Infinity $\ds$ $=$ $\ds \frac {2 \sigma^2} {\sqrt \pi} \int_{-\infty}^\infty t^2 \exp \left({-t^2}\right) \rd t$ $\ds$ $=$ $\ds \frac {2 \sigma^2} {\sqrt \pi} \left({\left[{-\frac t 2 \exp \left({-t^2}\right)}\right]_{-\infty}^\infty + \frac 1 2 \int_{-\infty}^\infty \exp \left({-t^2}\right) \rd t}\right)$ Integration by Parts $\ds$ $=$ $\ds \frac {2 \sigma^2} {\sqrt \pi} \cdot \frac 1 2 \int_{-\infty}^\infty \exp \left({-t^2}\right) \rd t$ Exponential Tends to Zero and Infinity $\ds$ $=$ $\ds \frac{2 \sigma^2 \sqrt \pi} {2 \sqrt \pi}$ Gaussian Integral $\ds$ $=$ $\ds \sigma^2$

$\blacksquare$

## Proof 2

By Moment Generating Function of Gaussian Distribution, the moment generating function of $X$ is given by:

$\map {M_X} t = \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2}$
$\var X = \expect {X^2} - \paren {\expect X}^2$

From Moment in terms of Moment Generating Function, we also have:

$\expect {X^2} = \map {M''_X} 0$

We have:

 $\ds \map {M''_X} t$ $=$ $\ds \frac {\d^2} {\d t^2} \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2}$ $\ds$ $=$ $\ds \map {\frac \d {\d t} } {\map {\frac \d {\d t} } {\mu t + \frac 1 2 \sigma^2 t^2} \frac \d {\map \d {\mu t + \dfrac 1 2 \sigma^2 t^2} } \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2} }$ Chain Rule for Derivatives $\ds$ $=$ $\ds \map {\frac \d {\d t} } {\paren {\mu + \sigma^2 t} \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2} }$ Derivative of Power, Derivative of Exponential Function $\ds$ $=$ $\ds \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2} \map {\frac \d {\d t} } {\mu + \sigma^2 t} + \paren {\mu + \sigma^2 t} \frac \d {\d t} \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2}$ Product Rule $\ds$ $=$ $\ds \sigma^2 \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2} + \paren {\mu + \sigma^2 t}^2 \map \exp {\mu t + \dfrac 1 2 \sigma^2 t^2}$

Setting $t = 0$, we obtain the second moment:

 $\ds \map {M''_X} 0$ $=$ $\ds \expect {X^2}$ $\ds$ $=$ $\ds \sigma^2 \map \exp {0 \mu + 0 \sigma^2} + \paren {\mu + 0 \sigma^2}^2 \map \exp {0 \mu + 0 \sigma^2}$ $\ds$ $=$ $\ds \sigma^2 \exp 0 + \mu^2 \exp 0$ $\ds$ $=$ $\ds \sigma^2 + \mu^2$ Exponential of Zero

So:

 $\ds \var X$ $=$ $\ds \sigma^2 + \mu^2 - \paren {\expect X}^2$ $\ds$ $=$ $\ds \sigma^2 + \mu^2 - \mu^2$ Expectation of Gaussian Distribution $\ds$ $=$ $\ds \sigma^2$

$\blacksquare$