ThisCalculator

Statistics

Variance Calculator: Formula and Worked Example

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Variance Calculator: Formula and Worked Example

This variance calculator finds the spread of a set of numerical values by averaging their squared deviations from the mean. Enter the data values to get either population variance or sample variance, along with the mean and number of values.

Formula

Variance is the sum of squared differences between each observation and the mean, divided by a denominator chosen according to whether the data represent a complete population or a sample:

Population variance: σ² = Σ(xᵢ − μ)² / N

Sample variance: s² = Σ(xᵢ − x̄)² / (n − 1)

  • xᵢ is one observed value, in the same unit as the data.
  • μ is the population mean; x̄ is the sample mean, in the data’s unit.
  • N is the number of values in the whole population; n is the number in the sample.
  • σ² and s² are variances, in squared data units, such as cm², dollars², or points².

The calculator’s “Population” option divides by n. Its “Sample” option divides by n − 1. The sample formula is sometimes called the corrected sample variance or Bessel-corrected variance. The list in the calculator is the full set being analyzed; select the variance type to determine how its squared deviations are divided.

Worked Example

Using the default values 2, 4, 6, 8, and 10, and the default Population option:

  1. Find the mean: (2 + 4 + 6 + 8 + 10) / 5 = 6.
  2. Subtract the mean from each value and square the differences: (2 − 6)² = 16, (4 − 6)² = 4, (6 − 6)² = 0, (8 − 6)² = 4, and (10 − 6)² = 16.
  3. Add the squared differences: 16 + 4 + 0 + 4 + 16 = 40.
  4. Divide by the population count, 5: 40 / 5 = 8.

Population variance = 8 squared units; mean = 6; number of values = 5. If the same five values are treated as a sample, the sum of squared differences remains 40, but the denominator is 5 − 1 = 4, so sample variance is 10.

What Variance Measures

Variance describes how spread out values are around their mean. A variance of zero means every value is identical. Larger variance generally means values lie farther from the mean, although the size is tied to the scale and units of the data. For example, a variance of 8 is not directly comparable across measurements in meters and measurements in centimeters: changing units changes the numerical variance.

Because the differences are squared, variance gives extra weight to values far from the mean and avoids positive and negative deviations cancelling one another. Squaring also changes the unit: a dataset measured in meters has variance in square meters, not meters. For a spread measure in the original units, use the standard deviation, which is the square root of variance.

Population or Sample?

Choose population variance when your values include every member of the group you want to describe—for example, every item in a particular small batch. Choose sample variance when your observations are a subset and you want to estimate variability in a larger population. In many statistical settings, dividing by n − 1 corrects the tendency of a sample’s squared deviations around its estimated mean to underestimate the population variance on average.

The choice depends on the question, not simply on how many values you have. A list can be a complete population for one purpose and a sample for another. If there is only one value, population variance is zero, but sample variance is undefined because n − 1 is zero. The calculator’s sample result therefore requires at least two observations.

How to Use and Interpret the Result

  • Enter numerical observations in the data list, separated as shown. Keep their units consistent.
  • Select Population for a complete group or Sample for observations used to estimate a larger group.
  • Read variance in squared units. The mean and count are shown as supporting results.
  • For standard deviation, take the square root of the variance. It returns to the data’s original units.

Variance is always nonnegative, apart from tiny negative values that may arise from limited-precision computation in some software. A substantial negative variance indicates an error in a calculation or implementation. Variance alone does not reveal whether values are symmetric, clustered in several groups, or affected by an outlier; inspect the data or use a plot and other summary statistics when that structure matters.

Common Mistakes and Limitations

A frequent mistake is dividing sample squared deviations by n instead of n − 1 when the goal is the usual unbiased estimate of population variance. Conversely, dividing a complete population’s deviations by n − 1 changes the quantity being calculated. Another error is averaging absolute differences or unsquared differences: neither is the standard definition of variance.

Keep units consistent before calculating. If a dataset mixes centimeters and meters, convert it to one unit first. Rounding every intermediate difference or square can also change the final answer; retain full precision during the calculation and round only the displayed result. The calculator displays variance to two decimal places, so a displayed zero can sometimes mean a small positive value rounded to 0.00.

Variance is sensitive to extreme observations because deviations are squared. It is useful in many statistical calculations, but it may not be a complete or intuitive description of a highly skewed dataset. Always interpret it in context and alongside the original measurement scale.

Frequently Asked Questions

What is the difference between sample and population variance?
Population variance divides the sum of squared deviations by the number of all values, N. Sample variance divides by n − 1 to estimate the variability of a larger population from a sample.

Why is sample variance divided by n − 1?
The sample mean is estimated from the same observations, which tends to make squared deviations around it too small as an estimate of population variability. Dividing by n − 1 corrects that expected bias under standard sampling assumptions.

Can variance be negative?
No. It is a sum of squared quantities divided by a positive denominator, so it cannot be negative mathematically. A tiny negative result may reflect numerical precision; a larger one suggests a calculation problem.

How do I convert variance to standard deviation?
Take the square root. If variance is 8 squared units, standard deviation is √8, approximately 2.83 units.

What does a variance of zero mean?
Every value is the same, so all deviations from the mean are zero. The dataset has no spread.

Related

Formula used
list data | Data values | 2, 4, 6, 8, 10
sel type | Variance type | Population=1, Sample=2
out variance | Variance | squared units | (sum((data-mean(data))^2))/(count(data)-(type-1)) | 2
out average | Mean | same as data | mean(data) | 2
out n | Number of values | values | count(data) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.