CS 70 Dscrete Mathematcs ad Probablty Theory Fall 206 Sesha ad Walrad DIS 0b. Wll I Get My Package? Seaky delvery guy of some compay s out delverg packages to customers. Not oly does he had a radom package to each customer, he teds to ope a package before delverg wth probablty 2. Let X be the umber of customers who receve ther ow packages uopeed. (a) Compute the expectato E(X). (b) Compute the varace Var(X). Soluto: (a) Defe X = Hece E(X) = E( { f the -th customer gets hs/her package uopeed 0 otherwse X ) = E(X ) E(X ) = Pr[X = ] = 2 sce the -th customer wll get hs/her ow package wth probablty ad t wll be uopeed wth probablty 2 ad the delvery guy opes the packages depedetly. Hece E(X) = 2 = 2. (b) To calculate Var(X), we eed to kow E(X 2 ). By learty of expectato: E(X 2 ) = E ( (X +X 2 +...+X ) 2) = E( The we cosder two cases, ether = j or j. Hece E(X 2) = E(X X j ) = E(X 2 ) + E(X X j ) X X j ) =E(X X j ) 2 for all. To fd E(X X j ), we eed to calculate Pr[X X j = ]. Pr[X X j = ] = Pr[X = ]Pr[X j = X = ] = 2 2( ) sce f customer has receved hs/her ow package, customer j has choces left. Hece E(X 2 ) = 2 + ( ) 2 2( ) = 3 4. Var(X) = E(X 2 ) E(X) 2 = 3 4 4 = 2. 2. Varace Ths problem wll gve you practce usg the stadard method to compute the varace of a sum of radom varables that are ot parwse depedet (so you caot use learty of varace). CS 70, Fall 206, DIS 0b
(a) A buldg has floors umbered,2,...,, plus a groud floor G. At the groud floor, m people get o the elevator together, ad each gets off at a uformly radom oe of the floors (depedetly of everybody else). What s the varace of the umber of floors the elevator does ot stop at? (I fact, the varace of the umber of floors the elevator does stop at must be the same, but the former s a lttle easer to compute.) (b) A group of three freds has books they would all lke to read. Each fred (depedetly of the other two) pcks a radom permutato of the books ad reads them that order, oe book per week (for cosecutve weeks). Let X be the umber of weeks whch all three freds are readg the same book. Compute Var(X). Soluto: (a) Let X be the umber of floors the elevator does ot stop at. As the prevous homework, we ca represet X as the sum of the dcator varables X,...,X, where X = f o oe gets off o floor. Thus, we have ( ) m E(X ) = Pr[X = ] =, ad from learty of expectato, E(X) = ( ) m E(X ) =. To fd the varace, we caot smply sum the varace of our dcator varables. However, we ca stll compute Var(X) = E(X 2 ) E(X) 2 drectly usg learty of expectato, but ow how ca we fd E(X 2 )? Recall that E(X 2 ) = E((X +... + X ) 2 ) = E(X X j ) = E(X X j ) = E(X 2 ) + E(X X j ). The frst term s smple to calculate: E(X 2) = 2 Pr[X = ] = ( ) m, meag that ( ) m E(X 2 ) =. X X j = whe both X ad X j are, whch meas o oe gets off the elevator o floor ad floor j. Ths happes wth probablty ( ) 2 m Pr[X = X j = ] = Pr[X = X j = ] =. CS 70, Fall 206, DIS 0b 2
Thus, we ca ow compute ( ) 2 m E(X X j ) = ( ). Fally, we plug to see that ( ) m ( ) 2 m ( ( ) m ) 2 Var(X) = E(X 2 ) E(X) 2 = + ( ). (b) Let X,...,X be dcator varables such that X = f all three freds are readg the same book o week. Thus, we have ( ) 2 E(X ) = Pr[X = ] =, ad from learty of expectato, As before, we kow that E(X) = E(X 2 ) = E(X ) = ( ) 2 =. E(X 2 ) + E(X X j ). Furthermore, because X s a dcator varable, E(X 2) = 2 Pr[X = ] = ( ) 2, ad ( ) 2 E(X 2 ) = =. Aga, because X ad X j are dcator varables, we are terested Pr[X = X j = ] = Pr[X = X j = ] = (( )) 2, the probablty that all three freds pck the same book o week ad week j. Thus, ( ) E(X X j ) = ( ) (( )) 2 = ( ). Fally, we compute Var(X) = E(X 2 ) E(X) 2 = ( ) + 2 ( ). 3. Markov s Iequalty ad Chebyshev s Iequalty A radom varable X has varace Var(X) = 9 ad expectato E(X) = 2. Furthermore, the value of X s ever greater tha 0. Gve ths formato, provde ether a proof or a couterexample for the followg statemets. CS 70, Fall 206, DIS 0b 3
(a) E(X 2 ) = 3. (b) Pr[X = 2] > 0. (c) Pr[X 2] = Pr[X 2]. (d) Pr[X ] 8/9. (e) Pr[X 6] 9/6. (f) Pr[X 6] 9/32. Soluto: (a) TRUE. Sce 9 = Var(X) = E(X 2 ) E(X) 2 = E(X 2 ) 2 2, we have E(X 2 ) = 9+4 = 3. (b) FALSE. Costruct a radom varable X that satsfes the codtos the questo but does ot take o the value 2. A smple example would be a radom varable that takes o 2 values, where Pr[X = a] = 2,Pr[X = b] = 2, ad a b. The expectato must be 2, so we have 2 a + 2 b = 2. The varace s 9, so E(X 2 ) = 3 (from part (a)) ad 2 a2 + 2 b2 = 3. Solvg for a ad b, we get Pr[X = ] = 2,Pr[X = 5] = 2 as a couterexample. (c) FALSE. Costruct a radom varable X that satsfes the codtos the questo but does ot have a equal chace of beg less tha or greater tha 2. A smple example would be a radom varable that takes o 2 values, where Pr[X = a] = p,pr[x = b] = p. Here, we use the same approach as part (b) except wth a geerc p, sce we wat p. The expectato must be 2, so we have pa + ( p)b = 2. The varace s 9, so E(X 2 ) = 3 ad pa 2 + ( p)b 2 = 3. Solvg for a ad b, we fd the relato b = 2± 3 x, where x = p p. The, we ca fd a example by pluggg values for x so that a,b 0 ad p 2. Oe such couterexample s Pr[X = 7] = 0 9,Pr[X = 3] = 0. (d) TRUE. Let Y = 0 X. Sce X s ever exceeds 0, Y s a o-egatve radom varable. By Markov s equalty, Pr[0 X a] = Pr[Y a] E(Y ) a Settg a = 9, we get Pr[X ] = Pr[0 X 9] 8 9. = E(0 X) a = 8 a. (e) TRUE. Chebyshev s equalty says Pr[ X E[X] a] Var(X). If we set a = 4, we a 2 have Pr[ X 2 4] 9 6. Now we smply observe that Pr[X 6] Pr[ X 2 4], because the evet X 6 s a subset of the evet X 2 4. (f) FALSE. We use the same approach as part (c), except we fd a couterexample that fts the equalty Pr[X 6] 9/32. Oe example s Pr[X = 0] = 9 3,Pr[X = 3 2 ] = 4 3. CS 70, Fall 206, DIS 0b 4
4. Easy A s A fred tells you about a course called Lazess Moder Socety that requres almost o work. You hope to take ths course ext semester to gve yourself a well-deserved break after masterg CS70. At the frst lecture, the professor aouces that grades wll deped oly a mdterm ad a fal. The mdterm wll cosst of three questos, each worth 0 pots, ad the fal wll cosst of four questos, also each worth 0 pots. He wll gve a A to ay studet who gets at least 60 of the possble 70 pots. However, speakg wth the professor offce hours you hear some very dsturbg ews. He tells you that, the sprt of the class, the GSIs are very lazy, ad to save tme the gradg wll be doe as follows. For each studet s mdterm, the GSIs wll choose a real umber radomly from a ormal dstrbuto wth mea µ = 5 ad varace σ 2 =. They ll mark each of the three questos wth that score. To grade the fal, they ll aga choose a radom umber from the same dstrbuto, depedet of the frst umber, ad wll mark all four questos wth that score. If you take the class, what wll the mea ad varace of your total class score be? Use Chebyshev s equalty to coclude that you have less tha a 5% chace of gettg a A. Soluto: Let X be the total umber of pots you receve the class. The X = X m + X f where X m are the pots you receve o mdterm ad X f are the pots you receve o the fal. Your mdterm score s geerated as X m = 3Y m, where the r.v. Y m represets the real umber that the professor chose whe gradg your mdterm. Smlarly, X f = 4Y f. The problem statemet tells us that Y m Normal(5,) ad Y f Normal(5,), so E[Y m ] = E[Y f ] = 5 ad Var(Y m ) = Var(Y f ) =. Thus, E[X] = E[X m ] + E[X f ] = 3E[Y m ] + 4E[Y f ] = 35 ad Var(X) = Var(X m ) + Var(X f ) = 9Var(Y m ) + 6Var(Y f ) = 25. Usg Chebyshev s Iequalty, we get Pr[X 60] Pr[ X 35 25] Var(X) 25 2 = 25. Ufortuately, you have at most a 4% chace of gettg a A. So, the aswer s: your mea score wll be 35, the varace wll be 25, ad yes, you ca coclude that you have less tha a 5% chace of gettg a A. Note that although we calculated a boud for Pr[ X 35 25], whch s the probablty that you wll get 60 or above or 0 or below, we caot dvde by 2 to refe our boud uless the dstrbuto s symmetrc about ts mea. I ths case, the dstrbuto s ot symmetrc. CS 70, Fall 206, DIS 0b 5