EECS 6 Probability and Random Processes University of California, Berkeley: Spring 07 Kannan Ramchandran March, 07 Midterm Exam (Solutions) Last name First name SID Name of student on your left: Name of student on your right: DO NOT open the exam until instructed to do so. The total number of points is 0, but a score of 00 is considered perfect. You have 0 minutes to read this exam without writing anything and 05 minutes to work on the problems. Box your final answers. Partial credit will not be given to answers that have no proper reasoning. Remember to write your name and SID on the top left corner of every sheet of paper. Do not write on the reverse sides of the pages. All eletronic devices must be turned off. Textbooks, computers, calculators, etc. are prohibited. No form of collaboration between students is allowed. If you are caught cheating, you may fail the course and face disciplinary consequences. You must include explanations to receive credit. Problem Part Max Points Problem Part Max Points (a) 0 5 (b) 3 0 (c) 8 4 5 (d) 0 Total 0
Problem. (a) (0 points, 4 points each part) Evaluate the statements with True or False. Give brief explanations in the provided boxes. Anything written outside the boxes will not be graded. () Given a random variable M Geom( 0 ) and i.i.d. exponential random variables X i Exp(), the distribution of the sum X + X + + X M is Erlang of order 0 with rate. True or False: False Explanation: It is exponential () Recall fountain codes as introduced in Lab 4. You would like to recover the packets x, x, x 3, x 4 and receive the following equations: x x 4 = x = x x x 3 x 4 = x 3 x 4 = The peeling decoder is able to recover all the packets that can possibly be recovered. True or False: False Explanation: An optimal decoder could recover all the packets, but peeling can recover only one
(3) Give an example of a discrete time Markov Chain which is transient and has period 3. (4) Consider a Poisson process with rate. Suppose that the 7 th arrival comes at time T. The joint distribution of the first 6 arrivals is the same as the joint distribution of U, U,..., U 6, where U i are i.i.d. U[0, T ] random variables. True or False: False Explanation: It has the joint distribution of the order statistics of 6 uniform random variables. (5) For a random variable X with a well-defined M X (s), we have: Var(X) = d ds ln M X(s) s=0 Explanation: True or False: True 3
(b) ( points) After attending an EE6 lecture, you went back home and started playing Twitch Plays Pokemon. Suddenly, you realized that you may be able to analyze Twitch Plays Pokemon. Figure : A snapshot of Twitch Plays Pokemon - (i) (6 points) The player in the top left corner performs a random walk on the 8 checkered squares and the square containing the stairs. At every step the player is equally likely to move to any of the squares in the four cardinal directions (North, West, East, South) if there is a square in that direction. Find the expected number of moves until the player reaches the stairs in Figure. Using symmetry, the 9 states can be grouped as follows. a b c b d e c e f Now, you can also observe that state d is equivalent to state c. a b c b c e c e f With the above states, one can write down the following first-step equations. T a = + T b T b = + 3 T a + 3 T c T c = + T b + T e T e = + 3 T c + 3 T f T f = 0 4
Solving the above equations gives: T a = 8, T b = 7, T c = 5, T d = Thus, the player has to make 8 moves to go downstairs on average. 5
Figure : A snapshot of Twitch Plays Pokemon - (ii) (6 points) The player randomly walks in the same way as in the previous part. Find the probability that the player reaches the stairs in the bottom right corner in Figure. Consider 9 initial states and corresponding probabilities of reaching the good stairs as follows. Using symmetry, one can obtain the following table. p q 0 p q With the above probabilities, one can write down the following first-step equations. Solving the above equations gives: p = q + q = 3 p + 3 + 3 0 p = 0.4, q = 0.3 Thus, Red is going to reach the good stairs with probability 0.4. 6
(c) (8 points) Suppose that X, X,..., X n are i.i.d. random variables and X i U[, ]. Does the sequence Y n = max{x, X,..., X n } converge in probability? If so, what does it converge to? Consider ɛ [0, ]. We see that: Pr( Y n ɛ) = Pr(max{X,..., X n } ɛ) Thus, Pr( Y n ɛ) 0 and we are done. = Pr(X ɛ,..., X n ɛ) ( = Pr(X i ɛ) n = ɛ ) n 7
(d) (0 points) Nodes in a wireless sensor network are dropped randomly according to a twodimensional Poisson process. A two-dimensional Poisson process is defined as follows: (i.) For any region of area A, the number of nodes in that region has a Poisson distribution with mean λa, (ii.) The number of nodes in non-overlapping regions is independent. Suppose that you are at an arbitrary location in the plane. Let X be the distance to the nearest node in the sensor network. Find E[X]. (Here distance between the points (x, y ) and (x, y ) is defined as (x x ) + (y y ) ) Given an arbitrary location, X > t if and only if there are no special points in the circle of radius t around the given point. The expected number in that circle is λπt, and since the number in that circle is Poisson with expected value λπt, the probability that number is 0 is e λπt. Thus Pr(X > t) = e λπt. Since X 0, we have E[X] = 0 Pr(X > t)dt = 0 e λπt dt We can look this up in a table of integrals, or recognize its resemblance to the Gaussian PDF. If we define σ = /(πλ), the above integral is E[X] = σ π 0 σ t π e σ dt = σ π = λ. 8
Problem. (5 points) Consider the continuous time Markov chain given in the figure. A 8 C 8 B (a.) (7 points) Draw a DTMC (discrete time Markov Chain) which has the same stationary distribution as the given CTMC and find the stationary distribution. 6 A 3 C 6 3 B 6 6 The flow equations are given by: 0π A = 8π B + π C π C = π A + π B 0π B = 8π A π A + π B + π C = Thus, π A = 0, π B = 8, π C = 7 9
(b.) (8 points) Let τ denote the first time the CTMC is in state C after starting from state A at time 0. Find M τ (s), the MGF of τ. Let T C, T B be the events that the first transition is to state C and state B, respectively: E[e sτ ] = E[e sτ T C ]P (T C ) + E[e sτ T B ]P (T B ) = s 5 + E[esτ ] 4 5 Where in the last equality, we note that the hitting time to state C from state A is the same as the hitting time to state C from state B. Thus, M τ (s) = s. 0
Problem 3. (0 points) (a.) (0 points) Batteries from Company X last an amount of time exponentially distributed with rate λ. The company guarantees that λ. Suppose that you have used n batteries from Company X and observed their lifetimes to be X, X,..., X n. Using Chebyshev s inequality, find the minimum n required to construct a confidence interval for the mean interval of the light bulb such that it has tolerance at most ɛ and confidence at least δ. In other words, we want to find n such that ( n i= P X i n ) λ ε δ We require ( P n ) n X i λ ε δ. i= By Chebyshev s Inequality, the above inequality will be satisfied so long as Var(n n i= X i) ε = Var(X i) nε = nλ ε δ. From our trustworthy source, we have the lower bound λ, so we are happy if we choose n 4δε. (b.) (0 points) Suppose now that you have taken 0000 samples of the batteries. With the same tolerance level ɛ, use the CLT to find your new confidence (you may again use the company guarantee that λ ). You may leave your answer in terms of Φ, the CDF of the standard normal distribution. We now assume n n i= X i N (λ, n λ ). We now seek to bound the probability of an ε -deviation from the mean: ( ) n P X i n λ ε P ( N (λ, n λ ) λ ε) i= = P ( N (0, n λ ) ε) = P ( N (0, ) ελ n) Φ( 00ε).
Problem 4. (5 points, 5 points each) There are a set of M bins and a set of balls labeled f, f,.... Let f (i) = {f j : j i mod M} be the set of balls thrown to bin i. The interarrival time between balls thrown to bin i is exponential with rate λ balls per second, and all interarrival times are independent. The situation is illustrated in Figure 3. f () f () f (3) f (M)... B B B 3 B M Figure 3: Balls throwing to bins (a.) Alice and Bob decide to play a betting game. Bob bets that there will be at least one ball in bin B after λ seconds and Alice bets that there will be at least two balls in bin B after λ seconds. What is the probability that exactly one of Bob and Alice wins money? Let E be the event that Bob wins money and E the event that Alice wins money. We are interested in P (E, E c) + P (Ec, E ). Note that P (E, E c ) is the probability that there is exactly one arrival in the first λ seconds and no arrivals in the next λ seconds, so P (E, E (c) ) = e. Additionally, P (E c, E ) is the probability that there are no arrivals in the first λ seconds, and at least arrivals in the next λ seconds, which is given by e ( e ). Thus, the probability that exactly one of them wins money is e e. (b.) Suppose that λ =. You peek into bin B i at a random time t. Let X be the difference between the time of the most recent arrival to bin B 3 and the time of the next arrival to any of the M bins. Find E[X ]. Note that by the same argument as random incidence, the time to the most recent arrival to the bin is exponential with rate, and the time to the next arrival to any bin is exponential with rate M. We are interested in X, the sum of these two random variables. We note that since they are independent, we find M X (s) as the product of the MGFs of these random variables to see that: M X (s) = ( s )( M M s ) = M M + s (M + )s We note that E[X ] = d ds M X (s) s=0. Plugging in, one sees: E[X ] = M (M + ) + M = M + M + M
Your friend finds a switch which can send balls to two consecutive bins as in Figure 4. f () f () f (3) f (M)... B B B 3 B M B Figure 4: Balls throwing to bins in the new configuration (c.) Call a bin a singleton if it has exactly one ball contained in it. number of singletons at time T? MT λe T λ, by linearity of expectation. What is the expected (d.) Suppose that your friend randomly chooses the setting on the switch so that the situation is equally likely to be that of Figure 3 and Figure 4. What is the variance of the total number of distinct balls in B and B after second? Let N be the number of distinct balls in B and B and let S be the setting of part a., S be the setting of part b. We need E[N ] and EN. First, we see that E[N ] = E[N S ]P (S ) + E[N S ]P (S ). Noting that E[N S ] = Var(N S ) + E[N S ], and the analagous setting for E[N S ], we find that E[N ] = 5 λ + 3 λ. We likewise see that E[N] = 5 λ, so Var(N) = 5 λ + 4 λ. 3
(e.) Alice and Bob decide to play a new game. They flip the switch so that the set up is as in Figure 4, but with a twist. Now, the balls in f () arrive according to a Poisson process with rate λ, but all other sets of balls ( f (), f (3),... ) arrive according to a Poisson process with rate λ. The game is as follows: Alice wins if at any point in time, B 3 contains 0 balls more than B. What is the probability that Alice wins? Note that the balls which go to both B and B 3 do not factor into the difference. Now, consider the merged Poisson process containing balls that go to B but not B 3 and the balls that go to B 3 but not B. Now, note that each arrival goes to bin λ B with probability λ+λ = 3 and to bin B 3 with probability 3. Now, set a Markov chain that tracks the difference between the number of balls in B 3 and B. Let state 0 be the starting state, state 0 the state at which Alice wins and state 0 the state at which Bob wins. The transitions are governed by P i,i+ = 3, P i,i = 3 for i = {,,..., 9} and P 0,0 =, P 0,0 =. Let p i denote the probability of hitting state 0 when starting at state 0 and note that p i = 3 p i+ + 3 p i. Additionally, one has that p 0 =, p 0 = 0. Thus, one can see that p i = i p. Thus, setting p k =, one finds that p = 9 0. Plugging in, one sees that p 0 = 0 ( 0 ). 0 4
END OF THE EXAM. Please check whether you have written your name and SID on every page. 5