Lahore University of Management Sciences CMPE 501: Applied Probability (Fall 2010) Homework 3: Solution 1. A candy factory has an endless supply of red, orange, yellow, green, blue and violet jelly beans. The factory packages the jelly beans into jars of 100 jelly beans each. One possible color distribution, for example, is a jar of 56 red, 22 yellow and 22 green jelly beans. As a marketing gimmick, the factory guarantees that no two jars have the same color distribution. What is the maximum number of jars that the factory can produce? Note: This is the same as asking how many different combinations (i.e. the order of the selection does not matter) can you have if you select k = 100 items with replacement from a bag containing n = 6 distinct items. Think of having a total of 100 slots for the jelly beans. The jelly beans are placed in these 100 slots in order of their color, so that we first have all the red ones (if any), then all the orange ones (if any) and so on. We also place 5 markers to seperate jelly beans of different colors. This gives us a total of 105 possible slots for the jelly beans and the markers. Each placement of the markers gives a unique distribution of colors. Two markers next to each other would mean that we do not have any beans of that particular color. E.g. The distribution above (56 red, 22 yellow and 22 green) would be represented by markers at slots number 57, 58, 81, 104 and 105. Now, the total number of ways we can place the 5 markers in the 105 slots gives us the total number of jars possible. Therefore the total number of jars possible is ( ) 105 5. 2. Two balls are chosen randomly from a bag containing 8 white, 4 black and 2 orange balls. Suppose that we win $2 for each black ball selected and we lose $1 for each white ball selected. Let X denote our winnings. Find the PMF of X. It s easy to see that the possible values of X are -2, -1, 0, 1, 2 and 4. Using the obvious notation for the color of the two balls selected: p X ( 2) = P(WW) = 8 14 7 13 = 28 1 p X ( 1) = P(OW) + P(WO) = 2 14 p X (0) = P(OO) = 2 14 1 13 = 1 1 8 13 + 8 14 2 13 = 16 1 p X (1) = P(BW) + P(WB) = 4 14 8 13 + 8 14 4 13 = 32 1 p X (2) = P(OB) + P(BO) = 2 14 4 13 + 4 14 2 13 = 8 1 p X (4) = P(BB) = 4 14 3 13 = 6 1 Page 1
3. The random variable X has the following PMF { c(1 + x) if x = 1,2,3, 4, 5 p X (x) = (a) Find the value of the constant c. We begin with x p X(x) = 1: This gives c = 1/20. (b) Find P(X 1), P(X 2) and P(X 5) p X (x) = c(2) + c(3) + c(4) + c(5) + c(6) = 1 x i. P(X 1) = p X (1) = c(1 + 1) = 1/10 ii. P(X 2) = p X (1) + p X (2) = c(1 + 1) + c(1 + 2) = 1/4 5 iii. P(X 5) = p X (x) = 1 x=1 (c) Find P(X { u : 2 u 15}) P ( X { u : 2 u 15} ) = P(X {2,3}) = p X (2) + p X (3) = c(3) + c(4) = 7/20 4. A packet communication system consists of a buffer that stores packets from some source, and a communication line that retrieves packets from the buffer and transmits them to a receiver. The system operates in time-slot pairs. In the first slot, the system stores a number of packets that are generated by the source according to a Poisson PMF with parameter λ, however, the maximum number of packets that can be stored is a given integer b, and packets arriving to a full buffer are discarded. In the second slot, the system transmits either all the stored packets or c packets (whichever is less). Here, c is a given integer with 0 < c < b. (a) Assuming that at the beginning of the first slot the buffer is empty, find the PMF of the number of packets stored at the end of the first slot and at the end of the second slot. Let X be the number of packets stored at the end of the first slot. For x < b, P(X = x) is the same as the probability that x packets are generated by the source. For x = b, P(X = x) is the same as the probability that b or more packets are generated at the source. We cannot have more than x = b packets in the buffer after slot 1. Page 2
Therefore e λλx for 0 x < b x! p X (x) = e λλx x! = 1 b 1 e λλx for x = b x! x=b x=0 0 for x > b Let Y be the number of packets stored at the end of the second slot. For all x c packets in the buffer after slot 1 we will have y = 0 packets after slot 2. For all c < x < b packets in the buffer after slot 1 we will have y = x c packets after slot 2. For x = b packets in the buffer after slot 1 we will have y = b c packets after slot 2. Therefore c p X (x) = x=0 c x=0 e λλx x! for y = 0 p X (y + c) = e λ λy+c for 0 < y < b c p Y (y) = (y + c)! b 1 p X (b) = 1 e λλx for y = b c x! x=0 (b) What is the probability that some packets get discarded during the first slot? The probability that some packets get discarded during the first slot is the same as the probability of the source generating k > b packets. This is given by k=b+1 p X (k) = 1 b p X (k) = 1 k=0 b k=0 e λλk k! 5. You just rented a large house and the realtor gave you 5 keys, one for each of the 5 doors of the house. Unfortunately, all keys look identical, so to open the front door, you try them at random. (a) Find the PMF of the number of trials you will need to open the door, under the following alternative assumptions: i. after an unsuccessful trial, you mark the corresponding key, so that you never try it again, and Let X be the number of trials needed to open the door. Let K i be the event that the ith key opens the door. So we have: p X (1) = P(K 1 ) = 1 5 p X (2) = P(K c 1)P(K 2 K c 1) = 4 5 1 4 = 1 5 p X (3) = P(K c 1)P(K c 2 K c 1)P(K 3 K c 2 K c 1) = 4 5 3 4 1 3 = 1 5 Page 3
Proceeding similarly we see that p X (k) = 1 5 for k = 1, 2,,5 We can also view the problem as ordering the keys in advance and then trying them in succession, in which case the probability of any of the five keys being correct is 1/5. ii. at each trial you are equally likely to choose any key. Let X be the number of trials needed to open the door. In this case, X is a geometric random variable with p = 1/5 and its PMF is p X (k) = 1 ( ) 4 k 1 5, k 1. 5 (b) (Optional) Repeat part (a) for the case where the realtor gave you an extra duplicate key for each of the 5 doors. i. As before, let X be the number of trials needed to open the door. Let K i be the event that the ith key opens the door. So we have: p X (1) = P(K 1 ) = 2 10 p X (2) = P(K c 1)P(K 2 K c 1) = 8 10 2 = 16 0 p X (3) = P(K c 1)P(K c 2 K c 1)P(K 3 K c 2 K c 1) = 8 10 7 2 8 = 14 0 Proceeding similarly we see that p X (k) = 2(10 k) 0 for k = 1,2,,10 We can also view the problem as ordering the keys in advance and then trying them in succession. The total number of ways we can order 10 keys is 10!. To take k trials to open the door, we have 2 possible keys for the kth position. For each of these 2 possibilities, the other (duplicate) key has to be one of the remaining 10 k keys (otherwise we would have needed less than k trails). The number of ways we can place the duplicate key in the last 10 k positions is 10 k. This gives us a total of 2(10 k) possible positions for the two correct keys. The remaining 8 keys can be placed in the remaining 8 positions in a total of 8! ways. Combining this we get: p X (k) = 2(10 k)8! 10! = 2(10 k) 0 as before. ii. As in part (a) above, the number of trails needed is a geometric random variable with p = 1/5 and its PMF is p X (k) = 1 ( ) 4 k 1 5, k 1. 5 Page 4
6. Two fair, three-sided dice 2 are rolled simultaneously. (a) Let X be the sum of the two rolls. Calculate the PMF, the expected value, and the variance of X. i. The PMF is ii. The expected value is: iii. The variance is E[X] = x = 2 = 4 1/ if k = 2 or k = 6 2/ if k = 3 or k = 5 p X (k) = 3/ if k = 4 xp X (x) ( ) 1 + 3 var(x) = E [ (X E[X]) 2] = x (x E[X]) 2 p X (x) ( ) 2 + 4 ( ) 3 + 5 ( ) 2 + 6 ( ) 1 = 1 (2 4)2 + 2 (3 4)2 + 3 (4 4)2 + 2 (5 4)2 + 1 (6 4)2 = 4/3 (b) (Optional) Repeat part (a) for the case where X is the square of the sum of the two rolls. i. The PMF is ii. The expected value is: E[X] = x = 4 = 52/3 1/ if k = 4 or k = 36 2/ if k = or k = 25 p X (k) = 3/ if k = 16 xp X (x) ( ) 1 + ( ) 2 + 16 ( ) 3 + 25 ( ) 2 + 36 ( ) 1 2 One can t really build a three-sided die, but it is nevertheless a well-defined probabilistic model. Page 5
iii. The variance is var(x) = E [ (X E[X]) 2] = x = 1 (x E[X]) 2 p X (x) ( 4 52 3 = 788/ ) 2 + 2 ( 52 3 ) 2 + 3 ( 16 52 3 ) 2 + 2 ( 25 52 3 ) 2 + 1 ( 36 52 ) 2 3 7. Consider another game played with dice. Each of two players rolls a fair, four-sided die. Player A scores the maximum of the two dice minus 1, which is denoted by X. Player B scores the minimum of the two dice, which is denoted by Y. (a) Find the expectations of X, Y, and X Y. The tables below show the 16 possible outcomes for the two dice and the values of X, Y and X Y. X Die 2 Die 1 1 2 3 4 1 0 1 2 3 2 1 1 2 3 3 2 2 2 3 4 3 3 3 3 Y Die 2 Die 1 1 2 3 4 1 1 1 1 1 2 1 2 2 2 3 1 2 3 3 4 1 2 3 4 X Y Die 2 Die 1 1 2 3 4 1-1 0 1 2 2 0-1 0 1 3 1 0-1 0 4 2 1 0-1 Since all 16 possible outcomes are equally likely, we can write the PMFs for X, Y and Z = X Y directly from the tables: 1/16 if x = 0 7/16 if y = 1 4/16 if z = 1 3/16 if x = 1 p X (x) = 5/16 if x = 2 7/16 if x = 3 Now the expected values are given by: 5/16 if y = 2 p Y (y) = 3/16 if y = 3 1/16 if y = 4 6/16 if z = 0 p Z (z) = 4/16 if z = 1 2/16 if z = 2 E[X] = x E[Y ] = y E[Z] = z xp X (x) = 17/8 yp Y (y) = 15/8 zp Z (z) = 1/4 Alternately, we could have calculated E[Z] without calculating the PMF of Z as E[Z] = E[X Y ] = E[X] E[Y ] = 17 8 15 8 = 1 4 as before. Note that this does not require X and Y to be independent. Page 6
(b) Find the variances of X, Y, and X Y. We can calculate the variance of X (and similarly Y and Z = X Y ) by using the formula: var(x) = E [ (X E[X]) 2] = (x E[X])p X (x). x We will instead use the simpler formula var(x) = E [ X 2] (E[X]) 2 Using the PMFs for X, Y and Z = X Y calculated in part (a) above we have: E [ X 2] = ( ) ( ) ( ) ( ) 1 3 5 7 x 2 p X (x) = 0 2 + 1 2 + 2 2 + 3 2 = 43 16 16 16 16 8 x E [ Y 2] = ( ) ( ) ( ) ( ) 7 5 3 1 y 2 p Y (y) = 1 2 + 2 2 + 3 2 + 4 2 = 35 16 16 16 16 8 y E [ Z 2] = ( ) ( ) ( ) ( ) 4 6 4 2 z 2 p Z (z) = ( 1) 2 + 0 2 + 1 2 + 2 2 = 1 16 16 16 16 z The variance is then given by: var(x) = E [ X 2] (E[X]) 2 = 43 ( ) 17 2 8 = 55 8 64 var(y ) = E [ Y 2] (E[Y ]) 2 = 35 ( ) 15 2 8 = 55 8 64 var(z) = E [ Z 2] ( ) 1 2 (E[Z]) 2 = 1 = 15 4 16 Note that since X and Y are not independent, var(z) var(x) ± var(y ) (or any other combination of var(x) and var(y )) and therefore we had to use the PMF of Z to calculate the var(z). 8. (Chapter 1 Problem 7): Form of the Poisson PMF. Let X be the Poisson random variable with parameter λ. Show that P(X = k) increases monotonically with k up to the point where k reaches the largest integer not exceeding λ, and after that decreases monotonically with k. See text book.. Consider a so-called binary symmetric channel shown below. The error rate is p = 0.2 meaning that the probability that a 0 (or 1) at the input will be changed to a 1 (or 0) at the output is 0.2. 0 1 p = 0.2 p = 0.2 1 p = 0.8 1 p = 0.8 0 1 Page 7
The input consists of a binary sequence of 0s and 1s, which are independent. Let E be a random variable equal to the number of errors made in the transmission of five eight-bit words (for a total of 40 binary digits). (a) What is the PMF of E? Since the probability of error for any bit (0 or 1) is 0.2, E is a binomial random variable with n = 40 and p = 0.2. The PMF of E is therefore given by: ( ) ( ) n 40 p E (k) = p k (1 p) n k = (0.2) k (0.8) (40 k) k k (b) What is the probability of at least 38 error-less digits being transmitted? P(at least 38 error-less digits) = P(E 2) = p E (0) + p E (1) + p E (2) ( ) 40 = (0.2) 0 (0.8) 40 + 0 = 0.0074 ( 40 1 ) (0.2) 1 (0.8) 3 + ( ) 40 (0.2) 2 (0.8) 38 2 (c) Let p = 5 10 8 and assume that 10 6 binary digits are transmitted per second. What is the probability of at least one error in a minute? The number of binary digits transmitted in one minute = n = 60 10 6. Optional Questions P(at least 1 error) = P(E 1) = 1 P(E < 1) = 1 p E (0) ( ) 6 10 7 = 1 (1 5 10 8 ) 6 107 0 = 0.502 1. Alice and Bob love to challenge each other to coin tossing contests. On one particular day, Alice brings 2n + 1 fair coins, and lets Bob toss n + 1 coins, while she tosses the remaining n coins. Show that the probability that after all the coins have been tossed Bob will have gotten more heads than Alice is 1/2. 2. A salesman has scheduled two appointments to sell encyclopedias. His first appointment will lead to a sale with probability 0.3, and his second will lead independently to a sale with probability 0.6. Any sale made is equally likely to be either for the deluxe model, which costs $1000, or the standard model, which costs $500. Determine the PMF of X, the total dollar value of all sales. Page 8
3. Five distinct numbers are randomly distributed to players numbered 1 to 5. Whenever two players compare their numbers, the one with the higher one is declared the winner. Initially, players 1 and 2 compare their numbers; the winner then compares with player 3, and so on. Let X denote the number of tmes player 1 is a winner. Find P(X = i) for i = 0,1, 2,3,4. 4. (Chapter 1 Problem 6): Form of the Binomial PMF. Consider the binomial random variable X with parameters n and p. Show that, as k increases, the PMF p X (k) first increases monotonically and then decreases monotonically, with the maximum obtained when k is the largest integer that is less or equal to (n + 1)p. 5. (Chapter 2 Problem 8) Justification of the Poisson approximation property Consider the PMF of the binomial random variable with parameters n and p. Show that asymptotically, as n, p 0, while np is fixed at a given scalar λ, this PMF approaches the PMF of the Poisson random variable with parameter λ. Page