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

**. The following uses formulas and examples to explain the difference between them.**

*n-1*## 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**X**: The i_{i}^{th}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
- X
_{i}: The i^{th}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 \)

## Conclusion and Further Reading

Note that, there are related concepts such as **sum of squares**. The relationship between **variance** and **sum of squares** is that **sum of squares** is the numerator of **variance**, regardless of population variance or sample variance. To have a better understanding of **sum of squares**, please check the following tutorial.