What Is Standard Deviation?
Press Next → or use ← → arrow keys
The Intuition — Two Packing Machines
Standard deviation captures exactly that: Machine A's is 0.15 g, Machine B's is 4.36 g. It answers the question the mean can't — "on average, how far does each value land from the middle?"
Standard deviation is the typical distance between a data point and the mean, expressed in the same units as the data. Small σ = consistent and predictable; large σ = scattered and unreliable.
Consistency You Can Measure
Machine B occasionally underfills to 14 g (angry customers) and overfills to 26 g (wasted product) — even though its average is a perfect 20. Standard deviation is the number quality control actually cares about, because it measures the consistency the mean hides.
Variance, Made Readable
Variance and standard deviation carry the same information about spread — but variance lives in squared units nobody can picture. Taking the square root gives standard deviation, which sits in the data's own units, so you can say "packets vary by about 0.15 g on average."
Population vs Sample
Because standard deviation is just the root of variance, the same divisor logic applies: use N for a full population and n − 1 for a sample. A sample tends to look tighter than the true population, and (n − 1) nudges the estimate up to correct that bias.
Eight Exam Scores, Step By Step
Scores: 52, 74, 68, 90, 61, 85, 72, 78. Work the sample standard deviation all the way through.
The class averaged 72.5, and students typically scored within about ±12 marks of that — so most fell roughly between 60 and 85. One number now describes both where the class sits and how spread out it is.
The 68-95-99.7 Rule
For normally distributed data, 68% of values land within ±1σ of the mean, 95% within ±2σ, and 99.7% within ±3σ. Standard deviation stops being an abstract number and becomes a map of where the data actually lives.
Heights: Mean 175 cm, σ = 7 cm
With mean 175 cm and σ = 7 cm, a man of 189 cm sits at exactly +2σ — taller than about 97.5% of men. Someone over 196 cm is beyond +3σ, in the rarest 0.15%. The empirical rule lets you turn any measurement into a "how unusual is this?" in your head.
The 68-95-99.7 rule assumes a bell shape. On heavily skewed data (incomes, wait times) it breaks down — so always visualize the distribution first before trusting those percentages.
Standardizing With Z-Scores
A z-score rewrites every value as its distance from the mean in units of σ. It recenters
the data to mean 0 and σ 1, so you can compare apples to oranges — a height and an exam score — and spot
how extreme any single point is. It's exactly what StandardScaler does for ML.
Flagging Anomalies At ±3σ
If server response times average 120 ms with σ = 11 ms, anything past mean + 3σ (~153 ms) is in the rarest 0.15% — so a 500 ms spike is a genuine anomaly, not random variation. The "mean ± 3σ" rule powers fraud alerts, fault detection, and lab flags across the board.
Standard Deviation vs Variance
| Property | Variance (σ² / s²) | Standard Deviation (σ / s) |
|---|---|---|
| Definition | Average squared deviation | Square root of variance |
| Units | Squared (g², ms²) | Same as data (g, ms) |
| Interpretability | Hard | Easy |
| Where it's used | PCA, ANOVA, proofs | Reporting, scaling, outliers |
| Empirical rule | Not directly | 68-95-99.7 in σ units |
Keep variance for the maths — it adds cleanly and powers PCA and ANOVA. Reach for standard deviation whenever a human needs to understand the spread, because it speaks in the data's own units and plugs straight into the empirical rule.
Where Standard Deviation Works
StandardScaler divides by σ so SVMs, KNN, and neural nets aren't dominated by large-scale features.Whether it's a defect limit, an investment's risk, or a rescaled feature, they all rest on the same idea: measure spread in real units and count it in σ. Master standard deviation and three different fields open up at once.
Computing σ — Mind The ddof
import numpy as np import statistics scores = [52, 74, 68, 90, 61, 85, 72, 78] # ── NumPy — set the divisor! ── np.std(scores, ddof=1) # 12.35 — SAMPLE (÷ n−1) ← usually correct np.std(scores, ddof=0) # 11.57 — POPULATION (÷ n) ← NumPy default! # ── statistics module (clearer names) ── statistics.stdev(scores) # 12.35 sample statistics.pstdev(scores) # 11.57 population
np.std() defaults to ddof=0 — the population divisor — which
underestimates the spread of a sample. For nearly all data-science work you want
ddof=1. It's a silent, one-character bug that quietly shrinks every standard deviation you
report.
Six Rules For Standard Deviation
You Now Understand Standard Deviation
Standard deviation is the square root of variance — the average distance from the mean, in the data's own units. It turns "spread" into a readable number, powers the 68-95-99.7 rule and z-scores, and draws the line between normal variation and genuine anomalies.
Connect σ to the normal distribution in depth, then explore covariance and correlation (how two variables move together) and confidence intervals, where standard deviation becomes the engine of inference.
📏 End of tutorial · Press ← to review, or click Restart