EE132B-HW Set #2 - Sol.
UCLA 2013 Fall
Prof. Izhak Rubin
Problem 1 For the Gaussian distribution with mean µ and variance σ 2 , find the moment generating function. Using the moment generating function, calculate the mean and the variance. (Hint: The probability density function for a Gaussian random variable X with mean µ and variance σ 2 is given by 1 (x − µ)2 √ exp − fX (x) = . 2σ 2 2πσ 2 !
Ans: By using the laplace transform, we obtain h
ΦX (s) = E e−sX
i
2 1 1 e− 2σ2 (x−µ) dx −∞ 2πσ 2 Z ∞ 1 2 2 2 1 √ = e− 2σ2 [x −2(µ−σ s)x+µ ] dx 2 −∞ 2πσ h i Z ∞ 2 − 12 (x−(µ−σ2 s)) +2(µσ2 s)−σ4 s2 1 2σ √ dx = e −∞ 2πσ 2 Z ∞ 2 1 2 1 − 12 (2µs−σ2 s2 ) √ =e e− 2σ2 (x−(µ−σ s)) dx −∞ 2πσ 2 1 2 2 = e− 2 (2µs−σ s ) .
=
Z
∞
e−sx √
We can obtain the first and second moment of X, which is given by d 1 ΦX (s) = − lim − 2µ − 2σ 2 s ΦX (s) = µ. s→0 ds s→0 2 2 d E[X 2 ] = lim 2 ΦX (s) s→0 d s " # 2 1 2 2 = lim σ ΦX (s) + 2µ − 2σ s ΦX (s) s→0 2 = µ2 + σ 2 .
E[X] = − lim
Thus, the variance is given as V ar[X] = E[X 2 ] − E[X]2 = σ 2 .
Problem 2 Consider the following probability density function: fX (x) =
λe−λ|x| , ∀x ∈ (−∞, ∞), 2
where λ > 0. 1
(1)
EE132B-HW Set #2 - Sol.
UCLA 2013 Fall
Prof. Izhak Rubin
(a) Calculate the mean directly. (b) Calculate the variance directly. (c) Find the moment generating function. (d) Find the mean and the variance from the moment generating function. Ans: ∞ 0 (a) E [X] = −∞ x f (x) dx = −∞ x λ eλx dx + R ∞ λ −λx R ∞ λ −λx2 = − 0 x 2 e dx + 0 x 2 e dx = 0
R
R
(b) V ar [X] = E [X 2 ] R ∞ 2 λ −λ|x| dx = −∞ x e R ∞ 22λ −λx = 2 0 x 2 e dx = h
R∞ 0
x λ2 e−λx dx
2 λ2
i
(c) ΦX (s) = E e−sX R ∞ −sx λ −λ|x| = −∞ e 2e dx R R 0 λ (λ−s)x = −∞ e dx + 0∞ λ2 e−(λ+s)x dx 2 1 1 = λ2 λ−s + λ+s h
i
1 1 + λ+s λ−s s→0 h i d2 λ 1 1 E [X 2 ] = lim ds + 2 2 λ−s λ+s s→0 V ar [X] = λ22
d λ (4) E [X] = − lim ds 2
=0 =
2 λ2
Problem 3 A coin is flipped until heads occur twice. Define two random variables X and Y to be the trial numbers at which the first and the second heads are observed. Assume that at any trial, the probability that a head occurs is p ∈ (0, 1). (a) Show that the joint probability is given by P (X = m, Y = n) =
(
p2 q n−2 , ∀m = 1, 2, . . . ; ∀n = 2, 3, . . . , 0 , otherwise.
(2)
(b) Calculate the marginal probability mass function for X and Y . (c) Calculate the conditional probability that X = m, given Y = n (i.e., P (X = m | Y = n)). Ans:
2
EE132B-HW Set #2 - Sol.
UCLA 2013 Fall
Prof. Izhak Rubin
(a) Let q = 1 − p, then we obtain P (X = m, Y = n) = P (Y = n | X = m)P (X = m) = P (Y − X = n − m | X = m). We set Z = Y − X, we obtain P (X = m, Y = n) = P (Z = n − m | X = m) = (1 − q)q n−m−1 (1 − q)q m−1 = (1 − q)2 q n−2 . (b) The marginal probability of X is given by P (X = m) =
∞ X
(1 − q)2 q n−2 = (1 − q)2
n=m+1
q m−1 = (1 − q)q m−1 . (1 − q)
The marginal probability of Y is given as P (Y = n) =
n−1 X
m=0
(1 − q)2 q n−2 = (n − 1)(1 − q)2 q n−2 .
(c) The conditional probability that X = m given Y = n, which is given by P (X = m | Y = n) =
P (X = m, Y = n) 1 = , ∀m = 1, 2, . . . , n − 1; ∀n = 2, 3, . . . . P (Y = n) n−1
Otherwise, P (X = m | Y = n) = 0.
Problem 4 Two DTEs are communicating via modems and RS-232C interfaces over a half duplex link. Data transmission is one directional with each message of length M. After a message is transmitted, the sender waits for a CTS message of length na before sending another message. Assume error-free operation and the following parameter values: • R (line bit rate) = 9600 bps • M (message length) = 1000 bits (all data bits) • nh (overhead in each message packet) = 24 bits • na (acknowledgement length) = 24 bits • tp (propagation time in one direction) = 1 msec 3
EE132B-HW Set #2 - Sol.
UCLA 2013 Fall
Prof. Izhak Rubin
Minimum transition time between states (1,3) and (1,1) (CTS delay) is equal to 10 msec at message transmitting end, and 20 msec at message receiving end (CTS transmitting end). All other delays during message transmission and reception are assumed to be negligible. For the stated conditions, determine the effective data rate in bps. Ans:
H
Data message
ACK
tp
Data message
Data message t
CTS delay in TX
tp
H
H
ACK
H
CTS delay in RX
Data message
tp
t
Figure 1: The waveforms seen by transmitter and receiver of the data message The Figure 1 illustrates waveforms seen by transmitter and receiver of the data message. As the figure indicates, the receiver completes reception of the data message h (plus overhead) at a time equal to tp plus the time M +n (which requires to transmit R the data message) and is ready to transmit after a delay equal to the CTS delay at the receiver. Reception of the CTS at the transmitter is then complete at time tp plus nRa after the receiver begins transmission. After another delay, equal to the CTS delay at the transmitter, the transmitter can begin to send the next message. Thus, the time required per data message of M bits is 24 + 1000 + 24 + 0.001 × 2 + 0.020 + 0.010 = 0.14117 (seconds) 9600
4