Definition · applies to random variables and data

High school

Consider data $x_1, \dots, x_n$ with mean $\bar{x}$. The variance of the data is the mean of the squared distances from the mean:

\[\operatorname{Var} = \frac{1}{n} \sum_{i = 1}^{n} (x_i - \bar{x})^2.\]
Undergraduate

Consider a random variable $X$ with expected value $\mu = \mathbb{E}[X]$. The variance of $X$ is

\[\operatorname{Var}(X) = \mathbb{E}[(X - \mu)^2].\]

Examples

Worked examples

  • Value:

    $\frac{74}{9} \approx 8.22$

    $\frac{(2 - \frac{16}{3})^2 + (5 - \frac{16}{3})^2 + (9 - \frac{16}{3})^2}{3} = \frac{74}{9}$
  • Value:

    $\operatorname{Var}(X) = \mathbb{E}[X^2] - 3.5^2 = \frac{91}{6} - \frac{49}{4} = \frac{35}{12} \approx 2.92$

  • Value:

    $\sigma^2 = 1/150 \approx 0.0067$ m$^2$

    The variance of the heights $1.6$, $1.7$, and $1.8$ m is the average of the squared differences from the mean $1.7$ m: \[\sigma^2 = \frac{(-0.1)^2 + 0^2 + 0.1^2}{3} = \frac{0.02}{3} = \frac{1}{150} \approx 0.0067 \ \mathrm{m}^2.\] The variance is in square meters, because the differences are squared.
  • Value:

    $\frac{(1.5)^2 + (0.5)^2 + (0.5)^2 + (1.5)^2}{4} = \frac{5}{4} = 1.25$

    The variance of the data $1, 2, 3, 4$ divides the sum $5$ of the squared distances from the mean $2.5$ by the number of data points, $4$.
  • Value:

    $0$

    The variance of the single data point $5$ is $0$, because the data point equals its mean.

Properties

  • The variance is in squared units: if $X$ is in meters, $\operatorname{Var}(X)$ is in square meters.
  • The high-school formula, which divides by $n$, gives the variance of the data themselves, such as the variance of a whole population. If the data are a random sample from a larger population, then the sample variance, which divides by $n - 1$ instead of $n$, gives a better estimate of the population variance.

Distinctions involving this term

  • Variance vs. Sample Variance: The spread of data is measured by the average squared distance of the data from their mean. The variance of the data divides the sum of the squared distances by the number $n$ of data points, which describes the data themselves. The sample variance divides by $n - 1$ instead, which gives an unbiased estimate of the variance of the population that the data were sampled from.
  • Variance vs. Standard Deviation: Variance and standard deviation both measure how spread out data or a random variable is around the mean. The variance is the mean squared distance from the mean, in squared units. The standard deviation is the square root of the variance, in the same units as the data.

All definitions · All distinctions · All examples · Notation