Saturday, September 26, 2026

Variance and Standard Deviation: Why Squaring Won

Variance occupies a privileged position in statistics.

Why?

Not because squaring deviations is intuitively inevitable.

It is because squared deviations have extraordinarily convenient mathematics.


1. Population variance

For a random variable (X),

E[(X-\mu)^2].
]

Expanding,

X^2-2\mu X+\mu^2.
]

Taking expectations,

E[X^2]-2\mu E[X]+\mu^2.
]

Since

[
E[X]=\mu,
]

we obtain

[
\boxed{
\operatorname{Var}(X)=E[X^2]-E[X]^2
}
]

This identity makes variance enormously convenient computationally and theoretically.


2. Why deviations are measured around the mean

Consider

[
L(c)=\sum_i(x_i-c)^2.
]

Differentiate:

-2\sum_i(x_i-c).
]

Set this equal to zero:

[
\sum_i(x_i-c)=0.
]

Therefore,

[
nc=\sum_i x_i
]

and hence

[
c=\bar{x}.
]

So the arithmetic mean is precisely the value that minimizes total squared deviation.

By contrast, the median minimizes total absolute deviation.

This gives us a beautiful duality:

[
L_2 \text{ loss} \rightarrow \text{mean}
]

[
L_1 \text{ loss} \rightarrow \text{median}.
]


3. Sample variance and (n-1)

For a sample,

\frac{1}{n-1}
\sum_i(x_i-\bar{x})^2.
]

Why (n-1)?

Because after estimating the sample mean, only (n-1) deviations are free.

Indeed,

[
\sum_i(x_i-\bar{x})=0.
]

Once (n-1) deviations are known, the last is determined.

More formally,

\frac{n-1}{n}\sigma^2.
]

Dividing by (n-1) instead removes this downward bias for estimating population variance.


4. Why standard deviation exists

Variance has squared units.

If height is measured in centimeters,

[
\operatorname{Var}(X)
]

has units of

[
\text{cm}^2.
]

Taking the square root produces

[
SD=\sqrt{\operatorname{Var}(X)},
]

which returns us to centimeters.

That makes standard deviation substantially easier to communicate.


5. Python demonstration

import numpy as np

x = np.array([4, 5, 5, 6, 10])

print("Population variance:",
      np.var(x, ddof=0))

print("Sample variance:",
      np.var(x, ddof=1))

print("Sample SD:",
      np.std(x, ddof=1))

Verify the alternative variance formula:

var1 = np.mean(
    (x - np.mean(x))**2
)

var2 = np.mean(x**2) - np.mean(x)**2

print(var1, var2)

6. R demonstration

x <- c(4, 5, 5, 6, 10)

# R's var() uses denominator n - 1
var(x)
sd(x)

# Population variance
mean((x - mean(x))^2)

# Computational identity
mean(x^2) - mean(x)^2

7. Variances add

One of variance's greatest mathematical advantages is:

\operatorname{Var}(X)
+\operatorname{Var}(Y)
+2\operatorname{Cov}(X,Y).
]

If (X) and (Y) are independent,

[
\operatorname{Cov}(X,Y)=0
]

and therefore

\operatorname{Var}(X)
+
\operatorname{Var}(Y).
]

Standard deviations do not enjoy such a clean decomposition.

This property helped make variance foundational in experimental design, quantitative genetics, measurement theory, and signal processing.

Fisher's 1918 work made variance decomposition central to statistical thinking.


8. Variance's Achilles heel

Variance squares deviations.

Suppose our data are:

[
1,2,3,4,5.
]

Now replace 5 with 100.

import numpy as np

a = np.array([1,2,3,4,5])
b = np.array([1,2,3,4,100])

print(np.var(a, ddof=1))
print(np.var(b, ddof=1))

The variance explodes.

In fact, classical variance has a breakdown point effectively approaching zero: one sufficiently extreme observation can make it arbitrarily large.

This motivates an entirely different branch of statistics.

Robust statistics.

No comments: