Variance Calculator

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

Separate numbers using a comma (,)
Separate numbers using a comma (,)

Results:

Variance (σ²):
 
Standard Deviation (σ):
 
Sum of Squares (SS):
 
Population Size (N):
 
Mean (μ):
 

Steps to Solve

Population Variance Formula

\sigma^{2} = \frac{\sum \left ( x_{i}-\mu \right )^{2}}{N}

Step One: Find the Mean

The mean is equal to the sum of each observation xi divided by the population size N.

\mu = \frac{\sum_{i=1}^{N}x_{i}}{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 μ.

\text{deviation} = x_{i}-\mu

Step Three: Square the Deviations

Square each deviation from the mean.

\text{squared deviation} = \left ( x_{i}-\mu \right )^{2}

Step Four: Find the Sum of Squares

Add each squared deviation to find the sum of squares.

SS = \sum \left ( x_{i}-\mu \right )^{2}

Step Five: Find the Variance

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

\sigma^{2} = \frac{SS}{N}
Learn how we calculated this below

scroll down


On this page:


How to Find Variance

Variance is a statistical measure of the variability from the mean in a data set. It is essentially a way to measure the spread between numbers and their center in a data set.[1]

The symbol for variance in a population is σ² (sigma-squared), and the variance for a sample is (s-squared).

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, and the formula to calculate it is different for a population versus a sample. There are actually different formulas to calculate the variance for population and sample data sets.

Population Variance Formula

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

\sigma^{2} = \frac{\sum \left ( x_{i}-\mu \right )^{2}}{N}

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

Sample Variance Formula

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

s^{2} = \frac{\sum \left ( x_{i}-\bar{x} \right )^{2}}{n-1}

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

Graphic showing the variance formula for a population and a sample.

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 because when working with a sample, the variance estimation includes some amount of bias.

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 sample (or population) mean of the data set.

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

\text{mean}=\frac{\text{sum of observations}}{\text{count of observations}}

The mean formula is often expressed like this:

\mu=\frac{\sum_{i=1}^{N}x_{i}}{N}
\mu=\frac{x_{1}+x_{2}+…+x_{N}}{N}

So, the mean is equal to the sum of sample observations xi 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.

\text{deviation} = x_{i}-\mu

Step Three: Square the Deviations

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

\text{squared deviation} = \left ( x_{i}-\mu \right )^{2}

Step Four: Calculate the Sum of Squares

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

SS = \sum \left ( x_{i}-\mu \right )^{2}

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. The formula to calculate the variance for a population and sample is a bit different:

Population Variance
\sigma^{2} = \frac{SS}{N}

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

Sample Variance
s^{2} = \frac{SS}{n-1}

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.

\bar{x}=\frac{1+2+5+6+9+10}{6}
\bar{x}=\frac{33}{6}=5.5

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

Observation Deviation from
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.

SS=20.25+12.25+0.25+0.25+12.25+20.25
[formula may scroll beyond screen]
SS=65.5

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

s^{2} = \frac{65.5}{6-1}
s^{2} = 13.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

\sigma^{2} = \sigma \times \sigma

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

For a Sample SD

s^{2} = s \times s

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

References

  1. 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
  2. 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
  3. Outlier, How To Calculate Variance In 4 Simple Steps, https://articles.outlier.org/how-to-calculate-variance
  4. 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
  5. Oxford College Department of Mathematics and Computer Science, Bessel's Correction, http://math.oxford.emory.edu/site/math117/besselCorrection/
  6. 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