= Variance
{title2=$\operatorname{Var}(X)$}
{wiki}
The <variance> measures the mean squared distance of a <random variable> from its <expected value>. For a real <square-integrable> <random variable> $X$,
$$
\operatorname{var}(X)=\mathbb E[(X-\mathbb EX)^2]
=\mathbb E[X^2]-(\mathbb EX)^2.
$$
The square prevents positive and negative deviations from cancelling. It also gives the <variance> squared units: if $X$ measures a <length> in metres, its <variance> has units of square metres. Its nonnegative square root is the <standard deviation>, which has the same units as $X$.
For example, let $X$ take $-1$, $0$ and $1$ with equal <probabilities>. Its <expected value> is zero, but its <variance> is $[(-1)^2+0^2+1^2]/3=2/3$, and its <standard deviation> is $\sqrt{2/3}$. The constant <random variable> zero has the same <expected value> and zero <variance>: a <mean> alone does not describe the spread. The <variance> is zero exactly when $X=\mathbb E X$ <almost surely>.
The <variance> is useful because squared deviations interact neatly with <linear combinations>. The <covariance> supplies the cross terms when combining different <random variables>, and a <covariance matrix> organizes those terms for many variables. The characterization of <variance as the minimum mean squared error of a constant> also explains why the <expected value> is the best constant prediction under squared error.
Back to article page