Skip to content
Glacius
StatisticsConcept reference

Sample variance

A sample variance divides the sum of squared deviations from the sample mean by a specified denominator such as n or n minus one.

On this page 7 sections
  1. Overview
  2. Variance summarizes squared deviations from the sample mean
  3. If squared deviations are supplied, add them directly
  4. Equal observations have zero squared deviations
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Variance summarizes squared deviations from the sample mean#

Variance summarizes squared deviations from the sample mean. Subtract the mean from each observation, square each difference, add the squares, then divide by the stated denominator.

For 1,3,51,3,5, the mean is 33. Deviations are 2,0,2-2,0,2, whose squares are 4,0,44,0,4. Their sum is 88.

Sample 1,3,5 has mean 3 and deviations −2,0,2. The two nonzero squared deviations are squares of side 2, area 4 each; the zero deviation contributes area 0. Total squared deviation is 8. Sample variance divides by n−1=2, giving 4.Sample 1,3,5 has mean 3 and deviations −2,0,2. The two nonzero squared deviations are squares of side 2, area 4 each; the zero deviation contributes area 0. Total squared deviation is 8. Sample variance divides by n−1=2, giving 4.
Figure 1Sample 1,3,5 has mean 3 and deviations −2,0,2. The two nonzero squared deviations are squares of side 2, area 4 each; the zero deviation contributes area 0. Total squared deviation is 8. Sample variance divides by n−1=2, giving 4.
Link to this figure ↗Download SVGDownload PNG

For 1,3,51,3,5, the squared-deviation sum is 88. Dividing by n=3n=3 gives 8/38/3. Dividing by n1=2n-1=2 gives 44. These definitions produce different numbers.

Check your reasoning

Sample: 2, 5, 8. Variance with denominator n-1?

Show answer and explanation
9

Squared deviations sum to 18; divide by 2: 9.

02If squared deviations are supplied, add them directly#

If squared deviations are supplied, add them directly. Squaring them again changes the calculation. With deviations themselves, square first so positive and negative differences do not cancel.

Check your reasoning

Squared deviations: 9, 0, 9. Variance with denominator n?

Show answer and explanation
6

Sum of squares 18; divide by 3: 6.

03Equal observations have zero squared deviations#

Equal observations have zero squared deviations. With one observation, dividing by nn gives zero; dividing by n1n-1 is undefined because the denominator is zero. Every task specifies which denominator to use.

Check your reasoning

Sample: 2, 6. Use denominator n. “Divide the square sum by 1.” Repair variance.

  1. A8
  2. B4
  3. C0
Show answer and explanation
4

Square sum 8; 8/2=4.

Key takeaway

Center, square, add, then divide by the stated denominator. Dividing by n and by n minus one gives different definitions.

  • Compute a centered squared-deviation sum.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Sample variance.” Math behind ML. /learn/s-sample-variance