Nothing Special   »   [go: up one dir, main page]

Academia.eduAcademia.edu

Probability and Stochastic Processes A Friendly Introduction for Electrical and Computer Engineers Third Edition International Students' Version QUIZ SOLUTIONS

Probability and Stochastic Processes A Friendly Introduction for Electrical and Computer Engineers Third Edition International Students’ Version QUIZ SOLUTIONS Roy D. Yates, David J. Goodman, David Famolari April 30, 2014 1 Comments on the Quiz Solutions • Matlab functions used in the text or in these quiz solutions can be found in the archive matcode3e.zip. This archive is available for download from the John Wiley companion website. Two other documents of interest are also available for download: – The Student Solutions Manual studentsolns3i.pdf. – A manual probmatlab3e.pdf describing the .m functions in matcode3e.zip • This manual uses a page size matched to the screen of an iPad tablet. If you do print on paper and you have good eyesight, you may wish to print two pages per sheet in landscape mode. On the other hand, a “Fit to Paper” printing option will create “Large Print” output. • Send error reports, suggestions, or comments to ryates@winlab.rutgers.edu. 2 Quiz 1.1 Solution A1 B1 A2 B2 A3 B3 = {vvv, vvd, dvv, dvd} = {vdv, vdd, ddv, ddd} = {vvv, ddd} = {vdv, dvd} = {vvv, vvd, vdv, dvv, vdd, dvd, ddv} = {ddd, ddv, dvd, vdd} Recall that Ai and Bi are collectively exhaustive if Ai ∪ Bi = S. Also, Ai and Bi are mutually exclusive if Ai ∩ Bi = φ. Since we have written down each pair Ai and Bi above, we can simply check for these properties. The pair A1 and B1 are mutually exclusive and collectively exhaustive. The pair A2 and B2 are mutually exclusive but not collectively exhaustive. The pair A3 and B3 are not mutually exclusive since dvd belongs to A3 and B3 . However, A3 and B3 are collectively exhaustive. Quiz 1.2 Solution There are exactly 50 equally likely outcomes: s51 through s100 . Each of these outcomes has probability 1/50. It follows that (a) P[{s100 }] = 1/50 = 0.02. (b) P[A] = P[{s90 , s91 , . . . , s100 }] = 11/50 = 0.22. (c) P[F ] = P[{s51 , . . . , s59 }] = 9/50 = 0.18. (d) P[T < 90] = P[{s51 , . . . , s89 }] = 39/50. = 0.78. (e) P[C or better] = P[{s70 , . . . , s100 }] = 31 × 0.02 = 0.62. (f) P[student passes] = P[{s60 , . . . , s100 }] = 41 × 0.02 = 0.82. 3 Quiz 1.3 Solution (a) The probability of exactly two voice packets is P [NV = 2] = P [{vvd, vdv, dvv}] = 0.3. (1) (b) The probability of at least one voice packet is P [NV ≥ 1] = 1 − P [NV = 0] = 1 − P [ddd] = 0.8. (2) (c) The conditional probability of two voice packets followed by a data packet given that there were two voice packets is P [{vvd} , NV = 2] P [NV = 2] 0.1 1 P [{vvd}] = = . = P [NV = 2] 0.3 3 P [{vvd} |NV = 2] = (3) (d) The conditional probability of two data packets followed by a voice packet given there were two voice packets is P [{ddv} |NV = 2] = P [{ddv} , NV = 2] = 0. P [NV = 2] The joint event of the outcome ddv and exactly two voice packets has probability zero since there is only one voice packet in the outcome ddv. (e) The conditional probability of exactly two voice packets given at least one voice packet is P [NV = 2, NV ≥ 1] P [NV ≥ 1] P [NV = 2] 0.3 3 = = = . P [NV ≥ 1] 0.8 8 P [NV = 2|Nv ≥ 1] = 4 (4) (f) The conditional probability of at least one voice packet given there were exactly two voice packets is P [NV ≥ 1|NV = 2] = P [NV ≥ 1, NV = 2] P [NV = 2] = = 1. P [NV = 2] P [NV = 2] (5) Given two voice packets, there must have been at least one voice packet. Quiz 1.4 Solution We can describe this experiment by the possible events N L, N R, BL, and BR. table: N L 0.35 R ? event space consisting of the four We represent these events in the B ? ? Once we fill in the table, finding the various probabilities will be simple. In a roundabout way, the problem statement tells us how to fill in the table. In particular, P[N ] = 0.7 = P[N L] + P[N R], P[L] = 0.6 = P[N L] + P[BL]. Since P[N L] = 0.35, we can conclude that P[N R] = 0.7 − 0.35 = 0.35 and that P[BL] = 0.6 − 0.35 = 0.25. This allows us to fill in two more table entries: N B L 0.35 0.25 R 0.35 ? The remaining table entry is filled in by observing that the probabilities must sum to 1. This implies P[BR] = 0.05 and the complete table is N B L 0.35 0.25 R 0.35 0.05 The various probabilities are now simple: 5 (a) P [B ∪ L] = P [N L] + P [BL] + P [BR] = 0.35 + 0.25 + 0.05 = 0.65. (b) P [N ∪ L] = P [N ] + P [L] − P [N L] = 0.7 + 0.6 − 0.35 = 0.95. (c) P [N ∪ B] = P [S] = 1. (d) P [LR] = P [LLc ] = 0. Quiz 1.5 Solution In this experiment, there are four outcomes with probabilities P[{vv}] = (0.8)2 = 0.64, P[{dv}] = (0.2)(0.8) = 0.16, P[{vd}] = (0.8)(0.2) = 0.16, P[{dd}] = (0.2)2 = 0.04. When checking the independence of any two events A and B, it’s wise to avoid intuition and simply check whether P[AB] = P[A] P[B]. Using the probabilities of the outcomes, we now can test for the independence of events. (a) First, we calculate the probability of the joint event: P [NV = 2, NV ≥ 1] = P [NV = 2] = P [{vv}] = 0.64. (1) Next, we observe that P[NV ≥ 1] = P[{vd, dv, vv}] = 0.96.. Finally, we make the comparison P [NV = 2] P [NV ≥ 1] = (0.64)(0.96) 6= P [NV = 2, NV ≥ 1] , (2) which shows the two events are dependent. (b) The probability of the joint event is P [NV ≥ 1, C1 = v] = P [{vd, vv}] = 0.80. 6 (3) From part (a), P[NV ≥ 1] = 0.96. Further, P[C1 = v] = 0.8 so that P [NV ≥ 1] P [C1 = v] = (0.96)(0.8) = 0.768 6= P [NV ≥ 1, C1 = v] . (4) Hence, the events are dependent. (c) The problem statement that the packets were independent implies that the events {C2 = v} and {C1 = d} are independent events. Just to be sure, we can do the calculations to check: P [C1 = d, C2 = v] = P [{dv}] = 0.16. (5) Since P[C1 = d] P[C2 = v] = (0.2)(0.8) = 0.16, we confirm that the events are independent. Note that this shouldn’t be surprising since we used the information that the packets were independent in the problem statement to determine the probabilities of the outcomes. (d) The probability of the joint event is P [C2 = v, NV is even] = P [{vv}] = 0.64. (6) Also, each event has probability P [C2 = v] = P [{dv, vv}] = 0.8, P [NV is even] = P [{dd, vv}] = 0.68. (7) (8) P [C2 = v] P [NV is even] = (0.8)(0.68) = 0.544 6= P [C2 = v, NV is even] . (9) Thus, Thus the events are dependent. 7 Quiz 1.6 Solution These two matlab instructions >> T=randi(140,1000,5); >> sum(T>120) ans = 126 147 134 133 163 simulate 5 runs of an experiment each with 1000 tweets. In particular, we note that T=randi(140,1000,5) generates a 1000 × 5 array T of pseudorandom integers between 1 and 140. Each column of T has 1000 entries representing an experimental run corresponding to the lengths of 1000 tweets. The comparison T>120 produces a 5×1000 binary matrix in which each 1 marks a long tweet with length over 120 characters. Summing this binary array along the columns with the command sum(T>120) counts the number of long tweets in each experimental run. The experiment in which we examine the length of one tweet has sample space S = {s1 , s2 , . . . , s140 } with si denoting the outcome that a tweet has length i. Note that P[si ] = 1/140 and thus P [tweet length > 120] = P [{s121 , s122 , . . . , s140 }] = 1 20 = . 140 7 (1) Thus in each run of 1000 tweets, we would expect to see about 1/7 of the tweets, or about 143 tweets, to be be long tweets with length of over 120 characters. However, because the lengths are random, we see that we observe in the neighborhood of 143 long tweets in each run. 8 Quiz 2.1 Solution Let Fi denote the event that that the user is found on page i. The tree for the experiment is ✟✟ 0.8 ✟ F1 ✟✟ 0.2 ✟ F1c ✟ 0.8 ✟ F2 ✟✟ 0.2 ✟ F2c ✟ 0.8 ✟ F3 ✟✟ 0.2 F3c The user is found unless all three paging attempts fail. Thus the probability the user is found is P [F ] = 1 − P [F1c F2c F3c ] = 1 − (0.2)3 = 0.992. (1) Quiz 2.2 Solution (a) We can view choosing each bit in the code word as a subexperiment. Each subexperiment has two possible outcomes: 0 and 1. Thus by the fundamental principle of counting, there are 2 × 2 × 2 × 2 = 24 = 16 possible code words. (b) An experiment that can yield all possible code words with two zeroes is to choose which 2 bits (out of 4 bits) will be zero. The other two bits  then must be ones. There are 42 = 6 ways to do this. Hence, there are six code words with exactly two zeroes. For this problem, it is also possible to simply enumerate the six code words: 1100, 1010, 1001, 0101, 0110, 0011. (c) When the first bit must be a zero, then the first subexperiment of choosing the first bit has only one outcome. For each of the next three bits, we have two choices. In this case, there are 1 × 2 × 2 × 2 = 8 ways of choosing a code word. 9 (d) For the constant ratio code, we can specify a code word by choosing M of the bits to be ones. The other N − M bits will  be zeroes. The N number of ways of choosing such a code word is M . For N = 8 and  8 M = 3, there are 3 = 56 code words. Quiz 2.3 Solution (a) In this problem, k bits received in error is the same as k failures in 100 trials. The failure probability is ǫ = 1 − p and the success probability is 1 − ǫ = p. That is, the probability of k bits in error and 100 − k correctly received bits is   100 k P [Ek,100−k ] = ǫ (1 − ǫ)100−k . (1) k For ǫ = 0.01, P [E0,100 ] = (1 − ǫ)100 = (0.99)100 = 0.3660. P [E1,99 ] = 100(0.01)(0.99)99 = 0.3700. P [E2,98 ] = 4950(0.01)2 (0.99)98 = 0.1849. P [E3,97 ] = 161, 700(0.01)3 (0.99)97 = 0.0610. (2) (3) (4) (5) (b) The probability a packet is decoded correctly is just P [C] = P [E0,100 ] + P [E1,99 ] + P [E2,98 ] + P [E3,97 ] = 0.9819. (6) Quiz 2.4 Solution For a Matlab simulation, we first generate a vector R of 100 random numbers. Second, we generate vector X as a function of R to represent the 3 possible outcomes of a flip. That is, X(i)=1 if flip i was heads, X(i)=2 if flip i was tails, and X(i)=3) is flip i landed on the edge. The matlab code is 10 R=rand(1,100); X=(R<= 0.4) ... + (2*(R>0.4).*(R<=0.9)) ... + (3*(R>0.9)); Y=hist(X,1:3) To see how this works, we note there are three cases: • If R(i) <= 0.4, then X(i)=1. • If 0.4 < R(i) and R(i)<=0.9, then X(i)=2. • If 0.9 < R(i), then X(i)=3. These three cases will have probabilities 0.4, 0.5 and 0.1. Lastly, we use the hist function to count how many occurences of each possible value of X(i). 11 Quiz 3.1 Solution The sample space, probabilities and corresponding grades for the experiment are Outcomes BB BC CB CC G2 3.0 2.5 2.5 2.0 Quiz 3.2 Solution (a) To find c, we recall that the PMF must sum to 1. That is,   3 X 1 1 = 1. PN (n) = c 1 + + 2 3 n=1 (1) This implies c = 6/11. Now that we have found c, the remaining parts are straightforward. (b) P[N = 1] = PN(1) = c = 6/11. (c) P [N ≥ 2] = PN (2) + PN (3) = c/2 + c/3 = 5/11. P (d) P[N > 3] = ∞ n=4 PN(n) = 0. Quiz 3.3 Solution Decoding each transmitted bit is an independent trial where we call a bit error a “success.” Each bit is in error, that is, the trial is a success, with probability p. Now we can interpret each experiment in the generic context of independent trials. (a) The random variable X is the number of trials up to and including the first success. Similar to Example 3.8, X has the geometric PMF ( p(1 − p)x−1 x = 1, 2, . . . PX(x) = 0 otherwise. 12 (b) If p = 0.1, then the probability exactly 10 bits are sent is PX (10) = (0.1)(0.9)9 = 0.0387. (1) The probability that at least 10 bits are sent is P [X ≥ 10] = ∞ X PX (x) . (2) x=10 This sum is not too hard to calculate. However, its even easier to observe that X ≥ 10 if the first 10 bits are transmitted correctly. That is, P [X ≥ 10] = P [first 10 bits correct] = (1 − p)10 . (3) For p = 0.1, P [X ≥ 10] = 0.910 = 0.3487. (4) (c) The random variable Y is the number of successes in 100 independent trials. Just as in Example 3.9, Y has the binomial PMF   100 y PY (y) = p (1 − p)100−y . (5) y If p = 0.01, the probability of exactly 2 errors is   100 PY (2) = (0.01)2 (0.99)98 = 0.1849. 2 (6) (d) The probability of no more than 2 errors is P [Y ≤ 2] = PY (0) + PY (1) + PY (2) = (0.99) 100 = 0.9207.   100 + 100(0.01)(0.99) + (0.01)2 (0.99)98 2 99 13 (7) (e) Random variable Z is the number of trials up to and including the third success. Thus Z has the Pascal PMF (see Example 3.10)   z−1 3 PZ (z) = p (1 − p)z−3 . (8) 2 Note that PZ(z) > 0 for z = 3, 4, 5, . . .. (f) If p = 0.25, the probability that the third error occurs on bit 12 is   11 PZ (12) = (0.25)3 (0.75)9 = 0.0645. (9) 2 Quiz 3.4 Solution Each of these probabilities can be read from the graph of the CDF FY (y). However, we must keep in mind that when FY (y) has a discontinuity at y0 , FY (y) takes the upper value FY (y0+ ). (a) P[Y < 1] = FY (1− ) = 0. (b) P[Y ≤ 1] = FY (1) = 0.6. (c) P[Y > 2] = 1 − P[Y ≤ 2] = 1 − FY (2) = 1 − 0.8 = 0.2. (d) P[Y ≥ 2] = 1 − P[Y < 2] = 1 − FY (2− ) = 1 − 0.6 = 0.4. (e) P[Y = 1] = P[Y ≤ 1] − P[Y < 1] = FY (1+ ) − FY (1− ) = 0.6. (f) P[Y = 3] = P[Y ≤ 3] − P[Y < 3] = FY (3+ ) − FY (3− ) = 0.8 − 0.8 = 0. Quiz 3.5 Solution 14 (a) With probability 1/3, the subscriber sends a text and the cost is C = 10 cents. Otherwise, with probability 2/3, the subscriber receives a text and the cost is C = 5 cents. This corresponds to the PMF   2/3 c = 5, PC (c) = 1/3 c = 10, (1)   0 otherwise. (b) The expected value of C is E [C] = (2/3)(5) + (1/3)(10) = 6.67 cents. (2) (c) For the next two parts we think of each text as a Bernoulli trial such that the trial is a “success” if the subscriber sends a text. The success probability is p = 1/3. Let R denote the number of texts received before sending a text. In terms of Bernoulli trials, R is the number of failures before the first success. R is similar to a geometric random variable except R = 0 is possible if the first text is sent rather than received. In general R = r if the first r trials are failures (i.e. the first r texts are received) and trial r + 1 is a success. Thus R has PMF ( (1 − p)r p r = 0, 1, 2 . . . PR (r) = (3) 0 otherwise. The probability of receiving four texts before sending a text is PR (4) = (1 − p)4 p. (4) (d) The expected number of texts received before sending a text is E [R] = ∞ X rPR (r) = r=0 ∞ X r=0 15 r(1 − p)r p. (5) Letting q = 1 − p and observing that the r = 0 term in the sum is zero, E [R] = p ∞ X rq r . (6) r=1 Using Math Fact B.7, we have E [R] = p 1−p q = = 2. 2 (1 − q) p (7) Quiz 3.6 Solution (a) As a function of N , the money spent by the tree customers is M = 450N + 300(3 − N ) = 900 + 150N. (b) To find the PMF of M , we can draw the following tree and map the outcomes to values of M : N =0 •M =900 0.4✟✟ ✟ ✟ 0.2✘✘N =1 •M =1050 ✟ ✘✘ ✟ ✘ ✘ ✟ ✘ ❳ ❍❍ ❳❳❳ ❍ ❳ 0.2❳❳N =2 •M =1200 ❍❍ 0.2❍❍ N =3 •M =1350 From this tree,   0.4 m = 900, PM (m) = 0.2 m = 1050, 1200, 1350   0 otherwise. 16 (1) From the PMF PM(m), the expected value of M is E [M ] = 900PM (900) + 1050PM (1050) + 1200PM (1200) + 1350PM (1350) = (900)(0.4) + (1050 + 1200 + 1350)(0.2) = 1080. (2) Quiz 3.7 Solution (a) Using Definition 3.11, the expected number of applications is E [A] = 4 X aPA (a) a=1 = 1(0.4) + 2(0.3) + 3(0.2) + 4(0.1) = 2. (1) (b) The number of memory chips is   4 A = 1, 2, M = g(A) = 6 A = 3,   8 A = 4. (2) (c) By Theorem 3.10, the expected number of memory chips is E [M ] = 4 X g(A)PA (a) a=1 = 4(0.4) + 4(0.3) + 6(0.2) + 8(0.1) = 4.8. (3) Since E[A] = 2, g(E[A]) = g(2) = 4. However, E[M ] = 4.8 6= g(E[A]). The two quantities are different because g(A) is not of the form αA + β. 17 Quiz 3.8 Solution For this problem, it is helpful to wrote out the PMF of N in the table 0 1 2 3 n PN (n) 0.4 0.3 0.2 0.1 The PMF PN(n) allows us to calculate each of the desired quantities. (a) The expected value is E [N ] = 3 X nPN (n) n=0 = 0(0.4) + 1(0.3) + 2(0.2) + 3(0.1) = 1. (1) (b) The second moment of N is  E N 2  = 3 X n2 PN (n) n=0 2 = 0 (0.4) + 12 (0.3) + 22 (0.2) + 32 (0.1) = 2. (2) (c) The variance of N is   Var[N ] = E N 2 − (E [N ])2 = 2 − 12 = 1. (d) The standard deviation is σN = p (3) Var[N ] = 1. Quiz 3.9 Solution The function samplemean(k) generates and plots five mn sequences for n = 1, 2, . . . , k. The ith column M(:,i) of M holds a sequence m1 , m2 , . . . , mk . 18 function M=samplemean(k); K=(1:k)’; M=zeros(k,5); for i=1:5, X=duniformrv(0,10,k); M(:,i)=cumsum(X)./K; end; plot(K,M); Here are two examples of samplemean: 10 10 8 8 6 6 4 4 2 2 0 0 0 50 100 (a) samplemean(100) 0 500 1000 (b) samplemean(1000) Each time samplemean(k) is called produces a random output. What is observed in these figures is that for small n, mn is fairly random but as n gets large, mn gets close to E[X] = 5. Although each sequence m1 , m2 , . . . that we generate is random, the sequences always converges to E[X]. This random convergence is analyzed in Chapter 10. 19 Quiz 4.2 Solution The CDF of Y is FY(y) 1   y < 0, 0 FY (y) = y/4 0 ≤ y ≤ 4,   1 y > 4. 0.5 0 0 2 y 4 (1) From the CDF FY (y), we can calculate the probabilities: (a) P[Y ≤ −1] = FY (−1) = 0 (b) P[Y ≤ 1] = FY (1) = 1/4 (c) P [2 < Y ≤ 3] = FY (3) − FY (2) = 3/4 − 2/4 = 1/4. (d) P [Y > 1.5] = 1 − P [Y ≤ 1.5] = 1 − FY (1.5) = 1 − (1.5)/4 = 5/8. Quiz 4.3 Solution (a) First we will find the constant c and then we will sketch the PDF. To find c, we use the fact that Z ∞ Z ∞ cxe−x/2 dx. (1) fX (x) dx = 1= 0 −∞ We evaluate this integral using integration by parts: Z ∞ −x/2 ∞ 2ce−x/2 dx + 1 = −2cxe 0 {z } | 0 = =0 −x/2 ∞ −4ce 0 20 = 4c. (2) Thus c = 1/4 and X has the Erlang (n = 2, λ = 1/2) PDF fX(x) 0.2 0.1 fX (x) = 0 0 5 10 ( (x/4)e−x/2 0 x ≥ 0, otherwise. 15 x (b) To find the CDF FX(x), we first note X is a nonnegative random variable so that FX(x) = 0 for all x < 0. For x ≥ 0, Z x Z x y −y/2 fX (y) dy = FX (x) = e dy 0 4 0 Z x 1 −y/2 y −y/2 x =− e e dy + 2 0 0 2 x = 1 − e−x/2 − e−x/2 . (3) 2 The complete expression for the CDF is FX(x) 1 0.5 FX (x) = 0 0 5 10 15 ( 1− 0 x 2  + 1 e−x/2 x ≥ 0, ow. x (c) From the CDF FX(x), P [0 ≤ X ≤ 4] = FX (4) − FX (0) = 1 − 3e−2 . (4) P [−2 ≤ X ≤ 2] = FX (2) − FX (−2) = 1 − 3e−1 . (5) (d) Similarly, 21 Quiz 4.4 Solution The PDF of Y is fY(y) 3 2 fY (y) = 1 0 −2 0 y ( 3y 2 /2 −1 ≤ y ≤ 1, 0 otherwise. (1) 2 (a) The expected value of Y is Z 1 Z ∞ (3/2)y 3 dy = (3/8)y 4 yfY (y) dy = E [Y ] = −∞ −1 1 −1 = 0. (2) Note that the above calculation wasn’t really necessary because E[Y ] = 0 whenever the PDF fY (y) is an even function, i.e., fY (y) = fY (−y). (b) The second moment of Y is Z 1 Z ∞  2 2 (3/2)y 4 dy = (3/10)y 5 y fY (y) dy = E Y = −1 −∞ 1 −1 = 3/5. (3) (c) The variance of Y is   Var[Y ] = E Y 2 − (E [Y ])2 = 3/5. (d) The standard deviation of Y is σY = Quiz 4.5 Solution (4) p p Var[Y ] = 3/5. (a) When X is an exponential (λ) random variable, E[X] = 1/λ and Var[X] = 1/λ2 . Since E[X] = 3 and Var[X] = 9, we must have λ = 1/3. The PDF of X is ( (1/3)e−x/3 x ≥ 0, fX (x) = (1) 0 otherwise. 22 (b) We know X is a uniform (a, b) random variable. To find a and b, we apply Theorem 4.6 to write a+b =3 2 (b − a)2 Var[X] = = 9. 12 E [X] = This implies √ b − a = ±6 3. a + b = 6, The only valid solution with a < b is √ √ b = 3 + 3 3. a = 3 − 3 3, The complete expression for the PDF of X is ( √ √ √ 1/(6 3) 3 − 3 3 < x < 3 + 3 3, fX (x) = 0 otherwise. (c) We know that the Erlang (n, λ) random variable has PDF ( n n−1 −λx λ x e x ≥ 0, (n−1)! fX (x) = 0 otherwise. (2) (3) (4) (5) (6) (7) The expected value and variance are E[X] = n/λ and Var[X] = n/λ2 . This implies n n = 9. (8) = 3, λ λ2 It follows that n = 3λ = 9λ2 . (9) Thus λ = 1/3 and n = 1. As a result, the Erlang (n, λ) random variable must be the exponential (λ = 1/3) random variable with PDF ( (1/3)e−x/3 x ≥ 0, fX (x) = (10) 0 otherwise. 23 Quiz 4.6 Solution The PDFs of X and Y are: fY(y) 0.4 ← fX(x) 0.2 fX(x) ← fY(y) 0 −5 0 x 5 y The fact that Y has twice the standard deviation of X is reflected in the greater spread of fY (y). However, it is important to remember that as the standard deviation increases, the peak value of the Gaussian PDF goes down. Each of the requested probabilities can be calculated using Φ(z) function and Table 4.1 or Q(z) and Table 4.2. (a) Since X is Gaussian (0, 1), P [−1 < X ≤ 1] = FX (1) − FX (−1) = Φ(1) − Φ(−1) = 2Φ(1) − 1 = 0.6826. (1) (b) Since Y is Gaussian (0, 2), P [−1 < Y ≤ 1] = FY (1) − FY (−1)     −1 1 =Φ −Φ σ σY  Y 1 = 2Φ − 1 = 0.383. 2 (2) (c) Again, since X is Gaussian (0, 1), P[X > 3.5] = Q(3.5) = 2.33 × 10−4 . (d) Since Y is Gaussian (0, 2), P [Y > 3.5] = Q  3.5 2 24  = 1 − Φ(1.75) = 0.04. (3) Quiz 4.7 Solution The CDF of X is FX(x) 1 0.5 0 −2 0 x 2   x < −1, 0 FX (x) = (x + 1)/4 −1 ≤ x < 1,   1 x ≥ 1. (1) The following probabilities can be read directly from the CDF: (a) P[X ≤ 1] = FX(1) = 1. (b) P[X < 1] = FX(1− ) = 1/2. (c) P[X = 1] = FX(1+ ) − FX(1− ) = 1/2. fX(x) (d) We find the PDF fY (y) by taking the derivative of FY (y). The resulting PDF is  0.5 0.5 1  −1 ≤ x < 1, 4 δ(x−1) fX (x) = (2) x = 1, 2   0 0 otherwise. −2 0 2 x Quiz 4.8 Solution From Theorem 4.7, we know that if X is a continuous uniform (a − 1, b) random variable, then Y = ⌈X⌉ is a discrete uniform (a, b) random variable. A Matlab function that implements this solution to produce m samples of a discrete uniform (a, b) random variable is: function y = duniformrv(a,b,m) x=uniformrv(a-1,b,m); y=ceil(x); Note that ceil(x) is the Matlab implementation of ⌈x⌉. 25 Quiz 5.1 Solution Each value of the joint CDF can be found by considering the corresponding probability. (a) FX,Y (−∞, 2) = P[X ≤ −∞, Y ≤ 2] ≤ P[X ≤ −∞] = 0 since X cannot take on the value −∞. (b) FX,Y (∞, ∞) = P[X ≤ ∞, Y ≤ ∞] = 1. This result is given in Theorem 5.1. (c) FX,Y (∞, y) = P[X ≤ ∞, Y ≤ y] = P[Y ≤ y] = FY (y). (d) FX,Y (∞, −∞) = P[X ≤ ∞, Y ≤ −∞] = P[Y ≤ −∞] = 0 since Y cannot take on the value −∞. Quiz 5.2 Solution From the joint PMF of Q and G given in the table, we can calculate the requested probabilities by summing the PMF over those values of Q and G that correspond to the event. (a) The probability that Q = 0 is P [Q = 0] = PQ,G (0, 0) + PQ,G (0, 1) + PQ,G (0, 2) + PQ,G (0, 3) = 0.06 + 0.18 + 0.24 + 0.12 = 0.6. (1) (b) The probability that Q = G is P [Q = G] = PQ,G (0, 0) + PQ,G (1, 1) = 0.18. (2) (c) The probability that G > 1 is P [G > 1] = 1 3 X X PQ,G (q, g) g=2 q=0 = 0.24 + 0.16 + 0.12 + 0.08 = 0.6. 26 (3) (d) The probability that G > Q is P [G > Q] = 1 3 X X PQ,G (q, g) q=0 g=q+1 = 0.18 + 0.24 + 0.12 + 0.16 + 0.08 = 0.78. (4) Quiz 5.3 Solution By Theorem 5.4, the marginal PMF of H is X PH (h) = PH,B (h, b) . (1) b=0,2,4 For each value of h, this corresponds to calculating the row sum across the table of the joint PMF. Similarly, the marginal PMF of B is PB (b) = 1 X PH,B (h, b) . (2) h=−1 For each value of b, this corresponds to the column sum down the table of the joint PMF. The easiest way to calculate these marginal PMFs is to simply sum each row and column: PH,B(h,b) b = 0 b = 2 b = 4 PH(h) h = −1 0 0.4 0.2 0.6 0.1 0 0.1 0.2 h=0 h=1 0.1 0.1 0 0.2 PB(b) 0.2 0.5 0.3 Quiz 5.4 Solution To find the constant c, we apply Z ∞Z ∞ fX,Y (x, y) dx dy 1= −∞ −∞ = Z 2 0 Z 1 cxy dx dy = c 0 Z 2 y 0 x2 2 1 0 27 ! c dy = 2 Z 2 y dy = 0 cy 2 4 2 = c. 0 (1) Thus c = 1. To calculate P[A], we write ZZ fX,Y (x, y) dx dy P [A] = Y 2 (2) A 1 A To integrate over A, we convert to polar coordinates using the substitutions x = r cos θ, y = r sin θ and dx dy = r dr dθ. This yields Z P [A] = = π/2 0 Z 1 Z 1 X 1 r2 sin θ cos θ r dr dθ 0 r3 dr 0 Z π/2  sin θ cos θ dθ = r4 /4 0 1 0  sin2 θ 2 π/2 0 ! 1 = . 8 (3) Quiz 5.5 Solution By Theorem 5.8, the marginal PDF of X is Z ∞ fX,Y (x, y) dy fX (x) = (1) −∞ Note that fX(x) = 0 for x < 0 or x > 1. For 0 ≤ x ≤ 1, Z  y=1 6x + 2 6 1 6 fX (x) = xy + y 3 /3 y=0 = (x + y 2 ) dy = 5 0 5 5 The complete expression for the PDF of X is ( (6x + 2)/5 0 ≤ x ≤ 1 fX (x) = 0 otherwise (2) (3) By the same method we obtain the marginal PDF for Y . For 0 ≤ y ≤ 1, Z ∞ fX,Y (x, y) dy fY (y) = −∞ 6 = 5 Z 1 6 (x + y ) dx = 5 2 0  28 x2 + xy 2 2  x=1 = x=0 6y 2 + 3 . 5 (4) Since fY (y) = 0 for y < 0 or y > 1, the complete expression for the PDF of Y is ( (3 + 6y 2 )/5 0 ≤ y ≤ 1, fY (y) = (5) 0 otherwise. Quiz 5.6(A) Solution (a) For random variables X and Y from Example 5.3, we observe that PY (1) = 0.09 and PX(0) = 0.01. However, PX,Y (0, 1) = 0 6= PX (0) PY (1) (1) Since we have found a pair x, y such that PX,Y (x, y) 6= PX(x)PY (y), we can conclude that X and Y are dependent. Note that whenever PX,Y (x, y) = 0, independence requires that either PX(x) = 0 or PY (y) = 0. (b) For random variables Q and G from Quiz 5.2, it is not obvious whether they are independent. Unlike X and Y in part (a), there are no obvious pairs q, g that fail the independence requirement. In this case, we calculate the marginal PMFs from the table of the joint PMF PQ,G(q, g) in Quiz 5.2. In transposed form, this table is PQ,G(q, g) q = 0 q = 1 PG(g) g=0 0.06 0.04 0.10 g=1 0.18 0.12 0.30 0.24 0.16 0.40 g=2 0.12 0.08 0.20 g=3 PQ(q) 0.60 0.40 Careful study of the table will verify that PQ,G(q, g) = PQ(q)PG(g) for every pair q, g. Hence Q and G are independent. 29 Quiz 5.6(B) Solution Since X1 and X2 are identical, fX1(x) = fX2(x) = fX(x). Since X1 and X2 are independent, ( x1 x2 · 0 ≤ x1 , x2 ≤ 2, (1) fX1 ,X2 (x1 , x2 ) = fX1 (x1 ) fX2 (x2 ) = 2 2 0 otherwise. Quiz 5.8(A) Solution It is helpful to first make a table that includes the marginal PMFs. PL,T(l, t) l=1 l=2 l=3 PT(t) t = 40 0.15 0.3 0.15 0.6 t = 60 0.1 0.2 0.1 0.4 PL(l) 0.25 0.5 0.25 (a) The expected value of L is E [L] = 1(0.25) + 2(0.5) + 3(0.25) = 2. Since the second moment of L is   E L2 = 12 (0.25) + 22 (0.5) + 32 (0.25) = 4.5, (1) (2) the variance of L is   Var [L] = E L2 − (E [L])2 = 0.5. (3) E [T ] = 40(0.6) + 60(0.4) = 48. (4) (b) The expected value of T is The second moment of T is   E T 2 = 402 (0.6) + 602 (0.4) = 2400. (5) Thus   Var[T ] = E T 2 − (E [T ])2 = 96. 30 (6) (c) First we need to find E [LT ] = 3 X X ltPLT (lt) t=40,60 l=1 = 1(40)(0.15) + 2(40)(0.3) + 3(40)(0.15) + 1(60)(0.1) + 2(60)(0.2) + 3(60)(0.1) = 96. (7) The covariance of L and T is Cov [L, T ] = E [LT ] − E [L] E [T ] = 96 − 2(48) = 0. (8) (d) Since Cov[L, T ] = 0, the correlation coefficient is ρL,T = 0. Quiz 5.8(B) Solution As in the discrete case, the calculations become easier if we first calculate the marginal PDFs fX(x) and fY (y). For 0 ≤ x ≤ 1, fX (x) = Z ∞ fX,Y (x, y) dy = −∞ Z 2 0 Similarly, for 0 ≤ y ≤ 2, Z Z ∞ fX,Y (x, y) dx = fY (y) = −∞ 2 0 1 xy dy = xy 2 2 y=2 1 xy dx = x2 y 2 x=1 = 2x. (1) y = . 2 (2) y=0 x=0 The complete expressions for the marginal PDFs are ( ( 2x 0 ≤ x ≤ 1, y/2 0 ≤ y ≤ 2, fX (x) = fY (y) = 0 otherwise, 0 otherwise. (3) From the marginal PDFs, it is straightforward to calculate the various expectations. 31 (a) The first and second moments of X are Z 1 Z ∞ 2 2x2 dx = . xfX (x) dx = E [X] = 3 0 −∞ Z 1 Z ∞   1 2x3 dx = . x2 fX (x) dx = E X2 = 2 0 −∞ (4) (5) The variance of X is Var[X] = E[X 2 ] − (E[X])2 = 1 . 18 (b) The first and second moments of Y are Z 2 Z ∞ 4 1 2 y dy = , yfY (y) dy = E [Y ] = 3 0 2 −∞ Z 2 Z ∞   1 3 y 2 fY (y) dy = E Y2 = y dy = 2. 0 2 −∞ (6) (7) The variance of Y is   2 16 = . Var[Y ] = E Y 2 − (E [Y ])2 = 2 − 9 9 (8) (c) We start by finding E [XY ] = = Z ∞ Z ∞ xyfX,Y (x, y) dx, dy −∞ −∞ Z 1Z 2 2 2 0 0 x3 x y dx, dy = 3 1 y3 0 3 2 0 8 = . 9 (9) The covariance of X and Y is then Cov [X, Y ] = E [XY ] − E [X] E [Y ] = 8 2 4 − · = 0. 9 3 3 (d) Since Cov[X, Y ] = 0, the correlation coefficient is ρX,Y = 0. 32 (10) Quiz 5.9 Solution This problem just requires identifying the various parameters in Definition 5.10. Specifically, from the problem statement, we know ρ = 1/2 and µX = 0, σX = 1, µY = 0, σY = 1. Applying these facts to Definition 5.10, we have 2 e−2(x −xy+y √ fX,Y (x, y) = 3π 2 2 )/3 . (1) Quiz 5.10 Solution We find P[C] by integrating the joint PDF over the region of interest. Specifically, P [C] = Z =4 =4 1 2 dy2 0 Z 1 2 0 1 2 y 2 2 Z y2 1 2 ! Z 1 2 Z y4 dy1 4dy3 dy4 0 0 0 ! Z 1 ! 2 y2 dy2 y4 dy4 0 0 1 2 y 2 4 33 1 2 0 !  2 1 1 = . =4 8 16 (1) Quiz 6.2 Solution √ Since Y = X, the fact that X is nonegative implies Y is non-negative. This implies FY (y) = 0 for y < 0. For y ≥ 0, we find i h√ FY (y) = P X ≤ y    (1) = P X ≤ y 2 = FX y 2 . For x ≥ 0, FX(x) = 1 − e−λx . Thus, ( 2 1 − e−λy FY (y) = 0 y≥0 otherwise (2) By taking the derivative with respect to y, it follows that the PDF of Y is ( 2 2λye−λy y ≥ 0 fY (y) = (3) 0 otherwise In comparing this result to the Rayleigh PDF given in√Appendix A, we observe that Y is a Rayleigh (a) random variable with a = 2λ. Quiz 6.3 Solution (a) Since X is always nonnegative, FX(x) = 0 for x < 0. Also, FX(x) = 1 for x ≥ 2 since its always true that x ≤ 2. Lastly, for 0 ≤ x ≤ 2, Z x Z x (1 − y/2) dy = x − x2 /4. (1) fX (y) dy = FX (x) = 0 −∞ The complete CDF of X is FX(x) 1 0.5 0 −1 0 1 x 2 3   x < 0, 0 FX (x) = x − x2 /4 0 ≤ x ≤ 2,   1 x > 2. 34 (2) (b) The probability that Y = 1 is P [Y = 1] = P [X ≥ 1] = 1 − FX (1) = 1/4. (3) (c) Since X is nonnegative, Y is also nonnegative. Thus FY (y) = 0 for y < 0. Also, because Y ≤ 1, FY (y) = 1 for all y ≥ 1. Finally, for 0 < y < 1, FY (y) = P [Y ≤ y] = P [X ≤ y] = FX (y) . FY(y) Using the CDF FX(x), the complete expression for 1   0 0.5 FY (y) = y − y 2 /4  0  1 −1 0 1 2 3 y (4) the CDF of Y is y < 0, 0 ≤ y < 1, y ≥ 1. (5) As expected, we see that the jump in FY (y) at y = 1 is exactly equal to P[Y = 1]. (d) By taking the derivative of FY (y), we obtain the PDF fY (y). Note that when y < 0 or y > 1, the PDF is zero. fY(y) 1.5 0.25 1 fY (y) = 0.5 0 −1 0 1 y 2 ( 1− 0 y 2 + δ(y−1) 4 0≤y≤1 otherwise 3 Quiz 6.4(A) Solution The time required for the transfer is T = 8L/B. For each pair of values of L and B, we can calculate the time T needed for the transfer. We can write 35 these down on the table for the joint PMF of L and B as follows: PL,B(l, b) b=512 l = 256 0.20 b=1024 (T =4) (T =1) 0.10 (T =12) l = 1536 0.05 (T =2) 0.05 l = 768 b=2048 0.10 0.20 (T =6) 0.00 (T =3) 0.10 (T =24) 0.20 (T =12) (T =6) From the table, writing down the PMF of T is just bookkeeping. For example P[T = 6] = 0.1 + 0.2 = 0.3. The complete table of the PMF is t PT(t) 1 2 3 4 6 12 0.05 0.1 0.2 0.2 0.3 0.15 Quiz 6.4(B) Solution First, we observe that since 0 ≤ X ≤ 1 and 0 ≤ Y ≤ 1, W = XY satisfies 0 ≤ W ≤ 1. Thus fW(0) = 0 and fW(1) = 1. Y For 0 < w < 1, we calculate the CDF FW(w) = P[W ≤ w]. As we see in the figure, the calculus is simpler if we integrate over the region XY > w. The calculus is XY > w 1 w XY = w FW (w) = 1 − P [XY > w] Z 1Z 1 =1− dy dx X w 1 Z w 1 w/x (1 − w/x) dx  = x − w ln x|x=1 x=w = w − w ln w. =1− w (1) For 0 ≤ w ≤ 1, the PDF is fW (w) = dFW (w) = − ln w. dw 36 (2) The complete PDF of W is   0 fW (w) = − ln w   0 w < 0, 0 ≤ w ≤ 1, w > 1. (3) Quiz 6.5 Solution Random variables X and Y have PDFs ( ( 3e−3x x ≥ 0, 2e−2y fY (y) = fX (x) = 0 0 otherwise, y ≥ 0, otherwise. (1) Since X and Y are nonnegative, W = X + Y is nonnegative and fW(w) = 0 for w < 0. For w > 0, we use Theorem 6.9 to write Z ∞ fX (w − y) fY (y) dy fW (w) = −∞ Z w Z w −3(w−y) −2y −3w e e dy = 6e =6 ey dy = 6e−3w (ew − 1) . (2) 0 0 The complete PDF of W is fW (w) = ( 6(e−2w − e−3w ) w ≥ 0, 0 otherwise. Quiz 6.6 Solution Your printing of this textbook may have typo. The PDF of V should be ( (v + 5)/72 −5 ≤ v ≤ 7, (1) fV (v) = 0 otherwise. 37 First we find the corresponding CDF FV (v). For −5 ≤ v ≤ 7, Z v Z v u+5 du fV (u) du = FV (v) = −5 72 −∞ v (u + 5)2 (v + 5)2 . = = 144 −5 144 (2) (3) The complete CDF of V is   v < −5, 0 2 FV (v) = (v + 5) /144 −5 ≤ v ≤ 7,   1 v > 7. (4) Now that we found the CDF FV (v), we can use Theorem 6.5. Over the interval −5 ≤ v ≤ 7, we find the inverse of the CDF by solving (v + 5)2 (5) 144 √ for v as a function of u. This yields v = 12 u − 5. Thus, when U is a uniform (0, 1) random variable, the function √ V = 12 U − 5 (6) u = FV (v) = generates samples of random variable V . In terms of Matlab, the code is simple: function V = Vsample(m) V=12*sqrt(rand(1,m))-5; In Vsample.m, m samples of a uniform (0, 1) random variable are given by rand(1,m). Here is a sample output >> V=Vsample(5) V = 6.7402 3.3603 5.7350 38 -0.4799 2.7932 Quiz 7.1(A) Solution (a) From the problem statement, we learn that the conditional PMF of N given the event I is ( 0.02 n = 1, 2, . . . , 50, PN |I (n) = 0 otherwise. (b) Also from the problem statement, the conditional PMF of N given the event T is ( 0.2 n = 1, . . . , 5, PN |T (n) = 0 otherwise. (c) The problem statement tells us that P[T ] = 1 − Theorem 7.2, we find the PMF of N is   0.155 PN (n) = PN |T (n) P [T ] + PN |I (n) P [I] = 0.005   0 P[I] = 3/4. From n = 1, . . . , 5, n = 6, . . . , 50, (1) otherwise. (d) First we find P [N ≤ 10] = 10 X PN (n) = (0.155)(5) + (0.005)(5) = 0.80. (2) n=1 By Theorem 7.1, the conditional PMF of N given N ≤ 10 is ( PN(n) n ≤ 10, PN |N ≤10 (n) = P[N ≤10] 0 otherwise,  0.155   0.8 = 0.19375 n = 1, . . . , 5, = 0.005 = 0.00625 n = 6, . . . , 10, 0.8   0 otherwise. 39 (3) Quiz 7.1(B) Solution From the problem statement, fY (y) = ( 1/10 0 < y < 10, 0 otherwise. (1) Using this PDF and Definition 7.3, the parts are straightforward. (a) P[Y ≤ 6] = R6 f (y) dy = −∞ Y R6 0 (1/10) dy = 0.6 . (b) From Definition 7.3, the conditional PDF of Y given Y ≤ 6 is ( fY (y) y ≤ 6, P[Y ≤6] fY |Y ≤6 (y) = 0 otherwise, ( 1/6 0 ≤ y ≤ 6, = 0 otherwise. (2) (c) The probability Y > 8 is P [Y > 8] = Z 10 8 1 dy = 0.2. 10 (d) From Definition 7.3, the conditional PDF of Y given Y > 8 is ( fY (y) y > 8, P[Y >8] fY |Y >8 (y) = 0 otherwise, ( 1 8 < y ≤ 10, 2 = 0 otherwise. 40 (3) (4) Quiz 7.2(A) Solution We refer to the solution of Quiz 7.1(A) for PN |N ≤10(n). (a) Given PN |N ≤10(n), calculating a conditional expected value is the same as for any other expected value except we use the conditional PMF. X E [N |N ≤ 10] = nPN |N ≤10 (n) = n 5 X 0.19375n + n=1 10 X 0.00625n = 3.15625. (1) n=6 (b) For the conditional variance, we first find the conditional second moment   X 2 E N 2 |N ≤ 10 = n PN |N ≤10 (n) = n 5 X 2 0.19375n + n=1 10 X 0.00625n2 n=6 = 0.19375(55) + 0.00625(330) = 12.719. (2) The conditional variance is   Var[N |N ≤ 10] = E N 2 |N ≤ 10 − (E [N |N ≤ 10])2 = 12.719 − (3.156)2 = 2.757. (3) Quiz 7.2(B) Solution We refer to the solution of Quiz 7.1(B) for the conditional PDFs fY |Y ≤6(y) and fY |Y >8(y). (a) From fY |Y ≤6(y), the conditional expectation is Z Z ∞ yfY |Y ≤6 (y) dy = E [Y |Y ≤ 6] = −∞ 41 6 0 y dy = 3. 6 (1) (b) From the conditional PDF fY |Y >8(y), we see that given Y > 8, Y is conditionally a continuous uniform (a = 8, b = 10) random variable. Thus, Var[Y |Y > 8] = (b − a)2 /12 = 1/3. (2) Quiz 7.3(A) Solution Since the event V > 80 occurs only for the pairs (L, X) = (2, 60), (L, X) = (3, 40) and (L, X) = (3, 60), P [A] = P [V > 80] = PL,X (2, 60) + PL,X (3, 40) + PL,X (3, 60) = 0.45. (1) By Definition 7.6, PL,X|A (l, X) = (P L,X(l,x) P[A] 0 lx > 80, otherwise. We can represent this conditional PMF in the following table: PL,X|A(l, x) x = 40 x = 60 l=1 0 0 0 4/9 l=2 1/3 2/9 l=3 The conditional expectation of V can be found from the conditional PMF. XX 4 1 2 1 E [V |A] = lxPL,X|A (l, x) = (120) + (120) + (180) = 133 . (2) 9 3 9 3 x l For the conditional variance Var[V |A], we first find the conditional second moment   XX E V 2 |A = (lx)2 PL,X|A (l, x) l x 1 2 4 = (120)2 + (120)2 + (180)2 = 18, 400. 9 3 9 (3) It follows that   2 Var [V |A] = E V 2 |A − (E [V |A])2 = 622 9 42 (4) Quiz 7.3(B) Solution For continuous random variables X and Y , we first calculate the probability of the conditioning event. ZZ Z 60 Z 3 xy dx dy. (1) P [B] = fX,Y (x, y) dx dy = 80/y 4000 40 B A little calculus yields Z P [B] = = Z 60 40 60 40 x2 2 y 4000 y 4000  3 80/y ! 9 3200 − 2 2 y dy  dy = 9 4 3 − ln . 8 5 2 (2) In fact, P[B] ≈ 0.801. The conditional PDF of X and Y is ( ( f (x,y) 40≤y≤60, X,Y (x, y) ∈ B, Kxy 80/y≤x≤3, P[B] = fX,Y |B (x, y) = 0 otherwise. 0 otherwise, (3) where K = (4000 P[B])−1 . The conditional expectation of W given event B is ZZ Z 60 Z 3 Kx2 y 2 dx dy. (4) E [W |B] = xyfX,Y |B (x, y) dx dy = 40 80/y These next steps are just calculus: Z K 60 2 3 x=3 E [W |B] = y x x=80/y dy 3 40 Z   K 60 K 9y 3 − 803 ln y = 27y 2 − 803 /y dy = 3 40 3 The conditional second moment of K given B is ZZ Z  2  2 E W |B = (xy) fX,Y |B (x, y) dx dy = 60 40 43 Z 60 40 ≈ 120.78. (5) 3 Kx3 y 3 dx dy. 80/y (6) With a final bit of calculus, Z  2  K 60 3 4 x=3 E W |B = y x x=80/y dy 4 40   Z  K 60 K 81 4 3 4 4 = 81y − 80 /y dy = y − 80 ln y 4 40 4 4 ≈ 16,116.10. 60 40 (7) It follows that Var[W |B] = E[W 2 |B] − (E[W |B])2 ≈ 1528.30. Quiz 7.4(A) Solution (a) The joint PMF of X and Y can be found from the marginal and conditional PMFs via PX,Y (x, y) = PY |X(y|x)PX(x). Incorporating the information from the given conditional PMFs can be confusing, however. Consequently, we note that X has range SX = {0, 2} and Y has range SY = {0, 1}. A table of the joint PMF will include all four possible combinations of X and Y . The general form of the table is PX,Y (x,y) y=0 y=1 x=0 x=2 PY |X(0|0)PX(0) PY |X(1|0)PX(0) PY |X(0|2)PX(2) PY |X(1|2)PX(2) Substituting values from PY |X(y|x) and PX(x), we have y=0 y=1 PX,Y (x, y) x=0 (0.8)(0.4) (0.2)(0.4) , x=2 (0.5)(0.6) (0.5)(0.6) which simplifies to PX,Y (x, y) y = 0 y = 1 x=0 0.32 0.08 . x=2 0.3 0.3 44 (b) From the joint PMF PX,Y (x, y), we can calculate 0.62 and the conditional PMF  0.32 16  = 31  0.62 PX,Y (x, 0) 15 0.3 = 0.62 PX|Y (x|0) = = 31  PY (0)  0 PY (0) = 0.32 + 0.3 = x = 0, x = 2, otherwise. Quiz 7.4(B) Solution (a) The joint PDF of X and Y is fX,Y (x, y) = fY |X (y|x) fX (x) = ( 6y 0 0 ≤ y ≤ x, 0 ≤ x ≤ 1, otherwise. (b) To find fX|Y (x|1/2), we first find Z ∞ fX,Y (x, 1/2) dx. fY (1/2) = −∞ For this integral, we keep in mind that fX,Y (x, y) is nonzero for y ≤ x ≤ 1, Specifically, for y = 1/2, we integrate over 1/2 ≤ x ≤ 1: Z 1 6(1/2) dx = 3/2. (1) fY (1/2) = 1/2 For 1/2 ≤ x ≤ 1, the conditional PDF of X given Y = 1/2 is fX|Y (x|1/2) = 6(1/2) fX,Y (x, 1/2) = = 2. fY (1/2) 3/2 (2) For x < 1/2 or x > 1, fX|Y (x|1/2) = 0. Thus given Y = 1/2, the X has the continuous uniform (1/2, 1) PDF ( 2 12 ≤ x ≤ 1, fX|Y (x|1/2) = (3) 0 otherwise. 45 Quiz 7.5(A) Solution (a) Given the conditional PMF PY |X(y|2), it is easy to calculate the conditional expectation E [Y |X = 2] = 1 X yPY |X (y|2) = (0)(0.5) + (1)(0.5) = 0.5. (1) y=0 (b) We can calculate the conditional variance Var[X|Y = 0] using the conditional PMF PX|Y (x|0). First we calculate the conditional expected value X 15 30 16 E [X|Y = 0] = +2· = . (2) xPX|Y (x|0) = 0 · 31 31 31 x The conditional second moment is   X 2 15 60 16 E X 2 |Y = 0 = x PX|Y (x|0) = 02 + 22 = . 31 31 31 x The conditional variance is then   Var[X|Y = 0] = E X 2 |Y = 0 − (E [X|Y = 0])2 = 960/961. (3) (4) Quiz 7.5(B) Solution (a) From the conditional PDF fY |X(y|x) given in Quiz 7.4(B), ( 8y 0 ≤ y ≤ 1/2, fY |X (y|1/2) = 0 otherwise. Now we calculate the conditional expected value Z 1/2 y(8y) dy = 8y 3 /3 E [Y |X = 1/2] = 0 46 1/2 0 = 1/3. (1) (2) (b) From the solution to Quiz 7.4(B), we see that given Y = 1/2, the conditional PDF of X is uniform (1/2, 1). Thus, by the definition of the uniform (a, b) PDF, Var [X|Y = 1/2] = (1 − 1/2)2 1 = . 12 48 Quiz 7.6 Solution Since X and Y are bivariate Gaussian random variables with ρ = 1/2, µX = µY = 0, and σX = σY = 1, Theorem 7.16 tells us that given Y = y, X is conditionally Gaussian with parameters y 2 = 1 − ρ2 . (1) µ̃X (y) = ρy = , σ̃X 2 For y = 2, we have 2 σ̃X = 3/4. µ̃X = µ̃X (2) = 1 The conditional PDF of X is 1 1 2 2 2 fX|Y (x|2) = p e−(x−µ̃X ) /2σ̃X = p e−2(x−1) /3 . 2 3π/2 2πσ̃X (2) (3) Quiz 7.7 Solution One straightforward method is to follow the approach of Example 5.26. Instead, we use an alternate approach. First we observe that X has the discrete uniform (1, 4) PMF. Also, given X = x, Y has a discrete uniform (1, x) PMF. That is, ( ( 1/4 x = 1, 2, 3, 4, 1/x y = 1, . . . , x, PX (x) = PY |X (y|x) = (1) 0 otherwise, 0 otherwise. Given X = x, and an independent uniform (0, 1) random variable U , we can generate a sample value of Y with a discrete uniform (1, x) PMF via Y = ⌈xU ⌉. This observation prompts the following program: 47 function xy=dtrianglerv(m) sx=[1;2;3;4]; px=0.25*ones(4,1); x=finiterv(sx,px,m); y=ceil(x.*rand(m,1)); xy=[x’;y’]; 48 Quiz 8.1 Solution By definition of A, Y1 = X1 , Y2 = X2 − X1 and Y3 = X3 − X2 . Since 0 < X1 < X2 < X3 , each Yi must be a strictly positive integer. Thus, for y1 , y2 , y3 ∈ {1, 2, . . .}, PY (y) = P [Y1 = y1 , Y2 = y2 , Y3 = y3 ]   X 1 = y1 , = P  X 2 − X 1 = y2 ,  X 3 − X 2 = y3   X1 = y1 ,  = P  X 2 = y2 + y1 , X 3 = y3 + y2 + y1 = PX (y1 , y2 + y1 , y3 + y2 + y1 ) = (1 − p)3 py1 +y2 +y3 . (1) (2)  ′ With a = 1 1 1 and q = 1 − p, the joint PMF of Y is ( ′ qpa y y1 , y2 , y3 ∈ {1, 2, . . .} , PY (y) = 0 otherwise. Quiz 8.2 Solution In the PDF fY(y), the components have dependencies as a result of the ordering constraints Y1 ≤ Y2 and Y3 ≤ Y4 . We can separate these constraints by creating the vectors     Y1 Y V= , W= 3 . (1) Y2 Y4 The joint PDF of V and W is   4 0 ≤ v1 ≤ v2 ≤ 1; fV,W (v, w) = 0 ≤ w1 ≤ w2 ≤ 1,   0 otherwise. 49 (2) We must verify that V and W are independent. For 0 ≤ v1 ≤ v2 ≤ 1, ZZ fV (v) = fV,W (v, w) dw1 dw2  Z 1 Z 1 = 4 dw2 dw1 w1 0 Z 1 4(1 − w1 ) dw1 = 2. = (3) 0 Similarly, for 0 ≤ w1 ≤ w2 ≤ 1, fW (w) = ZZ fV,W (v, w) dv1 dv2  Z 1 Z 1 = 4 dv2 dv1 = 2. 0 (4) v1 It follows that V and W have PDFs ( 2 0 ≤ v1 ≤ v2 ≤ 1, fV (v) = 0 otherwise. ( 2 0 ≤ w1 ≤ w2 ≤ 1, fW (w) = 0 otherwise. (5) (6) It is easy to verify that fV,W(v, w) = fV(v)fW(w), confirming that V and W are independent vectors. Quiz 8.3(A) Solution Referring to Theorem 2.9, each test is a subexperiment with three possible ′ outcomes: L, A and R. In five trials, the vector X = X1 X2 X3 indicating the number of outcomes of each subexperiment has the multinomial PMF   5 PX (x) = 0.3x1 0.6x2 0.1x3 . x 1 , x 2 , x3 50 We can find the marginal PMF for each Xi from the joint PMF PX(x); however it is simpler to just start from first principles and observe that X1 is the number of occurrences of L in five independent tests. If we view each test as a trial with success probability P[L] = 0.3, we see that X1 is a binomial (n, p) = (5, 0.3) random variable. Similarly, X2 is a binomial (5, 0.6) random variable and X3 is a binomial (5, 0.1) random variable. That is, for p1 = 0.3, p2 = 0.6 and p3 = 0.1,   5 x PXi (x) = pi (1 − pi )5−x . (1) x From the marginal PMFs, we see that X1 , X2 and X3 are not independent. Hence, we must use Theorem 8.1 to find the PMF of W . In particular, since X1 + X2 + X3 = 5 and since each Xi is non-negative, PW(0) = PW(1) = 0. Furthermore, PW (2) = PX (1, 2, 2) + PX (2, 1, 2) + PX (2, 2, 1) 5!0.3(0.6)2 (0.1)2 5!0.32 (0.6)(0.1)2 5!0.32 (0.6)2 (0.1) + + = 2!2!1! 2!2!1! 2!2!1! = 0.1458. (2) In addition, for w = 3, w = 4, and w = 5, the event W = w occurs if and only if one of the mutually exclusive events X1 = w, X2 = w, or X3 = w occurs. Thus, PW (3) = PW (4) = PW (5) = 3 X i=1 3 X i=1 3 X PXi (3) = 0.486, (3) PXi (4) = 0.288, (4) PXi (5) = 0.0802. (5) i=1 51 Quiz 8.3(B) Solution Since each Yi = 2Xi + 4, we can apply Theorem 8.5 to write   y1 − 4 y2 − 4 y3 − 4 1 , , fY (y) = 3 fX 2 2 2 2 ( (1/8)e−(y3 −4)/2 4 ≤ y1 ≤ y2 ≤ y3 , = 0 otherwise. (1) Note that for other matrices A, the constraints on y resulting from the constraints 0 ≤ X1 ≤ X2 ≤ X3 can be much more complicated. Quiz 8.4 Solution To solve this problem, we need to find the expected values E[Xi ] and E[Xi Xj ] for each I and j. To do this, we need the marginal PDFs fXi(xi ) and fXi ,Xj(xi , xj ). First we note that each marginal PDF is nonzero only if any subset of the xi obeys the ordering contraints 0 ≤ x1 ≤ x2 ≤ x3 ≤ 1. Within these constraints, we have Z 1 Z ∞ fX (x) dx3 = 6 dx3 = 6(1 − x2 ), (1) fX1 ,X2 (x1 , x2 ) = x2 −∞ and fX2 ,X3 (x2 , x3 ) = Z ∞ fX (x) dx1 = −∞ Z x2 6 dx1 = 6x2 , (2) 6 dx2 = 6(x3 − x1 ). (3) 0 and fX1 ,X3 (x1 , x3 ) = Z ∞ fX (x) dx2 = −∞ Z x3 x1 In particular, we must keep in mind that fX1 ,X2(x1 , x2 ) = 0 unless 0 ≤ x1 ≤ x2 ≤ 1, fX2 ,X3(x2 , x3 ) = 0 unless 0 ≤ x2 ≤ x3 ≤ 1, and that fX1 ,X3(x1 , x3 ) = 0 52 unless 0 ≤ x1 ≤ x3 ≤ 1. The complete expressions are ( 6(1 − x2 ) 0 ≤ x1 ≤ x2 ≤ 1, fX1 ,X2 (x1 , x2 ) = 0 otherwise. ( 6x2 0 ≤ x2 ≤ x3 ≤ 1, fX2 ,X3 (x2 , x3 ) = 0 otherwise. ( 6(x3 − x1 ) 0 ≤ x1 ≤ x3 ≤ 1, fX1 ,X3 (x1 , x3 ) = 0 otherwise. Now we can find the marginal PDFs. When 0 ≤ xi ≤ 1 for each xi , Z ∞ fX1 ,X2 (x1 , x2 ) dx2 fX1 (x1 ) = −∞ Z 1 6(1 − x2 ) dx2 = 3(1 − x1 )2 . = (4) (5) (6) (7) x1 fX2 (x2 ) = = Z ∞ fX2 ,X3 (x2 , x3 ) dx3 −∞ Z 1 x2 fX3 (x3 ) = = 6x2 dx3 = 6x2 (1 − x2 ). Z (8) ∞ fX2 ,X3 (x2 , x3 ) dx2 Z−∞ x3 0 6x2 dx2 = 3x23 . (9) The complete expressions are fX1 (x1 ) = ( 3(1 − x1 )2 0 53 0 ≤ x1 ≤ 1, otherwise. (10) fX2 (x2 ) = ( 6x2 (1 − x2 ) 0 ≤ x2 ≤ 1, 0 otherwise. (11) fX3 (x3 ) = ( 3x23 0 (12) 0 ≤ x3 ≤ 1, otherwise. Now we can find the components E[Xi ] = E [X1 ] = E [X2 ] = E [X3 ] = Z Z Z 1 0 R∞ −∞ xfXi(x) dx of µX . 3x(1 − x)2 dx = 1/4, (13) 6x2 (1 − x) dx = 1/2, (14) 3x3 dx = 3/4. (15) 1 0 1 0 To find the correlation matrix RX , we need to find E[Xi Xj ] for all i and j. We start with the second moments: Z 1  2 1 (16) 3x2 (1 − x)2 dx = . E X1 = 10 0 Z 1  2 3 6x3 (1 − x) dx = . E X2 = (17) 10 0 Z 1  2 3 3x4 dx = . (18) E X3 = 5 0 Using marginal PDFs, the cross terms are ZZ E [X1 X2 ] = x1 x2 fX1 ,X2 (x1 , x2 ) , dx1 dx2  Z 1 Z 1 6x1 x2 (1 − x2 ) dx2 dx1 = x1 0 Z 1 3 [x1 − 3x31 + 2x41 ] dx1 = . = 20 0 54 (19) E [X2 X3 ] = = E [X1 X3 ] = = = Z Z Z 1 0 1 0 1 0 Z Z Z 1 0 1 0 Z 1 x2 6x22 x3 dx3 dx2 2 [3x22 − 3x42 ] dx2 = . 5 1 x1  6x1 x3 (x3 − x1 ) dx3 dx1 (2x1 x33 − 3x21 x23 ) x3 =1 x3 =x1  dx1 [2x1 − 3x21 + x41 ] dx1 = 1/5. Summarizing the results, X has correlation matrix   1/10 3/20 1/5 RX = 3/20 3/10 2/5 . 1/5 2/5 3/5 (20) (21) Vector X has covariance matrix CX = RX − E [X] E [X]′     1  10 3 =  20  1 5 3 20 3 10 2 5 1 5 1 4 h   2  −  12  14 5   3 5 3 4 1 2 3 4 i  3 2 1 1  2 4 2 . = 80 1 2 3  (22) This problem shows that even for fairly simple joint PDFs, computing the covariance matrix can be time consuming. Quiz 8.5 Solution We observe that X = AZ + b where   2 1 , A= 1 −1 55   2 . b= 0 (1) It follows from Theorem 8.13 that µX = b and that      5 1 2 1 2 1 ′ = CX = AA = . 1 2 1 −1 1 −1 Quiz 8.6 Solution  ′ First, we observe that Y = AT where A = 1/31 1/31 · · · 1/31 . Since T is a Gaussian random vector, Theorem 8.11 tells us that Y is a 1 dimensional Gaussian vector, i.e., just a Gaussian random variable. The expected value of Y is µY = µT = 80. The covariance matrix of Y is 1 × 1 and is just equal to Var[Y ]. Thus, by Theorem 8.11, Var[Y ] = ACT A′ . In julytemps.m shown below, the first two lines generate the 31 × 31 covariance matrix CT, or CT . Next we calculate Var[Y ]. The final step is to use the Φ(·) function to calculate P[Y < T ]. function p=julytemps(T); [D1 D2]=ndgrid((1:31),(1:31)); CT=36./(1+abs(D1-D2)); A=ones(31,1)/31.0; CY=(A’)*CT*A; p=phi((T-80)/sqrt(CY)); Here is the output of julytemps.m: >> julytemps([70 75 80 85 90]) ans = 0.0000 0.0221 0.5000 0.9779 1.0000 Note that P[T ≤ 70] is not actually zero and that P[T ≤ 90] is not actually 1.0000. Its just that the Matlab’s short format output, invoked with the command format short, rounds off those probabilities. The long format output resembles: 56 >> format long >> julytemps([70 75]) ans = 0.000028442631 0.022073830676 >> julytemps([85 90]) ans = 0.977926169323 0.999971557368 The ndgrid function is a useful to way calculate many covariance matrices. However, in this problem, CX has a special structure; the i, jth element is CT (i, j) = c|i−j| = 36 . 1 + |i − j| If we write out the elements of the covariance  c0 c1 · · · ..  . c c CT =  .1 . 0 . .. ..  .. c30 · · · c1 matrix, we see that  c30 ..  .  . c1  c0 (1) (2) This covariance matrix is known as a symmetric Toeplitz matrix. Because Toeplitz covariance matrices are quite common, Matlab has a toeplitz function for generating them. The function julytemps2 use the toeplitz to generate the correlation matrix CT . function p=julytemps2(T); c=36./(1+abs(0:30)); CT=toeplitz(c); A=ones(31,1)/31.0; CY=(A’)*CT*A; p=phi((T-80)/sqrt(CY)); 57 Quiz 9.1 Solution Let K1 , . . . , Kn denote a sequence of iid random variables each with PMF ( 1/4 k = 1, . . . , 4, PK (k) = (1) 0 otherwise. We can write Wn = K1 + · · · + Kn . First, we note that the first two moments of Ki are 1+2+3+4 = 2.5, 4   12 + 2 2 + 32 + 42 E Ki2 = = 7.5. 4 E [Ki ] = (2) (3) Thus the variance of Ki is   Var[Ki ] = E Ki2 − (E [Ki ])2 = 7.5 − (2.5)2 = 1.25. (4) Since E[Ki ] = 2.5, the expected value of Wn is E [Wn ] = E [K1 ] + · · · + E [Kn ] = 2.5n. (5) Since the rolls are independent, the random variables K1 , . . . , Kn are independent. Hence, by Theorem 9.3, the variance of the sum equals the sum of the variances. That is, Var[Wn ] = Var[K1 ] + · · · + Var[Kn ] = 1.25n. (6) Quiz 9.2 Solution The MGF of K is  φK (s) = E e sK  = 4 X 1 k=0 5 esk = 58 1 + es + e2s + e3s + e4s . 5 (1) We find the moments by taking derivatives. The first derivative of φK (s) is dφK (s) es + 2e2s + 3e3s + 4e4s = . ds 5 Evaluating the derivative at s = 0 yields E [K] = dφK (s) ds = s=0 (2) 1+2+3+4 = 2. 5 To find higher-order moments, we continue to take derivatives:   d2 φK (s) E K2 = ds2 s=0 es + 4e2s + 9e3s + 16e4s = = 6. 5 s=0   d3 φK (s) E K3 = ds3 s=0 es + 8e2s + 27e3s + 64e4s ) = 5 s=0   d4 φK (s) E K4 = ds4 s=0 es + 16e2s + 81e3s + 256e4s = 5 s=0 (3) (4) = 20. (5) = 70.8. (6) Quiz 9.3(A) Solution Each Ki has MGF   es + e2s + · · · + ens es (1 − ens φK (s) = E esKi = = . n n(1 − es ) (1) Since the sequence of Ki is independent, Theorem 9.6 says the MGF of J is φJ (s) = (φK (s))m = 59 ems (1 − ens )m . nm (1 − es )m (2) Quiz 9.3(B) Solution Since the set of αj Xj are independent Gaussian random variables, Theorem 9.8 says that W is a Gaussian random variable. Thus to find the PDF of W , we need only find the expected value and variance. Since the expectation of the sum equals the sum of the expectations: E [W ] = α E [X1 ] + α2 E [X2 ] + · · · + αn E [Xn ] = 0. (1) Since the αj Xj are independent, the variance of the sum equals the sum of the variances: Var[W ] = α2 Var[X1 ] + α4 Var[X2 ] + · · · + α2n Var[Xn ] = α2 + 2(α2 )2 + · · · + n(α2 )n . (2) Defining q = α2 , we can use Math Fact B.6 to write Var[W ] = α2 − α2n+2 [1 + n(1 − α2 )] . (1 − α2 )2 (3) 2 With E[W ] = 0 and σW = Var[W ], we can write the PDF of W as Quiz 9.4 Solution fW (w) = p 1 2 2πσW e−w 2 /2σ 2 W (a) The expected access time is Z Z ∞ xfX (x) dx = E [X] = −∞ 12 0 (b) The second moment of the access time is Z Z ∞  2 2 x fX (x) dx = E X = −∞ . x dx = 6 ms. 12 12 0 (4) x2 dx = 48. 12 The variance of the access time is Var[X] = E[X 2 ] − (E[X])2 = 12. 60 (1) (2) (c) Using Xi to denote the access time of block i, we can write A = X1 + X2 + · · · + X12 (3) Since the expectation of the sum equals the sum of the expectations, E [A] = E [X1 ] + · · · + E [X12 ] = 12 E [X] = 72 ms. (4) (d) Since the Xi are independent, Var[A] = Var[X1 ] + · · · + Var[X12 ] = 12 Var[X] = 144. (5) Thus A has standard deviation σA = 12. (e) To use the central limit theorem, we use Table 4.1 to evaluate   75 − E [A] A − E [A] ≤ P [A ≤ 75] = P σA σA   75 − 72 ≈Φ = 0.5987. 12 (6) Then P[A > 75] = 1 − P[A ≤ 75] = 0.4013. (f) Once again, we use the central limit theorem and Table 4.1 to estimate   48 − E [A] A − E [A] < P [A < 48] = P σA σA   48 − 72 ≈Φ = 0.0227. (7) 12 Quiz 9.5 Solution One solution to this problem is to follow the approach of Example 9.10: 61 %unifbinom100.m sx=0:100;sy=0:100; px=binomialpmf(100,0.5,sx); py=duniformpmf(0,100,sy); [SX,SY]=ndgrid(sx,sy); [PX,PY]=ndgrid(px,py); SW=SX+SY; PW=PX.*PY; sw=unique(SW); pw=finitepmf(SW,PW,sw); pmfplot(sw,pw); Here is a graph of the PMF PW(w): 0.01 0.005 0 0 50 100 150 200 With some thought, it should be apparent that the finitepmf function is implementing the convolution of the two PMFs. 62 Quiz 10.1 Solution An exponential random variable with expected value 1 also has variance 1. By Theorem 10.1, Mn (X) has variance Var[Mn (X)] = 1/n. Hence, we need n = 100 samples. Quiz 10.2 Solution The train interarrival times X1 , X2 , X3 are iid exponential (λ) random variables. The arrival time of the third train is W = X1 + X2 + X3 . (1) In Theorem 9.9, we found that the sum of three iid exponential (λ) random variables is an Erlang (n = 3, λ) random variable. From Appendix A, we find that W has expected value and variance E [W ] = 3/λ = 6, Var[W ] = 3/λ2 = 12. (2) (3) (a) By the Central Limit Theorem,  20 − 6 W −6 P [W > 20] = P √ > √ 12 12   7 ≈Q √ = 2.66 × 10−5 . 3  (b) From the Markov inequality, we know that P [W > 20] ≤ E [W ] 6 = = 0.3. 20 20 (4) (c) To use the Chebyshev inequality, we observe that E[W ] = 6 and W nonnegative imply P [|W − E [W ]| ≥ 14] = P [W − 6 ≥ 14] + P [W − 6 ≤ −14] {z } | =0 = P [W ≥ 20] . 63 (5) Thus P [W ≥ 20] = P [|W − E [W ]| ≥ 14] 3 Var[W ] = = 0.061. ≤ 2 14 49 (6) (7) (d) For the Chernoff bound, we note that the MGF of W is φW (s) =  λ λ−s 3 = 1 . (1 − 2s)3 (8) The Chernoff bound states that P [W > 20] ≤ min e−20s φX (s) = min s≥0 s≥0 e−20s . (1 − 2s)3 (9) To minimize h(s) = e−20s /(1 − 2s)3 , we set the derivative of h(s) to zero: e−20s (40s − 14) dh(s) = 0. = ds (1 − 2s)4 (10) This implies s = 7/20. Applying s = 7/20 into the Chernoff bound yields P [W > 20] ≤ e−20s (1 − 2s)3 = 0.0338. 7 s= 20 (e) Theorem 4.11 says that for any w > 0, the CDF of the Erlang (3, λ) random variable W satisfies FW (w) = 1 − 64 2 X (λw)k e−λw k=0 k! (11) Equivalently, for λ = 1/2 and w = 20, P [W > 20] = 1 − FW (20)   10 102 −10 + 1+ =e 1! 2! −10 = 61e = 0.0028. (12) Although the Chernoff bound is weak in that it overestimates the probability by a factor of 12, it is a valid bound. By contrast, the Central Limit Theorem approximation grossly underestimates the true probability. Quiz 10.3 Solution (a) Since X is a Bernoulli random variable with parameter p = 0.8, we can look up in Appendix A to find that E[X] = p = 0.8 and variance Var[X] = p(1 − p) = (0.8)(0.2) = 0.16. (1) (b) By Theorem 10.1, Var[M100 (X)] = Var[X] = 0.0016. 100 (2) (c) Theorem 10.5 uses the Chebyshev inequality to show that the sample mean satisfies Var[X] . (3) P [|Mn (X) − E [X]| ≥ c] ≤ nc2 Note that E[X] = PX(1) = p. To meet the specified requirement, we choose c = 0.05 and n = 100. Since Var[X] = 0.16, we must have 0.16 =α 100(0.05)2 This reduces to α = 16/25 = 0.64. 65 (4) (d) Again we use Equation (3). To meet the specified requirement, we choose c = 0.1. Since Var[X] = 0.16, we must have 0.16 ≤ 0.05 n(0.1)2 (5) The smallest value that meets the requirement is n = 320. Quiz 10.4 Solution Define the random variable W = (X − µX )2 . Observe that V100 (X) = M100 (W ). By Theorem 10.10, the mean square error is  Var[W ]  . E (M100 (W ) − µW )2 = 100 Observe that µX = 0 so that W = X 2 . Thus, Z 1  2 x2 fX (x) dx = 1/3, µW = E X = −1 Z 1  4  2 x4 fX (x) dx = 1/5. E W =E X = (1) (2) (3) −1 Therefore Var[W ] = E[W 2 ] − µ2W = 1/5 − (1/3)2 = 4/45 and the mean square error is 4/4500 = 0.0009. Quiz 10.5 Solution Following the bernoullitraces.m approach, we generate m = 1000 sample paths, each sample path having n = 100 Bernoulli traces. at time k, OK(k) counts the fraction of sample paths that have sample mean within one standard error of p. The program bernoullisample.m generates graphs the number of traces within one standard error as a function of the time, i.e. the number of trials in each trace. 66 function OK=bernoullisample(n,m,p); x=reshape(bernoullirv(p,m*n),n,m); nn=(1:n)’*ones(1,m); MN=cumsum(x)./nn; stderr=sqrt(p*(1-p))./sqrt((1:n)’); stderrmat=stderr*ones(1,m); OK=sum(abs(MN-p)<stderrmat,2)/m; plot(1:n,OK); The following graph was generated by bernoullisample(50,5000,0.5): 1 0.5 0 0 10 20 30 40 50 As we would expect, as m gets large, the fraction of traces within one standard error approaches 2Φ(1) − 1 ≈ 0.68. The unusual sawtooth pattern, though perhaps unexpected, is examined in Problem 10.5.1. 67 Quiz 11.1 Solution From the problem statement, the conditional PMFs of K are ( 4k −104 10 e k = 0, 1, . . . k! PK|H0 (k) = 0 otherwise ( 6k −106 10 e k = 0, 1, . . . k! PK|H1 (k) = 0 otherwise (1) (2) Since the two hypotheses are equally likely, the MAP and ML tests are the same. From Theorem 11.6, the ML hypothesis rule is k ∈ A0 if PK|H0 (k) ≥ PK|H1 (k) ; k ∈ A1 otherwise. (3) This rule simplifies to k ∈ A0 if k ≤ k ∗ = 106 − 104 = 214, 975.7; ln 100 k ∈ A1 otherwise. (4) Thus if we observe at least 214, 976 photons, then we accept hypothesis H1 . Quiz 11.2 Solution For the QPSK system, a symbol error occurs when si is transmitted but (X1 , X2 ) ∈ Aj for some j 6= i. For a QPSK system, it is easier to calculate the probability of a correct decision. Given H0 , the conditional probability of a correct decision is P [C|H0 ] = P [X1 > 0, X2 > 0|H0 ] h√ i √ = P E/2 + N1 > 0, E/2 + N2 > 0 . (1) Because of the symmetry of the signals, P[C|H0 ] = P[C|Hi ] for all i. This implies the probability of a correct decision is P[C] = P[C|H0 ]. Since N1 and 68 N2 are iid Gaussian (0, σ) random variables, we have i h√ i h√ P [C] = P [C|H0 ] = P E/2 + N1 > 0 P E/2 + N2 > 0  h i2 √ = P N1 > − E/2 " !#2 √ − E/2 = 1−Φ . σ Since Φ(−x) = 1 − Φ(x), we have P[C] = Φ2 ( probability of error is PERR = 1 − P [C] = 1 − Φ2 p (2) E/2σ 2 ). Equivalently, the r E 2σ 2 ! . (3) Quiz 11.3 Solution To generate the ROC, the existing program sqdistor already calculates this miss probability PMISS = P01 and the false alarm probability PFA = P10 . The modified program, sqdistroc.m is essentially the same as sqdistor except the output is a matrix FM whose columns are the false alarm and miss probabilities. Here is the modified code: 69 function FM=sqdistroc(v,d,m,T) %square law distortion recvr %P(error) for m bits tested %transmit v volts or -v volts, %add N volts, N is Gauss(0,1) %add d(v+N)^2 distortion %receive 1 if x>T, otherwise 0 %FM = [P(FA) P(MISS)] x=(v+randn(m,1)); [XX,TT]=ndgrid(x,T(:)); P01=sum((XX+d*(XX.^2)< TT),1)/m; x= -v+randn(m,1); [XX,TT]=ndgrid(x,T(:)); P10=sum((XX+d*(XX.^2)>TT),1)/m; FM=[P10(:) P01(:)]; Next, the program sqdistrocplot.m calls sqdistroc three times to generate a plot that compares the receiver performance for the three requested values of d. function FM=sqdistrocplot(v,m,T); FM1=sqdistroc(v,0.1,m,T); FM2=sqdistroc(v,0.2,m,T); FM5=sqdistroc(v,0.3,m,T); FM=[FM1 FM2 FM5]; loglog(FM1(:,1),FM1(:,2),’-k’,FM2(:,1),FM2(:,2),’--k’,... FM5(:,1),FM5(:,2),’:k’); legend(’\it d=0.1’,’\it d=0.2’,’\it d=0.3’,3) ylabel(’P_{MISS}’); xlabel(’P_{FA}’); To see the effect of d, the commands T=-3:0.1:3; sqdistrocplot(3,100000,T); generated this receiver operating curve: 70 0 10 −1 10 −2 PMISS 10 −3 10 −4 10 d=0.1 d=0.2 d=0.3 −5 10 −5 10 −4 10 −3 −2 10 10 −1 10 PFA T=-3:0.1:3; sqdistrocplot(3,100000,T); 71 0 10 Quiz 12.1 Solution (a) First, we calculate the marginal PDF for 0 ≤ y ≤ 1: Z y x=y 2(y + x) dx = 2xy + x2 x=0 = 3y 2 . fY (y) = (1) 0 This implies the conditional PDF of X given Y is ( 2 + 2x2 0 ≤ x ≤ y, fX,Y (x, y) = 3y 3y fX|Y (x|y) = fY (y) 0 otherwise. (b) The minimum mean square error estimate of X given Y = y is  Z y 2x 2x2 dx = 5y/9. x̂M (y) = E [X|Y = y] = + 3y 3y 2 0 (2) (3) Thus the MMSE estimator of X given Y is X̂M (Y ) = 5Y /9. (c) To obtain the conditional PDF fY |X(y|x), we need the marginal PDF fX(x). For 0 ≤ x ≤ 1, Z 1 y=1 (4) 2(y + x) dy = y 2 + 2xy y=x = 1 + 2x − 3x2 . fX (x) = x For 0 ≤ x ≤ 1, the conditional PDF of Y given X is ( 2(y+x) x ≤ y ≤ 1, 2 fY |X (y|x) = 1+2x−3x 0 otherwise. (5) (d) The MMSE estimate of Y given X = x is ŷM (x) = E [Y |X = x] Z 1 2y 2 + 2xy 2y 3 /3 + xy 2 dy = = 2 1 + 2x − 3x2 x 1 + 2x − 3x 72 y=1 = y=x 2 + 3x − 5x3 . 3 + 6x − 9x2 (6) Quiz 12.2 Solution (a) Since the expectation of the sum equals the sum of the expectations, E [R] = E [T ] + E [X] = 0. (1) (b) Since T and X are independent, the variance of the sum R = T + X is Var[R] = Var[T ] + Var[X] = 9 + 3 = 12. (c) Since T and R have expected values E[R] = E[T ] = 0,   Cov [T, R] = E [T R] = E [T (T + X)] = E T 2 + E [T X] . (2) (3) Since T and X are independent and have zero expected value, E[T X] = E[T ] E[X] = 0 and E[T 2 ] = Var[T ]. Thus Cov[T, R] = Var[T ] = 9. (d) From Definition 5.6, the correlation coefficient of T and R is √ σT Cov [T, R] = 3/2. = ρT,R = p σR Var[R] Var[T ] (4) (e) From Theorem 12.3, the optimum linear estimate of T given R is T̂L (R) = ρT,R σT (R − E [R]) + E [T ] . σR (5) Since E[R] = E[T ] = 0 and ρT,R = σT /σR , T̂L (R) = σT2 3 σT2 R = R. R = 2 2 2 σR σT + σX 4 (6) Hence a∗ = 3/4 and b∗ = 0. (f) By Theorem 12.3, the mean square error of the linear estimate is e∗L = Var[T ](1 − ρ2T,R ) = 9(1 − 3/4) = 9/4. 73 (7) Quiz 12.3 Solution When R = r, the conditional PDF of X = Y − 40 − 40 log10 r is Gaussian with expected value −40 − 40 log10 r and variance 64. The conditional PDF of X given R is fX|R (x|r) = √ 1 2 e−(x+40+40 log10 r) /128 . 128π (1) From the conditional PDF fX|R(x|r), we can use Definition 12.2 to write the ML estimate of R given X = x as r̂ML (x) = arg max fX|R (x|r) . (2) r≥0 We observe that fX|R(x|r) is maximized when the exponent (x+40+40 log10 r)2 is minimized. This minimum occurs when the exponent is zero, yielding log10 r = −1 − x/40 (3) r̂ML (x) = (0.1)10−x/40 m. (4) or If the result doesn’t look correct, note that a typical figure for the signal strength might be x = −120 dB. This corresponds to a distance estimate of r̂ML (−120) = 100 m. For the MAP estimate, we observe that the joint PDF of X and R is fX,R (x, r) = fX|R (x|r) fR (r) = 106 1 √ 32π re−(x+40+40 log10 r) 2 /128 . (5) From Theorem 12.5, the MAP estimate of R given X = x is the value of r that maximizes fX,R(x, r). That is, r̂MAP (x) = arg max fX,R (x, r) . 0≤r≤1000 74 (6) Note that we have included the constraint r ≤ 1000 in the maximization to highlight the fact that under our probability model, R ≤ 1000 m. Setting the derivative of fX,R(x, r) with respect to r to zero yields   80 log10 e −(x+40+40 log10 r)2 /128 (x + 40 + 40 log10 r) = 0. (7) 1− e 128 Solving for r yields r = 10  1 −1 25 log10 e  10−x/40 = (0.1236)10−x/40 . (8) This is the MAP estimate of R given X = x as long as r ≤ 1000 m. When x ≤ −156.3 dB, the above estimate will exceed 1000 m, which is not possible in our probability model. Hence, the complete description of the MAP estimate is ( 1000 x < −156.3, r̂MAP (x) = (9) −x/40 (0.1236)10 x ≥ −156.3. For example, if x = −120dB, then r̂MAP (−120) = 123.6 m. When the measured signal strength is not too low, the MAP estimate is 23.6% larger than the ML estimate. This reflects the fact that large values of R are a priori more probable than small values. However, for very low signal strengths, the MAP estimate takes into account that the distance can never exceed 1000 m. Quiz 12.4 Solution (a) From Theorem 12.3, the LMSE estimate of X2 given Y2 is X̂2 (Y2 ) = ρX2 ,Y2 σX2 (Y2 − µY2 ) + µX2 = a∗ Y2 + b∗ , σY2 (1) where a∗ = ρX,Y σX Cov [X2 , Y2 ] = , σY Var[Y2 ] 75 b∗ = µX2 − a∗ µY2 . (2) Because E[X] = E[Y] = 0,   Cov [X2 , Y2 ] = E [X2 Y2 ] = E [X2 (X2 + W2 )] = E X22 = 1,     Var[Y2 ] = Var[X2 ] + Var[W2 ] = E X22 + E W22 = 1.1. (3) (4) It follows that a∗ = 1/1.1. Because µX2 = µY2 = 0, it follows that b∗ = 0. Finally, to compute the expected square error, we calculate the correlation coefficient ρX2 ,Y2 = 1 Cov [X2 , Y2 ] =√ . σX2 σY2 1.1 (5) The expected square error is e∗L = Var[X2 ](1 − ρ2X2 ,Y2 ) = 1 − 1 1 = = 0.0909. 1.1 11 (6)  ′ (b) Here we wish to estimate X2 given the observation vector Y = Y1 Y2 . Since Y = X + W and E[X] = E[W] = 0, it follows that E[Y] = 0. Thus we can apply Theorem 12.6 and write the minimum mean square error linear estimator as X̂2 (Y) = RX2 Y R−1 Y Y. (7) We need to find RY and RX2 Y . Note that X and W have correlation matrices     0.1 0 1 −0.9 . (8) , RW = RX = 0 0.1 −0.9 1 This implies RY = E [YY′ ] = E [(X + W)(X′ + W′ )] = E [XX′ + XW′ + WX′ + WW′ ] . 76 (9) Because X and W are independent, E[XW′ ] = E[X] E[W′ ] = 0. Similarly, E[WX′ ] = 0. This implies   1.1 −0.9 ′ ′ . (10) RY = E [XX ] + E [WW ] = RX + RW = −0.9 1.1 In addition, we need to find   RX2 Y = E [X2 Y′ ] = E [X2 Y1 ] E [X2 Y2 ]   = E [X2 (X1 + W1 )] E [X2 (X2 + W2 )] . (11) Since X and W are independent vectors, E[X2 W1 ] = E[X2 ] E[W1 ] = 0 and E[X2 W2 ] = 0. Thus     RX2 Y = E[X1 X2 ] E [X22 ] = −0.9 1 . (12) It follows that RX2 Y R−1 Y −1 1.1 −0.9 = −0.9 1 −0.9 1.1       2.75 2.25 = −0.225 0.725 . = −0.9 1 2.25 2.75    (13) Therefore, the optimum linear estimator of X2 given Y1 and Y2 is X̂2 (Y) = RX2 Y R−1 Y Y = −0.225Y1 + 0.725Y2 . (14) From Theorem 12.6(b), the mean square error is ′ e∗2 = Var [X2 ] − RX2 Y R−1 Y RX 2 Y     −0.9 = 0.0725. = 1 − −0.225 0.725 1 (15) In part (a), we used only Y2 to estimate X2 and the resulting mean square error was 0.0909. Here we showed that by using both Y1 and Y2 to estimate X2 , we reduced the mean square error to 0.0725, about a 20% reduction. 77 Quiz 12.5 Solution Since X and W have zero expected value, Y also has zero expected value. Thus, by Theorem 12.6, X̂L (Y) = RXY R−1 Y Y (1) Since X and W are independent, E[WX] = 0 and E[XW′ ] = 0′ . This implies   (2) RXY = E [XY′ ] = E [X(1′ X + W′ )] = 1′ E X 2 = 1′ .   Note that 1′ is the row vector 1 1 · · · 1 of twenty ones. By the same reasoning, the correlation matrix of Y is RY = E [YY′ ] = E [(1X + W)(1′ X + W′ )]   = 11′ E X 2 + 1 E [XW′ ] + E [WX] 1′ + E [WW′ ] = 11′ + RW (3) Note that 11′ is a 20 × 20 matrix with every entry equal to 1. Thus, ′ ′ RXY R−1 Y = 1 (11 + RW ) −1 (4) Y. (5) and the optimal linear estimator is X̂L (Y) = 1′ (11′ + RW ) −1 By Theorem 12.6(b), the mean square error is ′ ′ e∗L = Var[X] − RXY R−1 Y RYX = 1 − 1 (11 + RW ) −1 1. (6) Now we note that RW has i, jth entry RW (i, j) = c|i−j|−1 . The question we must address is what value c minimizes e∗L . This problem is atypical in that we do not usually get to choose the correlation structure of the noise. However, we will see that the answer is somewhat instructive. We note that the optimal c is not obviously apparent from Equation (6). In particular, we observe that Var[Wi ] = RW (i, i) = 1/c. Thus, when c is small, 78 the noises Wi have high variance and we would expect our estimator to be poor. On the other hand, if c is large then Wi and Wj are highly correlated and the separate measurements of X are very dependent. This would suggest that large values of c will also result in poor MSE. If this argument is not clear, consider the extreme case in which every Wi and Wj have correlation coefficient ρij = 1. In this case, our 20 measurements will be all the same and one measurement is as good as 20 measurements. To find the optimal value of c, we write a Matlab function mquiz9(c) to calculate the MSE for a given c and second function that finds the MSE for a range of values of c. function [mse,af]=mquiz9(c); v1=ones(20,1); RW=toeplitz(c.^((0:19)-1)); RY=(v1*(v1’)) +RW; af=(inv(RY))*v1; mse=1-((v1’)*af); function cmin=mquiz9minc(c); msec=zeros(size(c)); for k=1:length(c), [msec(k),af]=mquiz9(c(k)); end plot(c,msec); xlabel(’c’);ylabel(’e_L^*’); [msemin,optk]=min(msec); cmin=c(optk); Note in mquiz9 that v1 corresponds to the vector 1 of all ones. The following commands finds the minimum c and also produces the following graph: >> c=0.01:0.01:0.99; >> mquiz9minc(c) ans = 0.4500 1 e*L 0.8 0.6 0.4 0.2 0 0.5 c 1 As we see in the graph, both small values and large values of c result in large MSE. 79 Quiz 13.1 Solution (a) We obtain a continuous-time, continuous-value process when we record the temperature as a continuous waveform over time. (b) If at every moment in time, we round the temperature to the nearest degree, then we obtain a continuous-time, discrete-value process. (c) If we sample the process in part (a) every T seconds, then we obtain a discrete-time, continuous-value process. (d) Rounding the samples in part (c) to the nearest integer degree yields a discrete-time, discrete-value process. Quiz 13.2 Solution (a) Each resistor has resistance R in ohms with uniform PDF ( 0.01 950 ≤ r ≤ 1050 fR (r) = 0 otherwise The probability that a test produces a 1% resistor is Z 1010 (0.01) dr = 0.2. p = P [990 ≤ R ≤ 1010] = (1) (2) 990 (b) In t seconds, exactly t resistors are tested. Each resistor is a 1% resistor with probability p = 0.2, independent of any other resistor. Consequently, the number of 1% resistors found has the binomial (t, 0.2) PMF   t PN (t) (n) = (0.2)n (0.8)t−n . (3) n 80 (c) First we will find the PMF of T1 . This problem is easy if we view each resistor test as an independent trial. A success occurs on a trial with probability p = 0.2 if we find a 1% resistor. The first 1% resistor is found at time T1 = t if we observe failures on trials 1, . . . , t − 1 followed by a success on trial t. Hence, just as in Example 3.8, T1 has the geometric (0.2) PMF ( (0.8)t−1 (0.2) t = 1, 2, . . . PT1 (t) = (4) 0 otherwise. From Theorem 3.5, a geometric random variable with success probability p has expected value 1/p. In this problem, E[T1 ] = 1/p = 5. (d) Since p = 0.2, the probability the first 1% resistor is found in exactly five seconds is PT1(5) = (0.8)4 (0.2) = 0.08192. (e) Note that once we find the first 1% resistor, the number of additional trials needed to find the second 1% resistor once again has a geometric PMF with expected value 1/p since each independent trial is a success with probability p. That is, T2 = T1 + T ′ where T ′ is independent and identically distributed to T1 . Thus E [T2 |T1 = 10] = E [T1 |T1 = 10] + E [T ′ |T1 = 10] = 10 + E [T ′ ] = 10 + 5 = 15. (5) Quiz 13.3 Solution Since each Xi is a N (0, 1) random variable, each Xi has PDF 1 2 fXi ) (x) = √ e−x /2 . 2π  ′ By Theorem 13.1, the joint PDF of X = X1 · · · Xn is fX (x) = fX(1),...,X(n) (x1 , . . . , xn ) = k Y i=1 81 fX (xi ) = 1 −(x21 +···+x2n )/2 e . (2π)n/2 (1) (2) Quiz 13.4 Solution The first and second hours are nonoverlapping intervals. Since one hour equals 3600 sec and the Poisson process has a rate of 10 packets/sec, the expected number of packets in each hour is E[Mi ] = α = 36, 000. This implies M1 and M2 are independent Poisson random variables each with PMF ( m −α α e m = 0, 1, 2, . . . m! (1) PMi (m) = 0 otherwise Since M1 and M2 are independent, the joint PMF of M1 and M2 is  αm1 +m2 e−2α m1 = 0, 1, . . . ;  m1 !m2 !    m2 = 0, 1, . . . , PM1 ,M2 (m1 , m2 ) = PM1 (m1 ) PM2 (m2 ) =     0 otherwise. (2) Quiz 13.5 Solution To answer whether N ′ (t) is a Poisson process, we look at the interarrival times. Let X1 , X2 , . . . denote the interarrival times of the N (t) process. Since we count only even-numbered arrival for N ′ (t), the time until the first arrival of the N ′ (t) is Y1 = X1 + X2 . Since X1 and X2 are independent exponential (λ) random variables, Y1 is an Erlang (n = 2, λ) random variable; see Theorem 9.9. Since Yi (t), the ith interarrival time of the N ′ (t) process, has the same PDF as Y1 (t), we can conclude that the interarrival times of N ′ (t) are not exponential random variables. Thus N ′ (t) is not a Poisson process. Quiz 13.6 Solution First, we note that for t > s, X(t) − X(s) = W (t) − W (s) √ . α 82 (1) Since W (t) − W (s) is a Gaussian random variable, Theorem 4.13 states that W (t) − W (s) is Gaussian with expected value E [X(t) − X(s)] = E [W (t) − W (s)] √ =0 α (2) and variance  E [(W (t) − W (s))2 ]  α(t − s) = . E (W (t) − W (s))2 = α α (3) Consider s′ ≤ s < t. Since s√ ≥ s′ , W (t) − W (s) is independent of W (s′ ). √ ′ This implies [W (t) − W (s)]/ α is independent of W (s )/ α for all s ≥ s′ . That is, X(t) − X(s) is independent of X(s′ ) for all s ≥ s′ . Thus X(t) is a Brownian motion process with variance Var[X(t)] = t. Quiz 13.7 Solution First we find the expected value µY (t) = µX (t) + µN (t) = µX (t). (1) To find the autocorrelation, we observe that since X(t) and N (t) are independent and since N (t) has zero expected value, E[X(t)N (t′ )] = E[X(t)] E[N (t′ )] = 0. Since RY (t, τ ) = E[Y (t)Y (t + τ )], we have RY (t, τ ) = E [(X(t) + N (t)) (X(t + τ ) + N (t + τ ))] = E [X(t)X(t + τ )] + E [X(t)N (t + τ )] + E [X(t + τ )N (t)] + E [N (t)N (t + τ )] = RX (t, τ ) + RN (t, τ ). (2) Quiz 13.8 Solution From Definition 13.14, X1 , X2 , . . . is a stationary random sequence if for all sets of time instants n1 , . . . , nm and time offset k, fXn1 ,...,Xnm (x1 , . . . , xm ) = fXn1 +k ,...,Xnm +k (x1 , . . . , xm ) . 83 (1) Since the random sequence is iid, fXn1 ,...,Xnm (x1 , . . . , xm ) = fX (x1 ) fX (x2 ) · · · fX (xm ) . (2) Similarly, for time instants n1 + k, . . . , nm + k, fXn1 +k ,...,Xnm +k (x1 , . . . , xm ) = fX (x1 ) fX (x2 ) · · · fX (xm ) . (3) We can conclude that the iid random sequence is stationary. Quiz 13.9 Solution We must check whether each function R(τ ) meets the conditions of Theorem 13.12: R(τ ) ≥ 0, R(τ ) = R(−τ ), |R(τ )| ≤ R(0). (1) (a) R1 (τ ) = e−|τ | meets all three conditions and thus is valid. 2 (b) R2 (τ ) = e−τ also is valid. (c) R3 (τ ) = e−τ cos τ is not valid because R3 (−2π) = e2π cos 2π = e2π > 1 = R3 (0) (2) 2 (d) R4 (τ ) = e−τ sin τ also cannot be an autocorrelation function because R4 (π/2) = e−π/2 sin π/2 = e−π/2 > 0 = R4 (0) (3) Quiz 13.10 Solution (a) The autocorrelation of Y (t) is RY (t, τ ) = E [Y (t)Y (t + τ )] = E [X(−t)X(−t − τ )] = RX (−t − (−t − τ )) = RX (τ ). (1) Since E[Y (t)] = E[X(−t)] = µX , we can conclude that Y (t) is a wide sense stationary process. In fact, we see that by viewing a process backwards in time, we see the same second order statistics. 84 (b) Since X(t) and Y (t) are both wide sense stationary processes, we can check whether they are jointly wide sense stationary by seeing if RXY (t, τ ) is just a function of τ . In this case, RXY (t, τ ) = E [X(t)Y (t + τ )] = E [X(t)X(−t − τ )] = RX (t − (−t − τ )) = RX (2t + τ ). (2) Since RXY (t, τ ) depends on both t and τ , we conclude that X(t) and Y (t) are not jointly wide sense stationary. To see why this is, suppose RX (τ ) = e−|τ | so that samples of X(t) far apart in time have almost no correlation. In this case, as t gets larger, Y (t) = X(−t) and X(t) become less correlated. Quiz 13.11 Solution From the problem statement, E [X(t)] = E [X(t + 1)] = 0, (1) E [X(t)X(t + 1)] = 1/2, (2) Var[X(t)] = Var[X(t + 1)] = 1. (3)  ′ The Gaussian random vector X = X(t) X(t + 1) has covariance matrix and corresponding inverse     4 1 −1/2 1 1/2 −1 . (4) , CX = CX = 1 1/2 1 3 −1/2 Since x ′ C−1 X x  = x0     ′ 4 4 2 1 −1/2 x0 x1 x0 − x0 x+ x21 , = 1 x1 3 −1/2 3 the joint PDF of X(t) and X(t + 1) is the Gaussian vector PDF   1 1 ′ −1 fX(t),X(t+1) (x0 , x1 ) = exp − x CX x (2π)n/2 [det (CX )]1/2 2 1 − 32 (x20 −x0 x1 +x21 ) e . =√ 3π 2 85 (5) (6) (7) Quiz 13.12 Solution The simple structure of the switch simulation of Example 13.22 admits a deceptively simple solution in terms of the vector of arrivals A and the vector of departures D. With the introduction of call blocking. we cannot generate these vectors all at once. In particular, when an arrival occurs at time t, we need to know that M (t), the number of ongoing calls, satisfies M (t) < c = 120. Otherwise, when M (t) = c, we must block the call. Call blocking can be implemented by setting the service time of the call to zero so that the call departs as soon as it arrives. The blocking switch is an example of a discrete event system. The system evolves via a sequence of discrete events, namely arrivals and departures, at discrete time instances. A simulation of the system moves from one time instant to the next by maintaining a chronological schedule of future events (arrivals and departures) to be executed. The program simply executes the event at the head of the schedule. The logic of such a simulation is 1. Start at time t = 0 with an empty system. Schedule the first arrival to occur at S1 , an exponential (λ) random variable. 2. Examine the head-of-schedule event. • When the head-of-schedule event is the kth arrival is at time t, check the state M (t). – If M (t) < c, admit the arrival, increase the system state n by 1, and schedule a departure to occur at time t + Sn , where Sk is an exponential (λ) random variable. – If M (t) = c, block the arrival, do not schedule a departure event. • If the head of schedule event is a departure, reduce the system state n by 1. 3. Delete the head-of-schedule event and go to step 2. 86 After the head-of-schedule event is completed and any new events (departures in this system) are scheduled, we know the system state cannot change until the next scheduled event. Thus we know that M (t) will stay the same until then. In our simulation, we use the vector t as the set of time instances at which we inspect the system state. Thus for all times t(i) between the current head-of-schedule event and the next, we set m(i) to the current switch state. Here is the complete program: 87 function [M,admits,blocks]=simblockswitch(lam,mu,c,t); blocks=0; admits=0; %total no. blocks and admits M=zeros(size(t)); n=0; % no. in system time=[ exponentialrv(lam,1) ]; timenow=0; tmax=max(t); event=[ 1 ]; %first event is an arrival while (timenow<tmax) M((timenow<=t)&(t<time(1)))=n; timenow=time(1); eventnow=event(1); event(1)=[ ]; time(1)= [ ]; % clear current event if (eventnow==1) % arrival arrival=timenow+exponentialrv(lam,1); % next arrival b4arrival=time<arrival; event=[event(b4arrival) 1 event(~b4arrival)]; time=[time(b4arrival) arrival time(~b4arrival)]; if n<c %call admitted admits=admits+1; n=n+1; depart=timenow+exponentialrv(mu,1); b4depart=time<depart; event=[event(b4depart) -1 event(~b4depart)]; time=[time(b4depart) depart time(~b4depart)]; else blocks=blocks+1; % one more block, immed departure disp(sprintf(’Time %10.3d Admits %10d Blocks %10d’,... timenow,admits,blocks)); end elseif (eventnow==-1) %departure n=n-1; end end In most programming languages, it is common to implement the event schedule as a linked list where each item in the list has a data structure indicating an event timestamp and the type of the event. In Matlab, a simple (but not elegant) way to do this is to have maintain two vectors: time is a list of timestamps of scheduled events and event is a the list of event types. In this case, event(i)=1 if the ith scheduled event is an arrival, or 88 event(i)=-1 if the ith scheduled event is a departure. When the program is passed a vector t, the output [m a b] is such that m(i) is the number of ongoing calls at time t(i) while a and b are the number of admits and blocks. The following instructions t=0:0.1:5000; [m,a,b]=simblockswitch(10,0.1,120,t); plot(t,m); generated a simulation lasting 5,000 minutes. Here is a sample path of the first 100 minutes of that simulation: 120 100 M(t) 80 60 40 20 0 0 10 20 30 40 50 t 60 70 80 90 100 The 5,000 minute full simulation produced a=49658 admitted calls and b=239 blocked calls. We can estimate the probability a call is blocked as P̂b = b = 0.0048. a+b (1) In the Markov Chains Supplement, we will learn that the exact blocking probability is given by the “Erlang-B formula.” From the Erlang-B formula, we can calculate that the exact blocking probability is Pb = 0.0057.One reason our simulation underestimates the blocking probability is that in a 5,000 minute simulation, roughly the first 100 minutes are needed to load up the switch since the switch is idle when the simulation starts at time t = 0. However, this says that roughly the first two percent of the simulation time 89 was unusual. Thus this would account for only part of the disparity. The rest of the gap between 0.0048 and 0.0057 is that a simulation that includes only 239 blocks is not all that likely to give a very accurate result for the blocking probability. 90