29650 Engineering Mathematics 2 - Solution sheet 2 Question 1 Let r1 and r2 be continuous random variables. Show that if r1 and r2 are independent then they are also uncorrelated. Solution 1 To show that r1 and r2 are uncorrelated it is necessary to show that V(r1 + r2 ) = V(r1 ) + V(r2 ) (1) From Lecture 1 and solution sheet 1, V(r1 + r2 ) = E[ (r1 + r2 )2 ] − E(r1 + r2 )2 (2) = E(r12 + 2r1 r2 + r22 ) − [E(r1 ) + E(r2 )] 2 E(r12 ) + 2E(r1 r2 ) + E(r22 ) − E(r1 )2 − 2E(r1 )E(r2 ) − E(r12 ) − E(r1 )2 + E(r22 ) − E(r2 )2 (3) = = = E(r2 )2 V(r1 ) + V(r2 ) (4) (5) (6) The step from equation (4) to equation (5) uses the fact that r1 and r2 are independent and hence E(r1 r2 ) = E(r1 )E(r2 ). Question 2 A bag contains 60 dice. 30 of the dice are fair dice (F), 20 are weighted such that P(6) = 0.8, P() = 0.04, (n = 1, 2, 3, 4, 5) (these are referred to as type W1 ), and the remaining 10 are weighted such that P(6) = 0.9, P() = 0.02, (n = 1, 2, 3, 4, 5) (these are refered to as type W2 ). A dice is chosen at random from the bag and thrown. 1. Calculate P(6) the probability that the value on the dice is a 6? 2. Calculate the posterior probabilities P(F|6), P(W1 |6) and P(W2 |6) that the dice is of type F, W1 and W2 , respectively, given that a 6 was thrown? 3. Therefore, if a 6 is thrown, what is the most probable type of dice that was selected? 1 Solution 2 Since the dice must be one of F, W1 or W2 we have: P(6) = = = = P(6|F)P(F) + P(6|W1 )P(W1 ) + P(6|W2 )P(W2 ) 1 1 4 1 9 1 × + × + × 6 2 5 3 10 6 4 9 1 + + 12 15 60 30 1 = 60 2 (7) (8) (9) (10) For the posterior probabilities P(F|6) = P(W1 |6) = P(W1 |6) = P(6|F)P(F) =( 1 × 1 )÷ 1 = 1 P(6) 6 2 2 6 4 1 1 8 P(6|W1 )P(W1 ) =( × )÷ = P(6) 5 3 2 15 P(6|W2 )P(W2 ) 9 1 1 3 =( × )÷ = P(6) 10 6 2 10 (11) (12) (13) (14) Consequently if a 6 is throw it is most probable that the dice is of type W1 Question 3 A dark room contains two bags, each of which contains red and white balls. The first bag B1 contains 20 red balls and 5 white balls. The second bag B2 contains 8 red balls and 15 white balls. Because of the positions of the bags in the room, people choose to take balls from B1 five times as often as people choose B2 A person goes into the room, chooses a bag and takes one ball and then a second ball from the same bag. On leaving the room, the person sees that he has a red ball and a white ball. 1. Calculate the prior probabilities P(B1 ) and P(B2 ). 2. Calculate the probability that the person has a red ball and a white ball if the balls were selected from bag B1 . 3. Calculate the probability of a red ball and a white ball if the balls were taken from bag B2 . 4. Calculate the probability that the person has a red ball and a white ball. 5. Calculate the probability of B1 , given that the experiment resulted in a red ball and a white ball. 6. Calculate the probability of B2 , given that the experiment resulted in a red ball and a white ball. 7. Which bag did the person most probably take the balls from? 2 Solution 3 1. P(B1 ) = 5 × P(B2 ) and P(B1 ) + P(B2 ) = 1. Hence P(B1 ) = 5 6 = 0.83 and P(B2 ) = 1 6 = 0.17. 2. Denote the outcome that the person has a white ball by and a red ball by r. Then we need to calculate P({, r}|B1 ), where the curly brackets }} indicate that the order is not important. There are two possibilities. Either the person takes the white ball or the red ball first. The probability of taking the white ball is P(|B1 ) = 5 25 = 1 (15) 5 But now there are only 24 balls in the bag and P(r|, B1 ) = P(, r|B1 ) = P(|B1 ) × P(r|, B1 ) = 1 5 × 20 24 5 6 = = 5 6 Hence 1 (16) 6 Similarly, if a red ball is chosen first P(r, |B1 ) = P(r|B1 ) × P(|r, B1 ) = Hence P({r, }|B1 ) = 1 3 4 5 × 5 24 = 1 (17) 6 = 0.33. 3. Similarly for B2 P(, r|B2 ) = P(r, |B2 ) = Hence P({r, }|B2 ) = 120 253 P(|B2 ) × P(r|, B2 ) = 15 × 4 = 60 23 11 253 8 15 60 P(r|B2 ) × P(|r, B2 ) = × = 23 22 253 (18) (19) = 0.47. 4. Use the normal rule to calculate the probability: P({r, }) = = = P({r, }|B1 )P(B1 ) + P({r, }|B2 )P(B2 ) 1 5 120 1 × + × 3 6 253 6 20 5 + = 0.36 18 253 (20) (21) (22) 5. To calculate P(B1 |{r, }) use Bayes’ rule: P(B1 |{r, }) = = = P({r, }|B1 )P(B1 ) P({r, }) 0.33 × 0.83 0.36 0.78 (23) (24) (25) 6. For P(B2 |{r, }) P(B2 |{r, }) = = = 3 P({r, }|B2 )P(B2 ) P({r, }) 0.47 × 0.17 0.36 0.22 (26) (27) (28) 7. Hence the bag that the balls were chosen from is most probable 1. Question 4 A bag contains 50 fair dice and N weighted dice. For fair dice F, P(|F) = 1 6 for any value ∈ {1, 2, 3, 4, 5, 6}. For a weighted dice W, P( = 6|W) = 4 5 and P(|W) = 1 , 25 ∈ {1, 2, 3, 4, 5}. A person chooses a dice at random from the bag, throws it, and the result ia a 6. 1. Write down an expression, as a function of N, for the probability that the dice is weighted 2. What is the smallest value of N that leads to the conclusion that the dice was most probably weighted? Solution 4 First calculate the prior probabilities: P(F) = P(W) = 50 50 + N N 50 + N (29) (30) Now calculate P(6): P(6) = = = P(6|F)P(F) + P(6|W)P(W) 1 50 4 N × + × 6 50 + N 5 50 + N 125 + 12N 15(50 + N) (31) (32) (33) Hence P(W|6) = = = P(6|W)P(W) P(6) 4 N 125 + 12N ( × )÷ 5 50 + N 15(50 + N) 12N 125 + 12N (34) (35) (36) For the second part of the question, for the dice to be most probably weighted we need 12N > 12 In other words, 125+12N 24N > 125 + 12N (37) 12N > 125 (38) N ≥ 11 (39) 4 Question 5 A subject looks at an image consisting of two simple objects, O1 and O2 , while an eye-tracker returns the (, y) coordinates of the focus of his gaze. When the subject looks at O1 , the coordinate of the focus of gaze is characterised by a Gaussian probability density function g1 with mean -5 and variance 5, while a Gaussian probability density functiom g2 with mean 5 and variance 7 is used for object O2 . The probabilities that the subject looks at objects O1 and O2 are P(O1 ) = 0.6 and P(O2 ) = 0.4. 1. Calculate the posterior probability P(O1 | = 1) 2. Is it more probable that the subject was looking at object O1 or O2 ? Solution 5 The prior probabilities are given as P(O1 ) = 0.6 and P(O2 ) = 0.4. Calculate the conditional probability densities: p(1|O1 ) = p = p = p(1|O2 ) = = = 1 2π5 1 e −(1−(−5))2 10 e−3.6 10π 0.0049 1 −(1−5))2 e 14 p 2π7 1 16 e− 14 p 14π 0.048 (40) (41) (42) (43) (44) (45) Hence p(1) = p(1|O1 )P(O1 ) + p(1|O2 )P(O2 ) (46) = 0.6 × 0.0049 + 0.4 × 0.048 (47) = 0.022 (48) Hence P(O1 |1) = = = p(1|O1 )P(O1 ) P(1) 0.6 × 0.0049 0.022 0.132 (49) (50) (51) Hence, since P(O1 |1) + P(O2 |1) = 1, P(O2 |1) = 0.868 and the subject is most probably looking at object O2 . 5