# A calculus of the absurd

### Chapter 21 Probability

#### 21.1 Some facts about variance

The "variance" of a discrete random variable142142 Note: you’re not imagining things, I still need to add the section I have written defining these. is a measure of "spread" (how far apart values in a distribution are). It gives the expected value of the square of the distance of the observed values (in the outcome space) from the mean (expected value of the distribution). That’s a mouthful to say, so it can be easier to write this as a formula.

143143 If it’s not clear why $$X - \Expected [X]$$ gives the signed distance between $$X$$ and $$\Expected [X]$$, take a look at the "vectors" chapter.

$$\Var [X] = \Expected \left [\left (X - \Expected [X]\right )^2\right ]$$

There is an equivalent way in which the variance can be expressed which is a bit easier to use when trying to calculate the variance of a discrete random variable by hand:

\begin{align} \Var [X] & = \Expected \left [\left (X - \Expected [X]\right )^2\right ] \\ & = \Expected \left [X^2 - 2X\Expected [X] + \Expected [X]^2\right ] & \text {(step 1)} \\ & = \Expected [X^2] - 2\Expected [X]\Expected [X] + \Expected [X^2] & \text {(step 2)} \\ & = \Expected \left [X^2\right ] - \left (\Expected [X]\right )^2 \end{align}

When we went from step 1 to step 2, we took advantage of the fact that $$\Expected [X]$$ is constant; in effect, we grouped our expression as$$\Expected \left [\left (2\Expected [X]\right )X\right ]$$,144144 Bear in mind that $$\Expected [X]$$ is a constant and then used the linearity of expectation 145145 If this means nothing to you, please be aware that I have yet to write this section. to rewrite it as $$\left (2\Expected [X]\right )\Expected [X]$$.