unspurious.calculators

Foundations · Spread

Variance Calculator

Variance is the average squared distance from the mean — the squared sibling of the standard deviation, and the one that actually does the algebra. Get the sample and population variance of your data with every squared deviation drawn as a literal square, or combine the variances of two quantities and watch why independent spreads add as squares (σ = 3 and σ = 4 make 5, not 7) while standard deviations refuse to add at all.

The variance is reported both ways: divided by n − 1 (sample, the usual default) and by n (population, when these numbers are the whole group).

Result

In plain English

To measure spread you take each value’s distance from the mean, but those distances cancel out (the positives and negatives sum to zero). Squaring them first fixes that — and the variance is simply the average of those squared distances. Its square root, the standard deviation, brings the answer back to the original units, which is why the SD is what gets quoted. So why keep the variance around? Because the squared version is the one that behaves: variances of independent things add, and that single property underpins the standard error, error propagation, ANOVA and portfolio risk.

variance (s² or σ²)
The average squared deviation from the mean. Big spread, big variance; identical values, zero variance. Measured in the square of the data’s units (pounds², seconds²), which is its one inconvenience.
sample vs population (n − 1 vs n)
Divide the summed squared deviations by n − 1 for a sample (Bessel’s correction, which undoes a sample’s tendency to understate spread) or by n for a whole population. The gap matters most when n is small.
why square, not just take absolute values?
Squaring is smooth (differentiable), it penalises a few large errors more than many small ones, and it makes variances additive — none of which the mean absolute deviation can offer.
variances add, SDs don’t
For independent X and Y, Var(X + Y) = Var(X) + Var(Y). The standard deviations combine as √(σₓ² + σᵧ²) — like the sides of a right triangle — so σ = 3 and σ = 4 give 5, never 7.
covariance, the correction term
When X and Y move together, Var(X ± Y) = Var(X) + Var(Y) ± 2·Cov(X, Y). Positive correlation inflates the variance of a sum; negative correlation shrinks it — the mathematics behind diversification.

Frequently asked

What is variance, and how is it different from standard deviation?

Variance is the average of the squared distances of your data from their mean; the standard deviation is its square root. They carry the same information, but in different units — variance is in squared units (kg², say), the SD back in the original units (kg). The SD is easier to interpret and gets reported, while the variance is the one used inside formulas, because it has the clean algebraic property that independent variances add. Compute one and you have the other: σ = √(σ²).

Do I divide by n or by n − 1?

Divide by n − 1 when your numbers are a sample drawn from a larger population — which is almost always — and by n only when they are the entire population. The n − 1 version (called Bessel’s correction) compensates for the fact that the sample hugs its own mean a little too tightly, which would otherwise make the variance come out too small. This calculator shows both; the sample version is the standard default in research and in R’s and NumPy’s defaults.

Why use variance at all, when the standard deviation is easier to read?

Because of one property the SD lacks: for independent quantities, variances simply add. The variance of a sum is the sum of the variances; the variance of an average is the population variance divided by n (which is where the standard error σ/√n comes from). None of that works with standard deviations directly — they combine as a square root of summed squares, not by adding. So statisticians do the bookkeeping in variance and report the answer as an SD at the end.

If two things each vary by 3 and 4, doesn’t the total vary by 7?

Only if they are perfectly correlated. For independent quantities you add the variances, not the standard deviations: 3² + 4² = 9 + 16 = 25, so the combined SD is √25 = 5, not 7. Standard deviations add like the perpendicular sides of a right triangle (the combined spread is the hypotenuse). They only reach the full 7 when the two move in perfect lockstep (r = 1); when they move oppositely (r = −1) the spreads partly cancel, here down to just 1. The “Two variances to combine” mode draws this.