Variance as Expectation of Square minus Square of Expectation/Discrete

From ProofWiki
Jump to navigation Jump to search

Theorem

Let $X$ be a discrete random variable.

Then the variance of $X$ can be expressed as:

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


That is, it is the expectation of the square of $X$ minus the square of the expectation of $X$.


Proof

We let $\mu = \expect X$, and take the expression for variance:

$\var X := \ds \sum_{x \mathop \in \Img X} \paren {x - \mu}^2 \map \Pr {X = x}$

Then:

\(\ds \var X\) \(=\) \(\ds \sum_x \paren {x^2 - 2 \mu x + \mu^2} \map \Pr {X = x}\)
\(\ds \) \(=\) \(\ds \sum_x x^2 \map \Pr {X = x} - 2 \mu \sum_x x \map \Pr {X = x} + \mu^2 \sum_x \map \Pr {X = x}\)
\(\ds \) \(=\) \(\ds \sum_x x^2 \map \Pr {X = x} - 2 \mu \sum_x x \map \Pr {X = x} + \mu^2\) Definition of Probability Mass Function: $\ds \sum_x \map \Pr {X = x} = 1$
\(\ds \) \(=\) \(\ds \sum_x x^2 \map \Pr {X = x} - 2 \mu^2 + \mu^2\) Definition of Expectation: $\ds \sum_x x \map \Pr {X = x} = \mu$
\(\ds \) \(=\) \(\ds \sum_x x^2 \map \Pr {X = x} - \mu^2\)

Hence the result, from $\mu = \expect X$.

$\blacksquare$


Sources