Variance Calculator

Variance is the average squared distance of values from their mean. For 2, 4, 4, 4, 5, 5, 7, 9 the sum of squared deviations is 32, so the population variance is 4 and the sample variance is 4.5714. Choose sample or population above.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

What Is Variance?

Variance measures how spread out a set of numbers is. It is calculated by finding how far each value is from the mean, squaring those distances, and averaging them. A variance of zero means every value is the same. The bigger the variance, the more the values differ from one another.

Variance is the foundation of a large part of statistics. Analysis of variance (ANOVA), regression, portfolio theory and the standard deviation itself all build on it. Unlike the standard deviation, variance is expressed in squared units, so a variance of heights in centimetres is measured in cm². That makes it harder to picture, but it has useful mathematical properties: variances of independent quantities simply add together.

Variance vs Standard Deviation

VarianceStandard deviation
DefinitionMean of squared deviations from the meanSquare root of the variance
UnitsSquared (cm², $²)Same as the data (cm, $)
Symbolσ² (population), s² (sample)σ (population), s (sample)
Best forCalculations, ANOVA, combining independent sources of variationDescribing and communicating spread
Value for 2, 4, 4, 4, 5, 5, 7, 9 (sample)4.57142.1381

Variance Formula

Population variance: σ² = Σ(xᵢ − μ)² ÷ N Sample variance: s² = Σ(xᵢ − x̄)² ÷ (n − 1)
  • xᵢ is each value in the dataset.
  • μ and x̄ are the population mean and the sample mean.
  • Σ(xᵢ − mean)² is the sum of squares: add up the squared difference of every value from the mean.
  • N is the number of values in the population; n is the number in the sample.

A Shortcut Formula

You can avoid computing every deviation with the equivalent form σ² = (Σx² ÷ N) − μ²: the mean of the squares minus the square of the mean. For the dataset above, Σx² = 232, so 232 ÷ 8 − 5² = 29 − 25 = 4, matching the population variance.

Why Divide by n − 1?

A sample mean sits closer to its own data than the true population mean would, so squared deviations from it come out slightly too small. Dividing by n − 1 instead of n (Bessel’s correction) compensates, making the sample variance an unbiased estimate of the population variance.

Worked Example: Step-by-Step Variance

Use the preloaded dataset 2, 4, 4, 4, 5, 5, 7, 9.

Value (x)x − mean(x − mean)²
2−39
4−11
4−11
4−11
500
500
724
9416
Total032
  1. The mean is 40 ÷ 8 = 5. Note that the deviations always add to zero, which is a handy check.
  2. The sum of squares is 32.
  3. Population variance: 32 ÷ 8 = 4.
  4. Sample variance: 32 ÷ 7 = 4.5714.
  5. Taking square roots gives standard deviations of 2 and 2.1381.

Checking Your Work

Two quick checks catch most arithmetic slips. First, the deviations from the mean must add to exactly zero. Second, the sample variance must be slightly larger than the population variance for the same data: 4.5714 against 4, a ratio of exactly n ÷ (n − 1) = 8 ÷ 7.

How to Use This Variance Calculator

  1. Enter your numbers separated by commas, spaces or new lines.
  2. Pick Sample (divide by n − 1) or Population (divide by N) from the data type menu.
  3. Read the variance, standard deviation, mean, count and sum of squares in the results.
  4. Open the step-by-step solution to see each deviation squared and totalled.

Need only the spread in original units? Use the standard deviation calculator. For a quick measure of total spread, see the range calculator.

Real-World Uses of Variance

  • Finance: portfolio theory uses the variance and covariance of asset returns to measure risk and choose diversified mixes.
  • Experiments: ANOVA compares the variance between groups with the variance within groups to test whether treatments genuinely differ.
  • Machine learning: the bias–variance trade-off describes how a model’s predictions change with the training data. Feature selection often drops near-zero-variance columns.
  • Manufacturing: process capability studies track variance in part sizes to keep tolerances.
  • Genetics and biology: variance is split into genetic and environmental components to study heritability.

Useful Properties

  • Adding a constant to every value does not change the variance.
  • Multiplying every value by k multiplies the variance by k².
  • For independent variables, Var(X + Y) = Var(X) + Var(Y).

What Are the Most Common Mistakes With the Variance Calculator?

  • Mixing up variance and standard deviation. Variance is in squared units; if you need a figure in the original units, take the square root.
  • Using the wrong divisor. Sample data takes n − 1. Using n slightly underestimates the true spread.
  • Forgetting to square. Averaging raw deviations always gives zero.
  • Misreading size. A variance of 400 is not “large” by itself; compare it with the scale of the data.
  • Outliers. Squaring magnifies extreme values, so one outlier can dominate the result.
  • Expecting a negative value. Variance is never negative. A negative answer means a calculation error.

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

What is the difference between variance and standard deviation?

Variance is the average squared deviation from the mean and is measured in squared units. Standard deviation is its square root and is measured in the same units as the data, so it is easier to interpret.

When should I divide by n − 1 instead of n?

Divide by n − 1 when your numbers are a sample drawn from a larger population and you want to estimate the population variance. Divide by N only when your data is the entire population.

Can variance be negative?

No. Variance is built from squared differences, which are never negative. The smallest possible variance is zero, which happens when all values are identical.

How do you calculate variance step by step?

Find the mean, subtract it from each value, square the differences, add them up, and divide by N (population) or n − 1 (sample). For 2, 4, 4, 4, 5, 5, 7, 9 the sum of squares is 32, giving 4 and 4.5714.

Why is variance squared?

Squaring makes every deviation positive so they do not cancel out, and it gives larger deviations more weight. It also makes variance mathematically convenient, because variances of independent variables add.

What is a high variance?

It depends on the scale of the data. A variance is high when the values are widely spread relative to their mean. Compare it using the coefficient of variation to judge relative spread.