CS20 Spring 2022 Final Review Questions Zad Chin April 14, 2022 Problem 1. Prove A → B ≡ ¬A ∨ B. Solution : First, let’s consider the truth table for A → B. If A is true, then B must also be true. If A isn’t true, then we do not require that B be either true or false. A ⊤ ⊤ ⊥ ⊥ A→B ⊤ ⊥ ⊤ ⊤ B ⊤ ⊥ ⊤ ⊥ Next, let’s write out the truth table for ¬A ∨ B. A ⊤ ⊤ ⊥ ⊥ ¬A ∨ B ⊤ ⊥ ⊤ ⊤ B ⊤ ⊥ ⊤ ⊥ Since the truth tables are identical, we can conclude that the two expressions are equivalent. Problem 2. Prove by truth table that A → B ̸≡ B → A Solution : A ⊤ ⊤ ⊥ ⊥ A ⊤ ⊤ ⊥ ⊥ B ⊤ ⊥ ⊤ ⊥ A→B ⊤ ⊥ ⊤ ⊤ B→A ⊤ ⊤ ⊥ ⊤ B ⊤ ⊥ ⊤ ⊥ Since the truth tables differ for two assignments of truth values to propositions, the two propositions are not equivalent. 1 Problem 3. Put the following formula in conjunctive normal form: (¬(p ⊕ q)) → r. Solution : We should remove the → immediately, and then remove the double negation, which leaves (p ⊕ q) ∨ r. This expands to ((p ∨ q) ∧ ¬(p ∧ q)) ∨ r ≡ ((p ∨ q) ∧ (¬p ∨ ¬q)) ∨ r, using De Morgan’s Laws. Finally, we can use the distributive property of Or to reduce the expression to (p ∨ q ∨ r) ∧ (¬p ∨ ¬q ∨ r), which is in CNF. Problem 4. Put the following formula in disjunctive normal form: p ∨ (q → p) Solution : p ∨ (q → p) ≡ p ∨ (¬q ∨ p) ≡ p ∨ ¬q. This is in conjunctive and disjunctive form, since it only has one clause! Problem 5. Prove the statement: ”The integer 3n + 2 is odd if and only if the integer 9n + 5 is even, where n is an integer Solution : Suppose that 3n + 2 is odd, so that 3n + 2 = 2k + 1, for some k. Multiply both sides by 3 and subtract 1, obtaining 9n + 5 = 6k + 2 = 2(3k + 1), this shows that 9n + 5 is even. Then we prove the converse by contrapositive. suppose that 3n + 2 is not odd, then 3n + 2 = 2k, for some integer k. Then, multiply both sides by 3 and subtract 1, obtaining 9n + 5 = 6k − 1 = 2(3k − 1) + 1. This shows that 9n + 5 is odd. Problem 6. Disprove the statement ”For every positive integer n, n2 > 2n”. Solution : n=1 is a counterexample √ Problem 7. Prove that if x is irrational and x ≥ 0, then x is irrational. √ Solution : Proof by contrapositive: If x is rational, √ then x is rational, assuming that x ≥ 0. Suppose that sqrtx = p/q is rational, where q ̸= 0. Then, x = ( x)2 = (p/q)2 is also rational, again q 2 ̸= 0. Problem 8. Prove: The set of prime number is countably infinite Given that the Prime Numbers are a subset of the Natural Numbers and (by definition) the latter are countably infinite, the Primes cannot be uncountably infinite; their cardinality must be less than or equal to that of N. By Euclid’s proof there are infinitely many primes, therefore there can only be countably infinitely many primes. Solution : Problem 9. Prove: if A, B, and C are sets and B ⊂ C, then (A ∪ B) ∩ C = (A ∩ C) ∪ B Solution : To show that (A ∪ B) ∩ C ⊂ (A ∩ C) ∪ B. Let x ∈ (A ∪ B) ∩ C, then x ∈ C, and either x ∈ A or x ∈ B. If x ∈ A, then x ∈ A ∩ C ⊂ (A ∩ C) ∪ B. If x ∈ B, then again x ∈ (A ∩ C) ∪ B. To show that (A ∩ C) ∪ B ⊂ A ∪ B) ∩ C, let x ∈ (A ∩ C) ∪ B. Then, x ∈ B or x ∈ C. If x ∈ B, then x ∈ A ∪ B, and since B ⊂ C, x ∈ C, so x ∈ (A ∪ B) ∩ C. If x ∈ A ∩ C, then x ∈ A ⊂ A ∪ B, and x ∈ C, so x ∈ (A ∪ B) ∩ C. Problem 10. Prove a ≡ b (mod n) and c ≡ d (mod n) implies a − c ≡ b − d (mod n) Solution : Since a ≡ b, n | a − b and since c ≡ d, n | c − d. Because both a − b and c − d are evenly divisible by n, they are congruent, so a − b ≡ c − d. Because a − b ≡ c − d, we have that n | (a − b) − (c − d). Rewriting gives n | (a − c) − (b − d), which implies that a − c ≡ b − d. Problem 11. For the integers, it is true that ∀a, b ∈ Z.ab = 0 → (a = 0 ∨ b = 0). Prove or disprove this property for Zn . Solution : Consider Z12 . [3] · [4] = [12] = [0], but [3] ̸= [0] and [4] ̸= [0]. So it is not the case that ∀a, b ∈ Zn .[a] · [b] = [0] → ([a] = [0] ∨ [b] = [0]). ■ 2 Problem 12. Define a function f : [ 41 , 3] → [0, 1] where the intervals are on the real number line as follows: f (x) = 4x − 1 2x + 5 Prove that f is a bijection. Solution : We show that f is a bijection we show that it is one-to-one and onto. First we show that it is one-to-one. Suppose that f (x) = f (y), we need to show that x = y. Then, 4y−1 by definition of f : 4x−1 2x+5 = 2y+5 . Multiplying both sides by the denominators gives: (4x − 1)(2y + 5) = (4y − 1)(2x + 5). Multiplying out gives 8xy − 2y + 20x − 5 = 8xy − 2x + 20y − 5. Subtracting 8xy + 5 from both sides gives 20x − 2y = 20y − 2x. Grouping xs and y produces 22x = 22y, and therefore x = y. We now show that it is onto. Let y be an arbitrary real number in the interval [0, 1]. We show that there 5y+1 exists an x ∈ [ 14 , 3] such that f (x) = y. Let x = 4−2y . Since y is between 0 and 1, the numerator can be at most 6 and at least 1. The denominator can be at most 4, and at least 2. So the largest value x could be is 3 and the smallest it could be is 14 . Thus we’ve found an x such that f (x) = y for any y in the co-domain and verified that it is in the domain, so f is onto. Since f is both one-to-one and onto, f is a bijection. Problem 13. Relation R is defined as follow : R = {(x, y) ∈ Z|x = y (mod m)}. Prove that R is equivalence relation. Solution : To prove that it is equivalence, we need to show that it is reflexive, transitive and symmetric. Reflexive: By definition, x ≡ y (mod m) if an donly if m divides x − y. And x − x = 0 is divisible by m because 0 = 0 × m. Hence x ≡ x( (mod m)), showing that R is reflexive. Symmetry: If x ≡ y (mod m) then x − y is divisble by m, so x − y = km, where kis some integer. And this follows that y − x = −k(m), so y ≡ x (mod m). Thus, R is symmetric. Transitive: If x ≡ y (mod m) and y ≡ z (mod m), then m divides both x − y and y − z. By definition, x − y = km and y − z = lm, for some integer k and l. Therefore, resolving both equations, we get that: y = x−km and y = lm+z, which follows that x−km = lm+z, which shows that x−z = km+lm = m(k+l). Thus, x ≡ z (mod m). Therefore Relation R is an equivalence relation. Problem 14. Show that if we take n + 1 numbers from the set {2, 3, . . . , 2n, 2n + 1}, then some pair of numbers will have no prime factors in common. Solution : No pair of consecutive numbers in the set share a common divisor. So let the pigeonholes be pairs of consecutive numbers {2, 3}, {4, 5}, . . . , {2n, 2n + 1}. There will be n of these pigeonholes since the set contains 2n numbers. So if we select n + 1 numbers and map them each to the pigeonhole that contains them, we’ll have at least one pigeonhole with two numbers in it, and these will share no common divisors. B = {{p, p + 1} : (2 ≤ p ≤ 2n + 1) ∧ p ≡ 0 (mod 2)} A is any n + 1 distinct elements drawn from {2, 3, . . . , 2n, 2n + 1} f : A → B is defined as f (a) = b iff a ∈ b. |B| = n and |A| = n + 1 To see that two consecutive numbers share no common factor greater than 1, let m be a common divisor of two arbitrary consecutive integers a and a + 1. By definition of divisibility, m|a and m|a + 1. Since m divides a and a + 1, m|a + 1 − a, so m|1. No number larger than 1 can divide 1, so a and a + 1 share no common divisors larger than 1. √ Problem 15. Show that 3 is irrational Solution : Proof by contradiction: Refer In class problem 13. 3 Problem 16**. Suppose that the 10 integers 1, 2, . . . , 10 are randomly positioned around a circular wheel. Show that the sum of some set of 3 consecutively positioned numbers is at least 17. Solution : Let ai denote a label in the range [1..10]. For the purpose of contradiction, assume that the sum of any consecutive sectors is ≤ 16. Hence, a1 + a2 + a3 ≤ 16 a3 + a3 + a4 ≤ 16 a3 + a4 + a5 ≤ 16 ... a10 + a1 + a2 ≤ 16. 10 X ai ≤ 10 × 163 × (1 + 2 + 3 + ... + 10) ≤ 160165 ≤ 160 i=1 A contradiction arise. Therefore, the statement must be true. Problem 17. Prove that every bounded (above) increasing sequence of natural numbers is finite. Solution : Proof. The proof is by Well Ordering Principle. Let b0 , b1 , b2 , · · · be a bounded (above) increasing sequence of natural numbers. Let U be an upper bound of our sequence. So U ∈ N. By way of contradiction, suppose out sequence is infinite. Consider the set A defined by A = {n : n = U − bi for some i ∈ N} (i.e., A is the set of all numbers of form U − bi ). A ⊆ N because each bi ≤ U. Also, A is nonempty because U − b0 ∈ A. Thus by PWO, A has a minimum element. Let m be a minimum element of A. Then m = U − bj for some j ∈ N. Now consider m′ = U − bj+1 . By definition of A, we have m′ ∈ A. Also, m′ = U − bj+1 < U − bj [since sequence is increasing, bj+1 > bj ] = m. Thus m′ < m, which contradicts m being a minimum element of A. Therefore the sequence b0 , b1 , b2 , · · · is finite. Problem 18. Prove by well-ordering that every positive integer greater than one can be factored as a product of primes. Solution : In class problem 15 Problem 19. Prove that 2n < n! for all integers n ≥ 4. Solution : In class problem 16 Problem 20. Prove that in any list of n integers, there must be two integers for which the difference between them is divisible by n − 1 . Hint: Think about modular arithmetic. Solution : We use the pigeonhole principle. There are n − 1 possible remainders on dividing an integer by n − 1 . Let these be the pigeonholes. There are n integers. Let these be the pigeons. Map each n to its remainder when divided by n − 1 . Since there are more pigeons than pigeonholes, two numbers must have the same remainder. Since these two numbers have the same remainder when divided by n − 1 , their difference will be divisible by n − 1 . Problem 21. Consider the function f : N → N defined recursively as follows. ( n if 0 ≤ n ≤ 2 f (n) = 3f (n − 2) + 2f (n − 3) if n > 2 Prove that f (n) < 2n for all n ∈ N. Solution : Base Cases: Let n = 0. Then f (n) = 0 [definition of f ] < 1 = n = 1. Then f (n) = 1 [definition of f ] < 2 = 21 = 2n as wanted. Let [definition of f ] < 4 = 22 = 2n as wanted. INDUCTION STEP: Let n whenever 0 ≤ j < n. [IH] WTP: f (n) < 2n . f (n) = 3f (n − 2) + 2f (n − 3) < 3 · 2n−2 + 2 · 2n−3 [IH; 0 ≤ n − 3 < n − 2 < n] = 6 · 2n−3 + 2 · 2n−3 [express = 8 · 2n−3 = 2n as wanted. 4 20 = 2n as wanted. Let n = 2. Then f (n) = 2 > 2. Suppose f (j) < 2j [definition of f ; n > 2 ] using common term 2n−3 ] Problem 22. Prove by induction the binomial theorem, which says that n X (1 + x)n = Ckn xk . k=0 Solution : Induct on n. For n = 0, we can verify that the left side of the above equation is (1 + x)0 = 1. On the other hand, the right side of the above equation is 0 X Ck0 xk = C00 x0 = 1, k=0 so both sides of the equation agree, and the binomial theorem holds in the base case. Assume the binomial n theorem holds for some arbitrary n. Then, since Ckn + Ck−1 = Ckn+1 (3.5), we have (1 + x)n+1 = (1 + x)(1 + x)n = (1 + x)n + x(1 + x)n n n X X = Ckn xk + x Ckn xk = k=0 n X k=0 Ckn xk + k=0 n X Ckn xk+1 k=0 = C0n x0 + = C0n x0 + n X k=1 n X Ckn xk + = C0n+1 x0 + n Ck−1 xk k=1 Ckn xk + k=1 = C0n+1 x0 + n+1 X n X k=1 n X n X n Ck−1 xk + Cnn xn+1 k=1 k n+1 n+1 n Ckn + Ck−1 x + Cn+1 x n+1 n+1 Ckn+1 xk + Cn+1 x k=1 = n+1 X Ckn+1 xk , k=0 so the binomial theorem holds for n + 1, and the inductive step is proven. Hence, by induction, the binomial theorem holds for all n ≥ 0. Problem 23. Prove using strong induction that for all n ∈ N such that n ≥ 2, n is divisible by a prime. (Hint: Split the inductive step into cases based on whether n+1 is prime or composite.) Solution : In-class problem 17 5 Problem 24. Let fn be the Fibonacci numbers, defined by f0 = 0, f1 = 1, fn = fn−1 + fn−2 for n > 1. Prove that fn ≡ 2n3n (mod 5) Solution : Problem 25. Let T be a tree and e a new edge between two vertices of T. Explain why T + e must contain a cycle. Solution : Midterm Summer 2020 Call the vertices e connects u and v, so e = {u, v}. Since trees are connected by definition, there must have been a path of length greater than 1 between u and v. (It has to have been greater than 1 or the edge {u, v}would already be in the tree.) So adding e creates a cycle, connecting the end of that path back to the beginning. Problem 26. Prove that all graph G = (V, E) that has no cycles satisfies |V | = |E| + 1, ie it is a tree. Solution : Let G be a graph that satisfies the conditions above. We will show that G is minimally connected, and thus a tree. Consider G with all |E| edges deleted, and add these edges back to the graph one by one in an arbitrary order. At each of these edge additions, the number of connected components of the graph decreases by 1, for if this were not the case, the edge added would complete a cycle in G. Hence, at the start, the graph has |V | connected components, after |E| − 1 = |V | − 2 edge additions, the graph has 2 connected components, and after |E| = |V | − 1 edge additions, the graph (which is now G) has exactly 1 connected component. This shows minimal connectedness, as proposed. 6 Problem 27. Prove that if G is a connected graph on n vertices, then G has at least n − 1 edges. Solution : Solution 1: Proof by Contrapositive We prove the contraposition that if G has at most n − 2 edges, then G is not connected. We do so by proving the following stronger claim. The contraposition above is the case m = n − 2, in which case G has at least n − (n − 2) = 2 connected components, which means G is not connected. Solution 2: Proof with Induction Fix n ≥ 1. We prove the claim using induction on m. The base case m = 0 is true because if G has no edges, then it has n connected components. Assume the claim holds for some 0 ≤ m ≤ n − 2. Now for the inductive step, let G be a graph with m + 1 edges. Remove an arbitrary edge {u, v} from G. The resulting graph G′ has m edges, so by inductive hypothesis it has at least n − m connected components. Now add the edge {u, v} to get back G. Note that adding the edge {u, v} connects at most two connected components together (namely, the component where u lies, and the component where v lies, but these may be the same component). Therefore, letting Connected (G) denote the number of connected components of G, we conclude that Connected (G) ≥ Connected (G′ ) − 1 ≥ n − m − 1 = n − (m + 1) where in the second inequality above we have applied the inductive hypothesis. This completes the proof. Problem 28. For which values of n does the complete graph on n vertices have an Euler circuit? Solution : “A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree.” In Kn , each vertex is connected (once) to the n − 1 other vertices and thus has degree n − 1. Thus the condition is that n be odd. You might want to consider what happens when n = 1 and the graph has no edges. Problem 29. Prove or disprove: There exists a simple graph with 6 vertices and 5 edges such that G has an Euler circuit. Solution : Notice that G is not required to be connected. Those who noticed this and were confident that they knew the definition of an Euler circuit (a circuit which visits every edge of the graph exactly once, but not necessarily every vertex), can prove it by giving the example of a disconnected graph, such as the union of a 5-cycle and a single isolated vertex. This graph indeed has 6 vertices and 5 edges, and a circuit which traverses each edge exactly once. Problem 30. Prove by induction on k that every simple graph with n vertices and k edges has at least n − k connected components. Solution : We proceed by induction. Fix n ≥ 1 and let P (k) be the statement that every simple graph with n vertices and k edges has at least n − k connected components. We will show that P (k) is true for all k ≥ 0. Basis Step: P (0) says that a graph with no edges has n connected components, and this is true since each vertex is its own connected component. Inductive Step: Assume P (k) is true. Let G be a graph with n vertices and k + 1 edges. Let e = uv be an arbitrary edge of G, and let G′ = G − e be the graph obtained by deleting e. Let G1 , . . . , Gℓ be the connected components of G′ and note that ℓ ≥ n − k by the inductive hypothesis. Notice that if u and v are in the same connected component of G′ , then adding it does not change the connected components, so in this case G also has ℓ connected components. On the other hand if u ∈ Gi and v ∈ Gj for some i ̸= j then Gi ∪ Gj is a connected component of G, since there is a path from every x ∈ Gi and y ∈ Gj by concatenating a path from x to u, the edge uv, and a path from v to y. The other connected components of G′ remain connected components in G. Thus, the number of connected components decreases by at most one upon adding e, so the number of connected components in G is at least ℓ − 1 = n − k − 1 = n − (k + 1), as desired. 7 Problem 31. For each of the following pairs of functions f (x) and g(x), write a statement of the form f (x) = X(g(x)) where X is both correct and the most informative choice among O, o, Ω, ω, Θ. Justify your answer by taking a limit or using the definition. (A) f (x) = 2 log3 x, g(x) = log2 x3 (B) f (x) = 2x , g(x) = 3x (C) f (x) = x5 + 2x4 , g(x) = 16x4 + 100x3 + 4x2 + 1000 Solution : 2 log3 x 2 log2 x log3 x 2 (A) limx→∞ 2log 3 = 3 log x = (log 3)(3 log x) = (3 log 3) < ∞ Since both the limit and its reciprocal are 2x 2 2 2 2 constants less than infinity, f (x) = Θ(g(x)). x x (B) limx→∞ 23x = 23 = 0 Since the limit is 0, f (x) = o(g(x)). (C) limx→∞ x5 +2x4 16x4 +100x3 +4x2 +1000 = 16x4 x4 4 x5 + 2x x4 x4 100x3 4x2 + x4 + x4 + 1000 x4 = x+2 16+0+0+0 = x Since the limit is infinite, f (x) = ω(g(x)) Problem 32. a. Rank the following functions by order of growth; that is, find an arrangement g1 , g2 , . . . , g30 of the functions g1 = Ω (g2 ) , g2 = Ω (g3 ) , . . . , g29 = Ω (g30 ). Partition your list into equivalence classes such that functions f (n) and g(n) √ are in the 2same class if and only if f (n) = Θ(g(n)). n n! (lg n)! lg (lg∗ n) 2lg n ( 2)lg n 2 3 n 3 2n n lg n lg(n!) 2 n1/ lg n 2 ∗ n lg lg n lg lg n lg n n·2 n lg n √1 lg n 2lg n (lg√n)lg n en 4lg n (n + 1)! n+1 lg∗ (lg n) 2 2 lg n n 2n n lg n 22 b. Give an example of a single nonnegative function f (n) such that for all functions gi (n) in part (a), f (n) is neither O (gi (n)) nor Ω (gi (n)). Solution : (a) 8 2{ 2n+1 } 22 n (n + 1)! n! en n · 2n 2n (3/2)n (lg n)lg n = nlg lg n (lg n)! n3 n2 = 4lg n n lg n and lg(n!) n = 2lg n √ √ ( 2)lg n (= n) √ 2 2 lg n lg2 n ln n p lg n ln ln n 2lg n lg∗ n and lg∗ (lg n) lg (lg∗ n) n1/ lg n (= 2) and 1 (b) ( n+2 22 f (n) = 0 if n is even if n is odd for all functions gi (n) in part (a), f (n) is neither O (gi (n)) nor Ω (gi (n)). Problem 33. Show that the harmonic series 1 + 1 2 + 1 3 + · · · is divergent, even though limn→∞ an = 0. Solution : We observe that the first term in the harmonic series (1) is greater than 12 , while the next two terms in the harmonic series ( 12 and 13 ) are each greater than 14 , while the next four terms in the harmonic series are each greater than 81 , and so on. In general, then, we have that for the harmonic series: ∞ X 1 i=1 i >1+ 1 1 1 1 1 1 1 + ( + ) + ( + + + ) + ··· 2 4 4 8 8 8 8 ∞ X 1 i=1 i >1+ 1 1 1 + + + ··· 2 2 2 We know that the series on the right-hand side of the inequality diverges since limn→∞ an = the Comparison Test it is also true that the harmonic series diverges. Problem 34. Solve the following recurrence: T (n) = 2T (n − 1) + 3 ; T (1) = 1 9 1 2 ̸= 0, so by Solution : (a) Unrolling, we get T (n) = 2T (n − 1) + 3 = 2(2T (n − 2) + 3) + 3 = 2(2(2T (n − 3) + 3) + 3) + 3 = 23 T (n − 3) + 22 · 3 + 2 · 3 + 3 = 24 T (n − 4) + 23 · 3 + 22 · 3 + 2 · 3 + 3 ··· = 2i T (n − i) + i−1 X 3 2k k=0 We reach the base case when n − i = 1 That is, when i = n − 1. So, substituting i = n − 1 and T (1) = 1 into the above formula, we get: T (n) = 2n−1 + n−2 X n−2 X 3 2k = 2n−1 + 3 2k = 2n−1 + 3 2n−1 − 1 = 4 2n−1 − 3 = 2n+1 − 3 k=0 k=0 Problem 35. Count the number of ways to deal hands of 7 cars to each 5 players, from a deck of 52 cards, leaving 17 cards not dealt Solution : 52 7,7,7,7,7,17 Problem 36. More Cards Counting Problem: (a) How many poker hands consist of 2 Aces and 3 Kings? (b) How many Poker hands have three cards from one denomination and two from another (a full house)? (c) A royal flush is a hand consisting of an Ace, King, Queen, Jack and Ten, where all cards are from the same suit. How many royal flushes are possible? (d) A flush is a hand consisting of five cards from the same suit. How many different flushes are possible? Solution : (a) 42 × 43 (b) There are 13 ways to pick the first denomination. Then are then 43 ways to pick 3 cards of that denomination. There are 12 ways to pick the second denomination and then 42 ways to pick 2 cards of that denomination. Hence there are 13 × 43 × 12 × 43 = 3, 744 (c) There is exactly 1 way to pick a royal flush in each suit so there are 413of them 4 (d) There are 13 5 ways to get all cards of the same suit so there are 5 × 1 = 1, 287 · 4 = 5, 148 flushes. Problem 37. At a party, 15 married couples are seated at random at a round table. Suppose that of these married couples, 5 husbands and their wives are older than fifty and the remaining husbands and wives are all younger than fifty. What is the probability that all men over fifty are sitting next to their wives? Solution : We have five couples that need to be seated next to one another. So for now, let us think of each of these couples as a single person. This means that we have twenty five people. The number of ways to seat them at a round table is 24!. Now, for every elderly couple we have two different ways to seat them wife next to husband, and hence the total number of ways is 24! × 25. Dividing by 29! yields the answer. Problem 38. The coefficients of x7 in the polynomial (2x − 3)10 Solution : By the binomial theorem, we get that 10 7 2 (−3)3 7 10 Problem 39. January 1, 1999 was a Friday. Find the probability that a randomly chosen person born in 1999 was born on a Monday. Assume that there are 365 days in 1999 and there are equally likely as birthdays. Solution : 365 = 52 × 7 + 1, so each day of the week occurs 52 times in the year, except for one which occues 53 times. The excess day is the first and last day, where in this case, Friday. Hence, P (Born on Monday) = 52 365 Problem 40. A shop has eight flavors of donuts. Only 4 raisin donuts and 6 strawberry donuts are available. Each of the other six flavors is available in an unlimited amount. How many different assortments of 20 donuts can you order? Solution : First term is choices with no restrictions; Substract terms for ≥ 5 raisins and ≥ 7 strawberry, add back term for ≥ 5 raisins and ≥ 7 strawberry; Thus: 27 22 20 15 − + − 20 15 13 8 Problem 41. What is the probability that a 5-card poker hand has at least two face cards? (The face cards are the jacks, queens and kings. Thus there are 12 face cards in a standard 52-card deck.) Solution : We can calculate: (a) the number of poker hands in total, (b) the number of poker hands with no face cards at all, and (c) the number of poker hands with exactly one face card. The answer will be 52 (a) − (b) − (c), divided by (a). The 2 number of poker hands is ; similarly, the number of poker 5 40 hands that avoid the 12 face cards is . The number of hands that have exactly one face card is 5 40 12 · · (You choose a face card and then choose four non-face cards.) Thus the number of hands with 4 at least two face cards is 52 40 40 − − 12 · = 844272 5 5 4 52 Divide this by to get the answer. 5 Problem 42. Suppose that you are reading in a binary string, one character at a time. The first character is equally likely to be a 0 or a 1. Afterwards, the probability of reading a 1 given that the previous character is a 1 is 0.4, and the probability of reading a 1 given that the previous character is a 0 is 0.8. (a) What is the probability of reading 01? (b) What is the probability of reading 1001? Solution : (a) P (initially reading 0) ∗ P (reading 1 | read 0) = .5 ∗ .8 = .4 (b) P (initially reading 1) ∗ P (reading 0 | read 1) ∗ P (reading 0 | read 0) ∗ P (reading 1 | read 0) = .5 ∗ .6 ∗ .2 ∗ .8 = .048 Problem 43. Before going on vacation for a week, you ask an unreliable friend to water your ailing plant. Without water, the plant has a 90 percent chance of dying. With water, it has a 20 percent chance of dying. The probability that your friend will forget to water it is 30 percent. (a) What is the probability that your plant will be dead at the end of the week? (b) If the plant is dead when you return, what is the probability that your friend forgot to water it? 11 Solution : (a) We are looking for p(E), which is the denominator p(E | F )p(F ) + p(E | F̄ )p(F̄ ) in the second fraction above. The two summands in this expression correspond to these two situations: your friend forgot to water it and it died, and your friend remembered to water it and it died. Now p(E | F ) = 0.9, p(E | F̄ ) = 0.2, p(F ) = 0.3, p(F̄ ) = 0.7. Thus p(E) = 0.9 · 0.3 + 0.2 · 0.7 = 0.41 (b) This is p(E | F ) = 0.9·0.3 0.41 = 27/41. Numerically, the probability is about 66%. Problem 44. Pavel has a bag of ten coins. Nine are fair coins, the tenth has heads on both sides. Pavel draws a coin at random from the bag and flip it. If the coin comes up heads, what is the probability that the coin Pavel drew was the two-headed coin? Solution : Let E be the event that Pavel draws a 2-headed coin. Let F be the event that the drawn and flipped coin comes up head We want to find P (E|F ). We know that P (F |E) = 1 since 2-headed coin must come up with head and P (F |E) = 1/2 since other coins are fair and P (E) = 1/10. Using Bayes Rule, we get that: P (F |E)P (E) P (F |E)P (E) + P (F |E)P (E) 1 × 1/10 = 1 × 1/10 + 1/2 × 9/10 2 = 11 P (E|F ) = Problem 45. In the 1950s, brightly colored Fiestaware plates were a popular household item. Some of them were fired with radioactive glazes to achieve bright colors, and these have become valuable collectibles. (The Harvard Science Center owns one that is used for physics demonstrations.) At a flea market you find a dozen Fiestaware plates for sale. The merchant tells you that four of them are radioactive but that he does not know which they are. You choose two of them to purchase, the merchant wraps them up for you, and you rush to the Science Center to borrow a Geiger counter, which reveals that your parcel contains at least one valuable radioactive plate. Using Bayes’ rule, derive a simple formula for P (A ∩ B | A ∪ B), and use it to answer the question: What is the conditional probability that both your plates are radioactive, given that at least one of them is? Solution : P (A ∩ B | A ∪ B) = = = = = P (A ∪ B | A ∩ B)P (A ∩ B) P (A ∪ B) P (A ∩ B) P (A ∪ B) P (A ∩ B) P (A ∩ B) + P (A ∩ B) + P (A ∩ B) 4 3 12 · 11 4 3 4 8 8 4 12 · 11 + 12 · 11 + 12 · 11 3 19 12 Problem 46. You hold a share of stock in a student-run company ColdX that has invented a drug that cures the common cold. Tomorrow the FDA is going to rule on whether the company can start clinical trials. If they rule “Yes,” your share will be worth $60; if they rule “No,” your share will be worth $20. Shares of ColdX are trading at $30. So the value of a ColdX share is a random variable X, and the market thinks that the expectation of X is $30. (a)Determine the probability mass function for X, assuming that the market has priced ColdX shares fairly. (b) A “call option” on ColdX gives its owner the right (but not the obligation) to purchase a share of ColdX for $40 after the FDA issues its ruling. The value Y of this option is also a random variable. Show that its expectation, which is the fair price of the option, is $5. Solution : (a) We solve a system of 2 equations to find our 2 unknowns. 1. E(X) = 20P (X = 20) + 60P (X = 60) = 30 2. P (X = 20) + P (X = 60) = 1 P (X = 20) = 43 , P (X = 60) = 1 4 (b)Note that if you chose to buy this option, you would only buy a ColdX share if the FDA ruled Yes and the value of the share rose to $60. In this case, you would have gained $20 since you bought the share at $40 but could sell it for $60. E(Y )P (X = 60) = 20 14 = 5. 13