程序代写 COMP2610/COMP6261 Tutorial 1 Sample Solutions∗ Semester 2, 2018

COMP2610/COMP6261 Tutorial 1 Sample Solutions∗ Semester 2, 2018
1. We wish to calculate the probability of selecting an apple. What we have are the probabilities of selecting each of the boxes. We can also calculate from the information we are given the chance of choosing a particular fruit from a particular box. That is, we have conditional probabilities for fruit given box as well as marginal probabilities of selecting each of the boxes.
(a) We marginalise over boxes to express P (apple) in terms of joint probabilities, and then use the chain rule:
P (apple) = P (apple, red) + P (apple, green) + P (apple, blue) = P (apple|red)P (red) + P (apple|green)P (green) + P (apple|blue)P (blue)

Copyright By PowCoder代写 加微信 powcoder

= 0.3×0.2+0.3×0.6+0.5×0.2
(b) We want to compute P(green|orange). We know from the definition of conditional
probability that
To use this formula, we need P (green, orange) and P (orange). Now,
P (green|orange) = P (green, orange) . P (orange)
P (orange) = P (orange|red)P (red) + P (orange|green)P (green) + P (orange|blue)P (blue)
= 0.4 × 0.2 + 0.3 × 0.6 + 0.5 × 0.2 = 0.36. Note that in the calculations above we found
P (orange, green) = P (orange|green)P (green) = 0.3 × 0.6 = 0.18 Putting all this together, we have
P (green|orange) = P (green, orange) = 0.18 = 0.5. P (orange) 0.36
∗Based in part on solutions by for the 2012 version of the course. 1

2. (a) (b) (c)
Bydefinition,p(X =1,Y =1)= 500 = 1. 1000 2
Bythesumrule,p(X =1)=p(X =1,Y =1)+p(X =1,Y =0)= 750 = 3. 1000 4
Bydefinitionofexpectation,E[X]=p(X =1)·1+p(X =0)·0=p(X =1)= 34. Bydefinitionofconditionalprobability,p(Y =1|X=1)=p(X=1,Y=1) =1 ·4 =2.
By Bayes’ rule,
p(X =1,Y =1|Z =1)= p(Z =1|X =1,Y =1)·p(X =1,Y =1). p(Z = 1)
By the sum rule (or marginalisation),
p(X=1) 2 3 3 Bydefinitionofconditionalprobability,p(Y =1|X=0)=p(X=0,Y=1) =150 =3.
p(X =1,Y =1|Z =1)= 0.1·0.5 ≈0.1190.
p(Z =1)=􏰄p(Z =1,X =x,Y =y) x,y
=􏰄p(Z =1|X =x,Y =y)·p(X =x,Y =y) x,y
=0.9·(p(X =1,Y =0)+p(X =0,Y =1))+ 0.1·(p(X =1,Y =1)+p(X =0,Y =0))
􏰂115􏰃 􏰂11􏰃 =0.9· 4+100 +0.1· 2+10
p(X=0) 250 5
P (first ball is red) = P (second ball is red) = 0.5
3. We have
and we wish to calculate
P (2 reds in the box| 3 red balls selected from the box).
Using Bayes rule we find that the above is equal to
P (2 reds in the box, 3 red balls selected from the box) .
P ( 3 red balls selected from the box)
Since it is impossible to select two red balls if both balls in the box are white:
P ( 3 red balls selected from the box)
= P ( 3 red balls selected from the box|2 reds in the box)P (2 reds in the box) + P ( 3 red balls selected from the box|1 red in the box)P (1 reds in the box) = 1 × 0.25 + 0.125 × 0.5 = 0.3125

P (2 reds in the box| 3 red balls selected from the box) = 0.25/0.3125 = 0.800.
4. (a) The definition is nothing but a restatement of the chain rule,
p(X, Y ) = p(X|Y )p(Y ). We thus have, for random variables X, Y, Z,
p(X, Y, Z) = p(X|Y, Z)p(Y, Z). The chain rule also implies that
Therefore,
p(X, Y, Z) = p(Y |X, Z)p(X|Z)p(Z) p(Y, Z) = p(Y |Z)p(Z).
p(Y |X, Z)p(X|Z)p(Z) = p(X|Y, Z)p(Y |Z)p(Z) p(Y |X, Z)p(X|Z) = p(X|Y, Z)p(Y |Z),
which is the desired statement.
(b) By definition of conditional probability,
p(X1,…,Xn|Y) = p(X1,…,Xn,Y) p(Y )
p(X1,…,Xi−1,Xi+1,…,Xn|Y) = p(X1,…,Xi−1,Xi+1,…,Xn,Y) p(Y )
􏰐x p(X1,…,Xi−1,Xi = x,Xi+1,…,Xn,Y) = p(Y) =􏰄p(X1,…,Xi−1,Xi =x,Xi+1,…,Xn,Y)
x p(Y) =􏰄p(X1,…,Xi−1,Xi =x,Xi+1,…,Xn|Y).
5. Before we have any information, the probability of any of A, B or C getting the noose is 1/3 and the probability of them being released is 1 − 1/3 = 2/3. We want to find P (A released |B gets letter). Using Bayes’ rule:
P (A released |B gets letter) = P (B gets letter|A released ) × P (A released) . P (B gets letter)

As we have no a priori evidence as to which of B or C is guilty, the probability of B getting the letter is 1/2. Further, whether or not B gets the letter is independent of whether A is released. Thus,
P (B gets letter|A released ) × P (A released) = 1/2 × 2/3 = 1/3. P (A released |B gets letter) = 1/3 = 2/3.
Another way to see this is that who of B and C gets the letter is independent of whether or
not A get released. Thus P (A released|B gets letter) = P (A released) = 2/3.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com