Definitions: Variance and Standard Deviation
Both measures come from the same underlying calculation. You compute variance first, then take the square root to get standard deviation. They answer the same question — how spread out is the data? — but in different units. Descriptive statistics relies on both depending on context, and understanding when to use each one is a core skill in data analysis.
The choice between them is not arbitrary. Variance has mathematical properties that make it essential for theoretical work and certain statistical procedures. Standard deviation is preferred when you need to communicate a result clearly or compare spread to the mean itself — because it speaks the same language as the data.
Standard deviation = √Variance, and Variance = (Standard deviation)². These two facts connect every formula, calculation, and application covered on this page.
All Four Formulas Explained
There are four distinct formulas — two for variance (population and sample) and two for standard deviation (population and sample). The difference between population and sample formulas comes down to one thing: the denominator.
Population vs Sample: Why the Denominator Changes
When you have data for an entire population of N members, divide by N. When you have a sample of n members drawn from a larger population, divide by n − 1. The subtraction of 1 is called Bessel's correction, named after the mathematician Friedrich Bessel. Without it, sample variance systematically underestimates the true population variance — particularly with small samples. Dividing by n − 1 corrects that bias.
| Symbol | Name | Denominator | When to Use |
|---|---|---|---|
| σ² | Population Variance | N | You have data on the entire population |
| σ | Population Standard Deviation | N | You have data on the entire population |
| s² | Sample Variance | n − 1 | You have a sample from a larger population |
| s | Sample Standard Deviation | n − 1 | You have a sample from a larger population |
In practice, most research and data science work involves samples, so s and s² are far more common than σ and σ². Statistical software such as Excel, R, Python's NumPy, and SPSS all compute sample standard deviation by default with their standard functions.
Standard Deviation vs Variance: Key Differences
The main difference between standard deviation and variance is units. Variance is the average squared deviation from the mean (measured in squared units). Standard deviation is the square root of variance (measured in the same units as the data). Both measure spread; standard deviation is easier to interpret alongside the mean.
| Feature | Variance (σ² or s²) | Standard Deviation (σ or s) |
|---|---|---|
| Definition | Average squared deviation from the mean | Square root of variance |
| Formula (population) | σ² = Σ(xᵢ − μ)² / N | σ = √[Σ(xᵢ − μ)² / N] |
| Formula (sample) | s² = Σ(xᵢ − x̄)² / (n − 1) | s = √[Σ(xᵢ − x̄)² / (n − 1)] |
| Units | Squared units (kg², cm², $²) | Same units as data (kg, cm, $) |
| Sensitivity to outliers | Very high (deviations are squared) | High (inherits from variance) |
| Can be negative? | No — always ≥ 0 | No — always ≥ 0 |
| Equals zero when? | All values are identical | All values are identical |
| Additive property | Yes — variances of independent variables add | No — SDs do not add directly |
| Interpretability | Harder — squared units lack intuitive meaning | Easier — same scale as the data |
| Used in ANOVA? | Yes (F-statistic) | Indirectly |
| Used for confidence intervals? | Indirectly | Yes (standard error = s/√n) |
| Used in machine learning? | Yes (loss functions, PCA, covariance) | Yes (feature scaling, normalization) |
| Primary use case | Mathematical derivations, combined analysis | Reporting, interpretation, data visualization |
The Unit Problem with Variance
The squared-unit issue is not trivial. Suppose you measure house prices in dollars. The variance comes out in dollars-squared — a unit with no physical meaning you can relate to. Is a variance of $40,000,000 large or small? Hard to say. The standard deviation of $6,325 is immediately comparable to the mean price (say $350,000) and tells you something concrete about how prices cluster.
This is why reports, academic papers, and dashboards almost always present standard deviation rather than variance. Variance does its most important work behind the scenes — inside formulas for ANOVA, regression, and hypothesis tests — while standard deviation faces the audience.
Worked Examples: Step-by-Step Calculations
The following examples cover five real-world datasets. Each one calculates both variance and standard deviation from scratch to show the complete procedure.
Student Exam Scores
Five students score: 68, 74, 81, 74, 63 on a statistics exam. Calculate the sample variance and sample standard deviation.
| Student | Score (xᵢ) | xᵢ − x̄ | (xᵢ − x̄)² |
|---|---|---|---|
| A | 68 | 68 − 72 = −4 | 16 |
| B | 74 | 74 − 72 = +2 | 4 |
| C | 81 | 81 − 72 = +9 | 81 |
| D | 74 | 74 − 72 = +2 | 4 |
| E | 63 | 63 − 72 = −9 | 81 |
| Sum of squared deviations | 186 | ||
Find the mean: x̄ = (68 + 74 + 81 + 74 + 63) / 5 = 360 / 5 = 72
Calculate each squared deviation: See table above. Sum = 186.
Sample variance: s² = 186 / (5 − 1) = 186 / 4 = 46.5 points²
Sample standard deviation: s = √46.5 ≈ 6.82 points
✓ Sample variance s² = 46.5 points² | Sample standard deviation s ≈ 6.82 points. The typical score deviates about 6.82 points from the class mean of 72.
Employee Monthly Salaries ($)
A department has four employees with monthly salaries: $3,200 | $4,100 | $3,800 | $5,300. This is the complete department (population). Calculate population variance and population standard deviation.
Population mean: μ = (3,200 + 4,100 + 3,800 + 5,300) / 4 = 16,400 / 4 = $4,100
Squared deviations: (3200−4100)² = 810,000 | (4100−4100)² = 0 | (3800−4100)² = 90,000 | (5300−4100)² = 1,440,000. Sum = 2,340,000.
Population variance: σ² = 2,340,000 / 4 = $585,000 per month²
Population standard deviation: σ = √585,000 ≈ $764.85 per month
✓ Population variance σ² = $585,000/month² | Population standard deviation σ ≈ $764.85/month. Salaries typically fall within about $765 of the $4,100 average.
Daily High Temperatures (°C)
Six daily temperatures are recorded: 22, 19, 25, 21, 28, 23 °C. Treat as a sample. Calculate sample variance and standard deviation.
Mean: x̄ = (22 + 19 + 25 + 21 + 28 + 23) / 6 = 138 / 6 = 23°C
Squared deviations: (22−23)²=1 | (19−23)²=16 | (25−23)²=4 | (21−23)²=4 | (28−23)²=25 | (23−23)²=0. Sum = 50.
Sample variance: s² = 50 / (6 − 1) = 50 / 5 = 10°C²
Sample standard deviation: s = √10 ≈ 3.16°C
✓ Sample variance s² = 10°C² | Sample standard deviation s ≈ 3.16°C. Temperatures deviate from the 23°C mean by about 3.16°C on average.
Bolt Diameters (mm)
A production line samples 5 bolts with diameters: 10.1, 9.9, 10.2, 10.0, 9.8 mm. Calculate sample variance and standard deviation for quality control.
Mean: x̄ = (10.1 + 9.9 + 10.2 + 10.0 + 9.8) / 5 = 50.0 / 5 = 10.00 mm
Squared deviations: (0.1)²=0.01 | (−0.1)²=0.01 | (0.2)²=0.04 | (0.0)²=0 | (−0.2)²=0.04. Sum = 0.10.
Sample variance: s² = 0.10 / 4 = 0.025 mm²
Sample standard deviation: s = √0.025 ≈ 0.158 mm
✓ Sample variance s² = 0.025 mm² | Sample standard deviation s ≈ 0.158 mm. Bolt diameters vary by about 0.16 mm from the target 10.00 mm — an engineer can compare this to their tolerance specification.
Monthly Stock Returns (%)
A stock recorded monthly returns over 6 months: +3.2%, −1.5%, +4.8%, +0.9%, −2.1%, +3.7%. Calculate sample variance and standard deviation as a measure of investment risk.
Mean return: x̄ = (3.2 − 1.5 + 4.8 + 0.9 − 2.1 + 3.7) / 6 = 9.0 / 6 = 1.50%
Squared deviations: (1.7)²=2.89 | (−3.0)²=9.00 | (3.3)²=10.89 | (−0.6)²=0.36 | (−3.6)²=12.96 | (2.2)²=4.84. Sum = 40.94.
Sample variance: s² = 40.94 / 5 = 8.19 %²
Sample standard deviation: s = √8.19 ≈ 2.86%
✓ Sample variance s² ≈ 8.19 %² | Sample standard deviation s ≈ 2.86%. This stock typically returns within ±2.86% of its 1.50% average monthly return — the volatility measure used in portfolio risk analysis.
The Mathematical Relationship
Variance and standard deviation are not two independent calculations. They are two steps of the same process, and their relationship is exact:
σ = √σ² Populations = √s² Sampleσ² = σ² Square the SD to get varianceThis relationship has a concrete consequence: if you know one, you can calculate the other instantly. A sample standard deviation of s = 8.5 means the sample variance is s² = 72.25. A population variance of σ² = 100 means the population standard deviation is σ = 10.
Why Square the Deviations at All?
When you subtract the mean from each data point, you get a deviation. Some deviations are positive, some are negative, and if you simply add them all up, they cancel each other and sum to zero — which tells you nothing about spread. Two solutions exist: take the absolute value, or square the deviations. Statistics chose squaring for three reasons.
Squaring eliminates negative values
Any deviation squared is non-negative, so the sum of squared deviations is always positive — it correctly reflects the total spread regardless of whether individual values fall above or below the mean.
Squaring penalizes large deviations more heavily
A deviation of 10 contributes 100 to the sum of squares, while a deviation of 2 contributes only 4. This makes variance (and standard deviation) more sensitive to outliers than the mean absolute deviation, which is sometimes exactly the behavior you want when extreme values carry more risk.
Squared deviations enable additive combination
Variances of independent random variables add together: Var(X + Y) = Var(X) + Var(Y). Standard deviations do not have this property. This additivity makes variance the natural currency for combining uncertainty across multiple variables — essential in probability theory, ANOVA, and portfolio construction.
When to Use Variance vs Standard Deviation
Decision Guide: Which Measure to Use?
- You want a number in the same units as the mean for direct comparison
- You're computing a z-score: z = (x − μ) / σ
- You're building confidence intervals using the standard error (SE = s / √n)
- You're visualizing data with error bars on a chart
- You're comparing spread across datasets measured in the same unit
- You're using the empirical rule (68–95–99.7%) for a normal distribution
- You need the additive property: Var(X + Y) = Var(X) + Var(Y) for independent X and Y
- You're running ANOVA or an F-test (which compare ratios of variances)
- You're constructing a covariance or correlation matrix
- You're measuring portfolio risk where covariances between assets matter
- You're optimizing a mean squared error (MSE) loss function
- You're deriving theoretical results in probability or mathematical statistics
Real-World Applications
Finance & Investment
Variance (σ²) measures total portfolio risk. Covariance between asset returns determines how risks combine. Modern Portfolio Theory by Harry Markowitz built on variance as the core risk metric. Standard deviation, called volatility, communicates that risk in percentage terms investors can reason about.
Healthcare & Clinical Research
Standard deviation appears in clinical trial reports to describe the spread of patient outcomes around the mean response. Researchers use sample variance in repeated-measures ANOVA to compare treatment effects across multiple time points.
Manufacturing & Quality Control
Six Sigma methodology defines process capability using standard deviation (σ). A process "in control" keeps output within ±3σ of the target. Variance tracking over time detects drift before defects reach customers.
Machine Learning & AI
Mean Squared Error (MSE) — a core loss function — is the variance of residuals. Bias-variance tradeoff uses variance formally. Principal Component Analysis (PCA) seeks directions of maximum variance. Feature standardization divides by standard deviation.
Meteorology & Climate
Climate scientists report temperature anomaly standard deviation to quantify how much year-to-year temperatures deviate from a historical baseline. Variance is used when combining uncertainty estimates from multiple climate models.
Sports Analytics
Consistency is measured by standard deviation of performance metrics across games. A player with a lower standard deviation in shooting percentage is more predictable. Analysts use variance when building composite performance indices from multiple statistics.
Finance Case Study: Portfolio Variance
Case Study — Finance
Why Portfolio Theory Uses Variance, Not Standard Deviation
Two stocks each have a standard deviation of 10%. Naively you might assume that a 50/50 portfolio has SD = 10%. It does not — unless the stocks move perfectly together (correlation = +1). The correct formula uses variance and covariance:
If the two stocks have a correlation of −0.5 (they tend to move in opposite directions), the portfolio variance drops significantly below 100 (10²). You cannot do this calculation with standard deviations directly — which is exactly why variance is the preferred unit in portfolio mathematics. The portfolio's standard deviation is then √(portfolio variance), converting back to an interpretable percentage. This is why both measures are needed.
The SPREAD Framework
The following framework provides a memorable step-by-step procedure for computing variance and standard deviation from any dataset. Each letter maps to one action.
Computing in Excel, R, Python, and SPSS
| Software | Sample Standard Deviation | Sample Variance |
|---|---|---|
| Excel / Google Sheets | =STDEV(A1:A10) | =VAR(A1:A10) |
| Excel — Population | =STDEVP(A1:A10) | =VARP(A1:A10) |
| Python (NumPy) | np.std(data, ddof=1) | np.var(data, ddof=1) |
| Python (population) | np.std(data, ddof=0) | np.var(data, ddof=0) |
| Python (pandas) | df['col'].std() | df['col'].var() |
| R | sd(x) | var(x) |
| SPSS | Analyze → Descriptives → Std Dev | Analyze → Descriptives → Variance |
np.std() and np.var() default to ddof=0 (population formulas). For sample statistics — which is almost always what you want in data science — pass ddof=1. pandas .std() and .var() default to ddof=1 (sample), consistent with R's sd() and var().
Common Misconceptions
| Misconception | What's Wrong | The Correct Understanding |
|---|---|---|
| "Standard deviation is always smaller than variance" | ✗ False | ✓ When variance < 1, the standard deviation is actually larger than variance (e.g., variance = 0.25, SD = 0.5) |
| "You can add standard deviations the way you add variances" | ✗ False | ✓ Variances of independent variables add; standard deviations do not. You must square to get variance, add, then take the square root |
| "The mean ± 1 SD always contains 68% of data" | ✗ Incomplete | ✓ The 68–95–99.7 empirical rule only applies to normally distributed data. For non-normal data, use Chebyshev's theorem instead |
| "Sample variance uses n in the denominator" | ✗ False | ✓ Sample variance uses n − 1 (Bessel's correction) to correct for the downward bias that occurs when estimating population variance from a sample |
| "A larger standard deviation means the data is wrong" | ✗ False | ✓ High spread simply means the data is more variable. Whether that's a problem depends on context — it's normal for stock returns to be volatile and expected for temperatures across seasons |
| "Variance and standard deviation measure the same thing" | ✗ Oversimplified | ✓ They quantify the same spread but differ in units and mathematical properties. These differences determine which measure to use in each statistical procedure |
Interactive Variance & Standard Deviation Calculator
Variance & Standard Deviation Calculator
Extended Comparison Table
Standard Deviation vs Standard Error
Standard deviation and standard error are often confused. Standard deviation describes the spread of individual data points around the mean. Standard error (SE = s / √n) describes the precision of the sample mean as an estimate of the population mean — it gets smaller as sample size grows. Standard deviation does not depend on sample size.
| Measure | What It Describes | Formula |
|---|---|---|
| Standard Deviation (SD) | Spread of individual data points | s = √[Σ(xᵢ−x̄)²/(n−1)] |
| Standard Error (SE) | Precision of the sample mean | SE = s / √n |
| Variance | Spread of individual data points (squared units) | s² = Σ(xᵢ−x̄)²/(n−1) |
| Coefficient of Variation (CV) | Relative spread as a percentage of the mean | CV = (s / x̄) × 100% |
| Interquartile Range (IQR) | Middle 50% spread — resistant to outliers | IQR = Q3 − Q1 |
Formula Cheat Sheet
| Formula | Notation | Type | Key Note |
|---|---|---|---|
| Population Variance | σ² = Σ(xᵢ−μ)²/N | Descriptive | Use when you have all data (census) |
| Sample Variance | s² = Σ(xᵢ−x̄)²/(n−1) | Inferential | Bessel's correction: divide by n−1 |
| Population Standard Deviation | σ = √σ² | Descriptive | Same units as data |
| Sample Standard Deviation | s = √s² | Inferential | Most common in practice |
| Standard Error of Mean | SE = s/√n | Inferential | Shrinks as sample grows |
| Z-score | z = (x−μ)/σ | Standardization | How many SDs from the mean |
| Coefficient of Variation | CV = (σ/μ)×100% | Relative measure | Compares spread across different scales |
| Variance of sum (independent) | Var(X+Y) = Var(X)+Var(Y) | Probability | Variances add; SDs don't |
Frequently Asked Questions
n − 1 rather than n because of Bessel's correction. This adjustment compensates for the fact that the sample mean is used instead of the true population mean, making the sample variance an unbiased estimator of the population variance.
Sources & Further Reading
The concepts on this page draw from standard statistical theory. The following resources provide rigorous treatments for further study.