Why Center at the Mean?
A distribution describes how probability is spread across possible values. To measure that spread, we need a reference point and a way to keep deviations from cancelling. The mean supplies the reference point; squaring each deviation makes values above and below it contribute positively. Variance is the expected squared distance from the mean.
The centering matters: variance is not the expected square of \(X\), but the expected square of \(X\) after subtracting its mean. For an explicit calculation, first find the mean, then subtract it from each possible value, square those deviations, and average using the distribution’s probabilities or density.
The finite-second-moment condition ensures both that the mean exists and that the squared deviations have a finite expectation. The standard deviation is \(\sqrt{\operatorname{Var}(X)}\); unlike variance, it is expressed in the same units as \(X\).
Calculating Variance from a Distribution
The definition applies to every distribution, but its calculation takes a different form depending on how probability is represented. For a discrete variable, weight each centered square by its probability. For a continuous variable, integrate the centered square against the density. When a distribution has both point masses and a density, include both contributions.
Worked Example: A Discrete Distribution
Let \(X\) take the values \(-1,0,2\) with probabilities \(0.2,0.5,0.3\), respectively. Find its mean and variance using centered squares.
First check that the probabilities sum to one: \(0.2+0.5+0.3=1\). The mean is
Center each possible value at \(0.4\), square the deviation, and weight by its probability:
Thus \(\operatorname{Var}(X)=1.24\). Each contribution is nonnegative, including the contribution from the value below the mean.
Worked Example: A Continuous Uniform Distribution
Suppose \(X\) is uniform on \([0,4]\), with density \(f(x)=1/4\) for \(0\leq x\leq4\) and zero elsewhere. Find its variance from the centered integral.
The density integrates to one, since \(\int_0^4(1/4)\,dx=1\). Its mean is
Now center at \(2\) and integrate the squared deviation:
The variance is \(4/3\), and the standard deviation is \(\sqrt{4/3}=2/\sqrt{3}\). The calculation uses the density’s value \(1/4\) throughout the interval; omitting that factor would not average with respect to the distribution.
Point Masses and Density Together
A mixed distribution can assign positive probability to an exact value while also spreading probability continuously over an interval. A density alone does not describe the point mass: the probability at that exact value must be added separately. The following calculation uses the same mean for both parts of the centered-square expectation.
Worked Example: A Mixed Distribution
Let \(X\) have probability \(1/3\) at \(0\), and have density \(g(x)=1/3\) on \(1\leq x\leq3\), with density zero elsewhere. The density part has total probability \(\int_1^3(1/3)\,dx=2/3\); together with the atom, the total probability is one. Find the mean and variance.
The atom contributes zero to the mean. The continuous part gives
For the variance, the atom contributes its probability times its squared deviation from \(4/3\), and the density contributes an integral:
The atom’s contribution is \(16/27\), and the continuous part’s contribution is \(14/27\). Adding them gives \(\operatorname{Var}(X)=10/9\). Treating the density as though it had total probability one, or leaving out the atom, would describe a different distribution.
Why the Definition Is Finite and Nonnegative
The following facts justify the usual variance definition and explain two of its basic properties. First, a finite second moment guarantees a finite centered second moment. Second, the variance can be zero only when the random variable equals its mean with probability one.
Proof. By the Cauchy–Schwarz inequality, \(E[|X|]\leq\sqrt{E[X^2]}<\infty\), so \(\mu=E[X]\) is finite. For every real \(x\), \((x-\mu)^2\leq2x^2+2\mu^2\). Taking expectations shows \(E[(X-\mu)^2]\leq2E[X^2]+2\mu^2<\infty\). A square is nonnegative, so its expectation is nonnegative.
For the zero-variance claim, set \(Y=(X-\mu)^2\), which is nonnegative. If \(E[Y]=0\), then for each positive integer \(k\),
so \(P(Y\geq1/k)=0\). Since \(\{Y>0\}=\bigcup_{k=1}^{\infty}\{Y\geq1/k\}\), countable subadditivity gives \(P(Y>0)=0\). Thus \(X=\mu\) with probability one. Conversely, if \(X=\mu\) with probability one, then \((X-\mu)^2=0\) with probability one, and its expectation is zero. \(\square\)
There is also a useful converse about finiteness. If \(E[|X|]<\infty\) and \(E[(X-E[X])^2]<\infty\), then \(E[X^2]<\infty\), because \(X^2\leq2(X-E[X])^2+2(E[X])^2\). Thus, when the mean exists, finiteness of the centered second moment is equivalent to finiteness of the second moment.
Common Pitfalls
- Squaring before centering. Calculating \(E[X^2]\) does not by itself give the definition of variance. The centered quantity is \((X-E[X])^2\); use it directly in the discrete sum, integral, or mixed calculation.
- Forgetting to find the mean first. The deviations must be measured from \(E[X]\), not from zero or an arbitrary value. A wrong center changes every squared deviation.
- Leaving out probability weights. A discrete squared deviation must be multiplied by its probability. A continuous squared deviation must be integrated against the density.
- Dropping a point mass in a mixed law. The density describes only its continuous component. Add each atom’s probability times its centered square as a separate term.
- Assuming zero variance means zero values. It means \(X\) equals its own mean with probability one. That constant need not be zero.
Check Your Understanding
For each question, identify the centering value before calculating or interpreting variance.
- A discrete variable takes values \(1\) and \(3\) with probabilities \(1/4\) and \(3/4\). What is its mean, and how would you write its variance as a centered sum?
- A density is constant on \([2,6]\). What probability weight must appear in the variance integral, and why?
- A distribution has an atom at \(0\) and a density on \([1,2]\). Which two contributions must appear in its centered-square expectation?
- Explain why a random variable with zero variance must equal its mean with probability one.
- If the mean exists but the second moment is infinite, can the variance be finite? Use the finiteness result to justify your answer.