Monday, April 30, 2012

ECE302 Spring 2006 HW5 Solutions February 21, 2006 1


ECE302 Spring 2006 HW5 Solutions February 21, 2006 1
Solutions to HW5
Note: Most of these solutions were generated by R. D. Yates and D. J. Goodman, the
authors of our textbook. I have added comments in italics where I thought more detail was
appropriate. I have made corrections where needed. The solution to problem 3.9.2 is my
own.
Problem 3.1.1 • The cumulative distribution function of random variable X is
FX (x) =


0 x < −1,
(x + 1)/2 −1 x < 1,
1 x 1.
(a) What is P[X > 1/2]?
(b) What is P[−1/2 < X 3/4]?
(c) What is P[|X| 1/2]?
(d) What is the value of a such that P[X a] = 0.8?
Problem 3.1.1 Solution
The CDF of X is
FX (x) =


0 x < −1
(x + 1)/2 −1 x < 1
1 x 1
(1)
Each question can be answered by expressing the requested probability in terms of FX(x).
(a)
P [X > 1/2] = 1 − P [X 1/2] = 1 − FX (1/2) = 1 − 3/4 = 1/4 (2)
(b) This is a little trickier than it should be. Being careful, we can write
P [−1/2 X < 3/4] = P [−1/2 < X 3/4] + P [X = −1/2] − P [X = 3/4] (3)
Since the CDF of X is a continuous function, the probability that X takes on any
specific value is zero. This implies P[X = 3/4] = 0 and P[X = −1/2] = 0. (If this is
not clear at this point, it will become clear in Section 3.6.) Thus,
P [−1/2 X < 3/4] = P [−1/2 < X 3/4] = FX (3/4) − FX (−1/2) = 5/8 (4)
(c)
P [|X| 1/2] = P [−1/2 X 1/2] = P [X 1/2] − P [X < −1/2] (5)
Note that P[X 1/2] = FX(1/2) = 3/4. Since the probability that P[X = −1/2] = 0,
P[X < −1/2] = P[X 1/2]. Hence P[X < −1/2] = FX(−1/2) = 1/4. This implies
P [|X| 1/2] = P [X 1/2] − P [X < −1/2] = 3/4 − 1/4 = 1/2 (6)
ECE302 Spring 2006 HW5 Solutions February 21, 2006 2
(d) Since FX(1) = 1, we must have a 1. For a 1, we need to satisfy
P [X a] = FX (a) =
a + 1
2
= 0.8 (7)
Thus a = 0.6.
Problem 3.1.2 • The cumulative distribution function of the continuous random variable V is
FV (v) =


0 v < −5,
c(v + 5)2 −5 v < 7,
1 v 7.
(a) What is c?
(b) What is P[V > 4]?
(c) P[−3 < V 0]?
(d) What is the value of a such that P[V > a] = 2/3?
Problem 3.1.2 Solution
The CDF of V was given to be
FV (v) =


0 v < −5
c(v + 5)2 −5 v < 7
1 v 7
(1)
(a) For V to be a continuous random variable, FV (v) must be a continuous function. This
occurs if we choose c such that FV (v) doesn’t have a discontinuity at v = 7. We meet
this requirement if c(7 + 5)2 = 1. This implies c = 1/144.
(b)
P [V > 4] = 1 − P [V 4] = 1 − FV (4) = 1 − 81/144 = 63/144 = 7/16 (2)
(c)
P [−3 < V 0] = FV (0) − FV (−3) = 25/144 − 4/144 = 21/144 = 7/48 (3)
(d) Since 0 FV (v) 1 and since FV (v) is a nondecreasing function, it must be that
−5 a 7. In this range,
P [V > a] = 1 − FV (a) = 1 − (a + 5)2/144 = 2/3 (4)
The unique solution in the range −5 a 7 is a = 4p3 − 5 = 1.928.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 3
Problem 3.2.1 • The random variable X has probability density function
fX (x) =

cx 0 x 2,
0 otherwise.
Use the PDF to find
(a) the constant c,
(b) P[0 X 1],
(c) P[−1/2 X 1/2],
(d) the CDF FX(x).
Problem 3.2.1 Solution
fX (x) =

cx 0 x 2
0 otherwise
(1)
(a) From the above PDF we can determine the value of c by integrating the PDF and
setting it equal to 1. Z 2
0
cx dx = 2c = 1 (2)
Therefore c = 1/2.
(b) P[0 X 1] =
R 1
0
x
2 dx = 1/4
(c) P[−1/2 X 1/2] =
R 1/2
0
x
2 dx = 1/16
(d) The CDF of X is found by integrating the PDF from 0 to x.
FX (x) =
Z x
0
fX
􀀀
x′

dx′ =


0 x < 0
x2/4 0 x 2
1 x > 2
(3)
Problem 3.2.2 • The cumulative distribution function of random variable X is
FX (x) =


0 x < −1,
(x + 1)/2 −1 x < 1,
1 x 1.
Find the PDF fX(x) of X.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 4
Problem 3.2.2 Solution
From the CDF, we can find the PDF by direct differentiation. The CDF and correponding
PDF are
FX (x) =


0 x < −1
(x + 1)/2 −1 x < 1
1 x 1
fX (x) =

1/2 −1 x < 1
0 otherwise
(1)
Problem 3.3.3 • Random variable X has CDF
FX (x) =


0 x < 0,
x/2 0 x 2,
1 x > 2.
(a) What is E[X]?
(b) What is Var[X]?
Problem 3.3.3 Solution
The CDF of X is
FX (x) =


0 x < 0
x/2 0 x < 2
1 x 2
(1)
(a) To find E[X], we first find the PDF by differentiating the above CDF.
fX (x) =

1/2 0 x 2
0 otherwise
(2)
The expected value is then
E [X] =
Z 2
0
x
2
dx = 1 (3)
(b)
E

X2
=
Z 2
0
x2
2
dx = 8/6 = 4/3 (4)
Var[X] = E

X2
− E [X]2 = 4/3 − 1 = 1/3 (5)
Problem 3.3.4 • The probability density function of random variable Y is
fY (y) =

y/2 0 y < 2,
0 otherwise.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 5
What are E[Y ] and Var[Y ]?
Problem 3.3.4 Solution
We can find the expected value of X by direct integration of the given PDF.
fY (y) =

y/2 0 y 2
0 otherwise
(1)
The expectation is
E [Y ] =
Z

−∞
yfY (y)dy =
Z 2
0
y2
2
dy = 4/3 (2)
To find the variance, we first find the second moment
E

Y 2
=
Z

−∞
y2fY (y)dy =
Z 2
0
y3
2
dy = 2. (3)
The variance is then Var[Y ] = E[Y 2] − E[Y ]2 = 2 − (4/3)2 = 2/9.
Problem 3.4.2 • Y is an exponential random variable with variance Var[Y ] = 25.
(a) What is the PDF of Y ?
(b) What is E[Y 2]?
(c) What is P[Y > 5]?
Problem 3.4.2 Solution
(a) From Appendix A, we observe that an exponential PDF Y with parameter > 0 has
PDF
fY (y) =

e− y y 0
0 otherwise
(1)
In addition, the mean and variance of Y are
E [Y ] =
1

Var[Y ] =
1
2 (2)
Since Var[Y ] = 25, we must have = 1/5.
(b) The expected value of Y is E[Y ] = 1/ = 5, so
E

Y 2
= Var[Y ] + (E [Y ])2 = 50 (3)
(c)
P [Y > 5] =
Z

5
fY (y) dy = −e−y/5


5
= e−1 (4)
ECE302 Spring 2006 HW5 Solutions February 21, 2006 6
Problem 3.4.3 • X is an Erlang (n, ) random variable with parameter = 1/3 and expected value E[X] =
15.
(a) What is the value of the parameter n?
(b) What is the PDF of X?
(c) What is Var[X]?
Problem 3.4.3 Solution
From Appendix A, an Erlang random variable X with parameters > 0 a postive real
number and n a positive integer has PDF
fX (x) =

nxn−1e− x/(n − 1)! x 0
0 otherwise
(1)
In addition, the mean and variance of X are
E [X] =
n

Var[X] =
n
2 (2)
(a) Since = 1/3 and E[X] = n/ = 15, we must have n = 5.
(b) Substituting the parameters n = 5 and = 1/3 into the given PDF, we obtain
fX (x) =

(1/3)5x4e−x/3/24 x 0
0 otherwise
(3)
(c) From above, we know that Var[X] = n/ 2 = 45.
Note: we need not use the definitions in Appendix A to solve these problems. We can
obtain the expressions for the expected value and the variance by applying the definitions.
This will require using integration by parts and induction, but is not otherwise difficult.
Problem 3.5.1 • The peak temperature T, as measured in degrees Fahrenheit, on a July day in New Jersey is
the Gaussian (85, 10) random variable. What is P[T > 100], P[T < 60], and P[70 T 100]?
Problem 3.5.1 Solution
Given that the peak temperature, T, is a Gaussian random variable with mean 85 and
standard deviation 10 we can use the fact that FT (t) = ((t − μT )/ T ) and Table 3.1 on
ECE302 Spring 2006 HW5 Solutions February 21, 2006 7
page 123 to evaluate the following
P [T > 100] = 1 − P [T 100] = 1 − FT (100) = 1 −

100 − 85
10

= 1 − (1.5) = 1 − 0.9332 = 0.0668 (1)
P [T < 60] =

60 − 85
10

= (−2.5)
= 1 − (2.5) = 1 − .9938 = 0.0062 (2)
P [70 T 100] = FT (100) − FT (70)
= (1.5) − (−1.5) = 2 (1.5) − 1 = .8664 (3)
Problem 3.5.3 • X is a Gaussian random variable with E[X] = 0 and P[|X| 10] = 0.1. What is the
standard deviation X?
Problem 3.5.3 Solution
X is a Gaussian random variable with zero mean but unknown variance. We do know,
however, that
P [|X| 10] = 0.1 (1)
We can find the variance Var[X] by expanding the above probability in terms of the (·)
function.
P [−10 X 10] = FX (10) − FX (−10) =

10
X



1 −

10
X

= 2

10
X

− 1
(2)
This implies (10/ X) = 0.55. Using Table 3.1 for the Gaussian CDF, we find that 10/ X
0.125 or X 80.
Problem 3.6.2 • Let X be a random variable with CDF
FX (x) =


0 x < −1,
x/4 + 1/2 −1 x < 1,
1 1 x.
Sketch the CDF and find
(a) P[X < −1] and P[X −1],
(b) P[X < 0] and P[X 0],
(c) P[X > 1] and P[X 1].
ECE302 Spring 2006 HW5 Solutions February 21, 2006 8
Problem 3.6.2 Solution
Here the authors use the notation
FX
􀀀
a−

:= lim
x→a−
FX (a) (1)
FX
􀀀
a+
:= lim
x→a+
FX (a) (2)
where a is any value in the range of the CDF.
[As in] the previous problem we find
(a)
P [X < −1] = FX
􀀀
−1−

= 0 P [X −1] = FX (−1) = 1/4 (3)
Here we notice the discontinuity of value 1/4 at x = −1.
(b)
P [X < 0] = FX
􀀀
0−

= 1/2 P [X 0] = FX (0) = 1/2 (4)
Since there is no discontinuity at x = 0, FX(0−) = FX(0+) = FX(0).
(c)
P [X > 1] = 1 − P [X 1] = 1 − FX (1) = 0 (5)
P [X 1] = 1 − P [X < 1] = 1 − FX
􀀀
1−

= 1 − 3/4 = 1/4 (6)
Again we notice a discontinuity of size 1/4, here occurring at x = 1.
Problem 3.6.3 • For random variable X of Problem 3.6.2, find
(a) fX(x)
(b) E[X]
(c) Var[X]
Problem 3.6.3 Solution
(a) By taking the derivative of the CDF FX(x) given in Problem 3.6.2, we obtain the
PDF
fX (x) =
(x+1)
4 + 1/4 + (x−1)
4 −1 x 1
0 otherwise
(1)
The reason for the factor of 1/4 multiplying the impulses can be seen by graphing
the CDF and determining the magnitude of the jumps in the CDF that occur at ±1.
(You can calculate this without drawing the graph but it can be helpful to visualize the
behavior of the function.)
ECE302 Spring 2006 HW5 Solutions February 21, 2006 9
(b) The first moment of X is
E [X] =
Z

−∞
xfX (x) dx (2)
= x/4|x=−1 + x2/8

1
−1 + x/4|x=1 = −1/4 + 0 + 1/4 = 0. (3)
(c) The second moment of X is
E

X2
=
Z

−∞
x2fX (x) dx (4)
= x2/4

x=−1 + x3/12

1
−1 + x2/4

x=1 = 1/4 + 1/6 + 1/4 = 2/3. (5)
Since E[X] = 0, Var[X] = E[X2] = 2/3.
Problem 3.7.2 • Let X have an exponential ( ) PDF. Find the CDF and PDF of Y = pX. Show that Y
is a Rayleigh random variable (see Appendix A.2). Express the Rayleigh parameter a in
terms of the exponential parameter .
Problem 3.7.2 Solution
Since Y = pX, the fact that X is nonegative and that we asume the square root is always
positive implies FY (y) = 0 for y < 0. In addition, for y 0, we can find the CDF of Y by
writing
FY (y) = P [Y y] = P
hpX y
i
= P

X y2
= FX
􀀀
y2
(1)
For x 0, FX(x) = 1 − e− x. Thus,
FY (y) =

1 − e− y2
y 0
0 otherwise
(2)
By taking the derivative with respect to y, it follows that the PDF of Y is
fY (y) =

2 ye− y2
y 0
0 otherwise
(3)
In comparing this result to the Rayleigh PDF given in Appendix A, we observe that Y is a
Rayleigh (a) random variable with a = p2 .
ECE302 Spring 2006 HW5 Solutions February 21, 2006 10
Problem 3.7.3 • If X has an exponential ( ) PDF, what is the PDF of W = X2?
Problem 3.7.3 Solution
Since X is non-negative, W = X2 is also non-negative. Hence for w < 0, fW(w) = 0. For
w 0,
FW (w) = P [W w] = P

X2 w

(1)
= P [X w] (2)
= 1 − e− √w (3)
Taking the derivative with respect to w yields, for w 0, fW(w) = e− √w/(2pw). The
complete expression for the PDF is
fW (w) =
(
e−
pw
2√w w > 0
0 otherwise
(4)
where we note that we cannot allow w = 0 to be part of the first case when we have pw in
the denominator.
Problem 3.8.1 • X is a uniform random variable with parameters −5 and 5. Given the event B = {|X| 3},
(a) Find the conditional PDF, fX|B(x).
(b) Find the conditional expected value, E[X|B].
(c) What is the conditional variance, Var[X|B]?
Problem 3.8.1 Solution
The PDF of X is
fX (x) =

1/10 −5 x 5
0 otherwise
(1)
(a) The event B has probability
P [B] = P [−3 X 3] =
Z 3
−3
1
10
dx =
3
5
(2)
From Definition 3.15, the conditional PDF of X given B is
fX|B (x) =

fX (x) /P [B] x 2 B
0 otherwise
=

1/6 |x| 3
0 otherwise
(3)
(b) Given B, we see that X has a uniform PDF over [a, b] with a = −3 and b = 3. From
Theorem 3.6, the conditional expected value of X is E[X|B] = (a + b)/2 = 0.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 11
(c) From Theorem 3.6, the conditional variance of X is Var[X|B] = (b − a)2/12 = 3. Of
course we do not have to use Theorem 3.6. We can instead use the definitions and
write
Var[X|B] = E

X2|B

− (E [X|B])2 =
Z 3
−3
x2

1
6

dx − 02 = · · · = 3. (4)
Problem 3.8.2 • Y is an exponential random variable with parameter = 0.2. Given the event A = {Y < 2},
(a) What is the conditional PDF, fY |A(y)?
(b) Find the conditional expected value, E[Y |A].
Problem 3.8.2 Solution
From Definition 3.6, the PDF of Y is
fY (y) =

(1/5)e−y/5 y 0
0 otherwise
(1)
(a) The event A has probability
P [A] = P [Y < 2] =
Z 2
0
(1/5)e−y/5 dy = −e−y/5

2
0
= 1 − e−2/5 (2)
From Definition 3.15, the conditional PDF of Y given A is
fY |A (y) =

fY (y) /P [A] x 2 A
0 otherwise
(3)
=

(1/5)e−y/5/(1 − e−2/5) 0 y < 2
0 otherwise
(4)
(b) The conditional expected value of Y given A is
E [Y |A] =
Z

−∞
yfY |A (y) dy =
1/5
1 − e−2/5
Z 2
0
ye−y/5 dy (5)
Using the integration by parts formula
R
u dv = uv −
R
v du with u = y and dv =
e−y/5 dy yields
E [Y |A] =
1/5
1 − e−2/5

−5ye−y/5

2
0
+
Z 2
0
5e−y/5 dy

(6)
=
1/5
1 − e−2/5

−10e−2/5 − 25e−y/5

2
0

(7)
=
5 − 7e−2/5
1 − e−2/5
(8)
ECE302 Spring 2006 HW5 Solutions February 21, 2006 12
Problem 3.9.2 • For the modem receiver voltage X with PDF given in Example 3.32, use Matlab to plot
the PDF and CDF of random variable X. Write a Matlab function x=modemrv(m) that
produces m samples of the modem voltage X.
Problem 3.9.2 Solution
I generated the PDF and CDF using the Matlab commands normpdf and normcdf. I
generated a histogram of the random samples from the PDF generated by my Matlab
function modemrv. The code for generating the required plots is given below.
%
% Yates and Goodman 3.9.2 2/14/06 --sk
%
x1 = (normpdf([-30:.01:30],-5,2)+normpdf([-30:0.01:30],5,2))/2;
figure(1)
plot([-30:.01:30],x1)
title(’PDF for Example 3.32, p. 139’);
xlabel(’x’);
ylabel(’f_X(x)’);
print -deps pdf_3_9_2
figure(2)
x2 = (normcdf([-30:.01:30],-5,2)+normcdf([-30:0.01:30],5,2))/2;
plot([-30:.01:30],x2)
title(’CDF for Example 3.32, p. 139’);
xlabel(’x’);
ylabel(’F_X(x)’);
print -deps cdf_3_9_2
% some checks:
% height of local minimum of PDF at x = 0
disp(’height of local minimum of PDF at x = 0’)
fx0 = 2*exp(-25/8)/sqrt(32*pi)
% height of local maximum of PDF at x = +/- 5
disp(’height of local maximum of PDF at x = +/- 5’)
fx5 = (exp(-100/8)+1)/sqrt(32*pi)
x = modemrv(10000);
figure(3)
hist(x,100);
title(’Histogram of samples from the PDF of Example 3.32’)
xlabel(’x (Volts)’)
print -deps hist_3_9_2
ECE302 Spring 2006 HW5 Solutions February 21, 2006 13
Here is the plot of the PDF.
−30 −20 −10 0 10 20 30
0
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
PDF for Example 3.32, p. 139
x
fX(x)
Note that in order to verify that I was using the function normpdf correctly I plugged in
the values of 0 and 5 to see what the local maxima and minima should be. The results were
>> p3_9_2
height of local minimum of PDF at x = 0
fx0 =
0.0088
height of local maximum of PDF at x = +/- 5
fx5 =
0.0997
which match the values seen in the plot of the PDF.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 14
Here is the plot of the CDF.
−30 −20 −10 0 10 20 30
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
CDF for Example 3.32, p. 139
x
FX(x)
Without doing any calculations, we know that the CDF should have value FX(0) = 1/2 and
that FX(x) should approach 1 as x becomes large. Our plot meets both of these criteria.
Finally, here is the function modemrv,
function x=modemrv(m);
%Usage: x=modemrv(m)
%generates m samples of X, the modem
%receiver voltage in Exampe 3.32.
%X=+-5 + N where N is Gaussian (0,2)
sb=[-5; 5]; pb=[0.5; 0.5];
b=finiterv(sb,pb,m);
noise=gaussrv(0,2,m);
x=b+noise;
and the histogram of the data generated by the function modemrv. The shape of the his-
togram matches the shape of the PDF as it should.
ECE302 Spring 2006 HW5 Solutions February 21, 2006 15
−15 −10 −5 0 5 10 15
0
50
100
150
200
250
300
Histogram of samples from the PDF of Example 3.32
x (Volts)

No comments:

Post a Comment