# A Crash Course in Expected Value If you've never had the luck of taking a statistics course or just are looking for a refresher, here's a little intuitive introduction into expected value.

Problem 1

You are given \$10 and a proposition: if you give back the \$10 you are put into a lottery with a 10% chance of winning \$100.  Should you take the bet or keep your \$10?  If you keep the \$10 there is no risk and therefore you're guaranteed to have +\$10 at the end of the day.  If you take the risk you have 1/10th chance of winning and 9/10th chance of losing.  If we simulate the outcome 10 times, one of the times is expected to produce a win (+\$100) and nine of the times are expected to produce a loss (+\$0 from when we started).  To get the expected value, we simply average all possible outcomes (\$100*1+\$0*9)/10 = +\$10.  In this case, taking the bet gives us the same expected value as keeping the \$10 so it doesn't matter which you choose.

Problem 2

Every day it takes an hour to walk to work.  One day we found a really sweet shortcut that saves us 50 minutes of travel time.  The only downside to the shortcut is that it forces us to walk across the freeway.  The probability of being killed by a car while we cross is 1%.  Assuming we're optimizing for getting to work as soon as possible (we have to beat Becky who is always waiting in the break room to show us pictures of her cat) which route should we take?  If we die we never show up to work so the time that it takes is infinite.  The safe way gives us an expected travel time of 60 minutes.  Averaging the different outcomes for taking the dangerous route gives us ((10 minutes * 99%) + ( minutes * 1%))/100 = ∞ minutes.  60 minutes is less than eternity, so we should play it safe and take the less sweet route and endure Becky's cat one more day.  On second thought, the freeway doesn't sound so bad...

Problem 3

What's the expected value of a single die roll?
Since each side of the die is equally likely to be rolled, we can add up all combinations and divide by the number of combinations.
Using the arithmetic series formula to calculate the sum of numbers from 1 to 6 gives us 6*7/2=21.  Divided by the number of combinations gives us an expected value of 3.5. But wait, 3.5 is not a value on any die! It's important to note that expected value does not necessarily mean that we would ever expect to see this value.  Think of it as the average of all possible outcomes if we had the ability to run the experiment an infinite number of times.

What's the expected sum of two dice rolls?
Although each side is equally likely, each outcome is not.  For example, the outcome of the dice adding up to 7 is the most likely result:
2 (1+1)
3 (1+2) (2+1)
4 (1+3) (2+2) (3+1)
5 (1+4) (2+3) (3+ 2) (4+1)
6 (1+5) (2+4) (3+3) (4+2) (5+1)
7 (1+6) (2+5) (3+4) (4+3) (5+2) (6+1) <- Peak number of combinations
8 (2+6) (3+5) (4+4) (5+3) (6+2)
9 (3+6) (4+5) (5+4) (6+3)
10 (4+6) (5+5) (6+4)
11 (5+6) (6+5)
12 (6+6)
An easy way to sum the sums is by multiplying each sum by the number of combinations which lead to that sum:
(2+12)*1+(3+11)*2+(4+10)*3+(5+9)*4+(6+8)*5+(7)*6 = 252
and the total number of combinations is 6*6 = 36
Expected value for sum of 2 dice: 252/36 = 7