# Solutions to Midterm Exam

#### 14 March 2008

```  Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 20 points
Q6: 40 points
Total: 100 points
```

Question text is in black, solutions in blue.

The four true/false questions all involve a situation where two cards are drawn, without replacement, from a standard 52-card deck, such that each pair of cards is equally likely.

• Question 1 (10): True or false with justification: The probability that the two cards have the same rank (that is, that they form a pair) is exactly 1/17.

TRUE. The simplest argument is that after the first card is chosen, 3 of the other 51 cards have the same rank and 3/51 = 1/17. If you don't notice this trick, you can still get to the right answer fairly easily. There are 13 ranks and (4 choose 2) = 6 pairs of each rank, so 13*6 = 78 total pair hands. The total number of two-card hands is (52 choose 2) = 52*51/1*2 = 26*51. Dividing 13*6 by 26*51, canceling a 13, a 2, and a 3, gives 1/17.

• Question 2 (10): True or false with justification: The chance that the hand contains one or more aces is exactly [(4 choose 2) + 4(48)]/(52 choose 2).

TRUE. There are (52 choose 2) total hands -- how many contain one or more aces? There are (4 choose 2) with two aces. The ones with one ace each contain one of the four aces and one of the 48 other cards. So by the sum rule the total number of hands with aces is (4 choose 2) + 4*48 = 198 and by the probability rule the given answer is correct.

• Question 3 (10): True or false with justification: The chance that the two cards form a flush (have the same suit) is less than the chance that they form a straight (have two adjacent ranks, i.e., A-2, 2-3, 3-4,...,Q-K, K-A). (For purposes of this question, consider a straight flush to be both a straight and a flush.)

FALSE. Someone came up with quick argument -- once you pick the first card, there are eight cards that have rank adjacent to it but 12 of the same suit as it, so a flush is more likely, not less. The straightforward argument is that the number of straights is 13 (for choosing the rank sequence) times 4 times 4 (for choosing a suit for each rank) and 13*4*4 = 208, while the number of flushes is 4 (to choose the suit) times (13 choose 2) (to choose two cards of that suit) and 4*13*12/2 = 312. So there are more flushes, not fewer.

• Question 4 (10): True or false with justification: The chance that the hand contains either one or more aces, one or more kings, or both is more than twice the probability that it contains one or more aces.

FALSE. We can answer this without computing the probabilities exactly, because clearly Pr(one or more aces) = Pr(one or more kings) by symmetry, and by Inclusion/Exclusion Pr(ace or king) = Pr(ace) + Pr(king) - Pr(ace and king). Since Pr(ace and king) is positive, Pr(ace or king) is strictly less than 2*Pr(ace), not greater. Since Pr(ace and king) = 4*4/(52 choose 2), we could compute that Pr(ace or king) = [198 + 198 - 16]/(52 choose 2), less than 2*[198/(52 choose 2)].

• Question 5 (20): Consider a game where we toss a fair coin repeatedly until we get the same result twice in a row. Let the random variable X be the total number of coin tosses including the last two that are the same -- for example, if the first two tosses are both heads then X = 2.

• (a,5) Find the probability that X = 1, the probability that X = 2, the probability that X = 3, and the probability that X = 4.

We need two tosses to get a match, so Pr(X = 1) = 0. Using 1 for heads and 0 for tails, we finish after two tosses in the cases 00 and 11, and continue if we have 01 or 10, so Pr(X = 2) = 2/4 = 1/2. For three tosses we finish after exactly three in the cases of 011 and 100, each of which has probability 1/8, so Pr(X = 3) = 2/8 = 1/4. For four tosses, we stop in the cases 0100 and 1011, so Pr(X = 4) = 2/16 = 1/8.

• (b,5) For an arbitrary positive integer n, find the probability that X = n, as a function of n. Explain your answer.

We observed above that Pr(X = 1) = 0. If n ≥ 2, there are exactly two ways to stop after n tosses -- we can have the last two results equal and all the earlier tosses alternating. (So this is 0101...011 or 1010...100 with n odd and 0101...100 or 1010...011 with n even.) The chance of any particular result of n tosses is 1/2n, so Pr(X = n) =2/2n = 1/2n-1. Another way to get this result is to note that you get to the second toss with probability 1, and after getting to the n'th toss you have exactly a 1/2 chance of getting to the n+1'st toss.

• (c,10) Compute E(X), the expected value of X.

By the definition of expected value, we get the sum for n from 2 to infinity of n/2n-1, which is 2/2 + 3/4 + 4/8 + 5/16 + ... which can be written (1 + 2/4 + 3/8 + 4/16 + ... ) + (0 + 1/4 + 1/8 + 1/16 + ...). If the original sum is S, the second is 1 + S/2 + 1/2, and S = (S+3)/2 implies s = 3.

This is obviously similar to Game A in the text (the geometric distribution) which was the number of successes before the first failure -- recall that E(A) = 1. In this game, we have the first toss, then some number of tosses opposite to the last one (successes) before the first that agrees with the last one (failure). So we get 1 for the first toss, expected number 1 for the successes, then the failure -- this totals to 3.

A third way to see this is that we have one toss to move from the start position to the "waiting" position. Then when waiting we have a 1/2 chance of counting one toss and stopping, and 1/2 chance of counting one and still waiting. This gives up E(X) = 1 + E(W), E(W) = (1/2)(1) + (1/2)(1 + E(W)), hence E(W) = 2 and E(X) = 3.

• Question 6 (40): Every U.S. dollar bill has a serial number, which has eight digits. Assume that for a random dollar bill, each of these digits is equally likely to be any number in the set {0,1,2,3,4,5,6,7,8,9}, and that the digits are independent of each other.

• (a,5) Compute the probability that the eight digits on a random dollar bill are all different.

There are 108 possible serial numbers, all equally likely (First Counting Problem). The number with no repeats is 108, by the Second Counting Problem. The probability is thus (10*9*8*7*6*5*4*3)/108, which is 1(0.9)(0,8)(0.7)(0.6)(0.5)(0.4)(0.3) = 0.018144 or a little under 2%.

• (b,5) How many possibiltities are there for the multiset of digits occurring on a dollar bill? (One example of such a multiset is "three 4's, four 8's, and on 9".)

Fourth counting problem, with k (number of elements chosen) = 8, n (number of possible elements) = 10, giving (n - 1 + k choose k) = (17 choose 8) = 17*13*11*10 (after cancellation) = 24310.

• (c,5) How many possibilities are there for the set of digits occurring on a dollar bill? (In the example above, the set would be {3,8,9}.)

Third counting problem, with n = 10, but k can be any number from 1 through 8. So we have (10 choose 1) + (10 choose 2) + ... + (10 choose 8). This is a full-credit answer, but if we want the exact number it's easier to compute 210 - (10 choose 0) - (10 choose 9) - (10 choose 10) = 1024 - 1 - 10 - 1 = 1012.

• (d,5) Compute the probability that the eight digits on a random dollar bill divide into four copies of one digit and four of another digit. (I want the total for all choices of the two digits.)

We need to choose two ranks, for which there are (10 choose 2) possibilities. Then we need to choose 4 of the eight positions for the higher-ranked digit, and there are (8 choose 4) possibilities for this. Thus there are 45*70 = 3150 four-four serial numbers, and the probability is 3150/108 = 0.00003150, about one in 32,000.

• (e,10) Compute the probability that a random dollar bill has exactly four copies of some digit. (Hint: This could happen in several ways -- the situation in (d), which we could call 4-4, but also 4-3-1, 4-2-2, 4-2-1-1, or 4-1-1-1. You might also be able to use Inclusion/Exclusion.)

Inclusion/Exclusion is actually easier. The number of sequences with exactly four 4's, for example, is (8 choose 4)1494. The desired set is the union of (exactly four 0's), (exactly four 1's),..., (exactly four 9's). This union is ten times (8 choose 4)94, minus the double-counted sequences, which are exactly the sequences counted in part (d). So we get 4592000 - 3150 = 4588850. There is no need to worry about triple-counting, etc., because no sequence of length 8 can have exactly four of more than two types of digit.

The other natural method is extending d to get:

• 4-4: 3150 as above
• 4-3-1: 10*9*8 for ranks, (8 choose 4)(4 choose 3) for positions, total 720*280 = 201600
• 4-2-2: 10*(9 choose 2) for ranks, (8 choose 4)(4 choose 2) for positions, total 360*420 = 151200
• 4-2-1-1: 10*9*(8 choose 2) for ranks, (8 choose 4)(4 choose 2)(2 choose 1) for positions, 2520*840 = 2116800
• 4-1-1-1-1: 10*(9 choose 4) for ranks, (8 choose 4)*4*3*2 for positions, total 1260*1680 = 2116800
• sum of these five cases is actually 4588500, as above

• (f,10) Let F be a random variable equal to the number of 4's on a random dollar bill. Compute the expected value of F. Compute the variance of F.

Each digit is a Bernoulli trial, as it is independently a 4 with probability 1/10. So the expected value is np = 8/10, and the variance is np(1-p) = 72/100.