Mathwords logoMathwords

Sample Variance — Definition, Formula & Examples

Sample variance is a measure of how far the values in a data set are spread out from their mean, calculated using a sample rather than an entire population. It divides by n1n - 1 instead of nn to give an unbiased estimate of the true population variance.

Given a sample of nn observations x1,x2,,xnx_1, x_2, \dots, x_n with sample mean xˉ\bar{x}, the sample variance s2s^2 is defined as s2=1n1i=1n(xixˉ)2s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2. The divisor n1n - 1 represents the degrees of freedom and corrects for the bias that would occur if the population mean were estimated by the sample mean.

Key Formula

s2=i=1n(xixˉ)2n1s^2 = \frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n - 1}
Where:
  • s2s^2 = Sample variance
  • xix_i = Each individual data value
  • xˉ\bar{x} = Sample mean (average of all data values)
  • nn = Number of data values in the sample

How It Works

To find the sample variance, start by computing the mean of your data. Then subtract the mean from each data point and square the result — these are the squared deviations. Add up all the squared deviations and divide by n1n - 1, not nn. The reason for dividing by n1n - 1 (called Bessel's correction) is that a sample tends to underestimate the spread of the full population, and using n1n - 1 compensates for that. A larger sample variance means the data points are more spread out from the mean.

Worked Example

Problem: Find the sample variance of the data set: 4, 8, 6, 10, 12.
Step 1: Find the sample mean: Add all values and divide by the number of data points.
xˉ=4+8+6+10+125=405=8\bar{x} = \frac{4 + 8 + 6 + 10 + 12}{5} = \frac{40}{5} = 8
Step 2: Compute each squared deviation: Subtract the mean from each value, then square the result.
(48)2=16,(88)2=0,(68)2=4,(108)2=4,(128)2=16(4-8)^2 = 16,\quad (8-8)^2 = 0,\quad (6-8)^2 = 4,\quad (10-8)^2 = 4,\quad (12-8)^2 = 16
Step 3: Sum the squared deviations: Add up all the squared differences.
16+0+4+4+16=4016 + 0 + 4 + 4 + 16 = 40
Step 4: Divide by n − 1: Since there are 5 data points, divide by 4.
s2=4051=404=10s^2 = \frac{40}{5 - 1} = \frac{40}{4} = 10
Answer: The sample variance is s2=10s^2 = 10.

Visualization

Why It Matters

Sample variance appears throughout AP Statistics and introductory college statistics courses as a building block for hypothesis testing, confidence intervals, and regression analysis. In real-world research — from clinical drug trials to quality control in manufacturing — you almost never have data on the entire population, so sample variance is the version you actually compute. Taking the square root of sample variance gives you the sample standard deviation, which is reported in nearly every scientific paper.

Common Mistakes

Mistake: Dividing by n instead of n − 1
Correction: Dividing by n gives the population variance. When working with a sample, always divide by n − 1 to correct for bias. Check whether the problem says 'sample' or 'population' before choosing a formula.
Mistake: Forgetting to square the deviations
Correction: If you just sum (x_i − x̄) without squaring, the positive and negative differences cancel out and you get zero. Squaring ensures all deviations contribute positively to the total spread.

Related Terms