Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP9020 23T1
Week 10 Expected Values, Course Review Textbook (R & W) - Ch. 9, Sec. 9.2-9.4 Problem set week 10 1 Random Variables Definition An (integer) random variable is a function from Ω to Z. In other words, it associates a number value with every outcome. Random variables are often denoted by X ,Y ,Z , . . . 2 Example Random variable Xs def = sum of rolling two dice Ω = {(1, 1), (1, 2), . . . , (6, 6)} Xs((1, 1)) = 2 Xs((1, 2)) = 3 = Xs((2, 1)) . . . Example 9.3.3 Buy one lottery ticket for $1. The only prize is $1M. Ω = {win, lose} XL(win) = $999, 999 XL(lose) = −$1 3 Expectation Definition The expected value (often called “expectation” or “average”) of a random variable X is E (X ) = ∑ k∈Z P(X = k) · k 4 Example The expected sum when rolling two dice is E (Xs) = 1 36 · 2 + 2 36 · 3 + . . .+ 6 36 · 7 + . . .+ 1 36 · 12 = 7 Example 9.3.3 Buy one lottery ticket for $1. The only prize is $1M. Each ticket has probability 6 · 10−7 of winning. E (XL) = 6 · 10−7 · $999, 999 + (1− 6 · 10−7) · −$1 = −$0.4 NB Expectation is a truly universal concept; it is the basis of all decision making, of estimating gains and losses, in all actions under risk. Historically, a rudimentary concept of expected value arose long before the notion of probability. 5 Theorem (linearity of expected value) E (X + Y ) = E (X ) + E (Y ) E (c · X ) = c · E (X ) Example The expected sum when rolling two dice can be computed as E (Xs) = E (X1) + E (X2) = 3.5 + 3.5 = 7 since E (Xi ) = 1 6 · 1 + 16 · 2 + . . .+ 16 · 6, for each die Xi 6 Example E (Sn), where Sn def = |no. of heads in n tosses| ‘hard way’ E (Sn) = ∑n k=0 P(Sn = k) · k = ∑n k=0 1 2n (n k ) · k since there are (n k ) sequences of n tosses with k heads, and each sequence has the probability 12n = 12n ∑n k=1 n k (n−1 k−1 ) k = n2n ∑n−1 k=0 (n−1 k ) = n2n · 2n−1 = n2 using the ‘binomial identity’ ∑n k=0 (n k ) = 2n ‘easy way’ E (Sn) = E (S 1 1 + . . .+ S n 1 ) = ∑ i=1...n E (S i 1) = nE (S1) = n · 12 Note: Sn def = |heads in n tosses| while each S i1 def= |heads in 1 toss| 7 Example E (Sn), where Sn def = |no. of heads in n tosses| ‘hard way’ E (Sn) = ∑n k=0 P(Sn = k) · k = ∑n k=0 1 2n (n k ) · k since there are (n k ) sequences of n tosses with k heads, and each sequence has the probability 12n = 12n ∑n k=1 n k (n−1 k−1 ) k = n2n ∑n−1 k=0 (n−1 k ) = n2n · 2n−1 = n2 using the ‘binomial identity’ ∑n k=0 (n k ) = 2n ‘easy way’ E (Sn) = E (S 1 1 + . . .+ S n 1 ) = ∑ i=1...n E (S i 1) = nE (S1) = n · 12 Note: Sn def = |heads in n tosses| while each S i1 def= |heads in 1 toss| 8 Example E (Sn), where Sn def = |no. of heads in n tosses| ‘hard way’ E (Sn) = ∑n k=0 P(Sn = k) · k = ∑n k=0 1 2n (n k ) · k since there are (n k ) sequences of n tosses with k heads, and each sequence has the probability 12n = 12n ∑n k=1 n k (n−1 k−1 ) k = n2n ∑n−1 k=0 (n−1 k ) = n2n · 2n−1 = n2 using the ‘binomial identity’ ∑n k=0 (n k ) = 2n ‘easy way’ E (Sn) = E (S 1 1 + . . .+ S n 1 ) = ∑ i=1...n E (S i 1) = nE (S1) = n · 12 Note: Sn def = |heads in n tosses| while each S i1 def= |heads in 1 toss| 9 NB If X1,X2, . . . ,Xn are independent, identically distributed random variables, then E (X1 + X2 + . . .+ Xn) happens to be the same as E (nX1), but these are very different random variables. 10 Example You face a quiz consisting of six true/false questions, and your plan is to guess the answer to each question (randomly, with probability 0.5 of being right). There are no negative marks, and answering four or more questions correctly suffices to pass. What is the probability of passing and what is the expected score? To pass you would need four, five or six correct guesses. Therefore, p(pass) = (6 4 ) + (6 5 ) + (6 6 ) 64 = 15 + 6 + 1 64 ≈ 34% The expected score from a single question is 0.5, as there is no penalty for errors. For six questions the expected value is 6 ·0.5 = 3 11 Example You face a quiz consisting of six true/false questions, and your plan is to guess the answer to each question (randomly, with probability 0.5 of being right). There are no negative marks, and answering four or more questions correctly suffices to pass. What is the probability of passing and what is the expected score? To pass you would need four, five or six correct guesses. Therefore, p(pass) = (6 4 ) + (6 5 ) + (6 6 ) 64 = 15 + 6 + 1 64 ≈ 34% The expected score from a single question is 0.5, as there is no penalty for errors. For six questions the expected value is 6 ·0.5 = 3 12 Exercise 9.3.7 An urn has m + n = 10 marbles, m ≥ 0 red and n ≥ 0 blue. 7 marbles selected at random without replacement. What is the expected number of red marbles drawn?(m 0 )(n 7 )(10 7 ) · 0 + (m1)(n6)(10 7 ) · 1 + (m2)(n5)(10 7 ) · 2 + . . .+ (m7)(n0)(10 7 ) · 7 e.g. (5 2 )(5 5 )(10 7 ) · 2 + (53)(54)(10 7 ) · 3 + (54)(53)(10 7 ) · 4 + (55)(52)(10 7 ) · 5 = 10 120 · 2 + 50 120 · 3 + 50 120 · 4 + 10 120 · 5 = 420 120 = 3.5 13 Exercise 9.3.7 An urn has m + n = 10 marbles, m ≥ 0 red and n ≥ 0 blue. 7 marbles selected at random without replacement. What is the expected number of red marbles drawn?(m 0 )(n 7 )(10 7 ) · 0 + (m1)(n6)(10 7 ) · 1 + (m2)(n5)(10 7 ) · 2 + . . .+ (m7)(n0)(10 7 ) · 7 e.g. (5 2 )(5 5 )(10 7 ) · 2 + (53)(54)(10 7 ) · 3 + (54)(53)(10 7 ) · 4 + (55)(52)(10 7 ) · 5 = 10 120 · 2 + 50 120 · 3 + 50 120 · 4 + 10 120 · 5 = 420 120 = 3.5 14 Example Find the average waiting time for the first head, with no upper bound on the ‘duration’ (one allows for all possible sequences of tosses, regardless of how many times tails occur initially). A = E (Xw ) = ∑∞ k=1 k · P(Xw = k) = ∑∞ k=1 k 1 2k = 1 21 + 2 22 + 3 23 + . . . This can be evaluated by breaking the sum into a sequence of geometric progressions 1 2 + 2 22 + 3 23 + . . . = ( 1 2 + 1 22 + 1 23 + . . . ) + ( 1 22 + 1 23 + . . . ) + ( 1 23 + . . . ) + . . . = 1 + 1 2 + 1 22 + . . . = 2 15 Example Find the average waiting time for the first head, with no upper bound on the ‘duration’ (one allows for all possible sequences of tosses, regardless of how many times tails occur initially).