# Second Midterm Exam Solutions

### Directions:

• There are seven problems on pages 2-7, for 100 total points. Actual scale was A=87, C=57.

Questions are in black, solutions in blue.

• Question 1 (10): True or false with justification: A professor is making up a test with five true/false questions. He chooses whether to make each correct answer true or false independently and randomly, with equal probability for each. Let T be the number of "true" answers. Then Pr((T = 2) ∨ (T = 3)) < 3/4.

TRUE. T is a binomial random variable with n=5 and p=0.5, so the probability that T = i is B(5,0.5,i) = (5 choose i)(0.5)5. For T=2 this is (5 choose 2)/32 = 10/32, and for T=3 this is (5 choose 3)/32, also 10/32. The probability that T=2 or T=3, by the Sum Rule, is 20/32 = 5/8 < 3/4. As I mentioned during the test, I actually chose the five true/false answers this way, and they turned out to be four true and one false.

• Question 2 (10): True or false with justification: The random variable X has expected value 2, has variance 4, and always has X ≥ 0. Then the probability that X ≥ 6 must be at most 1/4.

TRUE. We might first try to prove this by Markov, but this gives us only that Pr(X ≥ 3μ) ≤ 1/3 which does not answer our question. If we apply Chebyshev, though, we get that Pr(|X - μ| ≥ 2σ) ≤ 1/22 and this proves that the statement is true.

• Question 3 (10): True or false with justification: Donuts come in four flavors, A, B, C, and D. I fill a box of 12 donuts by choosing the flavor of each uniformly and independently, so that the probability of each donut having a given flavor is 1/4. Then the probability that the box has 12 donuts of flavor A is 1/(12+4-1 choose 4-1).

FALSE. This would be true if all the multisets of donuts were equally likely, by the Fourth Counting Problem. But they are not equally likely -- the chance of twelve A's is just (1/4)12 by the Product Rule since the flavor of each donut is independent. We should verify that these two numbers are not accidently the same -- comparing the denominators, 412 = 224 is about 16 million, while (15 choose 3) = 15*14*13/1*2*3 is clearly less than 1 million (in fact it is 5*7*13=455).

• Question 4 (10): True or false with justification: The random variable Y takes one of the values in the set {2,3,4,5,6,7,8,9}, each with probability 1/8. Let A be the event that Y is odd, and B be the event that Y is prime. Then Pr(A|B) = Pr(B|A).

TRUE. Pr(A) = 1/2 because there are four odd numbers in the set, and Pr(B) = 1/2 because there are four primes. Bayes' Law tells us that P(A|B) = Pr(B|A)*Pr(A)/Pr(B), so we know without calculating either Pr(A|B) or Pr(B|A) that they are equal, because Pr(A) = Pr(B). In fact since Pr(A ∩ B) = 3/8, both Pr(A|B) and Pr(B|A) are (3/8)/(1/2) = 3/4.

• Question 5 (10): True or false with justification: Let Z be the event that a five-card poker hand, chosen from a standard deck of 52 cards with 13 cards of each suit, has at least one card from each suit. Then Pr(Z) ≥ 1 - 4(39 choose 5)/(52 choose 5). (Hint: What is the probability that the hand has no spades?)

TRUE. The probability of no spades is (39 choose 5) [the number of hands from the 39 non-spades] over (52 choose 5) [the total number of hands]. If we call this event NS, and define similar events NH, ND, and NC for the other three suits, then Z is the complement of NS ∪ NH ∪ ND ∪ NC. Each of the probabilities of these four events is (39 choose 5)/(52 choose 5), and thus by the Union Bound the probability of the union is at most 4(39 choose 5)/(52 choose 5). (Calculating it exactly would involve Inclusion/Exclusion -- you lost points if you said it was exactly 4(39 choose 5)/(52 choose 5).) Taking the complement tells us that Pr(Z) is at least 1 - 4(39 choose 5)/(52 choose 5).

We could compute the exact probability of Z by counting the hands with at least one card of each suit -- 134 ways to pick a card from each suit, times 48 ways to pick the fifth card, times 1/2 to correct for double-counting the fifth card and the other card of its suit. Then we would still have to compare 134*24 with (52 choose 5) - 4(39 choose 5).

• Question 6 (30): A party of n guests arrive at a restaurant and each person gives a hat to the hat-check person. When they leave, the n hats are randomly given to the n guests, with each of the n! one-to-one assignments of hats to guests being equally likely. Let C be the random variable indicating how many people receive their own hat.

• (a,5) Let Hi be the probability that person i gets their own hat back. What is Pr(Hi)?

Since person i is equally likely to get each of the n hats, the probability of getting the right one is 1/n.

• (b,5) If i and j are two different numbers in {1,..., n}, are Hi and Hj independent events? Prove your answer.

They are not independent. Several of you had the clever idea of looking at the n=2 case, where either both or neither of H1 and H2 are true and thus Pr(H1 ∩ H2) = 1/n, not 1/n2. In general Pr(H1 ∩ H2) is 1/n(n-1) because person 1 and person 2 are equally likely to get any of the n2 = n(n-1) ordered pairs of hats. This is not equal to Pr(H1) times Pr(H2), so the events are not independent, though note for part (e) that the difference becomes smaller as n increases.

For each i, let Ii be the random variable that is 1 if Hi occurs and 0 otherwise. Clearly E(Ii) = 1/n for each i, and C is the sum for i from 1 to n of Ii, so E(C) is n(1/n) = 1.

• (d,5) Find the probability that C = n and the probability that C = n-1.

Since exactly one of the n! orderings of the hats has C = n, the probability that C = n is 1/n!. The probability that C = n-1 is zero, because if n-1 guests each get their own hat, the only hat remaining for the other guest is her own and thus C = n rather than n-1.

• (e,10) Regardless of your answer to (b), assume for the moment that the events H1,..., Hn are independent. Under this assumption, compute the probability that C = 0. Find the limit of this probability as n goes to infinity.

C = 0 if and only if none of the events H1,..., Hn are true. Each Hi fails with probability 1 - 1/n by part (a). If we assume independence, we calculate Pr(C = 0) as (1 - 1/n)n, which we know to have a limit of 1/e as n goes to infinity.

Since the events are more and more nearly independent as n increases, the 1/e estimate is correct in the limit. In fact C approaches a standard Poisson distribution as n increases. The exact determination of Pr(C = 0) is called the derangement problem.

• Question 7 (20): James is a secret agent who has been assigned to defeat an enemy by winning \$1M (one million dollars) from him in a card game. Assume that the game consists of a series of independent hands, each of which is equally likely to be a win or a loss. James' plan is to bet \$1M on the first hand. If he wins, he will stop. Otherwise he will bet \$2M in the second hand. He will stop if he wins that hand, and otherwise bet \$4M on the third hand, \$8M on the fourth, and so on until he either wins (and stops with \$1M profit) or runs out of money. Let Gk be the random variable giving his net winnings if he has enough money to play at most k hands.
• (a,15) We can analyze the k-hand game by looking at the first hand. With probability 1/2, Gk = \$1M, and with probability 1/2, Gk = -\$1M + 2Gk-1. (This is because the second through k'th hands of the k-hand game are the same as a (k-1)-hand game with the stakes doubled.) Using this formula, prove by induction that for any k, E(Gk) = 0.

In the base case of k=0, it is clear that E(G0) = 0 because if James has only enough money to play at most 0 hands, he does not play at all and neither wins nor loses anything.

Now assume that E(Gk-1) = 0 and look at Gk. By the given formula, E(Gk) = (1/2)(\$1M) + (1/2)(-\$1M + 2E(Gk-1)) which by the IH is \$0.5M - \$0.5M + 2(0) = 0. This completes the induction and shows that E(Gk) = 0 for all k.

• (b,5) Using the result of (a) or otherwise, determine the probability of James winning or losing the k-hand game, and determine how much money he wins or loses.

We know that if he wins, James wins \$1M, and if he loses, he loses some amount Lk that depends on k. Let pk be his probability of winning the k-hand game. Because E(Gk) = 0, we know that pk(\$1M) - (1-pk)Lk = 0, so Lk (in millions) is pk/(1 - pk).

We thus need one of these two numbers to get the other. There are easy arguments to get either. James loses if and only if he loses k consecutive Bernoulli trials with success probability 1/2, which happens with probability 1/2k. This makes pk equal to 1 - 2-k. Alternatively, if James loses his total losses (in millions) are 1 + 2 + ... + 2k-1 = 2k - 1. This is Lk, and we can then verify that Lk = pk/(1 - pk).