# Variance of Bernoulli Distribution/Proof 5

## Theorem

Let $X$ be a discrete random variable with the Bernoulli distribution with parameter $p$:

$X \sim \Bernoulli p$

Then the variance of $X$ is given by:

$\var X = p \paren {1 - p}$

## Proof

From Moment Generating Function of Bernoulli Distribution, the moment generating function of $X$, $M_X$, is given by:

$\displaystyle \map {M_X} t = q + p e^t$
$\displaystyle \var X = \expect {X^2} - \paren {\expect X}^2$
$\displaystyle \expect {X^2} = \map {M_X''} 0$

We have:

 $\displaystyle \map {M_X''} t$ $=$ $\displaystyle \frac {\d^2} {\d t^2} \paren {q + p e^t}$ $\displaystyle$ $=$ $\displaystyle p \frac \d {\d t} \paren {e^t}$ Derivative of Constant, Derivative of Exponential Function $\displaystyle$ $=$ $\displaystyle p e^t$ Derivative of Exponential Function

Setting $t = 0$ gives:

 $\displaystyle \expect {X^2}$ $=$ $\displaystyle p e^0$ $\displaystyle$ $=$ $\displaystyle p$ Exponential of Zero

In Expectation of Bernoulli Distribution, it is shown that:

$\displaystyle \expect X = p$

So:

 $\displaystyle \var X$ $=$ $\displaystyle p - p^2$ $\displaystyle$ $=$ $\displaystyle p \paren {1 - p}$

$\blacksquare$