Isthisa roll2,3,4:lose$1 fairgame? roll5,4,6:win $1 roll5,4,5:win - - PowerPoint PPT Presentation

is this a
SMART_READER_LITE
LIVE PREVIEW

Isthisa roll2,3,4:lose$1 fairgame? roll5,4,6:win $1 roll5,4,5:win - - PowerPoint PPT Presentation

CarnivalDice MathematicsforComputerScience MIT6.042J/18.062J Chooseanumberfrom1to6, Great thenroll3fairdice: Expectations win$1foreachmatch lose$1ifnomatch AlbertRMeyer, AlbertRMeyer, expect_intro.1


slide-1
SLIDE 1

Albert R Meyer, May 8, 2013

Mathematics for Computer Science MIT 6.042J/18.062J

Great Expectations

expect_intro.1 Albert R Meyer, May 8, 2013

Carnival Dice Choose a number from 1 to 6, then roll 3 fair dice:

win $1 for each match lose $1 if no match

expect_intro.3 Albert R Meyer, May 8, 2013

Carnival Dice Example: choose 5, then

roll 2,3,4: lose $1 roll 5,4,6: win $1 roll 5,4,5: win $2 roll 5,5,5: win $3

expect_intro.4 Albert R Meyer, May 8, 2013

Carnival Dice

Is this a fair game?

expect_intro.5

1

slide-2
SLIDE 2

Albert R Meyer, May 8, 2013

Pr[0 fives] = 5 6 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟

3

Pr[1 five] = 3 1 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟ 5 6 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟

2

1 6 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟ Pr[2 fives] = 3 2 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟ 5 6 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟

1

1 6 ⎛ ⎝ ⎜ ⎜ ⎜ ⎜ ⎞ ⎠ ⎟ ⎟ ⎟ ⎟ ⎟

2

Pr[3 fives] = 1 6

Carnival Dice

125 = 216 ⎛ ⎞

3

⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎝ ⎜ ⎟ ⎠ ⎟

expect_intro.6 Albert R Meyer, May 8, 2013

Carnival Dice

# matches probability $ won 125/216

  • 1

1 75/216 1 2 15/216 2 3 1/216 3

expect_intro.7 Albert R Meyer, May 8, 2013

Carnival Dice so every 216 games, expect 0 matches about 125 times 1 match about 75 times 2 matches about 15 times 3 matches about once

expect_intro.8 Albert R Meyer, May 8, 2013

Carnival Dice

So on average expect to win:

125 −1 ( ) 75 ⋅ + ⋅ 15 + 1 ⋅ 3 1 2 + ⋅ 216 17 = − ≈ −8cents 216

expect_intro.9

2

slide-3
SLIDE 3

−1 ( ) 75 + ⋅ 15 + ⋅ 1 2 + 216

Albert R Meyer, May 8, 2013

So on average expect to win:

125 ⋅ 1 3 ⋅ 17 = − ≈ −8cents 216

NOT fair!

expect_intro.10 expect intro 10

Carnival Dice

Albert R Meyer, May 8, 2013

Carnival Dice

You can “expect” to lose 8 cents per play. But you never actually lose 8 cents on any single play, this is just your average loss.

expect_intro.11 Albert R Meyer, May 8, 2013

Expected Value

The expected value of random variable R is the average value of R

  • -with values weighted

by their probabilities

expect_intro.12 Albert R Meyer, May 8, 2013

The expected value of random variable R is E[R] ::= v ⋅Pr[R = v]

v∈range(R)

so E[$win in Carnival] = − 17

216

Expected Value

expect_intro.13

3

slide-4
SLIDE 4

Albert R Meyer, May 8, 2013

Alternative definition

E[R] = ∑ R(ω) ⋅Pr[ω]

ω∈S

this form helpful in some proofs

expect_intro.14 Albert R Meyer, May 8, 2013

Alternative definition

E[R] = ∑ R(ω) ⋅Pr[ω]

ω∈S

proof of equivalence: [R = v] ::= {ω|R(ω) = v} so

Pr[R = v] ::=

∑ Pr[ω]

ω∈ [R=v]

expect_intro.15 Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::= ∑ v ⋅Pr[R = v]

v∈range(R)

expect_intro.16 Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::= ∑ v ⋅Pr[R = v]

v∈range(R)

expect_intro.17

4

so

slide-5
SLIDE 5

5

Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::=

v ⋅ ∑ Pr[ω]

v∈range(R) ω∈[R=v]

expect_intro.18 Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::=

v ⋅ ∑ Pr[ω]

v∈range(R) ω∈[R=v]

=

∑ ∑ v ⋅Pr[ω]

v ω∈[R=v]

expect_intro.19 Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::=

v ⋅ ∑ Pr[ω]

v∈range(R) ω∈[R=v]

=

∑ ∑ v ⋅Pr[ω]

v ω∈[R=v]

expect_intro.20 Albert R Meyer, May 8, 2013

proof of equivalence Now

E[R] ::=

v ⋅ ∑ Pr[ω]

v∈range(R) ω∈[R=v]

=

∑ ∑ R(ω) ⋅Pr[ω]

v ω∈[R=v]

=

R(ω) ⋅Pr[ω]

ω∈S

expect_intro.21

Now

E[R] :

= R(ω) ⋅Pr[ω]

ω∈S

slide-6
SLIDE 6

Albert R Meyer, May 8, 2013

Sums vs Integrals

We get away with sums instead of integrals because the sample space is assumed countable:

S = {ω0, ω1,…, ωn,…}

expect_intro.23 Albert R Meyer, May 8, 2013

Rearranging Terms

It’s safe to rearrange terms in sums because

expect_intro.24 Albert R Meyer, May 8, 2013

Rearranging Terms

It’s safe to rearrange terms in sums because we implicitly assume that the defining sum for the expectation is absolutely convergent

expect_intro.25 Albert R Meyer, May 8, 2013

Absolute convergence

E[R] ::= ∑ v ⋅ Pr[R = v]

v∈range(R)

the terms on the right could be rearranged to equal anything at all when the sum is not absolutely convergent

expect_intro.26

6

slide-7
SLIDE 7

Albert R Meyer, May 8, 2013

Expected Value

also called

mean value, mean, or expectation

expect_intro.27 Albert R Meyer, May 8, 2013

Expectations & Averages

From a pile of graded exams, pick one at random, and let S be its score.

expect_intro.28 Albert R Meyer, May 8, 2013

Expectations & Averages

From a pile of graded exams, pick one at random, and let S be its score. Now E[S] equals the average exam score

expect_intro.29 Albert R Meyer, May 8, 2013

Expectations & Averages

We can estimate averages by estimating expectations

  • f random variables

expect_intro.30

7

slide-8
SLIDE 8

Expectations & Averages

We can estimate averages by estimating expectations

  • f random variables based
  • n picking random elements

pmmmm

  • mmmm
  • sampling

Albert R Meyer, May 8, 2013 expect_intro.31

Expectations & Averages

For example, it is impossible for all exams to be above average (no matter what the townspeople

  • f Lake Woebegone say):

Pr[R > E[R]] < 1

Albert R Meyer, May 8, 2013 expect_intro.32

Expectations & Averages

On the other hand

Pr[R > E[R]] ≥ 1−

is possible for all ɛ > 0

For example, almost everyone has an above average number of fingers.

Albert R Meyer, May 8, 2013 expect_intro.33

8

slide-9
SLIDE 9

MIT OpenCourseWare http://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science

Spring 2015 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.