A game at the carnival offers these odds: you get to roll a
ten-sided die, and if you roll RESULT_DESC,
you make MAKE dollars. Unfortunately,
if you roll anything else, you lose
LOSE dollars.
How much money do you expect to make (or lose) playing this game?
$
ANS
The expected value of an event (like playing this game) is the average of the values of each outcome. Since some outcomes are more likely than others (sometimes), we weight the value of each outcome according to its probability to get an accurate idea of what value to expect.
There are two events that can happen in this game: either
you roll RESULT_DESC, or you don't. So, the
expected value will look like this:
E =
(money gained when you roll RESULT_DESC)
\cdot
(probability of rolling RESULT_DESC)
+
(money gained when you don't roll RESULT_DESC)
\cdot
(probability of not rolling RESULT_DESC).
The money you gain when you win
is $MAKE.
The probability of winning is the probability
that you roll RESULT_DESC.
This probability is the number of winning outcomes
divided by the total number of
outcomes, MAKE_FR.
The money you gain when you lose is
$ -LOSE
(since you actually lose money). The probability that
you lose is the probability that you don't roll
RESULT_DESC.
This probability must be
1 - MAKE_FR = LOSE_FR.
So, if we take the average of the amount of money you make
on each outcome, weighted by how probable each outcome is,
we get the expected amount of money you will make:
(MAKE\cdotMAKE_FR) +
(-LOSE\cdotLOSE_FR) =
ANS_F = -$localeToFixed(-ANS, 2)
$localeToFixed(ANS, 2).
If you roll a SIDES-sided die, what is the expected value you will roll?
The expected value of an event (like rolling a die) is the average of the values of each outcome. To get an accurate idea of what value to expect, we weight the value of each outcome according to its probability.
In this case, there are SIDES outcomes: the first outcome is rolling a 1, the second outcome is rolling a 2, and so on. The value of each of these outcomes is just the number you roll.
So, the value of the first outcome is 1, and its
probability is \dfrac{1}{SIDES}.
The value of the second outcome is 2, the value of
the third outcome is 3, and so on. There are
SIDES outcomes altogether, and each of them
occurs with probability
\dfrac{1}{SIDES}.
So, if we average the values of each of these outcomes,
we get the expected value we will roll, which is
SUM =
mixedFractionFromImproper(ANS_N,SIDES,true,true).
You decide you're only going to buy a lottery ticket if your
expected winnings are larger than the ticket price. Tickets
cost $COST, and you get
$PRIZE if you win. The odds of
winning are 1 in ODDS,
meaning that you will win with probability
ODD_F.
Should you buy a ticket for this lottery?
The expected value of an event (like buying a lottery ticket) is the average of the values of each outcome. In this case, the outcome where you win is much less likely than the outcome that you lose. So, to get an accurate idea of how much money you expect to win or lose, we have to take an average weighted by the probability of each outcome.
This means the expected value, considering both the price
of the ticket and the possible winnings is
E = (money gained when you win)
\cdot (probability of winning) +
(money gained when you lose)
\cdot (probability of losing)
.
Let's figure out each of these terms one at a time. The
money you gain when you win is
$PRIZE and from the question, we
know the probability of winning is
ODD_F.
When you lose, you gain no money, or
$0, and the probability of losing is 1
- ODD_F.
Putting it all together, the expected value is
E = ($PRIZE)
(ODD_F) + ($0) (1 - ODD_F) =
$ \dfrac{PRIZE}{ODDS} =
$fraction(PRIZE,ODDS,true,true).
$fraction(PRIZE,ODDS,true,true) -
$COST is
positive.
So, we expect to make money by buying a lottery ticket, because
the expected value is positive.
$fraction(PRIZE,ODDS,true,true) -
$COST is
negative.
So, we expect to lose money by buying a lottery ticket, because
the expected value is negative.