You are on page 1of 5

29650 Engineering Mathematics 2 - Solution sheet 2

Sean Elvidge

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 (3)
= E(r12 ) + 2E(r1 r2 ) + E(r22 ) − E(r1 )2 − 2E(r1 )E(r2 ) − E(r2 ) 2
(4)
= E(r12 ) − E(r1 )2 + E(r22 ) − E(r2 )2 (5)
= V (r1 ) + V (r2 ) (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 ). To see this suppose r1 is governed by p1 and r2 is governed by p2 , then
Z ∞Z ∞
E(r1 r2 ) = xyp(x, y)dxdy (7)
−∞ −∞
Z ∞Z ∞
= xp1 (x)yp2 (y)dxdy (8)
−∞ −∞
Z ∞ Z ∞
= yp2 (y) xp1 (x)dxdy (9)
−∞ −∞
Z ∞
= yp(y)E(r1 )dy = E(r1 )E(r2 ) (10)
−∞

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 (x) =
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 (x) = 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 ) (11)


1 1 4 1 9 1
= × + × + × (12)
6 2 5 3 10 6
1 4 9
= + + (13)
12 15 60
30 1
= = (14)
60 2
For the posterior probabilities

P (6|F )P (F ) 1 1 1 1
P (F |6) = =( × )÷ = (15)
P (6) 6 2 2 6
P (6|W1 )P (W1 ) 4 1 1 8
P (W1 |6) = =( × )÷ = (16)
P (6) 5 3 2 15
P (6|W2 )P (W2 ) 9 1 1 3
P (W1 |6) = =( × )÷ = (17)
P (6) 10 6 2 10
(18)

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?

Solution 3
5 1
1. P (B1 ) = 5 × P (B2 ) and P (B1 ) + P (B2 ) = 1. Hence P (B1 ) = 6 = 0.83 and P (B2 ) = 6 = 0.17.

2
2. Denote the outcome that the person has a white ball by w and a red ball by r. Then we need to
calculate P ({w, 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
5 1
P (w|B1 ) = = (19)
25 5
20 5
But now there are only 24 balls in the bag and P (r|w, B1 ) = 24 = 6 Hence

1 5 1
P (w, r|B1 ) = P (w|B1 ) × P (r|w, B1 ) = × = (20)
5 6 6
Similarly, if a red ball is chosen first
4 5 1
P (r, w|B1 ) = P (r|B1 ) × P (w|r, B1 ) = × = (21)
5 24 6
1
Hence P ({r, w}|B1 ) = 3 = 0.33.
3. Similarly for B2
15 4 60
P (w, r|B2 ) = P (w|B2 ) × P (r|w, B2 ) = × = (22)
23 11 253
8 15 60
P (r, w|B2 ) = P (r|B2 ) × P (w|r, B2 ) = × = (23)
23 22 253
120
Hence P ({r, w}|B2 ) = 253 = 0.47.
4. Use the normal rule to calculate the probability:

P ({r, w}) = P ({r, w}|B1 )P (B1 ) + P ({r, w}|B2 )P (B2 ) (24)


1 5 120 1
= × + × (25)
3 6 253 6
5 20
= + = 0.36 (26)
18 253

5. To calculate P (B1 |{r, w}) use Bayes’ rule:

P ({r, w}|B1 )P (B1 )


P (B1 |{r, w}) = (27)
P ({r, w})
0.33 × 0.83
= (28)
0.36
= 0.78 (29)

6. For P (B2 |{r, w})

P ({r, w}|B2 )P (B2 )


P (B2 |{r, w}) = (30)
P ({r, w})
0.47 × 0.17
= (31)
0.36
= 0.22 (32)

7. Hence the bag that the balls were chosen from is most probable 1.

3
Question 4

A bag contains 50 fair dice and N weighted dice.


1
For fair dice F , P (x|F ) = 6 for any value x ∈ {1, 2, 3, 4, 5, 6}.
4 1
For a weighted dice W , P (x = 6|W ) = 5 and P (x|W ) = 25 , x ∈ {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:


50
P (F ) = (33)
50 + N
N
P (W ) = (34)
50 + N
Now calculate P (6):
P (6) = P (6|F )P (F ) + P (6|W )P (W ) (35)
1 50 4 N
= × + × (36)
6 50 + N 5 50 + N
125 + 12N
= (37)
15(50 + N )
Hence
P (6|W )P (W )
P (W |6) = (38)
P (6)
4 N 125 + 12N
= ( × )÷ (39)
5 50 + N 15(50 + N )
12N
= (40)
125 + 12N
12N 1
For the second part of the question, for the dice to be most probably weighted we need 125+12N > 2 In other
words,
24N > 125 + 12N (41)
12N > 125 (42)
N ≥ 11 (43)

Question 5

A subject looks at an image consisting of two simple objects, O1 and O2 , while an eye-tracker returns the
(x, y) coordinates of the focus of his gaze. When the subject looks at O1 , the x 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.

4
1. Calculate the posterior probability P (O1 |x = 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:
1 −(1−(−5))2
p(1|O1 ) = √
e 10 (44)
2π5
1
= √ e−3.6 (45)
10π
= 0.0049 (46)
1 −(1−5))2
p(1|O2 ) = √ e 14 (47)
2π7
1 16
= √ e− 14 (48)
14π
= 0.048 (49)

Hence

p(1) = p(1|O1 )P (O1 ) + p(1|O2 )P (O2 ) (50)


= 0.6 × 0.0049 + 0.4 × 0.048 (51)
= 0.022 (52)

Hence
p(1|O1 )P (O1 )
P (O1 |1) = (53)
P (1)
0.6 × 0.0049
= (54)
0.022
= 0.132 (55)

Hence, since P (O1 |1) + P (O2 |1) = 1, P (O2 |1) = 0.868 and the subject is most probably looking at object
O2 .

You might also like