Math 350 - Homework 2 - Solutions

1. If X and Y have a joint probability density function given by
f(x, y) = 2e
−(x+2y)
for x and y in (0, ∞), find the probability P(X < Y ).
The probability density function f(x, y) is defined on the first (positive) quadrant of R
2
. The Event
{X < Y } corresponds to the subset of the plane described by the edge-shaped region shown in the
figure.
The probability of this event is then given by the integral of f(x, y) over that region. I.e.,
P(X < Y ) =
_

0
_
y
0
2e
−(x+2y)
dxdy = 2
_

0
e
−2y
__
y
0
e
−x
dx
_
dy =
1
3
.
2. The continuous random variable X has a probability density function given by
f(x) = cx
for 0 < x < 1. Find the expected value E[X]. (You need to determine the value of c.)
The value of c comes from the condition
_
1
0
f(x) dx = 1. This integral is c/2, so c = 2. The expected
value is then
E[X] =
_
1
0
2x
2
dx =
_
2x
3
3
_
1
0
=
2
3
.
3. An airplane needs at least half of its engines to safely complete its mission. If each engine indepen-
dently functions with probability p, for what values of p is a three-engine plane safer than a five-engine
plane?
Under the assumptions of the exercise, the probability that j engines amongst n will work fine through
the duration of the mission is given by the binomial probability
p
n,j
:=
_
n
j
_
p
j
(1 −p)
n−j
.
Thus we have that the probability that a 3 engine airplane will run its mission safely is
p
3,3
+ p
3,2
=
_
3
3
_
p
3
(1 −p)
0
+
_
3
2
_
p
2
(1 −p)
1
= p
3
+ 3p
2
(1 −p).
The corresponding probability for a 5 engine plane is
p
5,5
+p
5,4
+p
5,3
=
_
5
5
_
p
5
(1 −p)
0
+
_
5
4
_
p
4
(1 −p)
1
+
_
5
3
_
p
3
(1 −p)
2
= p
5
+5p
4
(1 −p) +10p
3
(1 −p)
2
.
The values of p for which a 3 engine plane is safer than a 5 engine plane are those for which the first
probability is greater than the second. I.e., we need to solve the following inequality for p:
p
3
+ 3p
2
(1 −p) > p
5
+ 5p
4
(1 −p) + 10p
3
(1 −p)
2
.
This can be simplified to
2p
3
−5p
2
+ 4p −1 < 0.
Some guesswork (informed by plotting the graph of the cubic function) gives that 1 and 1/2 are
roots of the polynomial. Using the full factorization of the polynomial, we can write the inequality
as follows:
(p −1)
2
(2p −1) < 0.
But this quantity is negative exactly when the term 2p −1 is negative. Therefore, the 3 engine plane
is safer exactly when
p <
1
2
.
4. If X is a Poisson random variable with parameter λ, show that
(a) E[X] = λ.
(b) Var(X) = λ.
Before solving the problem, note the following infinite series values:

j=0
λ
j
j!
= e
λ

j=0

j
j!
= λ

j=1
λ
j−1
(j −1)!
= λe
λ

j=0
j
2
λ
j
j!
= λ

j=1

j−1
(j −1)!
= λ

j=0
(j + 1)λ
j
j!
= λ
2
e
λ
+ λe
λ
.
From this we immediately get
E[X] = e
−λ

j=0

j
j!
= λ
2
and
Var(X) = E[X
2
] −E[X]
2
= e
−λ

j=0
j
2
λ
j
j!

_
_
e
−λ

j=0

j
j!
_
_
2
= λ
2
+ λ −λ
2
= λ.
5. Two players play a certain game until one has won a total of five games. If player A wins each
individual game with probability 0.6, determine:
(a) what is the probability she will win the match?
It will be helpful to introduce some notation. Let W
1
indicate the event that player 1 wins the
match, and W
2
the event that player 2 wins the match. Also let N
j
, for j = 1, 2, . . . , denote
the event that a match will be exactly j games long. Note that a match cannot be decided
with fewer than 5 games, and it involves no more than 9 games. Let p denote the probability
that player 1 wins a single game, and q = 1 − p. By assumption p = 0.6. We wish to find the
probability P(W
1
).
First observe that W1 ∩N
j
is the event that player 1 wins and the match lasts exactly j games.
Since P(N
j
) = 0 if j < 5 or j > 9, we have
P(W
1
∩ N
j
) = 0 if j < 5 or j > 9.
If 5 ≤ j ≤ 9, I claim that
P(W
1
∩ N
j
) =
_
j −1
4
_
p
5
q
j−5
.
This can be explained as follows. Each elementary outcome of the event W
1
∩ N
j
can be
represented by a vector of the form (a
1
, . . . , a
j
), where an entry a
s
is either 0 (player 1 loses)
or 1 (player 1 wins). For example, (0, 1, 0, 1, 1, 0, 0, 1, 1) is an element of W
1
∩ N
9
. Notice that
a vector of this kind represents an outcome in W
1
∩ N
j
, for 5 ≤ j ≤ 9, if and only if: (i) it
has length j, (ii) it ends in 1, and (iii) exactly 4 of the first j − 1 entries are equal to 1. Thus
each elementary outcome of W
1
∩N
j
has probability p
5
q
j−5
and there are exactly
_
j−1
4
_
of them
(since the last entry must be 1). Therefore,
P(W
1
∩ N
j
) =
_
_
_
_
j−1
4
_
p
5
q
j−5
if 5 ≤ j ≤ 9
0 if j < 5 or j > 9.
Noting that W
1
= (W
1
∩ N
5
) ∪ · · · ∪ (W
1
∩ N
9
), a union of mutually exclusive events, then
P(W
1
) = P(W
1
∩ N
5
) +· · · + P(W
1
∩ N
9
)
=
9

j=5
_
j −1
4
_
p
5
q
j−5
= p
5
(1 + 5q + 15q
2
+ 35q
3
+ 70q
4
)
= 0.7334
(b) what is the expected number of games in a match?
The expected number of matches is
9

j=5
jP(N
j
) =
9

j=5
j (P(N
j
∩ W
1
) + P(N
j
∩ W
2
)) =
9

j=5
j
__
j −1
4
_
p
5
q
j−5
+
_
j −1
4
_
q
5
p
j−5
_
.
3
Therefore,
E[# of Games] = 5(p
5
+ q
5
) + 30(p
5
q + q
5
p) + 105(p
5
q
2
+ q
5
p
2
)+
280(p
5
q
3
+ q
5
p
3
) + 630(p
5
q
4
+ q
5
p
4
)
= 7.3538.
(c) Confirm your result by doing a computer simulation of the situation. For example, you can
simulate the outcome of a single game by flipping a biased coin (as in homework 1) with prob-
ability of heads equal to 0.6. Play the coin game a number of times, keeping a record of the
accumulated number of heads and tails. The process stops the first time that the count of heads
or tails reaches 5. (This cannot take more than 9 tosses.) Now determine which one (heads or
tail) reached 5 first, and how many steps it took for that to happen. By repeating the process a
large number of times (say, 1000) count the frequency of the times when heads (the first player)
wins. Similarly, obtain the average number of games (coin tosses) in a match.
Here is one possible way of doing this in Matlab (recall that anything in a line following % is
simply a comment):
%The main parameters are: p (probability that player 1 wins a game)
%and m (number of sample matches)
p=0.6;
m=100000;
%The outcome of each game is decided by flipping a biased coin
%with probability of heads equal to p. Thus we call for
%m strings of random numbers (0 or 1), with P(1)=p, each string
%of length 9. If the match is decied before step 9 we just ignore the
%remaining game outcomes.
G=(rand(m,9)<p);
%The cumulative sum of each row of G gives the number of wins of
%player 1 at each step of the match.
CS1=cumsum(G,2);
%Now consider the following quantity:
T1=sum((CS1<5),2)+1;
%For each sample match, T1 is a number such that 5<=T<=10.
%T1-1 is the number of games in a match before player 1 won a
%total of 5 games. If player 1 never made 5 wins, then T1=10.
%If T1<=9, then it must have won the match. Thus we the condition
%T1<=9 is equivalent to player 1 winning the match. The frequency of
%wins of player 1 is then
4
f=sum(T1<=9)/m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%To obtain the mean number of games in a match, we observe
%that, if player 1 wins, then T1 is the time when that happened.
%Therefore, if we define the corresponding quantity, T2, for player 2,
%the match ends at the minimum of T1 and T2.
CS2=cumsum(~G,2);
T2=sum((CS2<5),2)+1;
E=min(T1,T2);
%The average length of a match is now
l=sum(E)/m
Here are a typical sample values of f (frequency of wins of player 1) and l (average length of a
match) taking the number of trials of the simulated match to be m = 100000:
f =
0.7322
l =
7.3523
5

5 4 3 The values of p for which a 3 engine plane is safer than a 5 engine plane are those for which the first probability is greater than the second. 2 4. Using the full factorization of the polynomial.j := n j p (1 − p)n−j . note the following infinite series values: ∞ j=0 ∞ λj = eλ j! ∞ j=0 ∞ 2 j j=0 λj−1 jλj =λ = λeλ j! (j − 1)! j=1 ∞ ∞ j λ jλj−1 (j + 1)λj =λ =λ = λ2 eλ + λeλ . j! (j − 1)! j! j=1 j=0 ∞ From this we immediately get E[X] = e−λ j=0 jλj =λ j! 2 . If X is a Poisson random variable with parameter λ. Therefore. I. the 3 engine plane is safer exactly when 1 p< .e. Before solving the problem.5 + p5. j Thus we have that the probability that a 3 engine airplane will run its mission safely is p3. This can be simplified to 2p3 − 5p2 + 4p − 1 < 0.3 + p3. show that (a) E[X] = λ.. 3 2 The corresponding probability for a 5 engine plane is p5.4 + p5. But this quantity is negative exactly when the term 2p − 1 is negative.3 = 5 5 5 4 5 3 p (1 − p)0 + p (1 − p)1 + p (1 − p)2 = p5 + 5p4 (1 − p) + 10p3(1 − p)2 . we can write the inequality as follows: (p − 1)2 (2p − 1) < 0.2 = 3 3 3 2 p (1 − p)0 + p (1 − p)1 = p3 + 3p2 (1 − p). Some guesswork (informed by plotting the graph of the cubic function) gives that 1 and 1/2 are roots of the polynomial.the duration of the mission is given by the binomial probability pn. (b) Var(X) = λ. we need to solve the following inequality for p: p3 + 3p2 (1 − p) > p5 + 5p4 (1 − p) + 10p3 (1 − p)2 .

. 0. determine: (a) what is the probability she will win the match? It will be helpful to introduce some notation. If 5 ≤ j ≤ 9. Thus each elementary outcome of W1 ∩ Nj has probability p5 q j−5 and there are exactly j−1 of them 4 (since the last entry must be 1). (ii) it ends in 1.6.   j−1 4 P (W1 ∩ Nj ) = p5 q j−5 if 5 ≤ j ≤ 9 if j < 5 or j > 9. . We wish to find the probability P (W1 ). for 5 ≤ j ≤ 9.6. Note that a match cannot be decided with fewer than 5 games. . I claim that P (W1 ∩ Nj ) = j − 1 5 j−5 p q . Noting that W1 = (W1 ∩ N5 ) ∪ · · · ∪ (W1 ∩ N9 ). 1. for j = 1. p q + q p 4 4 3 . Notice that a vector of this kind represents an outcome in W1 ∩ Nj .7334 (b) what is the expected number of games in a match? The expected number of matches is 9 9 9 jP (Nj ) = j=5 j=5 j (P (Nj ∩ W1 ) + P (Nj ∩ W2 )) = j=5 j j − 1 5 j−5 j − 1 5 j−5 . then P (W1 ) = P (W1 ∩ N5 ) + · · · + P (W1 ∩ N9 ) 9 0 = j=5 j − 1 5 j−5 p q 4 = p5 (1 + 5q + 15q 2 + 35q 3 + 70q 4 ) = 0. we have P (W1 ∩ Nj ) = 0 if j < 5 or j > 9. . and q = 1 − p. and W2 the event that player 2 wins the match. .and ∞ Var(X) = E[X 2 ] − E[X]2 = e−λ j=0 jλ  j λ − e−λ = λ2 + λ − λ2 = λ. Since P (Nj ) = 0 if j < 5 or j > 9. If player A wins each individual game with probability 0. j! j! j=0 2 j  ∞ j 2 5. 0. aj ). a union of mutually exclusive events. Each elementary outcome of the event W1 ∩ Nj can be represented by a vector of the form (a1 . First observe that W 1 ∩ Nj is the event that player 1 wins and the match lasts exactly j games. Two players play a certain game until one has won a total of five games. 1. For example. By assumption p = 0. 1. 2. 1. Also let Nj . 4 This can be explained as follows. (0. 0. where an entry as is either 0 (player 1 loses) or 1 (player 1 wins). . 1) is an element of W1 ∩ N9 . and (iii) exactly 4 of the first j − 1 entries are equal to 1. if and only if: (i) it has length j. denote the event that a match will be exactly j games long. . and it involves no more than 9 games. Let W1 indicate the event that player 1 wins the match. . Therefore. Let p denote the probability that player 1 wins a single game.

6. Here is one possible way of doing this in Matlab (recall that anything in a line following % is simply a comment): %The main parameters are: p (probability that player 1 wins a game) %and m (number of sample matches) p=0.3538.2). Thus we the condition %T1<=9 is equivalent to player 1 winning the match. %If T1<=9. Similarly. then T1=10. with P(1)=p. m=100000.2)+1. %The outcome of each game is decided by flipping a biased coin %with probability of heads equal to p. Play the coin game a number of times. Thus we call for %m strings of random numbers (0 or 1). By repeating the process a large number of times (say. CS1=cumsum(G. (c) Confirm your result by doing a computer simulation of the situation. For example. obtain the average number of games (coin tosses) in a match. keeping a record of the accumulated number of heads and tails.6. T1 is a number such that 5<=T<=10. you can simulate the outcome of a single game by flipping a biased coin (as in homework 1) with probability of heads equal to 0. If player 1 never made 5 wins. The process stops the first time that the count of heads or tails reaches 5. %For each sample match. then it must have won the match. E[# of Games] = 5(p5 + q 5 ) + 30(p5 q + q 5 p) + 105(p5 q 2 + q 5 p2 )+ 280(p5q 3 + q 5 p3 ) + 630(p5 q 4 + q 5 p4 ) = 7. The frequency of %wins of player 1 is then 4 . (This cannot take more than 9 tosses. %Now consider the following quantity: T1=sum((CS1<5).) Now determine which one (heads or tail) reached 5 first. each string %of length 9. %T1-1 is the number of games in a match before player 1 won a %total of 5 games. G=(rand(m. If the match is decied before step 9 we just ignore the %remaining game outcomes.Therefore. and how many steps it took for that to happen. 1000) count the frequency of the times when heads (the first player) wins.9)<p). %The cumulative sum of each row of G gives the number of wins of %player 1 at each step of the match.

f=sum(T1<=9)/m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %To obtain the mean number of games in a match. E=min(T1.3523 5 . %Therefore. %The average length of a match is now l=sum(E)/m Here are a typical sample values of f (frequency of wins of player 1) and l (average length of a match) taking the number of trials of the simulated match to be m = 100000: f = 0. T2. T2=sum((CS2<5).2)+1. if player 1 wins.2).T2). then T1 is the time when that happened.7322 l = 7. we observe %that. CS2=cumsum(~G. for player 2. %the match ends at the minimum of T1 and T2. if we define the corresponding quantity.

Sign up to vote on this title
UsefulNot useful