# Variance And the Linearity Of Expectation

Ch. 1, Problem 8 - Data Reduction and Error Analysis for the Physical Sciences by Philip Bevington:

Justify the second equality in equations (1.8) and (1.14).

Solution:

In both cases this is a straight forward calculation using the distributive property of discrete and continuous (or integral) summation. Observe for equation (1.8),

$\lim_{N \to \infty} \frac{1}{N} \sum (x_i - \mu)^2$

$= \lim_{N \to \infty} \frac{1}{N} \sum ({x_i}^2 - 2 x_i \mu + {\mu}^2)$

$= \lim_{N \to \infty} \frac{1}{N} \sum ({x_i}^2) - 2 \lim_{N \to \infty} \frac{\mu}{N} \sum x_i + \lim_{N \to \infty} \frac{{\mu}^2}{N} \sum 1$

$= \lim_{N \to \infty} \frac{1}{N} \sum ({x_i}^2) - 2 \mu \lim_{N \to \infty} \frac{1}{N} \sum x_i + {\mu}^2 (\lim_{N \to \infty} \frac{1}{N} \sum 1)$

The limit of the last expression within parenthesis is one so,

$= \lim_{N \to \infty} \frac{1}{N} \sum ({x_i}^2 - 2 {\mu}^2 + {\mu}^2)$

$= \lim_{N \to \infty} \frac{1}{N} \sum ({x_i}^2 - {\mu}^2)$

which is a special case of

$= E[x^2] - {(E[x])}^2$

when the expectation is taken over a discrete set. Moving on to (1.14),

$\int (x - \mu)^2 p(x) \,dx = \int x^2 p(x) \,dx - 2\mu\int x p(x) \,dx + \int {\mu}^2 p(x) \,dx$

$= \int x^2 p(x) \,dx - 2\mu\mu + {\mu}^2 \int p(x) \,dx$

$= \int x^2 p(x) \,dx - 2{\mu}^2 + {\mu}^2$

$= \int x^2 p(x) \,dx - {\mu}^2$

which is again a special case of

$= E[x^2] - {(E[x])}^2$

but now for a continuous summation. Both of these calculations can be seen as consequences of the linearity of expectation. Consider,

$\begin{array}{ccl} \operatorname{Var}(X)&=&\operatorname{E}\left[(X - \operatorname{E}(X))^2\right]\\ &=&\operatorname{E}\left[X^2 - 2X\operatorname{E}(X) + [\operatorname{E}(X)]^2\right]\\ &=&\operatorname{E}(X^2) - \operatorname{E}[2X\operatorname{E}(X)] + [\operatorname{E}(X)]^2\\ &=&\operatorname{E}(X^2) - 2\operatorname{E}(X)\operatorname{E}(X) + [\operatorname{E}(X)]^2\\ &=&\operatorname{E}(X^2) - 2[\operatorname{E}(X)]^2 + [\operatorname{E}(X)]^2\\ &=&\operatorname{E}(X^2) - [\operatorname{E}(X)]^2 \end{array}$