Variance measures how far a set of numbers is spread out from its average. It is the mean of the squared deviations: values far from the mean count a lot, values close to it hardly at all. Variance underlies many statistical methods (analysis of variance (ANOVA), regression, portfolio risk, quality control) because variances of independent quantities simply add, which standard deviations do not.
Two versions exist. For a population, meaning every value you care about, divide the sum of squares by N. For a sample, divide by n − 1 instead; this Bessel’s correction makes the sample variance an unbiased estimate of the population variance. Choose the data set type and the calculator gives that version first, with the other underneath.
Because deviations are squared, variance is in squared units (cm², $²), which makes it hard to picture. Its square root, the standard deviation, brings the spread back to the original units, so both are listed.
How to use the Variance Calculator
- Data
- Data set type
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Find the mean, subtract it from every value, square each difference, add the squares and divide by n − 1 (sample) or N (population). The table shows each step.
Worked example
For 4, 8, 15, 16, 23 and 42 the mean is 18 and the squared deviations 196, 100, 9, 4, 25 and 576 add to 910. The sample variance is 910 ÷ 5 = 182 and the population variance 910 ÷ 6 = 151.67. Their square roots are 13.49 and 12.32.
Variance in common software
| Software | Sample variance | Population variance |
|---|---|---|
| Excel / Google Sheets | VAR.S | VAR.P |
| R | var() | var() × (n − 1)/n |
| Python (NumPy) | np.var(x, ddof=1) | np.var(x) |
| TI-84 | Sx² | σx² |
Formula
s² = Σ(x − x̄)² ÷ (n − 1) · σ² = Σ(x − μ)² ÷ N · shortcut: s² = (Σx² − n·x̄²) ÷ (n − 1)
Worked example
Inputs: Data: 4, 8, 15, 16, 23, 42; Data set type: Sample (divide by n − 1).
Results: Variance (chosen type) = 182; Sample variance (s²) = 182; Population variance (σ²) = 151.666667; Sum of squares = 910; Sample standard deviation = 13.490738; Population standard deviation = 12.315302.
Key terms
- Variance
- The average squared deviation from the mean.
- Sample variance (s²)
- The sum of squares divided by n − 1, an unbiased estimate of the population variance.
- Population variance (σ²)
- The sum of squares divided by N for a complete population.
Frequently asked questions
Why is variance in squared units?
Because deviations are squared; standard deviation brings it back to the original units.
Can variance be negative?
No. It is an average of squares, so it is 0 when all values are equal and positive otherwise.
What is the variance of 5, 5, 5, 7, 8, 8, 9, 9?
The mean is 7 and the squared deviations add to 22, so the population variance is 22 ÷ 8 = 2.75 and the sample variance 22 ÷ 7 = 3.14.
What is the variance of 1, 2, 4, 6 as a sample?
The mean is 3.25, the sum of squares 14.75, so s² = 14.75 ÷ 3 = 4.9167.
When do I use sample variance?
Whenever the data are a sample from a larger group and you want to estimate that group's variance, which is the usual case in research.
How is variance related to standard deviation?
Standard deviation is the square root of variance. A variance of 182 means a standard deviation of 13.49.
Why do variances add but standard deviations not?
For independent variables Var(X + Y) = Var(X) + Var(Y). Standard deviations combine as √(σ₁² + σ₂²), never as σ₁ + σ₂.
Sources
Guides on this topic
- Standard Deviation Explained: How to Calculate It and What It Means: Standard deviation is the typical distance from the mean. Learn to calculate it by hand, when to divide by n − 1, and how to read it with the 68–95–99.7 rule.