Applied Probability Models for CS (2016

Applied Probability Models for CS (2016-2017)
Exercise 1 Solution
1. (a) The probability to answer a question correctly is p=0.8. Assuming that the questions are independent, this is a binomial experiment with n=10. The expected
number of correct answers is thus E[X] = np = 10 · 0.8 = 8, and the expected
grade is E[10 · X] = 10 · E[X] = 10 · 8 = 80.
(b) The probability that a random student got 90 is:
P (90) = P (W ) · P (90|W ) + P (E) · P (90|E) = 0.75 · P (90|W ) + 0.25 · P (90|E)
Using the formula for binomial experiments, P (X = k) = nk pk (1 − p)n−k :
10
10
P (90) = 0.75 ·
· 0.89 · 0.21 + 0.25 ·
· 0.959 · 0.051 = 0.2801
9
9
(c) Using Bayes rule:
9
1
0.75 · 10
P (W ) · P (90|W )
9 · 0.8 · 0.2
=
= 0.7187
P (W |90) =
P (90)
0.2801
2. (a) The probability that you will be the first to get a frosted cupcake is the joint
probability that every one of the 14 students before you got a non-frosted cupcake,
and that you got a frosted one. The probability of each student to get a frosted
/ non-frosted cupcake is the number of frosted / non-frosted cupcakes out of all
the cupcakes left in the box, and the overall probability is:
20 19
7 10
20! · 15! · 10
·
· ... ·
·
=
= 1.666 · 10−4
30 29
17 16
6! · 30!
(b) The probability that all the frosted cupcakes were taken already is the joint
probability that 10 of the 14 students before you got frosted cupcakes. Then, the
probability that you and the other 4 before you got non-frosted cupcakes is 1.
The overall probability is:
14
10! · 20!
·
= 3.332 · 10−5
10
30!
(c) Two students received frosted cupcakes so far, so the probability to get a frosted
8
cupcake is p = 16
= 0.5.
i. If you don’t accept the deal, it doesn’t matter which cupcake your friend
gets. According to the expectation formula, your expected reward is:
p · rf + (1 − p) · rn = 0.5 · (rf + rn )
ii. If you accept the deal, there are three different outcomes: (1) you get a nonfrosted cupcake, (2) both you and your friend get frosted cupcakes, and (3)
you get a frosted cupcake and your friend doesn’t, and you switch cupcakes.
The probability of (1) is p1 = 0.5.
The probability of (2) is the joint probability of you getting a frosted cupcake
(0.5) and that only 6 more students after you and before your friend got a
frosted cupcake:
14
7! · 8!
= 0.233
p2 = 0.5 ·
·
15!
6
The probability of (3) is the joint probability of you getting a frosted cupcake
(0.5) and that 7 more students after you and before your friend got a frosted
cupcake (and also equals 1 − p1 − p2 ):
14
7! · 8!
p3 = 0.5 ·
·
= 0.267
7
15!
The expected reward is:
E = p1 · rn + p2 · rf + p3 · (rn + 2) = 0.5 · rn + 0.233 · rf + 0.267 · (rn + 2)
E = 0.767 · rn + 0.233 · rf + 0.533
iii. The deal doesn’t change the probabilities of you and your friend to get frosted
and non-frosted cupcakes, so you should decide according to the rewards, and
accept the deal if rf < rn + 2.
3. (a)
E[X + Y ] =
XX
(x + y) · P (x, y) =
x∈X y∈Y
=
XX
x∈X y∈Y
x·P (x, y)+
XX
(x · P (x, y) + y · P (x, y)) =
x∈X y∈Y
XX
y·P (x, y) =
y∈Y x∈X
X
x
x∈X
X
P (x, y)+
y∈Y
X
y∈Y
y
X
P (x, y) =
x∈X
P
Using the definition of marginal probability (P (x) = y∈Y P (x, y)):
X
X
=
x · P (x) +
y · P (y) = E[X] + E[Y ]
x∈X
y∈Y
(b) The expected grade of a student who used Wikipedia was computed in 1 (a):
1
E[X] = 80. Alice’s probability to get a frosted cupcake is p = 10
30 = 3 , and her
1
2
4
expected reward from eating a cupcake is E[Y ] = 3 · 2 + 3 · 1 = 3 . Her overall
expected reward is therefore E[X + Y ] = E[X] + E[Y ] = 81.333.
4. (a)
i. Using the expectation formula:
XX
E[X · Y ] =
x · y · P (x, y)
x∈X y∈Y
X and Y are independent, so P (x, y) = P (x) · P (y), and:
XX
X
X
E[X ·Y ] =
x·y ·P (x)·P (y) =
x·P (x)·
y ·P (y) = E[X]·E[Y ]
x∈X y∈Y
x∈X
y∈Y
ii. According to V AR[X] = E[X 2 ] − (E[X])2 :
V AR[X+Y ] = E[(X+Y )2 ]−(E[X+Y ])2 = E[X 2 +2XY +Y 2 ]−(E[X]+E[Y ])2 =
From the linearity of expectation:
= E[X 2 ] + 2 · E[X · Y ] + E[Y 2 ] − ((E[X])2 + 2 · E[X] · E[Y ] + (E[Y ])2 ) =
X and Y are indpendent, so according to i:
= E[X 2 ] + 2 · E[X] · E[Y ] + E[Y 2 ] − (E[X])2 − 2 · E[X] · E[Y ] − (E[Y ])2 =
= E[X 2 ] − (E[X])2 + E[Y 2 ] − (E[Y ])2 = V AR[X] + V AR[Y ]
(b)
1
for every
i. If the final exam grade is drawn from a uniform distribution ( 101
grade between 0-100), then the expectation of the final grade is:
E[X] =
100
X
i=0
i·
1
1
=
· 5050 = 50
101
101
Charlie used a printed encyclopedia, so the probability to answer each question correctly is p=0.95, the entire assignment is a binomial experiment with
n=10, and the expected grade is:
E[10 · X] = 10 · n · p = 10 · 10 · 0.95 = 95
X and Y are independant, so:
E[X · Y ] = E[X] · E[Y ] = 50 · 95 = 4750
ii. If the assignment grade affects the final exam grade, then X and Y are dependant; the expectation of their product is no longer the product of the
expectations, and should be computed with the joint distribution.