Skip to main content
Statistics & Probability

Variance Calculator: The Ultimate Guide to Dispersion

Calculate sample and population variance, standard deviation, and sum of squares with step-by-step deviation breakdowns and statistical analysis.

MD Abu Hanif Mia

Engineered & Verified by MD Abu Hanif Mia • Nexus Systems Engineering Team (NIST Constants & ISO 80000-2 Mathematical Standards)

Institutional Formula & Benchmark Verification • Last Verified: 2026-11-19

Formula at a Glance

Sample & Population Standard Deviation Formula

Verified Formula
s=∑i=1n(xi−xˉ)2n−1,σ=∑i=1N(xi−μ)2Ns = \sqrt{\frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n - 1}}, \quad \sigma = \sqrt{\frac{\sum_{i=1}^{N}(x_i - \mu)^2}{N}}

Key Formula Variables:

s, σStandard Deviation: Dispersion around the mean (sample s uses Bessel’s n-1)
xᵢData Points: Individual numeric observations in the dataset
x̄, μMean: Arithmetic average of all observations
n, NCount: Number of observations in sample or population
Calculation Methodology: 1. Compute the mean x̄. 2. Subtract x̄ from each observation and square each deviation. 3. Divide the sum of squares by (n - 1) for sample variance s² (or N for population σ²), then take the square root.
Try a 1-Click Scenario:
Continue Your Calculation Workflow

What to Calculate After Variance Calculator: The Ultimate Guide to Dispersion

The Math Behind It

Calculations for this tool are based on the standard Sample & Population Standard Deviation Formula:

s=∑i=1n(xi−xˉ)2n−1,σ=∑i=1N(xi−μ)2Ns = \sqrt{\frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n - 1}}, \quad \sigma = \sqrt{\frac{\sum_{i=1}^{N}(x_i - \mu)^2}{N}}
  • s, σ = Standard Deviation (Dispersion around the mean (sample s uses Bessel’s n-1))
  • xᵢ = Data Points (Individual numeric observations in the dataset)
  • x̄, μ = Mean (Arithmetic average of all observations)
  • n, N = Count (Number of observations in sample or population)

1. Compute the mean x̄. 2. Subtract x̄ from each observation and square each deviation. 3. Divide the sum of squares by (n - 1) for sample variance s² (or N for population σ²), then take the square root.

Quick Reference Matrix

Normal Distribution Empirical Rule (68–95–99.7% Sigma Coverage)

Interactive Presets

Percentage of observations falling inside ±1σ to ±3σ around the mean, illustrated with a reference normal distribution (μ = 100, σ = 15).

Normal Distribution Empirical Rule (68–95–99.7% Sigma Coverage)
Sigma BandData Within RangeOutside Range (Tails)Example (μ=100, σ=15)Action
±1σ68.27%31.73%85 – 115
±1.5σ86.64%13.36%77.5 – 122.5
±2σ95.45%4.55%70 – 130
±2.5σ98.76%1.24%62.5 – 137.5
±3σ99.73%0.27%55 – 145

Click any row to test these numbers in the interactive calculator above.

Statistical dispersion measures how tightly or widely individual observations in a dataset cluster around their central value. While measures of central tendency such as the mean or median identify the center of a distribution, two datasets can share the exact same average yet exhibit drastically different risk profiles and spread. Variance (σ2\sigma^2 for a population, s2s^2 for a sample) is the foundational metric of statistical variability, quantifying the average squared distance between each data point and the arithmetic mean.

In quantitative finance, quality assurance, experimental physics, and machine learning, variance governs how uncertainty is modeled and partitioned. Whether evaluating the historical return volatility of an equity portfolio, performing an Analysis of Variance (ANOVA) across clinical trial groups, or diagnosing the bias-variance tradeoff in a predictive algorithm, mastering variance calculation ensures accurate interpretation of data volatility.

Mathematical Formulas: Population vs. Sample Variance

Calculating variance requires distinguishing whether your dataset represents an entire closed population or a partial sample drawn to estimate a broader population.

Population Variance (σ2\sigma^2)

When every member of the target population is observed, the true population variance is the arithmetic mean of the squared deviations from the population mean:

σ2=∑i=1N(xi−μ)2N\sigma^2 = \frac{\sum_{i=1}^{N} (x_i - \mu)^2}{N}

Sample Variance (s2s^2)

When working with a sample of size nn taken from a larger population, the sample variance applies Bessel's correction by dividing the sum of squared deviations by n−1n - 1 rather than nn:

s2=∑i=1n(xi−xˉ)2n−1s^2 = \frac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n - 1}

Computational Sum of Squares Formula

In manual calculations or single-pass streaming algorithms, the algebraic raw-score identity computes the Sum of Squares (SSSS) directly from the sum of values and the sum of squared values:

SS=∑i=1n(xi−xˉ)2=∑i=1nxi2−(∑i=1nxi)2nSS = \sum_{i=1}^{n} (x_i - \bar{x})^2 = \sum_{i=1}^{n} x_i^2 - \frac{\left(\sum_{i=1}^{n} x_i\right)^2}{n}

Variable Definitions

  • σ2\sigma^2: Population variance, expressed in squared units of the original variable.
  • s2s^2: Unbiased sample variance estimator.
  • xix_i: The ii-th individual observation in the dataset.
  • μ\mu: Population arithmetic mean, calculated as 1N∑i=1Nxi\frac{1}{N}\sum_{i=1}^{N} x_i.
  • xˉ\bar{x}: Sample arithmetic mean, calculated as 1n∑i=1nxi\frac{1}{n}\sum_{i=1}^{n} x_i.
  • NN: Total number of observations in the complete population.
  • nn: Total number of observations in the sample.
  • n−1n - 1: Degrees of freedom (dfdf) available for estimating dispersion around an unknown population mean.

Understanding Bessel's Correction and Degrees of Freedom

A common question in applied statistics is why sample variance divides by n−1n - 1 instead of nn. When the true population mean μ\mu is unknown, we must substitute the sample mean xˉ\bar{x} into the variance formula. By mathematical definition, the sample mean xˉ\bar{x} is the exact point of minimum squared distance for the observations inside that specific sample. Consequently, the sum of squared deviations around the sample mean is always less than or equal to the sum of squared deviations around the true population mean:

∑i=1n(xi−xˉ)2≤∑i=1n(xi−μ)2\sum_{i=1}^{n} (x_i - \bar{x})^2 \le \sum_{i=1}^{n} (x_i - \mu)^2

Dividing the sample sum of squares by nn systematically underestimates the true population variance σ2\sigma^2 across repeated samples. Dividing by the degrees of freedom (df=n−1df = n - 1) scales the estimator upward by nn−1\frac{n}{n-1}, removing this downward bias. Once xˉ\bar{x} is fixed, only n−1n - 1 observations are free to vary independently because the final nn-th value is determined by the constraint ∑(xi−xˉ)=0\sum (x_i - \bar{x}) = 0.

Step-by-Step Worked Calculation Example

Suppose an industrial quality engineer measures the tensile strength (in megapascals, MPa) of a random sample of n=6n = 6 steel alloy specimens: {14,18,20,22,26,32}{14, 18, 20, 22, 26, 32}.

  1. Compute the Sample Mean (xˉ\bar{x}):
    xˉ=14+18+20+22+26+326=1326=22 MPa\bar{x} = \frac{14 + 18 + 20 + 22 + 26 + 32}{6} = \frac{132}{6} = 22\text{ MPa}
  2. Calculate Individual Deviations (xi−xˉx_i - \bar{x}): Subtracting $22$ from each value gives −8,−4,−2,0,+4,+10-8, -4, -2, 0, +4, +10. Notice that (−8)+(−4)+(−2)+0+4+10=0(-8) + (-4) + (-2) + 0 + 4 + 10 = 0, confirming the mean is exact.
  3. Square Each Deviation and Compute the Sum of Squares (SSSS):
    SS=(−8)2+(−4)2+(−2)2+02+42+102=64+16+4+0+16+100=200 MPa2SS = (-8)^2 + (-4)^2 + (-2)^2 + 0^2 + 4^2 + 10^2 = 64 + 16 + 4 + 0 + 16 + 100 = 200\text{ MPa}^2
  4. Divide by Degrees of Freedom for Sample Variance (s2s^2): Dividing SS=200SS = 200 by n−1=5n - 1 = 5 gives sample variance and standard deviation:
    s2=2005=40.0 MPa2,s=40.0≈6.3246 MPas^2 = \frac{200}{5} = 40.0\text{ MPa}^2, \qquad s = \sqrt{40.0} \approx 6.3246\text{ MPa}

c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 c69,-144,104.5,-217.7,106.5,-221 l0 -0 c5.3,-9.3,12,-14,20,-14 H400000v40H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z M834 80h400000v40h-400000z"/>​≈6.3246 MPa If those six specimens constituted the entire population, dividing by N=6N = 6 yields σ2=2006≈33.3333 MPa2\sigma^2 = \frac{200}{6} \approx 33.3333\text{ MPa}^2 (σ≈5.7735 MPa\sigma \approx 5.7735\text{ MPa}).

Comparison of Statistical Dispersion Metrics

Dispersion MetricMathematical FormulaMeasurement UnitsOutlier SensitivityPrimary Analytical Application
Sample Variance (s2s^2)∑(xi−xˉ)2n−1\frac{\sum (x_i - \bar{x})^2}{n - 1}Squared units (unit2\text{unit}^2)Very HighANOVA, linear regression, portfolio optimization
Standard Deviation (ss)∑(xi−xˉ)2n−1\sqrt{\frac{\sum (x_i - \bar{x})^2}{n - 1}}
l0 -0
c4,-6.7,10,-10,18,-10 H400000v40
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M1001 80h400000v40h-400000z"/>​Original unitsHighConfidence intervals, z-scores, Six Sigma limits
Coefficient of Variation (CVCV)s∣xˉ∣×100%\frac{s}{|\bar{x}|} \times 100%Percentage (%%)HighComparing volatility across different scales
Mean Absolute Deviation (MADMAD)∑∣xi−xˉ∣n\frac{\sum |x_i - \bar{x}|}{n}Original unitsModerateDemand forecasting error and robust risk tracking
Interquartile Range (IQRIQR)Q3−Q1Q_3 - Q_1Original unitsVery LowSkewed distributions and box-plot outlier fences

Practical Applications of Variance

In Modern Portfolio Theory, asset return variance serves as the mathematical definition of investment risk. Total portfolio variance depends on both individual asset variances (wi2σi2w_i^2 \sigma_i^2) and pairwise covariances (2wiwjCov(i,j)2 w_i w_j \text{Cov}(i, j)), enabling diversification to lower overall volatility. Furthermore, because variance is directly additive for independent variables (Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)), ANOVA and regression models partition total sum of squares (SStotalSS_{\text{total}}) into explained model variance (SSbetweenSS_{\text{between}}) and residual error variance (SSwithinSS_{\text{within}}) to compute the FF-statistic for hypothesis testing.

Frequently Asked Questions

What is the mathematical formula used by the Variance Calculator: The Ultimate Guide to Dispersion?
The Variance Calculator: The Ultimate Guide to Dispersion uses the Sample & Population Standard Deviation Formula: s = √[ Σ(xᵢ - x̄)² / (n - 1) ] | σ = √[ Σ(xᵢ - μ)² / N ]. Where: s, σ = Standard Deviation (Dispersion around the mean (sample s uses Bessel’s n-1)); xᵢ = Data Points (Individual numeric observations in the dataset); x̄, μ = Mean (Arithmetic average of all observations); n, N = Count (Number of observations in sample or population). 1. Compute the mean x̄. 2. Subtract x̄ from each observation and square each deviation. 3. Divide the sum of squares by (n - 1) for sample variance s² (or N for population σ²), then take the square root.
When should I use sample variance (n - 1) instead of population variance (N)?
Use population variance (dividing by N) only when your dataset contains every single member of the group being studied, such as all 50 US state populations. Use sample variance (dividing by n - 1) whenever your dataset is a subset drawn from a larger population and you want an unbiased estimate of the true population dispersion.
Why are deviations squared when calculating variance?
Simply averaging raw deviations from the mean always yields zero because positive and negative deviations cancel each other out. Squaring each deviation makes every term non-negative, penalizes large outliers more heavily than small fluctuations, and produces a smooth, differentiable function suitable for inferential statistics like ANOVA and regression.
Can variance ever be a negative number?
No. Because variance is the average of squared real numbers and every squared real deviation is greater than or equal to zero, variance must always be zero or positive. A variance of exactly zero occurs only when every observation in the dataset is identical.
What is the difference between variance and standard deviation?
Variance measures dispersion in squared units of the original data (such as squared dollars or squared centimeters), which makes mathematical manipulation and variance partitioning straightforward. Standard deviation is the positive square root of variance, restoring the dispersion metric back to the original units of measurement for intuitive interpretation.
How do extreme outliers affect variance?
Because deviations from the mean are squared, variance is highly sensitive to outliers. A single observation located three times farther from the mean than a typical point contributes nine times as much to the sum of squares, which can inflate variance in heavily skewed datasets.

Community Discussions & Real Scenarios

Ask specific questions, compare edge cases, and get advice from people calculating the same scenario.