Variance and Standard Deviation

When analysing a dataset, knowing only the average (mean) is often not enough. Two classes could have the same mean exam score yet one class could have scores tightly clustered around 70 while the other ranges from 20 to 100. Variance and standard deviation are the most widely used measures of spread, quantifying how far individual data values typically lie from their mean. They are the foundation of almost every branch of inferential statistics. Both measures are built on the idea of a deviation: the signed distance between each data value and the mean. Because positive and negative deviations cancel when simply summed, statisticians square each deviation before averaging them. This squared average is the variance. Taking the square root of the variance returns the standard deviation, which has the convenient property of being expressed in the same units as the original data — making it directly interpretable. There are two closely related versions of each formula: the population version (used when you have every member of the group) and the sample version (used when your data is a subset drawn from a larger population). Understanding when to use each version, and why the sample formula divides by n − 1 rather than n, is one of the key conceptual milestones in a first statistics course.

Key takeaways
  • Find the mean
  • Calculate each deviation
  • Square the deviations
  • Average the squared deviations to get variance
  • Take the square root to get standard deviation

Find the mean

Add all data values and divide by the number of values. For a dataset x₁, x₂, …, xₙ the mean is x̄ = (x₁ + x₂ + ⋯ + xₙ) / n. This is the reference point from which all deviations are measured.

Calculate each deviation

Subtract the mean from every individual value: (xᵢ − x̄). A positive deviation means the value is above average; a negative deviation means it is below. Notice that the sum of all deviations always equals zero, which is why we cannot simply average them.

Square the deviations

Compute (xᵢ − x̄)² for every data point. Squaring eliminates negative signs, ensures larger deviations contribute more heavily than small ones, and produces the 'sum of squares' — a central quantity in statistics.

Average the squared deviations to get variance

For a population of N values, divide the total sum of squared deviations by N: σ² = Σ(xᵢ − μ)² / N. For a sample of n values, divide by (n − 1) instead: s² = Σ(xᵢ − x̄)² / (n − 1). Dividing by n − 1 (Bessel's correction) compensates for the fact that a sample mean is closer to the sample data than the true population mean is, which would otherwise cause the sample variance to systematically underestimate the population variance.

Take the square root to get standard deviation

σ = √σ² for a population and s = √s² for a sample. The standard deviation is in the same units as the data (e.g., marks, centimetres, seconds), making it far easier to interpret than variance. A small standard deviation indicates data points are tightly packed; a large one indicates they are widely spread.

The Key Equation

s=∑i=1n(xi−xˉ)2n−1s = \sqrt{\frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n-1}}
  • s — Sample standard deviation (same as data): The typical distance of a data value from the sample mean; the most common measure of spread in practice.
  • x_i — Individual data value (same as data): The i-th observation in the dataset.
  • \bar{x} — Sample mean (same as data): The arithmetic average of the sample, computed as Σxᵢ / n.
  • n — Sample size (dimensionless): The total number of observations in the sample.
  • n-1 — Degrees of freedom (dimensionless): Using n − 1 instead of n (Bessel's correction) produces an unbiased estimate of the population variance.

Worked Example

Problem. Five students scored the following marks on a quiz: 4, 7, 13, 2, 9. Calculate the sample variance s² and the sample standard deviation s.

s2=18.5,s=18.5≈4.30s^2 = 18.5, \quad s = \sqrt{18.5} \approx 4.30

Answer. Sample variance s² = 18.5 marks²; sample standard deviation s ≈ 4.30 marks.

Figure
Diagram
Squared Deviations for the Quiz ScoresData value (xᵢ)(xᵢ − x̄)²0247913091827362540936s²=18.5x̄=7
Origins · 1 minKarl Pearson and how this was discovered
KP
Karl Pearson
1857–1936 · British

Karl Pearson formalised and popularised the standard deviation as a measure of spread, coining the term 'standard deviation' in 1894. He also developed the correlation coefficient, the chi-squared test, and founded the first university statistics department, establishing statistics as a rigorous scientific discipline. Pearson was such a prolific writer that his collected papers fill 18 volumes. He was also a committed social activist who believed passionately — controversially by today's standards — in using statistics to improve society, and he spent years in public disputes with fellow statistician Ronald Fisher over the correct foundations of statistical inference.

  • The Arithmetic Mean — The mean is the reference point from which every deviation in the variance formula is measured; you must compute it first.
  • Range and Interquartile Range — Range and IQR are simpler measures of spread; comparing them with standard deviation reveals why squared-deviation measures are preferred for symmetric distributions.
  • The Normal Distribution — Standard deviation is the key parameter of the normal distribution; the 68-95-99.7 rule describes how data cluster within 1, 2, and 3 standard deviations of the mean.
  • Z-Scores and Standardisation — A z-score expresses any data value as a number of standard deviations from the mean, directly applying the concept of standard deviation to compare values across different datasets.