Home / Statistics

Mean, Variance and Standard Deviation

The mean says where the data sits; variance and standard deviation say how far it spreads. Drag points around and watch all three respond — then see why one outlier can wreck them.

Controls

number of points8

Drag any point on the plot to change the data.

Data, Mean and Spread

drag the points

Live Calculation

mean μ
0
variance σ²
0
std dev σ
0
within 1σ
0

Mean, Variance and Standard Deviation

Where the data sits, and how far it wanders — the two numbers behind every normalisation layer.

Quick Context

Two datasets can share the same average and still look nothing alike. The mean describes the centre; variance and standard deviation describe the spread. You need both to say anything useful about data.

The Three Formulas

mean: μ = (Σ xᵢ) / n variance: σ² = Σ (xᵢ − μ)² / n std dev: σ = √σ²

Read variance as a recipe: measure how far each point sits from the mean, square those distances, and average them. The table below the plot performs exactly these steps on your live data.

Why Square the Deviations?

Because raw deviations always cancel out. Points above the mean are positive, points below are negative, and by the definition of the mean they sum to exactly zero — every time, for every dataset. Check the Σ row in the table.

Squaring removes the signs so distances can accumulate. It also weights large deviations far more heavily: a point 4 away contributes 16, while four points 1 away contribute 4 in total. This is precisely why a single outlier can dominate the variance — press the Outlier button and watch σ jump.

Standard Deviation Is the Readable One

Variance is in squared units — if your data is in kilograms, the variance is in kg², which means nothing physically. Taking the square root returns you to the original units, so σ can be read directly off the same axis as the data. That is the only reason both quantities exist.

As a rule of thumb for roughly bell-shaped data, about 68% of points fall within ±1σ and 95% within ±2σ. The app counts this for your actual data — try the two-groups preset and watch the rule break down, since it only holds for normal-ish distributions.

n or n−1?

Dividing by n gives the population variance — correct when your data is the entire group. Dividing by n−1 gives the sample variance, used when your data is a sample being used to estimate a larger population. The sample version is slightly larger, correcting a bias that arises because you measured deviations from the sample's own mean rather than the true one. Toggle the checkbox and watch the difference shrink as n grows.

Where It Shows Up in ML

Standardisation — the z-score — rewrites every value as "how many standard deviations from the mean":

z = (x − μ) / σ

This is what feature scaling, batch normalisation and layer normalisation all compute. It puts features measured in wildly different units onto a common footing, which stops the largest-scaled feature from dominating training purely because of its units.

Interactive Exploration Guide

  1. Drag a point far to the right. The mean drifts toward it and σ grows sharply — both are sensitive to extremes.
  2. Watch the Σ(x−μ) row as you drag. It stays pinned at zero no matter what you do.
  3. Load "Tightly clustered", then "Widely spread". The means can be similar while σ differs several-fold — the average alone hides this completely.
  4. Load "Two groups". The mean lands in the empty gap between the clusters, describing a value that no data point is anywhere near.
  5. Toggle n−1 with only 2 points, then raise n. The correction is large for tiny samples and negligible for big ones.

Key Takeaway

The mean locates the data, the standard deviation measures its spread in the same units, and variance is the squared intermediate that makes the maths work. Squaring is what makes both outlier-sensitive — and the z-score built from them is the normalisation step in nearly every model you will train.

Cheat sheet

Mean, Variance and Standard Deviation

The mean says where the data sits; variance and standard deviation say how far it spreads. Drag points around and watch all three respond — then see why one outlier can wreck them.

MATHS · vizlearn.in/maths/mean_variance_standard_deviation.html