March 13 Homework Solutions Math 151, Winter 2012 Chapter 7 Problems (pages 373-379) Problem 30 If X and Y are independent and identically distributed with mean µ and variance σ 2 , find E[(X − Y )]2 . E[(X − Y )2 ] = E[X 2 − 2XY + Y 2 ] = E[X 2 ] − 2E[XY ] + E[Y 2 ] = (Var(X) + E[X]2 ) − 2(Cov(X, Y ) + E[X]E[Y ]) + (Var(Y ) + E[Y ]2 ) = (σ 2 + µ2 ) − 2(0 + µ2 ) + (σ 2 + µ2 ) = 2σ 2 . Problem 34 If 10 married couples are randomly seated at a round table, compute (a) the expected number of the number of wives who are seated next to their husbands. Label the wives 1 through 10 and let Xi =P1 if the i-th wife is seated next to her husband and Xi = 0 otherwise. Let X = 10 i=1 Xi be the number of wives seated next to their husbands. Then E[X] = 10 X E[Xi ] = i=1 10 X P {Xi = 1}. i=1 Given where the i-th wife sits, her husband may sit in one of the 19 remaining seats, two of which are next to his wife. So P {Xi = 1} = 2/19 and hence E[X] = 10 X P {Xi = 1} = 10 · i=1 2 20 = . 19 19 (b) the variance of the number of wives who are seated next to their husbands. We want to compute Var(X) = 10 X Var(Xi ) + 2 i=1 X Cov(Xi , Xj ). i<j Since Xi only takes values 0 or 1, we have Var(Xi ) = E[Xi2 ] − E[Xi ]2 = P {Xi2 = 1} − P {Xi = 1}2 = P {Xi = 1} − P {Xi = 1}2 2 2 2 = − 19 19 34 = . 361 1 Also, for i = 1, ..., 10 and j 6= i we have Cov(Xi , Xj ) = E[Xi Xj ] − E[Xi ]E[Xj ] = P {Xi = Xj = 1} − P {Xi = 1}P {Xj = 1}. We know P {Xi = Xj = 1} = P ({Xj = 1}|{Xi = 1})P {Xi = 1}. Given that the i-th wife and her husband sit next to each other, the j-th wife can sit in any of the 18 remaining seats. If the j-th wife sits next to the i-th wife or her husband, the j-th wife’s husband may sit in one of the remaining 17 seats, only one of which is next to his wife. If the j-th wife does not sit next to the i-th wife or her husband, then the j-th wife’s husband may sit in one of the remaining 17 seats, two of which is next to his wife. Thus 16 2 1 2 1 · + · = . P ({Xi = 1}|{Xj = 1}) = 18 17 18 17 9 So P {Xi = Xj = 1} = 1/9 · 2/19 = 2/171. Hence 2 2 2 2 Cov(Xi , Xj ) = − = . 171 19 3249 Hence Var(X) = 10 X i=1 Var(Xi ) + 2 X i<j 10 2 360 34 +2· · = . Cov(Xi , Xj ) = 10 · 361 2 3249 361 Problem 37 A die is rolled twice. Let X equal the sum of the outcomes, and let Y equal the first outcome minus the second. Compute Cov(X, Y ). Let Z1 be the outcome of the first role and let Z2 be the outcome of the second roll. So X = Z1 + Z2 and Y = Z1 − Z2 . Then Cov(X, Y ) = Cov(Z1 + Z2 , Z1 − Z2 ) = Cov(Z1 , Z1 ) − Cov(Z1 , Z2 ) + Cov(Z2 , Z1 ) − Cov(Z2 , Z2 ) = Var(Z1 ) − Var(Z2 ) since Cov(Z1 , Z2 ) − Cov(Z2 , Z1 ) = 0 since Var(Z1 ) = Var(Z2 ). Note that Var(Z1 ) = Var(Z2 ) because Z1 and Z2 are identically distributed. Problem 41 A pond contains 100 fish, of which 30 are carp. If 20 fish are caught, what are the mean and variance of the number of carp among the 20? What assumptions are you making? Let X denote the number of carp caught of the 20 fish caught. We assume that each of the 100 ways to catch the 20 fish are equally likely. Then X satisfies a hypergeometric 20 distribution with parameters n = 20, N = 100, m = 30 (see Section 4.8.3 on page 160 in the text). By the formulas on page 162 and 163 for the expected value and variance of the hypergeometric series, we have E[X] = nm 20 · 30 = =6 N 100 2 and nm (n − 1)(m − 1) nm 20 · 30 19 · 29 20 · 30 112 Var(X) = +1− = +1− = . N N −1 N 100 99 100 33 Problem 45 If X1 , X2 , X3 , and X4 are (pairwise) uncorrelated random variables, each having mean 0 and variance 1, compute the correlations of (a) X1 + X2 and X2 + X3 . We have Cov(X1 + X2 , X2 + X3 ) = Cov(X1 , X2 ) + Cov(X1 , X3 ) + Cov(X2 , X2 ) + Cov(X2 , X3 ) = 0 + 0 + Var(X2 ) + 0 = 1. Note Var(X1 + X2 ) = Var(X1 ) + Var(X2 ) + 2 Cov(X1 , X2 ) = 1 + 1 + 2 · 0 = 2. Similarly Var(X2 + X3 ) = 0. So the correlation between X1 + X2 and X2 + X3 is 1 Cov(X1 + X2 , X2 + X3 ) 1 = . ρ(X1 + X2 , X2 + X3 ) = p =√ 2 2·2 Var(X1 + X2 ) Var(X2 + X3 ) (b) X1 + X2 and X3 + X4 . Since Cov(X1 + X2 , X3 + X4 ) = Cov(X1 , X3 ) + Cov(X1 , X4 ) + Cov(X2 , X3 ) + Cov(X2 , X4 ) =0+0+0+0 = 0, the correlation between X1 + X2 and X3 + X4 is 0. Problem 48 A fair die is successively rolled. Let X and Y denote, respectively, the number of rolls necessary to obtain a 6 and a 5. Find (a) E[X]. E[X] = ∞ X xP {X = x} = x=1 since P∞ x=1 xz x−1 ∞ X x(5/6)x−1 (1/6) = (1/6) · x=1 = 1 (1−z)2 for |z| < 1. 3 1 = 6. (1 − 5/6)2 (b) E[X|Y = 1]. E[X|Y = 1] = ∞ X xP ({X = x}|{Y = 1}) x=1 = = = ∞ X x(5/6)x−2 (1/6) x=2 ∞ X 6 5 1 5 x=2 ∞ X x(5/6)x−1 (1/6) x(5/6)x−1 x=2 ∞ 1 1X =− + x(5/6)x−1 5 5 x=1 1 1 1 =− + · 5 5 (1/6)2 ∞ X since xz x−1 = x=1 1 for |z| < 1 (1 − z)2 = 7. (c) E[X|Y = 5]. We have E[X|Y = 5] = ∞ X xP ({X = x}|{Y = 5}) x=1 ∞ X P {X = x, Y = 5} x = P {Y = 5} x=1 ∞ X 1 = xP {X = x, Y = 5}. P {Y = 5} x=1 We know P {Y = 5} = (5/6)4 (1/6). If x ≤ 4, then P {X = x, Y = 5} = (4/6)x−1 (1/6)(5/6)4−x (1/6) = 4x−1 54−x 6−5 . If x = 5, then P {X = x, Y = 5} = 0. If x ≥ 6, then P {X = x, Y = 5} = (4/6)4 (1/6)(5/6)x−6 (1/6) = 44 5x−6 6−x . 4 Thus ∞ X 1 xP {X = x, Y = 5} E[X|Y = 5] = P {Y = 5} x=1 1 = (5/6)4 (1/6) = 4 X x−1 4−x −5 x·4 5 6 + x=1 ∞ X ! 4 x−6 −x x·4 5 6 x=6 3637 . 625 Problem 59 There are n + 1 participants in a game. Each person independently is a winner with probability p. The winners share a total prize of 1 unit. Let A denote a specified one of the players, and let X denote the amount that is received by A. (a) Compute the expected total prize shared by the players. Let Y be the total prize shared by the players. If there is no winner, then Y = 0. If there is at least one winner, then Y = 1. The probability that there is no winner is (1 − p)n+1 . Therefore the the expected total prize shared by the players is E[Y ] = P {Y = 1} = 1 − (1 − p)n+1 . (b) Argue that E[X] = 1 − (1 − p)n+1 . n+1 Label the players Pn+1 1 through n + 1 and let Yi denote the prize of the i-th player. Note Y = i=1 Yi is the total prize shared by the players. By part (a), E[Y ] = 1 − (1 − p)n+1 . Since the players win independently and with the same probability, E[Yi ] is independent of i. In particular, E[Yi ] = E[X] is the expected prize of A. Therefore n+1 X n+1 1 − (1 − p) = E[Y ] = E[Yi ] = (n + 1)E[X], i=1 so E[X] = 1 − (1 − p)n+1 . n+1 (c) Compute E[X] by conditioning on whether A is a winner, and conclude that E[(1 + B)−1 ] = 1 − (1 − p)n+1 (n + 1)p when B is a binomial random variable with parameters n and p. Let I = 1 if A wins and I = 0 otherwise. Then E[X] = E[E[X|I]]. If I = 0, then E[X|I] = 0 since A can only get a prize if A wins. If I = 1, then E[X|I] = (1+B)−1 , 5 where B denotes the number of winners excluding I. Note that B is a binomial random variable with parameters n and p. Therefore E[X] = E[E[X|I]] = E[X|I = 0] · P {I = 0} + E[X|I = 1] · P {I = 1} = 0 + E[(1 + B)−1 ] · p = E[(1 + B)−1 ] · p. So using part (b), we get E[(1 + B)−1 ] = E[X] 1 − (1 − p)n+1 = . p (n + 1)p Chapter 7 Theoretical Exercises (pages 380-384) Problem 33 A coin that lands on heads with probability p is continually flipped. Compute the expected number of flips that are made until a string of r heads in a row is obtained. Let X denote the number of flips that are made until a string of r heads in a row is obtained. Let Y denote the number of flips until the first occurrence of tails. Then E[X] = E[E[X|Y ]] = ∞ X E[X|Y = i]P {Y = i}. i=1 Note P {Y = i} = pi−1 (1 − p). If i ≤ r, then on the i + 1 flip we start over trying to get r consecutive heads and thus E[X|Y = i] = i + E[X]. If i > r, then the first r flips are heads and thus E[X|Y = i] = r. Hence E[X] = ∞ X E[X|Y = i]P {Y = i} i=1 = (1 − p) r X pi−1 (i + E[X]) + (1 − p) i=1 ∞ X pi−1 r i=r+1 r r X X = (1 − p) ipi−1 + (1 − p) pi−1 E[X] + rpr i=1 i=1 r X = (1 − p) ipi−1 + E[X](1 − pr ) + rpr i=1 6 We can calculate r X ip i−1 = i=1 ∞ X ip i=1 i−1 − ∞ X ipi−1 i=r+1 ∞ X = ∞ X 1 i−1 − rp − (i − r)pi−1 2 (1 − p) i=r+1 i=r+1 = X rpr 1 − − ipr+i−1 (1 − p)2 1 − p i=1 ∞ 1 pr rpr − − (1 − p)2 1 − p (1 − p)2 1 − (1 − p)rpr − pr = . (1 − p)2 = So r X ipi−1 + E[X](1 − pr ) + rpr E[X] = (1 − p) i=1 1 − (1 − p)rpr − pr + E[X](1 − pr ) + rpr = (1 − p) (1 − p)2 1 − pr = + E[X](1 − pr ). 1−p Solving for E[X], we get E[X] = 1 − pr . pr (1 − p) Problem 34 For another approach to Theoretical Exercise 33, let Tr denote the number of flips required to obtain a run of r consecutive heads. (a) Determine E[Tr |Tr−1 ]. Let j be an integer with j ≥ r − 1. Let I = 1 if the j + 1 flip is heads and I = 0 if it is tails. Then E[Tr |Tr−1 = j] = E[Tr |Tr−1 = j, I = 0]P {I = 0} + E[Tr |Tr−1 = j, I = 1]P {I = 1}. If I = 0, that is the next flip is tails, we start over trying to get r consecutive heads. Thus E[Tr |Tr−1 = j, I = 0] = j + 1 + E[Tr ]. If I = 1, then we’ve succeeded at getting r consecutive heads, and so E[Tr |Tr−1 = j, I = 1] = j + 1. Hence E[Tr |Tr−1 = j] = E[Tr |Tr−1 = j, I = 0]P {I = 0} + E[Tr |Tr−1 = j, I = 1]P {I = 1} = (j + 1 + E[Tr ])(1 − p) + (j + 1)p = j + 1 + (1 − p)E[Tr ]. That is, E[Tr |Tr−1 ] is the function of Tr−1 whose value at Tr−1 = j is j + 1 + (1 − p)E[Tr ]. 7 (b) Determine E[Tr ] in terms of E[Tr−1 ]. We have E[Tr ] = E[E[Tr |Tr−1 ]] X = E[Tr |Tr−1 = j]P {Tr−1 = j} j = X j + 1 + (1 − p)E[Tr ] P {Tr−1 = j} j = X j · P {Tr−1 = j} + 1 + (1 − p)E[Tr ] j = E[Tr−1 ] + 1 + (1 − p)E[Tr ] Hence E[Tr ] = E[Tr−1 ] 1 + . p p (c) What is E[T1 ]? E[T1 ] = ∞ X iP {T1 = i} = i=1 since P∞ n=1 nxn−1 = 1 (1−x)2 ∞ X i(1 − p)i−1 p = i=1 for |x| < 1. (d) What is E[Tr ]? E[Tr−1 ] 1 + p p E[Tr−2 ] 1 1 = + 2+ 2 p p p = ... E[Tr ] = r−1 E[T1 ] X 1 = r−1 + p pi i=1 1 p−1 − p−r + pr 1 − p−1 pr − 1 = r . p (p − 1) = 8 1 p = 2 p p