You're at a carnival and you see a game. For $2 you roll a standard six-sided die. If the number showing is a six you win $10, otherwise, you win nothing. If you're trying to make money, is it in your interest to play the game? To answer a question like this we need the concept of expected value.

The expected value can really be thought of as the mean of a random variable. This means that if you ran a probability experiment over and over, keeping track of the results, the expected value is the average of all the values obtained. The expected value is what you should anticipate happening in the long run of many trials of a game of chance.

### How to Calculate the Expected Value

The carnival game mentioned above is an example of a discrete random variable. The variable is not continuous and each outcome comes to us in a number that can be separated out from the others. To find the expected value of a game that has outcomes *x*_{1}, *x*_{2}, . . ., *x*_{n} with probabilities *p*_{1}, *p*_{2}, . . . , *p*_{n}, calculate:

*x*_{1}*p*_{1} + *x*_{2}*p*_{2} + . . . + *x*_{n}*p*_{n}.

For the game above, you have a 5/6 probability of winning nothing. The value of this outcome is -2 since you spent $2 to play the game. A six has a 1/6 probability of showing up, and this value has an outcome of 8. Why 8 and not 10? Again we need to account for the $2 we paid to play, and 10 - 2 = 8.

Now plug these values and probabilities into the expected value formula and end up with: -2 (5/6) + 8 (1/6) = -1/3. This means that over the long run, you should expect to lose on average about 33 cents each time you play this game. Yes, you will win sometimes. But you will lose more often.

### The Carnival Game Revisited

Now suppose that the carnival game has been modified slightly. For the same entry fee of $2, if the number showing is a six then you win $12, otherwise, you win nothing. The expected value of this game is -2 (5/6) + 10 (1/6) = 0. In the long run, you won't lose any money, but you won't win any. Don't expect to see a game with these numbers at your local carnival. If in the long run, you won't lose any money, then the carnival won't make any.

### Expected Value at the Casino

Now turn to the casino. In the same way as before we can calculate the expected value of games of chance such as roulette. In the U.S. a roulette wheel has 38 numbered slots from 1 to 36, 0 and 00. Half of the 1-36 are red, half are black. Both 0 and 00 are green. A ball randomly lands in one of the slots, and bets are placed on where the ball will land.

One of the simplest bets is to wager on red. Here if you bet $1 and the ball lands on a red number in the wheel, then you will win $2. If the ball lands on a black or green space in the wheel, then you win nothing. What is the expected value on a bet such as this? Since there are 18 red spaces there is a 18/38 probability of winning, with a net gain of $1. There is a 20/38 probability of losing your initial bet of $1. The expected value of this bet in roulette is 1 (18/38) + (-1) (20/38) = -2/38, which is about 5.3 cents. Here the house has a slight edge (as with all casino games).

### Expected Value and the Lottery

As another example, consider a lottery. Although millions can be won for the price of a $1 ticket, the expected value of a lottery game shows how unfairly it is constructed. Suppose for $1 you choose six numbers from 1 to 48. The probability of choosing all six numbers correctly is 1/12,271,512. If you win $1 million for getting all six correct, what is the expected value of this lottery? The possible values are -$1 for losing and $999,999 for winning (again we have to account for the cost to play and subtract this from the winnings). This gives us an expected value of:

(-1)(12,271,511/12,271,512) + (999,999)(1/12,271,512) = -.918

So if you were to play the lottery over and over, in the long run, you lose about 92 cents — almost all of your ticket price — each time you play.

### Continuous Random Variables

All of the above examples look at a discrete random variable. However, it is possible to define the expected value for a continuous random variable as well. All that we must do in this case is to replace the summation in our formula with an integral.

### Over the Long Run

It is important to remember that the expected value is the average after many trials of a random process. In the short term, the average of a random variable can vary significantly from the expected value.