Foundations of Computer Science Lecture 20 Expected Value of a Sum - - PowerPoint PPT Presentation

foundations of computer science lecture 20 expected value
SMART_READER_LITE
LIVE PREVIEW

Foundations of Computer Science Lecture 20 Expected Value of a Sum - - PowerPoint PPT Presentation

Foundations of Computer Science Lecture 20 Expected Value of a Sum Linearity of Expectation Iterated Expectation Build-Up Expectation Sum of Indicators Last Time 1 Sample average and expected value. 2 Definition of Mathematical expectation. 3


slide-1
SLIDE 1

Foundations of Computer Science Lecture 20 Expected Value of a Sum

Linearity of Expectation Iterated Expectation Build-Up Expectation Sum of Indicators

slide-2
SLIDE 2

Last Time

1 Sample average and expected value. 2 Definition of Mathematical expectation. 3 Examples: Sum of dice; Bernoulli; Uniform; Binomial; waiting time; 4 Conditional expectation. 5 Law of Total Expectation. Creator: Malik Magdon-Ismail Expected Value of a Sum: 2 / 12 Today →

slide-3
SLIDE 3

Today: Expected Value of a Sum

1

Expected value of a sum.

Sum of dice. Binomial. Waiting time. Coupon collecting.

2

Iterated expectation.

3

Build-up expectation.

4

Expected value of a product.

5

Sum of indicators.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 3 / 12 Expected Value of a Sum →

slide-4
SLIDE 4

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-5
SLIDE 5

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-6
SLIDE 6

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-7
SLIDE 7

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

E[Z] = E[a1X1 + a2X2 + · · · + akXk] = a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-8
SLIDE 8

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

E[Z] = E[a1X1 + a2X2 + · · · + akXk] = a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Proof. E[Z] =

  • ω∈Ω
  • a1X1(ω) + a2X2(ω) + · · · + akXk(ω)
  • · P(ω)

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-9
SLIDE 9

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

E[Z] = E[a1X1 + a2X2 + · · · + akXk] = a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Proof. E[Z] =

  • ω∈Ω
  • a1X1(ω) + a2X2(ω) + · · · + akXk(ω)
  • · P(ω)

= a1

  • ω∈Ω X1(ω) · P(ω) + a2
  • ω∈Ω X2(ω) · P(ω) + · · · + ak
  • ω∈Ω Xk(ω) · P(ω)

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-10
SLIDE 10

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

E[Z] = E[a1X1 + a2X2 + · · · + akXk] = a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Proof. E[Z] =

  • ω∈Ω
  • a1X1(ω) + a2X2(ω) + · · · + akXk(ω)
  • · P(ω)

= a1

  • ω∈Ω X1(ω) · P(ω) + a2
  • ω∈Ω X2(ω) · P(ω) + · · · + ak
  • ω∈Ω Xk(ω) · P(ω)

= a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-11
SLIDE 11

Expected Value of a Sum

You expect to win twice as much from two lottery tickets as from one. The expected value of a sum is a sum of the expected values. Theorem (Linearity of Expectation). Let X1, X2, . . . , Xk be random variables and let Z = a1X1 + a2X2 + · · · + akXk be a linear combination of the Xi. Then,

E[Z] = E[a1X1 + a2X2 + · · · + akXk] = a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

Proof. E[Z] =

  • ω∈Ω
  • a1X1(ω) + a2X2(ω) + · · · + akXk(ω)
  • · P(ω)

= a1

  • ω∈Ω X1(ω) · P(ω) + a2
  • ω∈Ω X2(ω) · P(ω) + · · · + ak
  • ω∈Ω Xk(ω) · P(ω)

= a1 E [X1] + a2 E [X2] + · · · + ak E [Xk].

1 Summation can be taken inside or pulled outside an expectation. 2 Constants can be taken inside or pulled outside an expectation.

E

 

k

  • i=1 aiXi

  =

k

  • i=1 ai E [Xi]

Creator: Malik Magdon-Ismail Expected Value of a Sum: 4 / 12 Sum of Dice →

slide-12
SLIDE 12

Sum of Dice

Let X be the sum of 4 fair dice, what is E[X]?

Creator: Malik Magdon-Ismail Expected Value of a Sum: 5 / 12 Expected Number of Successes →

slide-13
SLIDE 13

Sum of Dice

Let X be the sum of 4 fair dice, what is E[X]? sum

4 5 6 7 · · · 24 P[sum]

1 1296 4 1296 10 1296

? · · ·

1 1296

→ E[X] = 4 ×

1 1296 + 5 × 4 1296 + · · ·

Creator: Malik Magdon-Ismail Expected Value of a Sum: 5 / 12 Expected Number of Successes →

slide-14
SLIDE 14

Sum of Dice

Let X be the sum of 4 fair dice, what is E[X]? sum

4 5 6 7 · · · 24 P[sum]

1 1296 4 1296 10 1296

? · · ·

1 1296

→ E[X] = 4 ×

1 1296 + 5 × 4 1296 + · · ·

MUCH faster to observe that X is a sum,

X = X1 + X2 + X3 + X4,

where Xi is the value rolled by die i and

E[Xi] = 31

2.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 5 / 12 Expected Number of Successes →

slide-15
SLIDE 15

Sum of Dice

Let X be the sum of 4 fair dice, what is E[X]? sum

4 5 6 7 · · · 24 P[sum]

1 1296 4 1296 10 1296

? · · ·

1 1296

→ E[X] = 4 ×

1 1296 + 5 × 4 1296 + · · ·

MUCH faster to observe that X is a sum,

X = X1 + X2 + X3 + X4,

where Xi is the value rolled by die i and

E[Xi] = 31

2.

Linearity of expectation:

E[X] = E[X1 + X2 + X3 + X4] = E[X1]

3 1

2

+ E[X2]

3 1

2

+ E[X3]

3 1

2

+ E[X4]

3 1

2

= 4 × 31

2 = 14.

←in general n × 31

2

  • Exercise. Compute the full PDF for the sum of 4 dice and expected value from the PDF.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 5 / 12 Expected Number of Successes →

slide-16
SLIDE 16

Expected Number of Successes in n Coin Tosses

X is the number of successes in n trials with success probability p per trial, X = X1 + · · · + Xn

Each Xi is a Bernoulli and

E[Xi] = p.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 6 / 12 Expected Waiting Time →

slide-17
SLIDE 17

Expected Number of Successes in n Coin Tosses

X is the number of successes in n trials with success probability p per trial, X = X1 + · · · + Xn

Each Xi is a Bernoulli and

E[Xi] = p.

Linearity of expectation,

E[X] = E[X1 + X2 + · · · + Xn] = E[X1]

p

+ E[X2]

p

+ · · · + E[Xn]

p

= n × p.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 6 / 12 Expected Waiting Time →

slide-18
SLIDE 18

Expected Waiting Time to n Successes

X is the waiting time for n successes with success probability p. X = wait to 1st

  • X1

Creator: Malik Magdon-Ismail Expected Value of a Sum: 7 / 12 Coupon Collecting →

slide-19
SLIDE 19

Expected Waiting Time to n Successes

X is the waiting time for n successes with success probability p. X = wait to 1st

  • X1

+ wait from 1st to 2nd

  • X2

Creator: Malik Magdon-Ismail Expected Value of a Sum: 7 / 12 Coupon Collecting →

slide-20
SLIDE 20

Expected Waiting Time to n Successes

X is the waiting time for n successes with success probability p. X = wait to 1st

  • X1

+ wait from 1st to 2nd

  • X2

+ wait from 2nd to 3rd

  • X3

Creator: Malik Magdon-Ismail Expected Value of a Sum: 7 / 12 Coupon Collecting →

slide-21
SLIDE 21

Expected Waiting Time to n Successes

X is the waiting time for n successes with success probability p. X = wait to 1st

  • X1

+ wait from 1st to 2nd

  • X2

+ wait from 2nd to 3rd

  • X3

+ · · · + wait from (n − 1)th to nth

  • Xn

= X1 + X2 + X3 + · · · + Xn.

Each Xi is a waiting time to one success, so

E[Xi] = 1 p.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 7 / 12 Coupon Collecting →

slide-22
SLIDE 22

Expected Waiting Time to n Successes

X is the waiting time for n successes with success probability p. X = wait to 1st

  • X1

+ wait from 1st to 2nd

  • X2

+ wait from 2nd to 3rd

  • X3

+ · · · + wait from (n − 1)th to nth

  • Xn

= X1 + X2 + X3 + · · · + Xn.

Each Xi is a waiting time to one success, so

E[Xi] = 1 p.

Linearity of expectation:

E[X] = E[X1 + X2 + · · · + Xn] = E[X1]

1/p

+ E[X2]

1/p

+ · · · + E[Xn]

1/p

= n/p.

  • Example. If you are waiting for 3 boys, you have to wait 3-times as long as for 1 boy.
  • Exercise. Compute the expected square of the waiting time.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 7 / 12 Coupon Collecting →

slide-23
SLIDE 23

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-24
SLIDE 24

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-25
SLIDE 25

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-26
SLIDE 26

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

+ wait from 2nd to 3rd

  • X1

↑ p3= n−2

n

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-27
SLIDE 27

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

+ wait from 2nd to 3rd

  • X1

↑ p3= n−2

n

+ · · · + wait from (n − 1)th to nth

  • X1

↑ pn= n−(n−1)

n

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-28
SLIDE 28

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

+ wait from 2nd to 3rd

  • X1

↑ p3= n−2

n

+ · · · + wait from (n − 1)th to nth

  • X1

↑ pn= n−(n−1)

n

= X1 + X2 + X3 + · · · + Xn. E[Xi] = 1/pi,

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-29
SLIDE 29

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

+ wait from 2nd to 3rd

  • X1

↑ p3= n−2

n

+ · · · + wait from (n − 1)th to nth

  • X1

↑ pn= n−(n−1)

n

= X1 + X2 + X3 + · · · + Xn. E[Xi] = 1/pi, E[X1] = n

n,

E[X2] =

n n−1,

E[X3] =

n n−2,

. . . , E[Xn] =

n n−(n−1).

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-30
SLIDE 30

Coupon Collecting: Collecting the Flags

A pack of gum comes with a flag (169 countries). X is the number of gum-purchases to get all the flags.

X = wait to 1st

  • X1

↑ p1= n

n

+ wait from 1st to 2nd

  • X1

↑ p2= n−1

n

+ wait from 2nd to 3rd

  • X1

↑ p3= n−2

n

+ · · · + wait from (n − 1)th to nth

  • X1

↑ pn= n−(n−1)

n

= X1 + X2 + X3 + · · · + Xn. E[Xi] = 1/pi, E[X1] = n

n,

E[X2] =

n n−1,

E[X3] =

n n−2,

. . . , E[Xn] =

n n−(n−1).

Linearity of expectation:

E[X] = n( 1

n + 1 n−1 + 1 n−2 + · · · + 1 1) = nHn ≈ n(ln n + 0.577).

n = 169 → you expect to buy about 965 packs of gum. Lots of chewing!

  • Example. Cereal box contains 1-of-5 cartoon characters. Collect all to get $2 rebate.

Expect to buy about 12 cereal boxes. If a cereal box costs $5, that’s a whopping 31

3% discount.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 8 / 12 Iterated Expectation →

slide-31
SLIDE 31

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-32
SLIDE 32

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-33
SLIDE 33

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

E[X2 | X1] = X1 × 31

2.

The RHS is a function of X1, a random variable.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-34
SLIDE 34

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

E[X2 | X1] = X1 × 31

2.

The RHS is a function of X1, a random variable. Compute its expectation.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-35
SLIDE 35

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

E[X2 | X1] = X1 × 31

2.

The RHS is a function of X1, a random variable. Compute its expectation.

E[X2] = EX1[E[X2 | X1]]

(another version of total expectation)

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-36
SLIDE 36

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

E[X2 | X1] = X1 × 31

2.

The RHS is a function of X1, a random variable. Compute its expectation.

E[X2] = EX1[E[X2 | X1]]

(another version of total expectation)

= E[X1] × 31

2

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-37
SLIDE 37

Iterated Expectation

  • Experiment. Roll a die and let X1 be the value. Now, roll a second

die X1 times and let X2 be the sum of these X1 rolls of the second die. An example outcome is (4; 2, 1, 2, 6) with X1 = 4 and X2 = 11:

E[X2 | X1] = X1 × 31

2.

The RHS is a function of X1, a random variable. Compute its expectation.

E[X2] = EX1[E[X2 | X1]]

(another version of total expectation)

= E[X1] × 31

2

= 31

2 × 31 2 = 121 2.

  • Exercise. Justify this computation using total expectation with 6 cases:

E[X2] = E[X2 | X1 = 1] · P[X1 = 1] + E[X2 | X1 = 2] · P[X1 = 2] + · · · + E[X2 | X1 = 6] · P[X1 = 6].

Creator: Malik Magdon-Ismail Expected Value of a Sum: 9 / 12 Build-Up Expectation →

slide-38
SLIDE 38

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-39
SLIDE 39

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-40
SLIDE 40

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

= 1 + pW(k − 1, ℓ) + (1 − p)W(k, ℓ − 1).

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-41
SLIDE 41

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

= 1 + pW(k − 1, ℓ) + (1 − p)W(k, ℓ − 1).

Base cases: W(k, 0) = k/p and W(0, ℓ) = ℓ/(1 − p)

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

W(k, ℓ) 1 2 3 4 5 6 7 · · · 1 2 k ℓ . . . 2 4 6 8 10 12 14 · · · 2 4 . . .

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-42
SLIDE 42

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

= 1 + pW(k − 1, ℓ) + (1 − p)W(k, ℓ − 1).

Base cases: W(k, 0) = k/p and W(0, ℓ) = ℓ/(1 − p)

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

W(k, ℓ) 1 2 3 4 5 6 7 · · · 1 2 k ℓ . . . 2 4 6 8 10 12 14 · · · 2 4 . . . 2 3

×p ×(1 − p)

+1

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-43
SLIDE 43

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

= 1 + pW(k − 1, ℓ) + (1 − p)W(k, ℓ − 1).

Base cases: W(k, 0) = k/p and W(0, ℓ) = ℓ/(1 − p)

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

W(k, ℓ) 1 2 3 4 5 6 7 · · · 1 2 k ℓ . . . 2 4 6 8 10 12 14 · · · 2 4 . . . 2 3

×p ×(1 − p)

+1

2 3 4.5 6.25 8.13 10.06 12.03 14.02 · · ·

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-44
SLIDE 44

Build-Up Expectation: Waiting for 2 Boys and 6 Girls

W(k, ℓ) = E[waiting time to k boys and ℓ girls].

The first child is either a boy or girl, so by total expectation, W(k, l) = E[waiting time | boy]

  • 1+W(k−1,ℓ)

× P[boy]

  • p

+ E[waiting time | girl]

  • 1+W(k,ℓ−1)

× P[girl]

  • 1−p

= 1 + pW(k − 1, ℓ) + (1 − p)W(k, ℓ − 1).

Base cases: W(k, 0) = k/p and W(0, ℓ) = ℓ/(1 − p)

Waiting Time PX E[X] = 12.156

5 10 15 20 25 0.05 0.1 0.15

W(k, ℓ) 1 2 3 4 5 6 7 · · · 1 2 k ℓ . . . 2 4 6 8 10 12 14 · · · 2 4 . . . 2 3

×p ×(1 − p)

+1

2 3 4.5 6.25 8.13 10.06 12.03 14.02 · · · 4 4.5 5.5 6.88 8.5 10.28 12.16 14.09 · · · 12.16 . . . . . . . . . . . . . . . . . . . . . . . . ...

Creator: Malik Magdon-Ismail Expected Value of a Sum: 10 / 12 Expected Value of a Product →

slide-45
SLIDE 45

Expected Value of a Product

X is a single die roll:

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-46
SLIDE 46

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-47
SLIDE 47

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-48
SLIDE 48

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X]

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-49
SLIDE 49

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X] = (31

2)2 = 121 4.✘

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-50
SLIDE 50

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X] = (31

2)2 = 121 4.✘

X1 and X2 are independent die rolls:

1 2 3 4 5 6 2 4 6 8 10 12 3 6 9 12 15 18 4 8 12 16 20 24 5 10 15 20 25 30 6 12 18 24 30 36 Die 1 Value Die 2 Value Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-51
SLIDE 51

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X] = (31

2)2 = 121 4.✘

X1 and X2 are independent die rolls: E[X1X2] =

1 36(1+2+···+6+2+4+···+12+3+6+···+18+···+6+12+···+36)

=

441 36 = 121 4.

1 2 3 4 5 6 2 4 6 8 10 12 3 6 9 12 15 18 4 8 12 16 20 24 5 10 15 20 25 30 6 12 18 24 30 36 Die 1 Value Die 2 Value Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-52
SLIDE 52

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X] = (31

2)2 = 121 4.✘

X1 and X2 are independent die rolls: E[X1X2] =

1 36(1+2+···+6+2+4+···+12+3+6+···+18+···+6+12+···+36)

=

441 36 = 121 4.

1 2 3 4 5 6 2 4 6 8 10 12 3 6 9 12 15 18 4 8 12 16 20 24 5 10 15 20 25 30 6 12 18 24 30 36 Die 1 Value Die 2 Value

E[X1X2] = E[X1] × E[X2] = (31

2)2 = 121 4.✓

Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-53
SLIDE 53

Expected Value of a Product

X is a single die roll: E[X2] = 1

6 · 12 + 1 6 · 22 + 1 6 · 32 + 1 6 · 42 + 1 6 · 52 + 1 6 · 62 = 91 6 = 151 6.

E[X2] = E[X × X]= E[X] × E[X] = (31

2)2 = 121 4.✘

X1 and X2 are independent die rolls: E[X1X2] =

1 36(1+2+···+6+2+4+···+12+3+6+···+18+···+6+12+···+36)

=

441 36 = 121 4.

1 2 3 4 5 6 2 4 6 8 10 12 3 6 9 12 15 18 4 8 12 16 20 24 5 10 15 20 25 30 6 12 18 24 30 36 Die 1 Value Die 2 Value

E[X1X2] = E[X1] × E[X2] = (31

2)2 = 121 4.✓

Expected value of a product XY.

1 In general, the expected product is not a product of expectations. 2 For independent random variables , it is: E[XY] = E[X] × E[Y]. Creator: Malik Magdon-Ismail Expected Value of a Sum: 11 / 12 Sum of Indicators →

slide-54
SLIDE 54

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-55
SLIDE 55

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-56
SLIDE 56

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4 X1=0 X2=1 X3=1 X4=0

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-57
SLIDE 57

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4 X1=0 X2=1 X3=1 X4=0

X = X1 + X2 + X3 + X4 = 2

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-58
SLIDE 58

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4 X1=0 X2=1 X3=1 X4=0

X = X1 + X2 + X3 + X4 = 2 Xi are Bernoulli with P[Xi = 1] = 1

4.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-59
SLIDE 59

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4 X1=0 X2=1 X3=1 X4=0

X = X1 + X2 + X3 + X4 = 2 Xi are Bernoulli with P[Xi = 1] = 1

  • 4. Linearity of expectation:

E[X] = E[X1] + E[X2] + E[X4] + E[X4] =

1 4 + 1 4 + 1 4 + 1 4 = 4 × 1 4 = 1.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12

slide-60
SLIDE 60

Sum of Indicators: Successes in a Random Assignment

X is the number of correct hats when 4 hats randomly land on 4 heads.

hats:

4 2 3 1

men:

1 2 3 4 X1=0 X2=1 X3=1 X4=0

X = X1 + X2 + X3 + X4 = 2 Xi are Bernoulli with P[Xi = 1] = 1

  • 4. Linearity of expectation:

E[X] = E[X1] + E[X2] + E[X4] + E[X4] =

1 4 + 1 4 + 1 4 + 1 4 = 4 × 1 4 = 1.

  • Exercise. What about if there are n people?

Interesting Example (see text). Apply sum of indicators to breaking of records. Instructive Exercise. Compute the PDF of X and the expectation from the PDF.

Creator: Malik Magdon-Ismail Expected Value of a Sum: 12 / 12