# 程序代写案例-STAB52H3

University of Toronto Scarborough
Department of Computer & Mathematical Sciences
STAB52H3 Introduction to Probability
Term Test 2
November 16,
2020
Duration: 60 minutes
Examination aids allowed: Open notes-books
Instructions:
• Answer all questions directly on the examination paper; use the last pages if you need
more space, and provide clear pointers to your work.
• Show your intermediate work, and write clearly and legibly.
Question: 1 2 3 4 5 6 7 8 9 10 Total
Points: 20 20 20 20 20 20 20 20 20 20 200
Score:
1. (20 points) Consider two random variables X and Y that are binary valued, i.e., the set
of possible values is {0, 1}. Let the marginal distribution of X be
P(X = 0) = p, P(X = 1) = 1− p.
It is given that the conditional distribution of Y given X is
P(Y = 0|X = 0) = 3
4
, P(Y = 1|X = 0) = 1
4
,
P(Y = 1|X = 1) = 1
2
, P(Y = 0|X = 1) = 1
2
.
(a) (10 points) Find the value of p ∈ [0, 1] such that the marginal distributions of X
and Y are the same.
(b) (10 points) For the value of p given in (a), find the conditional distribution of X
given Y .
Solution: (a) By the law of total probability, we have
P(Y = 0) = P(Y = 0|X = 0)P(X = 0) + P(Y = 0|X = 0)P(X = 0)
=
3
4
p+
1
2
(1− p).
We require that X and Y have the same marginal distribution. So
P(Y = 0) =
3
4
p+
1
2
(1− p) = p = P(X = 0).
Solving gives p = 2
3
. Since X and Y are binary valued, if p = 2
3
then they have the
same marginal distributions.
(b) We have
P(X = 0|Y = 0) = P(Y = 0|X = 0)P(X = 0)
P(Y = 0)
= P(Y = 0|X = 0) = 3
4
,
P(X = 1|Y = 0) = 1− P(X = 0|Y = 0) = 1
4
,
P(X = 1|Y = 1) = P(Y = 1|X = 1)P(X = 1)
P(Y = 1)
= P(Y = 1|X = 1) = 1
2
,
P(X = 0|Y = 1) = 1− P(X = 1|Y = 1) = 1
2
.
(Note that the transition probabilities from X to Y are the same as those from Y to
X.)
Page 2 of 10 (contd...)
2. (20 points) Consider two random variables X and Y that are binary valued, i.e., the set
of possible values is {0, 1}. Let the marginal distribution of X be
P(X = 0) = p, P(X = 1) = 1− p.
It is given that the conditional distribution of Y given X is
P(Y = 0|X = 0) = 2
3
, P(Y = 1|X = 0) = 1
3
,
P(Y = 1|X = 1) = 1
2
, P(Y = 0|X = 1) = 1
2
.
(a) (10 points) Find the value of p ∈ [0, 1] such that the marginal distributions of X
and Y are the same.
(b) (10 points) For the value of p given in (a), find the conditional distribution of X
given Y .
Solution: (a) By the law of total probability, we have
P(Y = 0) = P(Y = 0|X = 0)P(X = 0) + P(Y = 0|X = 0)P(X = 0)
=
2
3
p+
1
2
(1− p).
We require that X and Y have the same marginal distribution. So
P(Y = 0) =
2
3
p+
1
2
(1− p) = p = P(X = 0).
Solving gives p = 3
5
. Since X and Y are binary valued, if p = 3
5
then they have the
same marginal distributions.
(b) We have
P(X = 0|Y = 0) = P(Y = 0|X = 0)P(X = 0)
P(X = 0)
= P(Y = 0|X = 0) = 2
3
,
P(X = 1|Y = 0) = 1− P(X = 0|Y = 0) = 1
3
,
P(X = 1|Y = 1) = P(Y = 1|X = 1)P(X = 1)
P(Y = 1)
= P(Y = 1|X = 1) = 1
2
,
P(X = 0|Y = 1) = 1− P(X = 1|Y = 1) = 1
2
.
(Note that the transition probabilities from X to Y are the same as those from Y to
X.)
Page 3 of 10 (contd...)
3. (20 points) Let (X, Y ) be a random vector whose distribution is given by
P((X, Y ) = (0, 0)) = P((X, Y ) = (0, 1)) = P((X, Y ) = (1, 1)) =
1
3
.
(a) (4 points) Find the marginal distributions of X and Y , and give their name and
parameters.
(b) (16 points) Find the correlation coefficient Cor(X, Y ) = ρXY between X and Y .
Solution: (a) We have X ∼ Bernoulli(1
3
) and Y ∼ Bernoulli(2
3
).
(b) The covariance is given by
Cov(X, Y ) = E[XY ]− E[X]E[Y ].
We have
E[XY ] =
1
3
0 · 0 + 1
3
0 · 1 + 1
3
1 · 1 = 1
3
,
Recall that if Z ∼ Bernoulli(p) then E[Z] = p and Var(Z) = p(1− p). So
E[X] =
1
3
, E[Y ] =
2
3
,
and we have
Cov(X, Y ) =
1
3
− 1
3
2
3
=
1
9
.
Also
Var(X) =
1
2
2
3
=
2
9
, Var(Y ) =
2
3
1
3
=
2
9
.
Thus
Cor(X, Y ) =
Cov(X, Y )√
Var(X)

Var(Y )
=
1
2
.
4. (20 points) Let (X, Y ) be a random vector whose distribution is given by
P((X, Y ) = (0, 1)) = P((X, Y ) = (1, 0)) = P((X, Y ) = (1, 1)) =
1
3
.
(a) (4 points) Find the marginal distributions of X and Y , and give their name and
parameters.
(b) (16 points) Find Var(X + Y ).
Page 4 of 10 (contd...)
Solution: (a) We have X ∼ Bernoulli(2
3
) and Y ∼ Bernoulli(2
3
).
(b) We have
Var(X + Y ) = Var(X) + 2Cov(X, Y ) + Var(Y ).
The covariance is given by
Cov(X, Y ) = E[XY ]− E[X]E[Y ].
We have
E[XY ] =
1
3
0 · 1 + 1
3
1 · 0 + 1
3
1 · 1 = 1
3
,
Recall that if Z ∼ Bernoulli(p) then E[Z] = p and Var(Z) = p(1− p). So
E[X] =
2
3
, E[Y ] =
2
3
,
and we have
Cov(X, Y ) =
1
3
− 2
3
2
3
=
−1
9
.
Also
Var(X) = Var(Y ) =
2
3
1
3
=
2
9
.
Thus
Var(X + Y ) =
2
9
− 21
9
+
2
9
=
2
9
.
5. (20 points) Consider two independent Exponential RVs: X ∼ Exponential(1) and Y ∼
Exponential(2). Find the probability P(X > Y ).
Solution:
The joint PDF is fX,Y (x, y) = fX(x)fY (y) = e
−x2e−2y, ∀x, y > 0. The probability is
given by the integral of the joint PDF over the region R = {(x, y) ∈ R : x > y} =
Page 5 of 10 (contd...)
{(x, y) ∈ R : 0 < x, 0 < y < x}
P(X > Y ) =
∫∫
R
fX,Y (x, y)dxdy
=
∫ ∞
x=0
[∫ x
y=0
2e−xe−2ydy
]
dx
=
∫ ∞
x=0
e−x
[∫ x
y=0
2e−2ydy
]
dx
=
∫ ∞
x=0
e−x
[−e−2y]x
0
dx
=
∫ ∞
x=0
e−x
[
1− e−2x] dx
=
∫ ∞
x=0
e−xdx−
∫ ∞
x=0
e−3xdx
= 1− [−1
3
e−3x
]∞
x=0
= 1− [0 + 1
3
] = 2
3
.
6. (20 points) Consider two independent and identically distributed Exponential RVsX, Y ∼
Exponential(1). Find the probability P(X > 2Y ).
Solution:
The joint PDF is fX,Y (x, y) = fX(x)fY (y) = e
−xe−y, ∀x, y > 0. The probability is
given by the integral of the joint PDF over the region R = {(x, y) ∈ R : x > 2y} =
Page 6 of 10 (contd...)
{(x, y) ∈ R : 0 < x, 0 < y < x/2}
P(X > 2Y ) =
∫∫
R
fX,Y (x, y)dxdy
=
∫ ∞
x=0
[∫ x
y=0
e−xe−ydy
]
dx
=
∫ ∞
x=0
e−x
[∫ x/2
y=0
e−ydy
]
dx
=
∫ ∞
x=0
e−x
[−e−y]x/2
0
dx
=
∫ ∞
x=0
e−x
[
1− e−x/2] dx
=
∫ ∞
x=0
e−xdx−
∫ ∞
x=0
e−3x/2dx
= 1− [−2
3
e−3x/2
]∞
x=0
= 1− [0 + 2
3
] = 1
3
.
7. Let the RV X follow Uniform(0, 1) distribution, and define the new RV Y = 1
1+X
.
(a) (3 points) What is the range of possible values of Y ?
(b) (10 points) Find the CDF of Y .
(c) (7 points) Find the PDF of Y .
Solution:
(a) Since X ranges in [0, 1], then Y = 1
1+X
will take values between 1
1+0
= 1 and
1
1+1
= 1
2
, i.e. Y ∈ [1
2
, 1]
(b) The CDF of the Uniform(0,1) is the identity function, FX(x) = x, ∀x ∈ (0, 1).
We have
FY (y) = P(Y ≤ y) = P
(
1
1 +X
≤ y
)
= P
(
1 +X ≥ 1
y
)
= P
(
X ≥ 1
y
− 1
)
= 1− P
(
1 +X <
1
y
)
= 1− FX
(
1
y
− 1
)
= 1−
(
1
y
− 1
)
= 2− 1
y
, ∀y ∈ [1
2
, 1]
Page 7 of 10 (contd...)
(c) There are two ways to find the PDF of Y :
a) Differentiate the CDF of Y form the previous part:
fY (y) =
d
dy
FY (y) =
d
dy
(2− y−1) = y−2 = 1
y2
, ∀y ∈ [1
2
, 1]
b) Use the PDF method:
h(x) = (1 + x)−1 ⇒
{
h−1(y) = y−1 − 1
h′(x) = −(1 + x)−2
fY (y) =
fX(h
−1(y))
|h′(h−1(y))| =
1
| − (1 + h−1(y))−2|
=
1
(1 + y−1 − 1)−2 =
1
y2
, ∀y ∈ [1
2
, 1]
8. Let the RV X follow Uniform(0, 1) distribution, and define the new RV Y = 1−X2.
(a) (3 points) What is the range of possible values of Y ?
(b) (10 points) Find the CDF of Y .
(c) (7 points) Find the PDF of Y .
Solution:
(a) Since X ranges in [0, 1], then Y = 1 −X2 will take values between 1 − 02 = 1
and 1− 12 = 0, i.e. Y ∈ [0, 1]
(b) The CDF of the Uniform(0,1) is the identity function, FX(x) = x, ∀x ∈ (0, 1).
We have
FY (y) = P(Y ≤ y) = P
(
1−X2 ≤ y)
= P
(
X2 ≥ 1− y) = P(X ≤√1− y)
= 1− P
(
X <

1− y
)
= 1− FX
(√
1− y
)
= 1−

1− y, ∀y ∈ [0, 1]
(c) There are two ways to find the PDF of Y :
a) Differentiate the CDF of Y form the previous part:
fY (y) =
d
dy
FY (y) =
d
dy
(
1−

1− y
)
=
d
dy
(
1− (1− y)12
)
=
1
2
(1− y)−12 = 1
2

1− y , ∀y ∈ [0, 1]
Page 8 of 10 (contd...)
b) Use the PDF method:
h(x) = 1− x2 ⇒
{
h−1(y) =

1− y
h′(x) = −2x
fY (y) =
fX(h
−1(y))
|h′(h−1(y))| =
1
| − 2(√1− y)|
=
1
2(

1− y) , ∀y ∈ [0, 1]
9. Consider two RVs X, Y where X has marginal PDF fX(x) =
{
x/2, x ∈ (0, 2)
0, otherwise
and
Y has conditional PDF fY |X(y|x) =
{
1/x, y ∈ (0, x)
0, otherwise
(i.e. Y given X is uniformly
distributed in (0, X).)
(a) (10 points) Find the marginal PDF of Y ; are X and Y independent? (justify your
(b) (10 points) Find the conditional PDF of X given Y , and identify its distribution
(i.e. give its name and parameters).
Solution:
(a) The joint PDF of X, Y is given by
fX,Y (x, y) = fX(x)fY |X(y|x) =
{
x
2x
= 1
2
, 0 < y < x < 2
0, otherwise
The marginal PDF of Y is found by integrating out X from the joint PDF
fY (y) =
∫ ∞
x=−∞
fX,Y (x, y)dx =
{∫ 2
x=y
1
2
dx = 2−y
2
, y ∈ (0, 2)
0, otherwise
The RVs are NOT independent, since the conditional and marginal PDFs of Y
are different (moreover, the conditional range of Y depends on X).
(b) The conditional PDF of X given Y is
fX|Y (x|y) = fX,Y (x, y)
fY (y)
=
{
1/2
(2−y)/2 =
1
2−y , x ∈ (y, 2)
0, otherwise
Note that the conditional PDF of X does not depend on X (is flat), and is
actually Uniform(y, 2).
Page 9 of 10 (contd...)
10. Consider two RVs X, Y where X has marginal PDF fX(x) =
{
2x, x ∈ (0, 1)
0, otherwise
and Y has
conditional PDF fY |X(y|x) =
{
1/x, y ∈ (0, x)
0, otherwise
(i.e. Y given X is uniformly distributed
in (0, X).)
(a) (10 points) Find the marginal PDF of Y ; are X and Y independent? (justify your
(b) (10 points) Find the value of the conditional probability P(X > 3
4
|Y = 1
2
).
Solution:
(a) The joint PDF of X, Y is given by
fX,Y (x, y) = fX(x)fY |X(y|x) =
{
2x/x = 2, 0 < y < x < 1
0, otherwise
The marginal PDF of Y is found by integrating out X from the joint PDF
fY (y) =
∫ ∞
x=−∞
fX,Y (x, y)dx =
{∫ 1
x=y
2dx = 2(1− y), y ∈ (0, 1)
0, otherwise
The RVs are NOT independent, since the conditional and marginal PDFs of Y
are different (moreover, the conditional range of Y depends on X).
(b) Note that the joint distribution is Uniform over the triangle 0 < y < x < 1. If
you condition on Y = 1/2, then X will range uniformly over (1/2, 1); hence, the
conditional probability of X > 3/4 is P (X > 3
4
|Y = 1
2
) = 1/2. You can verify
this more formally using the conditional PDF of X given Y
fX|Y (x|y) = fX,Y (x, y)
fY (y)
=
{
2
2(1−y) =
1
1−y , x ∈ (y, 1)
0, otherwise
Note that the conditional PDF of X does not depend on X (is flat), and is
actually Uniform(y, 1). For Y = 1/2, we have fX|Y (x|1/2) = 11−1/2 = 2,∀x ∈
(1/2, 1).
P(X > 3
4
|Y = 1
2
) =
∫ 1
3/4
fX|Y (x|1/2)dx
=
∫ 1
3/4
2dx = 2(1− 3/4) = 1/2
Page 10 of 10 Total marks: 200  Email:51zuoyejun

@gmail.com