Lesson 5: Expected Values

Links

Quick recap: Averages

You're likely already familiar with the concept of an average or arithmetic mean; averages are important for our lesson today, so we'll briefly review what they are before we start. Suppose you have a list of values, like this: L = a, b, c, d

The arithmetic mean, or average (they mean the same thing in this context), of this list is the sum of all of its elements divided by the number of elements, like so:

(a + b + c + d) / 4

If you know your algebra, you'll notice that we could also write this as a sum of fractions:

(a/4) + (b/4) + (c/4) + (d/4)

You'll also notice that we can represent this as a sum of products if we want, multiplying by the reciprocal:

(0.25 * a) + (0.25 * b) + (0.25 * c) + (0.25 * d)

Hold that thought for a moment, it'll be important.

Variable values

Random variables are all very well and good. We can use them to think about the outcomes of a chance experiment, and to explain how probability is distributed between those outcomes. What might be really nice, though, is to be able to assign a single numerical value to a random variable so we could use it in equations.

This is where the concept of expected value comes in. This is one of the oldest ideas in modern probability theory, going all the way back to Pascal and Fermat and their problem of points in the 1650s. We can't predict the value that a random variable might take on, but we can look at all the values and probabilities in the probability distribution, and make an educated mathematical guess at what the average value will be if we perform the experiment many times.

For a discrete random variable, like we're working with, the expected value is a sum of products: we multiply each possible value by its probability, and then add them all up. You've probably noticed that this looks a lot like that last average calculation we showed above:

(0.25 * a) + (0.25 * b) + (0.25 * c) + (0.25 * d)

That's because the expected value is really a weighted average of the whole probability distribution. A weighted average is a lot like an ordinary average (the arithmetic mean), except that some elements of the list count more than others. When we calculate the expected value of a random variable, we just use the probabilities in its probability distribution as weights. If all of our probabilities are the same, that means each value has a probability of 1/N, just like we end up using for an ordinary average. If some of the probabilities are different, we just need to multiply by them instead of by 1/N.

Let's try an example where the probabilities aren't all the same. Suppose we spin the pointer on this wheel, and assign the number we land on to the random variable X:

A drawing of a spinner with three regions: one takes up 1/2 of the circle and says '0' inside, one takes up 1/4 of the circle and says '1' inside, and finally one takes up 1/4 of the circle and says '5' inside.

It should be pretty obvious by now that there's a probability of 0.5 that we'll land on 0, a probability of 0.25 that we'll land on 1, and a probability of 0.25 that we'll land on 5. That means the expected value is:

(0.5 * 0) + (0.25 * 1) + (0.25 * 5) = 1.5

When you're doing these calculations for your carnival game, the values will probably be how much the prizes cost. You'll also need to account for the price that customers pay to play your game; one way to do this is to add another negative value (because the player loses money) with a probability of 1 attached to it (because everybody always pays the entry fee). Suppose the numbers on the wheel above indicate cash prizes of $0, $1, and $5, and the player pays $1 to play the game. Our expected value calculation could look like this:

(1 * -1) + (0.5 * 0) + (0.25 * 1) + (0.25 * 5) = 0.5

Because this expected value is still positive, the carnival operators will lose money on this game on average — that's not good! Maybe we should leave the things you could do to fix this as an exercise for the reader.[1]

Review

It doesn't seem like a lot, but what we learned in this lesson is still really important:

With expected values, so long as your probability numbers are good enough, you can really, truly say how much money your carnival game will make. This will probably be the most important part of your presentation when you try to sell your game to the carnival operators.