Centre and spread
The mean of a random variable — its expected value — describes a 'typical' value from the distribution, a summary of the centre of the distribution.
We now define a summary of the spread of values around this centre. A small spread of values means that a value from the distribution will probably be close to the mean; a larger spread would arise when a random value from the distribution is probably further from the mean.
Variance
The mean of a discrete random variable is defined as
\[ E[X] = \mu = \sum_{\text{all } x} {x \times p(x)} \]and this has been shown to be closely related to the mean of a discrete data set. In a similar way, the definition of the variance of a discrete random variable is closely related to the sample variance of a data set.
Definition
The variance of a discrete random variable, X, is defined to be
\[ \Var (X) = \sigma^2 = E \left[(X - \mu)^2 \right] \]where \(\mu\) is the variable's mean.
As with the variance of a data set, \(s^2 = \dfrac { \sum {(x_i - \overline{x})^2}} {n-1}\), this is a kind of average of squared differences of values from the mean. The standard deviation, \(\sigma\), is defined to be the square root of the variance.
The formula for the variance that we have used in the above definition gives a good feel for its interpretation, but the result below is usually easier to apply in practice when evaluating a random variable's variance.
Alternative formula for variance
A discrete random variable's variance can be written as
\[ \Var (X) = E \left[(X - \mu)^2 \right] = E[X^2] - \left( E[X] \right)^2 \]since the expected value of a constant such as \(\mu^2\) is the constant itself and \(E[X] = \mu \).
When the probability function is described by a mathematical function, the summations needed to find \(E[X]\) and \(E[X^2]\) can often be evaluated mathematically. However we will now illustrate the calculations for an example in which the probabilities are specified in tabular form.
Example
A couple want at least two children and no more than four, but will stop when they get a boy. Assuming that the probability of each child being a girl is \(\frac {1} {2} \) , independently of the genders of previous children, the probability function for the number of girls in the resulting family is
Number of girls, x | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
p(x) | 0.25 | 0.5 | 0.125 | 0.0625 | 0.0625 |
What are the mean and standard deviation of \(X\)?
This table shows how \(E[X]\) and \(E[X^2]\) can be calculated.
x | \(p(x) \) | \(x \times p(x) \) | \(x^2 \times p(x) \) |
0 | 0.25 | 0 | 0 |
1 | 0.5 | 0.5 | 0.5 |
2 | 0.125 | 0.25 | 0.5 |
3 | 0.0625 | 0.1875 | 0.5625 |
4 | 0.0625 | 0.25 | 1.0 |
Total | 1 | \(E[X] = 1.1875\) | \(E[X^2] = 2.5625\) |
From these,
\[ \mu = E[X] = 1.1875 \]and
\[ \sigma^2 = E[X^2] - \left( E[X] \right)^2 = 2.5625 - 1.1875^2 = 1.152 \]and the standard deviation is
\[ \sigma = \sqrt {1.152} = 1.073 \]The next result gives the variance of a linear function of X.
Variance of a linear function of X
If X is a discrete random variable and a and b are constants,
\[ \Var(a + b \times X) = b^2 \times \Var(X) \]We showed earlier that the mean of this linear function is
\[ E[a + b \times X] = a + b \times E[X] \]From the definition of a random variable's variance,
\[ \begin{align} \Var(a + bX) & = E \left[\big((a + bX) - (a + b\mu)\big)^2 \right] \\ & = E \left[(bX - b\mu)^2 \right] \\ & = b^2 \times E \left[(X - \mu)^2 \right] \\ & = b^2 \times \Var(X) \end{align} \]