Concepts: Random variables, mean and variance
Probability19 min readLesson 5 of 8
5.1 From outcomes to numbers
An outcome of an experiment need not be a number, and a random variable turns it into one. In formal language it is a function from the sample space to the real numbers. When a coin is tossed three times, the number of heads obtained is a random variable, because each of the eight outcomes yields a count between 0 and 3. The same sample space can carry more than one such variable; on the same three tosses, counting heads and counting tails produce two different ones.
5.2 The probability distribution
Once the values of the random variable are known, each value gets a probability by adding the probabilities of the outcomes that produce it. This list is the probability distribution of the random variable, usually shown in a table with values in one row and probabilities in the other. The probabilities must satisfy two conditions: every one lies between 0 and 1, and their total is 1. If the outcomes are not equally likely, the probabilities come from a tree or from conditional probabilities, not from counting.
5.3 Mean
The mean, also called the expectation or expected value, is the probability-weighted average of the values. It is the value that the average of a very long sequence of observations would approach, and it need not be a value the random variable can actually take. For a fair die the mean is the average of the six faces, which is 3.5.
5.4 Variance and standard deviation
The variance measures how far the values spread from the mean, again weighted by the probabilities. A second form, obtained by expanding the square, is often quicker: compute the mean, compute the mean of the squares, and subtract the square of the mean. The standard deviation is the positive square root of the variance and has the same units as the random variable. For a fair die the variance is 35/12, so the standard deviation is about 1.71.
5.5 Two standard examples
A card is drawn from a well-shuffled pack of 52. Let the random variable be 1 if the card is a spade and 0 otherwise. The probability of 1 is one quarter and of 0 is three quarters, so the mean is one quarter and the variance is three sixteenths. A random variable that takes only 0 and 1 with success probability p has mean p and variance p times 1 minus p, and this small fact is worth remembering.
Two cards are drawn one after the other without replacement from a pack of 52, and the number of red cards is recorded. The possible values are 0, 1 and 2, and the tree gives the three probabilities by multiplying along the branches. They add to 1, which is the first check of any distribution, and the mean and variance then follow by substitution.
5.6 Why the mean and variance matter
The mean locates the distribution and the variance measures its width, so together they summarise a random variable in two numbers. Two distributions with the same mean can behave very differently if their variances differ, and questions often ask for both to test whether the spread has been understood. In a board answer, the table, the sum check, the mean and then the variance should appear in that order, because each step uses the previous one.
5.7 Worked example
A fair die is rolled once and the number shown is the random variable. Find its mean and variance.
Each face has probability 1/6. The mean is (1 + 2 + 3 + 4 + 5 + 6)/6 = 21/6 = 3.5. The mean of the squares is (1 + 4 + 9 + 16 + 25 + 36)/6 = 91/6, which is about 15.17. The variance is therefore 91/6 minus the square of 3.5, that is 91/6 minus 49/4, which simplifies to 35/12, about 2.92. The standard deviation is the square root of that, about 1.71. Notice that the mean 3.5 is not a face of the die: the expectation is a long-run average, not necessarily a possible value.
5.8 A second worked check
The sum of two fair dice is a random variable with values from 2 to 12. Its mean is the sum of the two individual means, 3.5 plus 3.5, which is 7. Because the two dice are independent, the variances add as well, so the variance of the sum is two copies of 35/12, which is 35/6, about 5.83. The independence is what allows addition of variances; without it the covariance term would have to be handled.
