## Maths in a minute: Variance

When faced with a list of numbers we often feel the urge to compute its average to get a rough idea of how big or small those numbers are. What the average doesn't tell us, however, is how spread out the numbers are. As an example, imagine you ask five of your friends what their yearly salaries are and you get the answers

Here are two populations with the same average (100) and different variances. You can think of the horizontal axis measuring salaries and the vertical axis of measuring how many people in a population receive the corresponding salary. The red curve has a smaller variance because the salaries are not as spread out as they are for the blue one.

The average of this set of numbers is

but knowing this number doesn’t give you any indication of the fact that there’s one salary that’s a lot bigger than the other four.

To get a sense of how spread out a data set is, you can use
something called its *sample variance*. First, work out the difference
between each number on the list and the average of the list and then
square that difference (the reason we square it
is that we're only interested in the size of the difference and not
whether it's positive or negative). Now take the average of these
squared differences. In our example above, this gives us the following sample variance:

That's a very large number, which indicates that all of our five numbers lie quite far away from their average: an indication that the data set is very spread out. By contrast, look at the set

The average is

The sample variance in this case is

That’s a small number, indicating that the set of numbers isn’t very spread out at all.

Here’s the formal definition of the sample variance of a list , , , ..., of numbers whose average is :

This definition works for a given list of numbers, but there’s also a definition of variance that works when you are dealing with a random process, such as rolling dice, and would like to know how spread out a list of outcomes of the process is likely to be. Suppose your random process has outcomes which we label , , , etc, up to If you’re rolling a die, then and , ... , Also suppose you know the probability , , etc, up to of each outcome. In the case of a fair die we have , but generally the probabilities of different outcomes could be different. The *expected value* is defined as

It's a sort of idealised average, find out more here.
The *population variance* is defined as

The population variance gives you an idea of how spread out the outcomes are likely to be if you repeat the random process a large number of times. You can try and work out for yourself what its value is for a fair die. Conversely, if you don't know the population variance of a process, then the sample variance you get from repeating the process a large number of times can be used to estimate it.

The positive square root of the variance is called the *standard deviation*.

You can also define the variance of an infinite or continuous random variable. See here to find out more.