Bilkent University
Spring 2020-21
Math 255 Probability and Statistics
Midterm 2, April 12, 2021
1. [10 pts] Let (X, Y ) be a pair of mixed random variables such that X is discrete with
(
1/2, x = 1;
pX (x) =
1/2, x = 2,
and Y is continuous with (
xe−xy , y ≥ 0;
fY |X (y|x) =
0, y < 0.
Compute the following probabilities. Answers must be numeric in simplest possible form. Each part
is 5 pts.
(a) P {Y > ln 2} | {X = 1 )
(b) pX|Y (1 | ln 2)
(Note that ln 2 = 0.693 is the natural logarithm of 2. Also note that eln 2 = 2.)
Solution.
(a) We use the conditional PDF fY |X (y|1) = e−y for this part.
Z ∞
∞
P {Y > ln 2} | {X = 1 ) = e−y dy = −e−y ln 2 = −0 + e− ln 2 = 1/2.
ln 2
(b) Use the Bayes’ rule for this part.
pX (1)fY |X (ln 2 | 1) pX (1)fY |X (ln 2 | 1)
pX|Y (1 | ln 2) = P =
x pX (x)fY |X (ln 2 | x) pX (1)fY |X (ln 2 | 1) + pX (2)fY |X (ln 2 | 2)
1 − ln 2 1
2e e− ln 2 2
= 1 − ln 2 = = = 1/2.
2e + 12 2e−2 ln 2 e− ln 2+ 2e−2 ln 2 1
2 + 2 14
2. [10 pts] Let (X, Y ) be a pair of continuous random variables with a joint PDF
(
1
, 0 < x < y < 1;
fX,Y (x, y) = y
0, otherwise.
Compute the following. Answers must be numeric in simplest possible form. Each part is 5 pts. (The
two parts can be solved independently.)
(a) Cov(X, Y )
(b) E[Y | {X = 1/2}]
(In case you need, ln 2 = 0.693.)
Solution.
(a) We will compute the covariance using the formula Cov(X, Y ) = E[XY ]−E[X] E[Y ]. First compute
the
R ∞ expectations. For E[X], one approach is to compute fX (x) first, and use the formula E[X] =
−∞
x fX (x) dx. Instead, we view X as a function g(X, Y ) = X and use the formula
Z ∞Z ∞
E[X] = x fX,Y (x, y) dx dy.
−∞ −∞
With the specific density here, we have
Z 1Z y Z 1 2 y 1 1
y2
Z
1 1 x y 1
E[X] = x dx dy = dy = dy = = .
0 0 y 0 y 2 0 0 2 4 0 4
For E[Y ] and E[XY ], we can proceed similarly.
Z ∞ Z ∞ Z 1 Z y Z 1Z y
1
E[Y ] = y fX,Y (x, y) dx dy = y dx dy = dx dy
−∞ −∞ 0 0 y 0 0
Z 1 2 1
y 1
= y dy = = .
0 2 0 2
Z ∞ Z ∞ Z 1 Z y Z 1 Z y
1
E[XY ] = x y fX,Y (x, y) dx dy = x y dx dy = xdx dy
−∞ −∞ 0 0 y 0 0
Z 1 2 y 1 1
y2 y3
Z
x 1
= dy = dy = = .
0 2 0 0 2 6 0 6
Thus, we obtain
1 1 1 1
Cov(X, Y ) = E[XY ] − E[X] E[Y ] = − · = .
6 4 2 24
(b) To compute E[Y | {X = 1/2}], we first need to obtain the conditional PDF fY |X (y|1/2). By Bayes’
rule,
fY (y)fX|Y (1/2|y) fY (y)fX|Y (1/2|y)
fY |X (y|1/2) = = R∞ .
fX (1/2) f (y)fX|Y (1/2|y) dy
−∞ Y
For the specific case here, we have
Z ∞ Z 1 1
1 1
fY (y)fX|Y (1/2|y) dy = dy = ln(y) = − ln( ) = ln 2 = 0.693.
−∞ 1
2
y 1 2
2
Thus, we obtain
(
1 1
y ln 2 , 2 < y < 1;
fY |X (y|1/2) =
0, otherwise.
The rest is straightforward.
Z ∞ Z 1
1 1
E[Y |X = 1/2] = y fY |X (y|1/2) dy = y· dy = = 0.721
−∞ 1/2 y ln 2 2 ln 2
3. [5 pts] Let (X, Y ) be a pair of independent and identically distributed (i.i.d.) random variables with
(
1/2k , k = 1, 2, 3;
pX (k) = pY (k) =
1/8, k = 4,
and let Z = X + Y . Compute and list in a table the PMF pZ (z) at each z where pZ (z) > 0. Do not
forget to check that the PMF pZ you computed is a valid PMF.
Solution.
P4
In general, we have the convolution formula pZ (z) = x=1 pX (x)pY (z−x) for each z ∈ {2, 3, 4, 5, 6, 7, 8}.
Specifically, we have
1 1 1 16
pZ (2) = pX (1)pY (1) = · = =
2 2 4 64
1 1 1 1 1 16
pZ (3) = pX (1)pY (2) + pX (2)pY (1) = · + · = =
2 4 4 2 4 64
1 1 1 1 1 1 3 12
pZ (4) = pX (1)pY (3) + pX (2)pY (2) + pX (3)pY (1) = · + · + · = =
2 8 4 4 8 2 16 64
1 1 1 1 1 1 1 1 3 12
pZ (5) = pX (1)pY (4) + pX (2)pY (3) + pX (3)pY (2) + pX (4)pX (1) = · + · + · + · = =
2 8 4 8 8 4 8 2 16 64
1 1 1 1 1 1 5
pZ (6) = pX (2)pY (4) + pX (3)pY (3) + pX (4)pY (2) = · + · + · =
4 8 8 8 8 4 64
1 1 1 1 2
pZ (7) = pX (3)pY (4) + pX (4)pY (3) = · + · =
8 8 8 8 64
1 1 1
pZ (8) = pX (4)pY (4) = · =
8 8 64
z pZ (z)
2 16/64
3 16/64
4 12/64
5 12/64
6 5/64
7 2/64
8 1/64
sum 64/64
4. [5 pts] Let (X, Y ) be a pair of random variables with a uniform distribution inside the triangle with
corners (0, 0), (0, 1), and (1, 0) in the x − y plane, that is,
(
2, x ≥ 0, y ≥ 0, x + y ≤ 1;
fX,Y (x, y) =
0, otherwise,
and let Z = X + Y . Compute the CDF FZ (z) and the PDF fZ (x) for all z. (Hint: Draw a picture of
the PDF fX,Y together with the line x + y = z.)
Solution.
First note that the PDF fX,Y (x, y) is non-zero
only over the triangular region shown in the figure
bounded by the lines x ≥ 0, y ≥ 0, and x + y ≤ 1.
We also see from the figure that the probability
P(Z ≤ z) equals 2 (the density) times the area of
the triangle bounded by the lines x ≥ 0, y ≥ 0,
and x + y ≤ min(1, z). This is used to calculate
the CDF FZ (z) as follows.
FZ (z) = P(Z ≤ z) = P(X + Y ≤ z)
1, z > 1;
= z 2 , 0 ≤ z ≤ 1;
0, z < 0.
Note that for 0 ≤ z ≤ 1, FZ (z) can also be computed by integration.
Z z Z z−y Z z z
FZ (z) = P (Z ≤ z) = P (X + Y ≤ z) = 2 dx dy = 2(z − y) dy = −(z − y)2 = z2.
0 0 0 0
Differentiating the CDF FZ (z), we get the PDF
(
dFZ (z) 2z, 0 ≤ z ≤ 1;
fZ (z) = =
dz 0, otherwise.