# Difference between Population Variance and Sample Variance

The difference between population variance and sample variance is on the denominator of the formula.

In particular, the denominator for population variance is N, whereas sample variance is n-1. The following uses formulas and examples to explain the difference between them.

## Data Example

The following are 5 numbers that we are going to calculate variance. The mean of these 5 numbers is 56.

## Formula and Example for Population Variance

The following is the formula for population variance.

$$\sigma ^2=\frac{\sum_{i=1}^N (x_i-\mu)^2}{N}$$

where

• μ: Population mean
• Xi: The ith element from the population
• N: Population size

Suppose that the 5 numbers shown above are all the numbers in a population. Then, we can then calculate the variance as follows.

$$\sigma ^2=\frac{\sum_{i=1}^N (x_i-\mu)^2}{N}=\frac{(20-56)^2+(50-56)^2+(30-56)^2+(80-56)^2+(100-56)^2}{5}=904$$

## Formula and Example for Sample Variance

For sample variance, the formula is as follows.

$$S^2=\frac{\sum_{i=1}^n (x_i-\bar{x})^2}{n-1}$$

where

• $$\bar{x}$$: sample mean
• Xi: The ith element from the population
• n: sample size

Thus, if the 5 numbers shown above are a sample of data from a population (which should have more than 5 numbers), the denominator should be 4, rather than 5, since we use one degree of freedom to estimate the mean.

$$S^2=\frac{\sum_{i=1}^n (x_i-\bar{x})^2}{n-1} =\frac{(20-56)^2+(50-56)^2+(30-56)^2+(80-56)^2+(100-56)^2}{5-1}=1130$$