# What is the formula for the variance of a probability distribution?

Feb 27, 2017

Often a shorthand notation is used, where the limits of summation (or integration) are omitted, and sometimes the subscripts;

For a discrete Random Variable X, where:

${\sum}_{i = 1}^{n} P \left({x}_{i}\right) = \sum P \left(X = x\right) = \sum P \left(x\right) = 1$

then the Expectation is defined by:

$E \left(X\right) = {\sum}_{i = 1}^{n} \setminus {x}_{i} \setminus P \left(X = {x}_{i}\right) = \sum x P \left(x\right)$

Then the variance is defined by:

$V a r \left(X\right) = E \left({X}^{2}\right) - {\left\{E \left(X\right)\right\}}^{2}$
$\text{ } = {\sum}_{i = 1}^{n} \setminus {x}_{i}^{2} \setminus P \left(X = {x}_{i}\right) - {\left\{{\sum}_{i = 1}^{n} \setminus {x}_{i} \setminus P \left(X = {x}_{i}\right)\right\}}^{2}$
$\text{ } = \sum {x}^{2} P \left(x\right) - {\left\{\sum x P \left(x\right)\right\}}^{2}$

We get similar results for a continuous Random Variable $X$, where:

$P \left(a \le X \le b\right) = {\int}_{a}^{b} \setminus f \left(x\right) \setminus \mathrm{dx} = 1$

and the Expectation, is defined by (and shorthand):

$E \left(X\right) = {\int}_{a}^{b} \setminus x f \left(x\right) \setminus \mathrm{dx} = {\int}_{D} \setminus x f \left(x\right) \setminus \mathrm{dx}$

and the variance is defined by:

$V a r \left(X\right) = E \left({X}^{2}\right) - {\left\{E \left(X\right)\right\}}^{2}$
$\text{ } = {\int}_{a}^{b} \setminus {x}^{2} f \left(x\right) \setminus \mathrm{dx} - {\left\{{\int}_{a}^{b} \setminus x f \left(x\right) \setminus \mathrm{dx}\right\}}^{2}$
$\text{ } = {\int}_{D} \setminus {x}^{2} f \left(x\right) \setminus \mathrm{dx} - {\left\{{\int}_{D} \setminus x f \left(x\right) \setminus \mathrm{dx}\right\}}^{2}$