Variance of Bernoulli Distribution

From ProofWiki
Jump to navigation Jump to search

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 1

From the definition of variance:

$\var X = \expect {\paren {X - \expect X}^2}$

From the Expectation of Bernoulli Distribution, we have $\expect X = p$.

Then by definition of Bernoulli distribution:

\(\displaystyle \expect {\paren {X - \expect X}^2}\) \(=\) \(\displaystyle \paren {1 - p}^2 \times p + \paren {0 - p}^2 \times \paren {1 - p}\)
\(\displaystyle \) \(=\) \(\displaystyle p - 2 p^2 + p^3 + p^2 - p^3\)
\(\displaystyle \) \(=\) \(\displaystyle p - p^2\)
\(\displaystyle \) \(=\) \(\displaystyle p \paren {1 - p}\)

$\blacksquare$


Proof 2

From Variance as Expectation of Square minus Square of Expectation:

$\var X = \expect {X^2} - \paren {\expect X}^2$

From Expectation of Function of Discrete Random Variable:

$\displaystyle \expect {X^2} = \sum_{x \mathop \in \Img X} x^2 \, \map \Pr {X = x}$


So:

\(\displaystyle \expect {X^2}\) \(=\) \(\displaystyle 1^2 \times p + 0^2 \times \paren {1 - p}\)
\(\displaystyle \) \(=\) \(\displaystyle p\)

Then:

\(\displaystyle \var X\) \(=\) \(\displaystyle \expect {X^2} - \paren {\expect X}^2\)
\(\displaystyle \) \(=\) \(\displaystyle p - p^2\) Expectation of Bernoulli Distribution
\(\displaystyle \) \(=\) \(\displaystyle p \paren {1 - p}\)

$\blacksquare$


Proof 3

We can simply use the Variance of Binomial Distribution, putting $n = 1$.

$\blacksquare$


Proof 4

From Variance of Discrete Random Variable from PGF, we have:

$\var X = \map { {\Pi_X}''} 1 + \mu - \mu^2$

where $\mu = \expect X$ is the expectation of $X$.


From the Probability Generating Function of Bernoulli Distribution, we have:

$\map {\Pi_X} s = q + p s$

where $q = 1 - p$.


From Expectation of Bernoulli Distribution, we have $\mu = p$.


We have $\map { {\Pi_X}''} s = 0$ from Derivatives of PGF of Bernoulli Distribution.


Hence:

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

$\blacksquare$


Proof 5

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$

From Variance as Expectation of Square minus Square of Expectation, we have:

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

From Moment in terms of Moment Generating Function:

$\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$