Skip to lesson content

Lesson 3 of 6

Statistics · Lesson 3 of 6

Variance and Standard Deviation

“Average squared deviations to measure spread, then restore the original unit with a square root.”

Learning Objectives

• Explain why squaring deviations prevents cancellation and why their total needs a denominator. • Derive variance from average squared distance to the mean and interpret zero variance. • Calculate standard deviation and distinguish its unit from the unit of variance. • Calculate variance and standard deviation for raw observations and discrete frequencies. • Use algebra and known summation formulas to reason about structured datasets.

A second way to retain every deviation

Absolute distances prevented positive and negative deviations from cancelling. Squaring each deviation also makes its contribution nonnegative, and it gives a useful algebraic measure. Larger deviations contribute disproportionately more: a distance of 4 contributes 16, whereas a distance of 2 contributes 4. This makes squared deviations especially responsive to values far from the mean.

Start with observations x₁, x₂, …, xₙ and their mean x̄. Their squared deviations are (x₁ − x̄)² through (xₙ − x̄)². If their sum is zero, every squared deviation must be zero, because none can be negative. Hence every observation equals the mean. If the sum is positive, some variation exists, but its size also depends on how many observations were included.

Why a total of squares can give a misleading comparison

Imagine comparing a small dataset with a much larger one. Even if each value in the larger set lies closer to the common mean, it has many more contributions to its squared-deviation total. A measure intended to describe average scatter should not grow merely because more observations were counted. The chapter’s two datasets make this issue concrete.

Set A: 6 observations0102030405060Mean 30Set B: 31 observations0102030405060Mean 30
Unequal counts around the same mean— Set A has only six values but reaches much farther from 30; set B has thirty-one values clustered more tightly.
Example — Compare totals with averages

Problem
Set A is 5, 15, 25, 35, 45, 55. Set B contains every integer from 15 to 45. Compare their squared-deviation totals and averages.

  1. 1.Both sets have mean 30. A’s deviations are −25, −15, −5, 5, 15, 25.
  2. 2.A’s squared total is 625 + 225 + 25 + 25 + 225 + 625 = 1750.
  3. 3.B’s deviations are every integer from −15 to 15. Its squared total is 2(1² + 2² + … + 15²) = 2 × 15 × 16 × 31/6 = 2480.
  4. 4.The total for B is larger, but B also has 31 observations while A has 6. Averaging gives 1750/6 ≈ 291.67 for A and 2480/31 = 80 for B.
  5. 5.The average squares correctly reflect the greater distances in A. The difference arises from dividing by each dataset’s own count, not from changing either dataset.
DatasetCountMeanSquared-deviation totalAverage squared deviation
A63017501750/6 ≈ 291.67
B3130248080

Variance is the mean squared deviation

The quantity obtained by averaging the squared deviations from the mean is called variance. It uses every observation and accounts for the dataset size. Its symbol is σ², read as sigma squared. The lowercase sigma σ is different from the uppercase summation symbol Σ.

Definition
Variance

Variance is the arithmetic mean of the squared deviations of the observations from their arithmetic mean. In the convention used here, the denominator is the number of observations in the dataset.

Variance of ungrouped observationsLaTeX
n is the total number of observations. Each deviation is calculated from the same mean x̄ before it is squared and added.

Variance is always nonnegative. It equals zero exactly when all observations are identical. A large variance indicates larger average squared distances, but comparisons need a common measurement scale and context. A variance of 25 in one unit is not directly comparable with 25 in an unrelated unit.

Example — Identical observations

Problem
Find the variance of 7, 7, 7, 7.

  1. 1.The mean is 28/4 = 7.
  2. 2.Each deviation is 7 − 7 = 0, so each squared deviation is zero.
  3. 3.The variance is 0/4 = 0. The dataset has a centre but no spread.

Standard deviation returns to the original unit

If observations are measured in centimetres, deviations are also in centimetres, but squaring produces square centimetres. Variance therefore has a squared unit. Taking its nonnegative square root produces standard deviation, which uses the same unit as the original observations and is easier to interpret alongside the mean.

Definition
Standard deviation

Standard deviation is the nonnegative square root of variance. It is denoted by σ and has the same unit as the original observations. It is zero when the variance is zero.

Standard deviation of ungrouped observationsLaTeX
The square root covers the whole average. Do not take a square root of each deviation separately and then average.

Standard deviation is not the same as mean deviation: one is the square root of an average of squares, while the other is an average of absolute distances. Both describe scatter, but they weigh the distances differently. A standard deviation does not tell us that every observation is exactly that far from the mean.

Example — From variance to an interpretable unit

Problem
A length dataset has variance 16 cm². What is its standard deviation?

  1. 1.The standard deviation is the nonnegative square root of the variance.
  2. 2.σ = √16 = 4 cm. Taking the square root also restores the length unit.
  3. 3.The negative number −4 is not chosen, even though its square is 16, because a measure of spread is nonnegative.

A complete calculation for raw data

A clear table makes the calculation traceable: find the mean, subtract it from every value, square each deviation and sum. When the values form a regular sequence, an assumed-mean calculation can simplify finding the mean. The variance still uses deviations from the actual mean, not deviations from a convenient assumed value.

Example — Variance of regularly spaced values

Problem
Find the variance and standard deviation of 6, 8, 10, 12, 14, 16, 18, 20, 22, 24.

  1. 1.Use assumed mean A = 14 and common scale h = 2. The coded values are −4, −3, −2, −1, 0, 1, 2, 3, 4, 5, whose sum is 5.
  2. 2.The true mean is 14 + 2 × 5/10 = 15.
  3. 3.Deviations from 15 are −9, −7, −5, −3, −1, 1, 3, 5, 7, 9. Their squares total 330.
  4. 4.Variance is 330/10 = 33, and standard deviation is √33 ≈ 5.74.
  5. 5.The coding origin 14 helped find the mean; using it instead of 15 in the squared-deviation column would calculate a different average.
Value xᵢdᵢ = (xᵢ − 14)/2xᵢ − 15(xᵢ − 15)²
6-4-981
8-3-749
10-2-525
12-1-39
140-11
16111
18239
203525
224749
245981
Total50330
The order of operations matters

Variance is the average of squared deviations, not the square of the average deviation. The latter is zero about the mean. Standard deviation takes one square root after summing and dividing, and deviations must be measured from the actual mean.

Discrete frequencies weight squared distances

A frequency table compresses repeated values, just as it did for mean deviation. A value with frequency fᵢ contributes its squared deviation fᵢ times. Multiply each square by its frequency before summing, then divide by total frequency N. Neither the number of rows nor the sum of distinct values is the correct observation count.

Variance and standard deviation with frequenciesLaTeX
First compute x̄ = Σfᵢxᵢ/N. These formulas are the raw-data definitions with repeated contributions collected into frequency rows.
Example — A discrete frequency calculation

Problem
Find variance and standard deviation for values 4, 8, 11, 17, 20, 24, 32 with frequencies 3, 5, 9, 5, 4, 3, 1.

  1. 1.Total frequency is 30, and Σfᵢxᵢ = 420, so the mean is 14.
  2. 2.Deviations are −10, −6, −3, 3, 6, 10, 18. Square them and weight by frequency.
  3. 3.The contributions are 300, 180, 81, 45, 144, 300 and 324. Their sum is 1374.
  4. 4.Variance is 1374/30 = 45.8; standard deviation is √45.8 ≈ 6.77.
  5. 5.A rare extreme observation can still contribute substantially: value 32 occurs once but contributes 18² = 324 to the total.
ValueFrequencyfᵢxᵢxᵢ − 14(xᵢ − 14)²fᵢ(xᵢ − 14)²
4312-10100300
8540-636180
11999-3981
175853945
20480636144
2437210100300
3213218324324
Total304201374
Example — Check weighting by expanding a small table

Problem
Values 1 and 4 have frequencies 2 and 1. Find variance and standard deviation.

  1. 1.The underlying observations are 1, 1, 4. Their mean is (2 × 1 + 1 × 4)/3 = 2.
  2. 2.The weighted squared-deviation total is 2(1 − 2)² + 1(4 − 2)² = 2 + 4 = 6.
  3. 3.Variance is 6/3 = 2, and standard deviation is √2.
  4. 4.Expanding the table gives the same three contributions 1, 1 and 4. Weighting preserves the raw-data definition.

Structured data can be handled algebraically

When the observations follow a known pattern, a general calculation can replace a long table. The first n natural numbers provide a useful example. Their mean comes from a known sum, and expanding the centred squares lets the sum of squares formula do the remaining work. This also shows why it is useful to understand the definition rather than only a numerical routine.

Example — The first n natural numbers

Problem
Find the mean and variance of 1, 2, …, n.

  1. 1.Their total is n(n + 1)/2, so their mean m = (n + 1)/2.
  2. 2.Expand the squared-deviation total: Σ(i − m)² = Σi² − 2mΣi + nm².
  3. 3.Use Σi = nm and Σi² = n(n + 1)(2n + 1)/6. The total becomes n(n + 1)(2n + 1)/6 − nm².
  4. 4.Divide by n: variance = (n + 1)(2n + 1)/6 − (n + 1)²/4.
  5. 5.With denominator 12 this is [(n + 1)(4n + 2) − 3(n + 1)²]/12 = (n + 1)(n − 1)/12 = (n² − 1)/12.
  6. 6.For n = 1 this gives zero, as it should for a single observation. Standard deviation is √((n² − 1)/12).

Check your understanding

Focus on why the divisor and square root appear. A correct numerical calculation should agree with the definition, use the right unit, and yield a nonnegative spread.

Quiz

Quick check

Why divide a squared-deviation total by the number of observations?

Quick check

A variance of 9 m² corresponds to which standard deviation?

Quick check

When is variance zero?

Quick check

What is the variance of 2, 4, 6?

Quick check

Values 1 and 4 have frequencies 2 and 1. What is their variance?

Quick check

What is the mean of the first n natural numbers?

Quick check

Variance is 33. What is standard deviation?

Practice Problems

Practice Problems
  1. Calculate the mean and variance of 6, 7, 10, 12, 13, 4, 8, 12. Compare variance with the mean deviation found earlier.
  2. Derive the variance (n² − 1)/12 for the first n natural numbers, including the expansion of centred squares.
  3. Find mean and variance for the first ten positive multiples of 3 by a direct centred-deviation calculation.
  4. Find mean and variance for values 6, 10, 14, 18, 24, 28, 30 with frequencies 2, 4, 7, 12, 8, 4, 3.
  5. Find mean and variance for values 92, 93, 97, 98, 102, 104, 109 with frequencies 3, 2, 3, 2, 6, 3, 3.
  6. Explain why a squared-deviation total can give a misleading comparison for datasets of different sizes.
  7. For measurements in seconds, state the units of mean deviation, variance and standard deviation, and explain each.

Key Takeaways

Key Takeaways

• Squaring deviations prevents cancellation but a total of squares still depends on the number of observations. • Variance averages squared deviations from the actual mean using n or total frequency N. • Variance is nonnegative and vanishes exactly when every observation is the same. • Standard deviation is the nonnegative square root of variance and returns to the original unit. • Frequency weighting collects repeated contributions without changing the definition. • Averages of absolute distances and square roots of average squared distances are different measures.