Third Midterm Exam Solutions

27 April 2006

Scale was A=93, C=63.

Questions are in black, solutions are in blue.

```  Q1: 30 points
Q2: 20 points
Q3: 30 points
Q4: 20 points
Total: 100 points
```

• Question 1 (30): One kind of Roman dice, called tali, had four sides numbered 1, 3, 4, and 6 (well, I, III, IV, and VI, but never mind). This problem will deal with both fair tali, where each of the four sides has an equal probability of coming up, and unfair tali, where 1 and 4 each have probability 0.2 and 3 and 6 each have probability 0.3 -- we assume that different throws are independent. Four tali were thrown at once (we might call this throwing 4D4).

• (a,10) A Venus throw is where each of the four dice have a different number. What is the probability of a Venus throw with four fair tali? What is the probability with four unfair tali?

Of the 44 = 256 possible atomic events, 4! = 24 are Venus events. (There are 44 = 24 no-repeat sequences of four elements from the set {1. 3. 4. 6}.)

In the fair tali case, each of the atomic events are equally likely. So the probability of a Venus, by the Probability Rule, is 24/256 = 3/32 = 0.09375.

In the unfair tali case, we need to compute the probability of each of the 24 atomic events in question and add them together. Fortunately all of these probabilities are the same -- (0.2)(0.3)(0.2)(0.3) = 0.0036 -- because in each case we multiply the same four probabilities in a different order. (We can multiply because the throws of the different tali are independent events by assumption.) So the overall probability is 24(0.0036) = 0.0864.

• (b,10) What is the expected value of the sum of the numbers on the four tali? Again, answer for both fair and unfair tali.

Because expected values add, we need only find the expected score from one talus and multiply it by four. (Many of you found the expected value for only one talus, and if so I detected two points for your failure to read the question carefully.) The expected value is the sum, over all atomic events, of the value of the event times the probability of the event.

For a fair talus, the four events are equally likely, so the expected value is (1 + 3 + 4 + 6)/4 = 3.5, and the expected value of the sum of four tali is 4(3.5) = 14.

For an unfair talus, the expected value is (0.2)1 + (0.3)3 + (0.2)4 + (0.3)6 = 3.7, so the expected value of the sum of four tali is 14.8.

• (c,10) A senio was a throw of four tali that has at least one six, is not a Venus, and does not have all four sixes. Compute the number of possible senio throws and the probability (with fair tali only) of throwing a senio.

There are three ways for a throw to not be a senio, and these three events are pairwise disjoint. We could have no sixes (34 = 81 atomic events), four sixes (1 event), or a Venus (24 events as computed in (a)). This gives 106 non-senio events and thus 256 - 106 = 150 senio events. In the fair tali case all atomic events are equally likely, and so the probability of a senio is 150/256 = 75/128 = 0.5859375.

• Question 2 (20): In a strand of DNA, a codon is a sequence f three bases that causes some amino acid to be added to a protein. For our purposes, a codon is a three-letter string in the language (A + C + G + T)*.

• (a,5) How many possible codons are there?

There are 43 = 64 sequences of length 3 from a 4-element set.

• (b,5) How many of these codons have three different bases (three different letters)?

There are 43 = 24 no-repeat sequences from a four-element set.

• (c,5) How many different sets of bases might occur in a codon? (For example, the set of bases occurring in the codon ACA is {A, C}.)

We could have any set of one, two, or three bases. The number of these is (4 choose 1) + (4 choose 2) + (4 choose 3) = 4 + 6 + 4 = 14. We could also say that we could have any of the 24 = 16 sets except for the set of all four bases or the empty set, for 16 - 2 = 14 total sets.

• (d,5) How many different multisets of bases might occur in a codon? (For example, the multiset of bases occurring in the codon ACA is {A, A, C}.)

There are (4 - 1 + 3 choose 3) = (6 choose 3) = 20 multisets of size three from a four-element set. We apply the formula (n - 1 + k choose k) with n = 4 and k = 3.

• Question 3 (30): Here is a directed graph G with three vertices and five edges. Each edge is labeled by a letter (for example, edge d is a loop at vertex 3). We define the language L to be those strings in (a + b + c + d + e)* that represent paths in G.

``````
a
(1) ------------->(2)
^<--------------/ |
|       b         |
|                 |
|  e              | c
\               /
\             /
\---(3)<----/
^ \
\/
``````
• (a,15) Prove that every string in the language X = (ab + ace)* is also in L. Use induction on the definition of this language -- λ is in X, if w is in X then so are wab and wace, and no other strings are in X. (Hint: Prove that if w is in X, then there is a path labeled by w from vertex 1 to itself.)

We prove that for any string w in X, there is a path labeled by w from vertex 1 to itself.

For the base case, we take w = λ and note that there is a path of length 0, labeled by λ, from vertex 1 to itself. (Many of you said correctly that λ was the base base but then failed to give any argument that λ meets the given condition to be in L.)

For the inductive case, we let w be an arbitrary string and assume that w is in L, so that there is a path labeled by w from vertex 1 to itself. We then have to prove that both the strings wab and wace are in L, which is to say that there are paths from 1 to itself labeled by each of these two strings. For wab, there is a path that follows w from 1 to itself, then takes edge a to 2, then takes edge b to 1. So this path goes from 1 to itself and is labeled by wab. Similarly there is a path that starts at 1, takes w to 1, takes a to 2, takes c to 3, and then takes e to 1. This path is labeled by wace and goes from 1 to itself. We have completed the inductive case and thus completed the proof that all strings in (ab + ace)* are in L.

• (b,15) For each value of k in the set {0, 1, 2, 3, 4}, determine how many strings of length k are in L. (For positive k, this is the number of paths of length k in G, counting all possible start points and end points. For k = 0, look carefully at the number of strings.)

There is one string of length 0 in (a + b + c + d + e)*, and it is in L because there is a path of length 0 labeled by λ at each vertex.

For k = 1, 2, 3, and 4 there is one string for each path, and we can compute the number of paths by letting A be the adjacency matrix of G, calculating Ak using matrix multiplication over the naturals, and adding the nine entries of each matrix:

``````
A = 0 1 0   A^2 = 1 0 1  A^3 = 1 1 1    A^4 = 2 1 2
1 0 1         1 1 1        2 1 2          3 2 3
1 0 1         1 1 1        2 1 2          3 2 3
``````

Thus the number of strings for k = 1 is 5, for k = 2 is 8, for k = 3 is 13, and for k = 4 is 21. You may have noticed that these are all Fibonacci numbers, and in fact it is not hard to prove by induction that Ak is:

``````
F(k)   F(k+1)  F(k)
F(k+2) F(k)    F(k+2)
F(k+2) F(k)    F(k+2)
``````

This makes the sum of the entries (for positive k) 4F(k) + F(k+1) + 4F(k+2) = 3F(k) + 5F(k+2) = F(k+5). (Of course simply giving the numbers through k = 4 is a full-credit answer for this problem, but you should notice cases where interesting induction proofs come up.)

• Question 4 (20): Angelina and Brad are two students in the same discussion section of a computer science course. Every week, their professor divides the eleven students in their section into four groups, three of three students each and one of two students. He does this by taking eleven cards (two 2's, three jacks, three queens, and three kings) and dealing one to each of the students. The students getting cards of the same rank become a group. Assume that each of the 11! different assignments of cards to students is equally likely.

• (a,5) Of these 11! assignments, how many put Angelina in the two-person group? What is the probability that she will be in the two-person group?

We can give Angelina either of the two 2's, and then distribute the other ten cards to the other ten students in any of 10! ways. This gives 2(10!) assignments where Angelina is in the two-person group, and the probability is 2(10!)/11! = 2/11. You could also compute the probability more directly, since the probability that Angelina gets each of the eleven cards is equal, so there is a 2/11 probability that she will get one of the two 2's.

• (b,5) How many of the assignments create a two-person group consisting of Angelina and Brad? What is the probability that this happens?

There are 2! = 2 ways to assign the two 2's to Angelina and Brad, and 9! ways to assign the other nine cards to the other nine students. This gives 2(9!) assignments with Angelina and Brad as the two-person group, for a probability of 2(9!)/11! = 2/(10*11) = 1/55. Another way to get the probability is to see that each of the (11 choose 2) = 55 pairs of students is equally likely to be the two-person group, making the probability 1/55 that one particular pair is chosen. (You could then compute the number of assignments from the probability.)

• (c,10) What is the total probability that Angelina and Brad will be in the same group (that is, that they form a two-person group or are two members of some three-person group)? (Hint: There are several equally valid ways to solve this problem. It may help to think of Angelina first being dealt one of the eleven cards, with Brad then getting one of the ten remaining cards.)

The event that Angelina and Brad are together is the union of four disjoint events: they both get 2's, they both get jacks, they both get queens, or they both get kings. We get the total probability by adding the probabilities of these four individual events. In part (b) we computed the probability of their both getting 2's as 1/55. For them to both get jacks, we can think of Angelina first getting one of the three jacks (probability 3/11) and then Brad getting one of the two remaining jacks (2/10). This gives (3/11)(2/10) = 3/55 for the probability of their both getting jacks. The probabilities of both queens or both kings are each also 3/55 by exactly the same argument. So the total is 1/55 + 3/55 + 3/55 + 3/55 = 10/55 = 2/11. (As far as I can see, it is just coincidence that this equals the answer to (a).)