Variance Calculator
Calculate population or sample variance and standard deviation from any data set.
Results
What is Variance?
Variance measures how far data points spread from their mean. It is computed as the average of the squared deviations from the mean, making it a fundamental concept in statistics, probability, and data science.
The Formula
Population variance: σ² = Σ(xᵢ − μ)² / n. Sample variance: s² = Σ(xᵢ − x̄)² / (n−1). Steps: (1) find the mean, (2) subtract the mean from each value and square the result, (3) sum all squared deviations, (4) divide by n or n−1.
Why Square the Deviations?
Without squaring, positive and negative deviations would cancel out, always giving zero. Squaring keeps all deviations positive and magnifies larger deviations — a desirable property since large deviations from the mean are often more important. The trade-off is that variance is in squared units, which is why standard deviation (the square root) is often preferred for reporting.
Additive Property
For independent random variables X and Y: Var(X + Y) = Var(X) + Var(Y). This additive property makes variance central to statistical theory. Standard deviation is NOT additive: SD(X+Y) ≠ SD(X) + SD(Y).
Applications
Variance appears in ANOVA (analysis of variance), regression analysis, portfolio theory (Markowitz mean-variance optimization), quality control (process variation), and machine learning (bias-variance tradeoff). A portfolio's variance equals the weighted sum of asset variances plus covariance terms.
Worked Example: Sample Variance of Test Scores
Five students scored: 70, 75, 80, 85, 90 on a test. Calculate the sample variance.
Step 1 — Find the mean: x̄ = (70+75+80+85+90)/5 = 400/5 = 80.
Step 2 — Calculate squared deviations: (70−80)² = 100, (75−80)² = 25, (80−80)² = 0, (85−80)² = 25, (90−80)² = 100.
Step 3 — Sum of squared deviations: 100 + 25 + 0 + 25 + 100 = 250.
Step 4 — Sample variance (divide by n−1 = 4): s² = 250/4 = 62.5.
Step 5 — Standard deviation: s = √62.5 ≈ 7.91. This means scores typically deviate from the mean by about 7.91 points.
Frequently Asked Questions
Variance is the average squared deviation from the mean. It measures how spread out data is. High variance = data spread out; low variance = data clustered near the mean.
Population variance (σ²) uses n in the denominator and applies when you have all data. Sample variance (s²) uses n−1 (Bessel's correction) for an unbiased estimate when working with a sample.
Squaring makes all deviations positive (preventing cancellation), gives more weight to large deviations, and produces a mathematically tractable quantity with useful properties like additivity for independent variables.
SD = √variance. Variance is in squared units; SD returns to original units. Both measure spread, but SD is more interpretable. A variance of 25 means SD = 5.
No. Variance is always ≥ 0. It equals 0 only when all values in the data set are identical (no spread at all).
Bessel's correction divides by n−1 instead of n when computing sample variance. It corrects for the fact that a sample mean is not the true population mean. Dividing by n systematically underestimates the true variance, so n−1 gives an unbiased estimate. For large n, the difference is negligible.
The coefficient of variation is the standard deviation divided by the mean, expressed as a percentage: CV = (SD / mean) × 100%. It measures relative spread and is useful for comparing variability across data sets with different units or scales. A CV of 10% means the data has moderate variability; above 30% is considered high variability.