Expected Value and Variance
Have you ever wondered whether it would be “worth it” to
buy a lottery ticket every week, or pondered questions such
as “If I were offered a choice between a million dollars, or a
1 in 100 chance of a billion dollars, which would I choose?”
One method of deciding on the answers to these questions
is to calculate the expected earnings of the enterprise, and
aim for the option with the higher expected value.
This is a useful decision making tool for problems that
involve repeating many trials of an experiment such as
investing in stocks, choosing where to locate a business, or
where to fish.
(For once-off decisions with high stakes, such as the choice
between a sure 1 million dollars or a 1 in 100 chance of a
billion dollars, it is unclear whether this is a useful tool.)
Example
John works as a tour guide in Dublin. If he has 200 people
or more take his tours on a given week, he earns e1,000. If
the number of tourists who take his tours is between 100
and 199, he earns e700. If the number is less than 100, he
earns e500. Thus John has a variable weekly income.
From experience, John knows that he earns e1,000 fifty
percent of the time, e700 thirty percent of the time and
e500 twenty percent of the time. John’s weekly income is a
random variable with a probability distribution
Income Probability
e1,000 0.5
e700 0.3
e500 0.2
Example
What is John’s average income, over the course of a
50-week year?
Over 50 weeks, we expect that John will earn
I
e1000 on about 25 of the weeks (50%);
I
e700 on about 15 weeks (30%); and
I
e500 on about 10 weeks (20%).
This suggests that his average weekly income will be
25(e1000) + 15(e700) + 10(e500)
50
= e810.
Dividing through by 50, this calculation changes to
.5(e1000) + .3(e700) + .2(e500) = e810.
Expected Value of a Random Variable
The answer in the last example stays the same no matter
how many weeks we average over. This suggests the
following: If X is a random variable with possible values
x
1
, x
2
, . . . , x
n
and corresponding probabilities p
1
, p
2
, . . . , p
n
,
the expected value of X, denoted by E(X), is
E(X) = x
1
p
1
+ x
2
p
2
+ ··· + x
n
p
n
.
Outcomes Probability Out. × Prob.
X P(X) XP(X)
x
1
p
1
x
1
p
1
x
2
p
2
x
2
p
2
.
.
.
.
.
.
.
.
.
x
n
p
n
x
n
p
n
Sum = E(X)
Expected Value of a Random Variable
We can interpret the expected value as the long term
average of the outcomes of the experiment over a large
number of trials. From the table, we see that the
calculation of the expected value is the same as that for the
average of a set of data, with relative frequencies replaced
by probabilities.
Warning: The expected value really ought to be called the
expected mean. It is NOT the value you most expect to
see but rather the average (or mean) of the values you see
over the course of many trials.
Coin tossing example
Flip a coin 4 times and observe the sequence of heads and
tails. Let X be the number of heads in the observed
sequence. Last time we found the following probability
distribution for X:
X P(X)
0 1/16
1 4/16
2 6/16
3 4/16
4 1/16
Find the expected number of heads for a trial of this
experiment, that is find E(X).
E(X) =
1
16
· 0 +
4
16
· 1 +
6
16
· 2 +
4
16
· 3 +
1
16
· 4 =
0 + 4 + 12 + 12 + 4
16
=
32
16
= 2.
NFL example
The following probability distribution from “American
Football” Statistics in Sports, 1998, by Hal Stern, has an
approximation of the probabilities for yards gained on a
running play in the NFL. Actual play by play data was
used to estimate the probabilities. (-4 represents 4 yards
lost on a running play).
x, yards prob x, yards prob
4 .020 6 .090
2 .060 8 .060
1 .070 10 .050
0 .150 15 .085
1 .130 30 .010
2 .110 50 .004
3 .090 99 .001
4 .070
NFL example
Based on this data, what is the expected number of yards
gained on a running play in the NFL?
E(X) = (4) ·.020+(2) ·0.060 +(1) ·0.070 +0 ·0.150 +1 ·
0.130+2·0.110 +3·0.090+4·0.070+6·0.090+8 ·0.060+10·
0.050 + 15 ·0.085 + 30 ·0.010 + 50 ·0.004 + 99 ·0.001 = 4.024
Roulette example
In roulette, when you bet $1 on red, the probability
distribution for your earnings, denoted by X, is given by:
X P(X)
1 18/38
-1 20/38
(a) What are your expected earnings for this bet?
E(X) = 1 · (18/38) + (1) · (20/38) = 2/38.
(b) How much would you expect to win/lose if you bet $1
on red 100 times? What would the casino expect to earn if
you bet $1 on red 100 times?
You would expect to win 100 · E(X) = 200/38 $5.26.
Your loss is the casino’s gain so the casino’s earnings are
the negative of your loss: $5.26.
A winning(?) strategy for Roulette?
Roulette seems like a fool’s game. But here’s a possible
strategy for playing it:
1. Begin by betting a dollar on red.
2. If you win, take your winnings and go home.
3. If you lose, place two one-dollar bets in a row on red.
4. Whatever happens on those two rolls, go home (either
with your winnings to date, or cutting your losses)
Question: Is this a winning strategy? Specifically, what is
the probability that you will leave the Roulette wheel with
more money than you began with, and is this probability
more or less than 1/2?
A winning(?) strategy for Roulette?
Let X be net winnings from this strategy. Possible
outcomes/values for X:
I
Win on first roll, probability 18/38 .474, X = +1
I
Lose on first, win on next two, probability
(20/38)(18/38)
2
.118, X = +1
I
Lose on first, win exactly one of next two, probability
(20/38)2(18/38)(20/38) .262, X = 1
I
Lose all three, probability (20/38)
3
.146, X = 3.
So X takes value +1 with probability .592, value 1
with probability .262, and value 3 with probability
.146. So the strategy is winning you have a get gain
more often than a net loss!
On the other hand,
E(X) = 1(.592) 1(.262) 3(.146) = .108. So on average,
playing this strategy long-term, you will lose money :(
Gambling example
The rules of a carnival game are as follows:
1. The player pays $1 to play the game.
2. The player then flips a fair coin, if the player gets a
head the game attendant gives the player $2 and the
player stops playing.
3. If the player gets a tail on the coin, the player rolls a
fair six-sided die. If the player gets a six, the game
attendant gives the player $1 and the game is over.
4. If the player does not get a six on the die, the game is
over and the game attendant gives nothing to the
player.
Gambling example
Let X denote the player’s (net) earnings for this game.
Last time, we saw that X has probability distribution
X P(X)
-1 5/12
0 1/12
1 1/2
(a) What are the expected earnings for the player for each
play of this game?
E(X) = (1)·
5
12
+0·
1
12
+1·
1
2
=
5 + 0 + 6
12
=
1
12
$0.08.
(b) What are the expected earnings for the game host for
each play of this game?
Host’s earnings are negative of your earnings:
1/12 $0.08.
Variance and standard deviation
Let us return to the initial example of John’s weekly income
which was a random variable with probability distribution
Income Probability
e1,000 0.5
e700 0.3
e500 0.2
with mean e810. Over 50 weeks, we might expect the
variance of John’s weekly earnings to be roughly
25(e1000-e810)
2
+ 15(e700-e810)
2
+ 10(e500-e810)
2
50
= 49, 900
or
.5(e1000-e810)
2
+.3(e700-e810)
2
+.2(e500-e810)
2
= 49, 900
Variance and standard deviation
As with the calculations for the expected value, if we had
chosen any large number of weeks in our estimate, the
estimates would have been the same. This suggests a
formula for the variance of a random variable.
If X is a random variable with values x
1
, x
2
, . . . , x
n
,
corresponding probabilities p
1
, p
2
, . . . , p
n
, and expected
value µ = E(X), then
Variance = σ
2
(X) = p
1
(x
1
µ)
2
+ p
2
(x
2
µ)
2
+ ··· + p
n
(x
n
µ)
2
and
Standard Deviation = σ(X) =
Variance .
Variance and standard deviation
Variance = σ
2
(X) = p
1
(x
1
µ)
2
+ p
2
(x
2
µ)
2
+ ··· + p
n
(x
n
µ)
2
Standard Deviation = σ(X) =
Variance .
x
i
p
i
x
i
p
i
(x
i
µ) (x
i
µ)
2
p
i
(x
i
µ)
2
x
1
p
1
x
1
p
1
(x
1
µ) (x
1
µ)
2
p
1
(x
1
µ)
2
x
2
p
2
x
2
p
2
(x
2
µ) (x
2
µ)
2
p
2
(x
2
µ)
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
x
n
p
n
x
n
p
n
(x
n
µ) (x
n
µ)
2
p
n
(x
n
µ)
2
Sum = µ Sum = σ
2
(X)
Gambling example
The rules of a carnival game are as follows:
1. The player pays $1 to play the game.
2. The player then flips a fair coin, if the player gets a
head the game attendant gives the player $2 and the
player stops playing.
3. If the player gets a tail on the coin, the player rolls a
fair six-sided die. If the player gets a six, the game
attendant gives the player $1 and the game is over.
4. If the player does not get a six on the die, the game is
over and the game attendant gives nothing to the
player.
Gambling example
Let X denote the player’s (net) earnings for this game.
Last time we saw that the probability distribution of X is
given by:
X P(X)
-1 5/12
0 1/12
1 1/2
Use the value for µ = E(X) found above to find the
variance and standard deviation of X, that is find σ
2
(X)
and σ(X).
Gambling example
x
i
p
i
x
i
· p
i
(x
i
µ) (x
i
µ)
2
p
i
· (x
i
µ)
2
-1 5/12
5
12
13
12
169
144
845
1728
0 1/12
0
12
1
12
1
144
1
1728
1 6/12
6
12
11
12
121
144
726
1728
Sum = µ =
1
12
Sum = σ
2
(X) =
1572
1728
0.909
σ 0.953.
Coin tossing example
An experiment consists of flipping a coin 4 times and
observing the sequence of heads and tails. The random
variable X is the number of heads in the observed
sequence. Last time we found the following probability
distribution for X:
X P(X)
0 1/16
1 4/16
2 6/16
3 4/16
4 1/16
We saw above that the expected value for this random
variable is E(X) = 2. Find σ
2
(X) and σ(X).
Coin tossing example
x
i
p
i
x
i
· p
i
(x
i
µ) (x
i
µ)
2
p
i
· (x
i
µ)
2
0
1
16
0
16
2 4
4
16
1
4
16
4
16
1 1
4
16
2
6
16
12
16
0 0
0
16
3
4
16
12
16
1 1
4
16
4
1
16
4
16
2 4
4
16
Sum = µ = 2 Sum = σ
2
(X) = 1
σ = 1.
Another formula for variance
Using (x µ)
2
= x
2
2µx + µ
2
, we get another formula for
variance:
σ
2
(X) = p
1
(x
1
µ)
2
+ p
2
(x
2
µ)
2
+ ··· + p
n
(x
n
µ)
2
= p
1
(x
2
1
2µx
1
+ µ
2
)
2
+ ··· + p
n
(x
2
n
2µx
n
+ µ
2
)
2
= [p
1
x
2
1
+ ··· + p
n
x
2
n
] +
2µ[p
1
x
1
+ ···p
n
x
n
] +
µ
2
[p
1
+ ···p
n
]
= E(X
2
) 2µE(X) + µ
2
= E(X
2
) 2E(X)E(X) + E(X)
2
= E(X
2
) E(X)
2
.
σ
2
(X) = E(X
2
) E(X)
2
.
Redoing the coin example
Using the definition of variance:
x
i
p
i
x
i
· p
i
(x
i
µ) (x
i
µ)
2
p
i
· (x
i
µ)
2
0
1
16
0
16
2 4
4
16
1
4
16
4
16
1 1
4
16
2
6
16
12
16
0 0
0
16
3
4
16
12
16
1 1
4
16
4
1
16
4
16
2 4
4
16
Sum = µ = 2 Sum = σ
2
(X) = 1
σ = 1.
Redoing the coin example
Using the new formula:
x
i
p
i
p
i
x
i
x
2
i
p
i
x
2
i
0
1
16
0
16
0
0
16
= 0
1
4
16
4
16
1
4 · 1
16
=
4
16
2
6
16
12
16
4
6 · 4
16
=
24
16
3
4
16
12
16
9
4 · 9
16
=
36
16
4
1
16
4
16
16
1 · 16
16
=
16
16
Sum = E(X) =
µ = 2 Sum = E(X
2
) =
80
16
= 5
Hence
σ
2
(X) = E(X
2
) E(X)
2
= 5 2
2
= 1
Back to the Roulette strategy
Recall that we had a Roulette strategy where your
winnings X had probability distribution
P (X = 1) = .592, P (X = 1) = .262, P(X = 3) = .146.
We calculated E(X) = 1(.592) 1(.262) 3(.146) .108
We can easily calculate
E(X
2
) = 1
2
(.592) + (1)
2
(.262
2
) + (3)
2
(.146
2
) 2.16
From this we get σ
2
(X) = .216 (.108)
2
2.15, so the
standard deviation of your winnings is roughly
2.15 1.46.
The strategy “bet once on Red” has expected winnings
.053, with standard deviation .998 our complicated
strategy is a little bit worse on average, and much more
unstable