# Variance Calculator

Enter a data set for a population or sample to calculate variance using the calculator below.

## Results:

Variance (σ²): | |
---|---|

Standard Deviation (σ): | |

Sum of Squares (SS): | |

Population Size (N): | |

Mean (μ): |

### Steps to Solve

#### Population Variance Formula

#### Step One: Find the Mean

The mean is equal to the sum of each observation x_{i} divided by the population size N.

#### Step Two: Find the Deviation From the Mean

The deviation from the mean for each observation is equal to its value minus the mean μ.

#### Step Three: Square the Deviations

Square each deviation from the mean.

#### Step Four: Find the Sum of Squares

Add each squared deviation to find the sum of squares.

#### Step Five: Find the Variance

The variance is equal to the sum of squares SS divided by the population size N.

Variance (s²): | |
---|---|

Standard Deviation (s): | |

Sum of Squares (SS): | |

Sample Size (n): | |

Mean (x̄): |

### Steps to Solve

#### Sample Variance Formula

#### Step One: Find the Mean

The mean is equal to the sum of each observation x_{i} divided by the sample size n

#### Step Two: Find the Deviation From the Mean

The deviation from the mean for each observation is equal to its value minus the mean x̄.

#### Step Three: Square the Deviations

Square each deviation from the mean.

#### Step Four: Find the Sum of Squares

Add each squared deviation to find the sum of squares.

#### Step Five: Find the Variance

The variance is equal to the sum of squares SS divided by the sample size n minus 1.

## On this page:

- Calculator
- How to Find Variance
- Sample Bias
- Variance Formula
- Population Variance Formula
- Sample Variance Formula
- Steps to Calculate the Variance
- Step One: Calculate the Mean
- Step Two: Calculate Deviations From the Mean
- Step Three: Square the Deviations
- Step Four: Calculate the Sum of Squares
- Step Five: Calculate the Variance
- How to Find Variance using the Standard Deviation
- References

## How to Find Variance

Variance is a characteristic of a random variable that reflects how dispersed its outcomes are. If the expected value or mean is a reflection of the “location” or “center” of a probability distribution, then variance and its close relative standard deviation help describe the typical distance from the mean.^{[1]}

Although variance is a trait of probability distributions, it is also commonly calculated from data. If you have many outcomes that all come from the same probability distribution, for example, men’s heights, then that entire set of data has a mean and variance.

The population variance is the expected difference between a man’s height and the average man’s height, squared. It is usually denoted by σ² (sigma-squared).

The formula for population variance can be used to estimate the variance of the underlying distribution from which the data arises.

### Sample Bias

There is, however, a slight problem owing to the fact that the mean is also typically estimated at the same time as you estimate the variance, and as a result, the population variance will be slightly biased as an estimate of the variance. In this context, biased means wrong, on average.

If the amount of data is large, this difference is not typically hugely consequential. But in small samples or particular cases, the bias might matter. Moreover, the bias has a consistent direction.

It tends to produce estimates that are, on average, slightly smaller than the variance of the underlying distribution. In the case of hypothesis testing, underestimating the variance may lead to overconfidence in your conclusions.

In other cases, you might think observations are more unusual than they are. If you think 95% of men are between 5’7″ and 5’11”, you might think a 6′ man is extraordinarily tall, but you might be wrong if you underestimated your variance.

Fortunately, there is an easy fix. The sample variance is an often-used alternative formula for estimating the variance of a distribution.

When interpreting the data, a low variance means that the observations in the set are close to the mean, while a high variance means the data is highly dispersed.

### Variance Formula

The variance is equal to the standard deviation squared. As mentioned above, the formula to calculate population variance is slightly different from sample variance.

#### Population Variance Formula

You can calculate the population variance using the following formula:^{[2]}

Thus, the variance for a population σ² is equal to the sum of squares ∑(x_{i} – μ)² divided by the population size N.

#### Sample Variance Formula

You can calculate a sample variance using the following formula:^{[3]}

Thus, the variance for a sample s is equal to the sum of squares ∑(x_{i} – x̄)² divided by the sample size n minus 1.

If you look closely, you might notice that in the sample variance formula, the sum of squares is divided by n – 1 rather than just n. This is the difference in denominators mentioned earlier.

When working with a sample, the population variance is a biased estimator of the variance in the underlying distribution.

In the sample variance formula, the n – 1 denominator is called the *degrees of freedom*.^{[4]}

Since the sum of squares for a sample is lower than it is for a population, subtracting one from the sample size artificially increases the variance to offset this bias, which is known as Bessel’s Correction.^{[5]} Bessel’s Correction is more useful when the size of the sample data set is small, but for large sample sizes that are closer to the population size, it’s less necessary.

### Steps to Calculate the Variance

We simplify the formulas above to find the variance in five easy steps.^{[6]}

#### Step One: Calculate the Mean

The first step to finding the variance is to find the arithmetic mean. If you have a sample of data from the population, you may call this the sample mean, while if you have data from the entire population, you may call it a population mean, although the two formulas are essentially the same.

To calculate the mean, add each observation in the dataset together, then divide the result by the sample size (or population size).

The mean formula is often expressed like this:

So, the mean is equal to the sum of sample observations x_{i} divided by the total number of observations N.

#### Step Two: Calculate Deviations From the Mean

Next, you’ll need to find the deviation from the mean for every observation in the data set by subtracting the mean from each number.

#### Step Three: Square the Deviations

The next step is to calculate the square for each deviation from the mean found in the previous step.

#### Step Four: Calculate the Sum of Squares

Then, calculate the sum of squares using the sum of squares formula:

The sum of squares *SS* is equal to the sum of the squared deviations of each value from the mean.

#### Step Five: Calculate the Variance

Finally, using the sum of squares and sample or population size, it’s time to calculate the variance in the data. Here you must decide whether you want to use the population or sample variance, as they are a bit different:

##### Population Variance

The variance for a population is equal to the sum of squares divided by the size of the population.

##### Sample Variance

The variance for a sample is equal to the sum of squares divided by the number of observations in the sample minus one.

**For example,** let’s calculate the variance for the sample data [1,2,5,6,9,10].

We’ll use the five steps to find the variance shown above.

**Step One:** Find the mean by summing the values, then dividing by the number of values in the data.

**Step Two:** Find the deviations from the mean for each number by subtracting the mean.

Observation | Deviation from x̄ |
---|---|

1 | 1 – 5.5 = -4.5 |

2 | 2 – 5.5 = -3.5 |

5 | 5 – 5.5 = -0.5 |

6 | 6 – 5.5 = 0.5 |

9 | 9 – 5.5 = 3.5 |

10 | 10 – 5.5 = 4.5 |

**Step Three:** Find the square for each of the deviations from the mean by raising them to the power of 2.

Deviation | Squared Deviation |
---|---|

-4.5 | -4.5² = 20.25 |

-3.5 | -3.5² = 12.25 |

-0.5 | -0.5² = 0.25 |

0.5 | 0.5² = 0.25 |

3.5 | 3.5² = 12.25 |

4.5 | 4.5² = 20.25 |

**Step Four:** Find the sum of squares by adding up all of the squared deviations.

**Step Five:** Find the variance by dividing the sum of squares by the number of data points in the sample minus 1.

So, the variance in this sample is equal to **13.1**.

### How to Find Variance using the Standard Deviation

We mentioned earlier that the variance is equal to the standard deviation squared. So, to find the variance using the standard deviation, raise the SD to the power of two.

#### For a Population SD

The variance for a population is equal to the population standard deviation squared.

#### For a Sample SD

The variance for a sample is equal to the sample standard deviation squared.

## References

- Wasserman, L., All of Statistics - A Concise Course in Statistical Inference,
*Springer New York*, 50. https://www.google.com/books/edition/All_of_Statistics/qrcuBAAAQBAJ - Kuter, K., Essential Probability Theory for Data Science - 7.2: Sample Variance,
*LibreTexts Statistics*, https://stats.libretexts.org/Courses/Saint_Mary%27s_College_Notre_Dame/DSCI_500B_Essential_Probability_Theory_for_Data_Science_(Kuter)/07%3A_The_Sample_Variance_and_Other_Distributions/7.2%3A_Sample_Variance - Outlier, How To Calculate Variance In 4 Simple Steps, https://articles.outlier.org/how-to-calculate-variance
- Lane, D., Introductory Statistics - 10.2: Degrees of Freedom,
*LibreTexts Statistics*, https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_(Lane)/10%3A_Estimation/10.02%3A_Degrees_of_Freedom - Oxford College Department of Mathematics and Computer Science, Bessel's Correction, http://math.oxford.emory.edu/site/math117/besselCorrection/
- PennState Eberly College of Science, STAT 200 Elementary Statistics - Measures of Spread, https://online.stat.psu.edu/stat200/lesson/2/2.2/2.2.5