Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Cmput 272 Winter 2005 Assignment 2 Solutions Posted: Wed, Jan 19 Due: Thurs, Mar 3 / Fri, Mar 4 at beginning of class Reading: Chapters 2.2, 2.3, 2.4, 2.5, 3.1, 3.2, 3.3, 3.4 Department of Computing Science University of Alberta Question 1. [Exercises 2.2 # 6] Negate each of the following and simplify the resulting statement. (a) p ∧ (q ∨ r) ∧ (¬p ∨ ¬q ∨ r) Answer: ¬[p ∧ (q ∨ r) ∧ (¬p ∨ ¬q ∨ r)] ⇐⇒ [¬p ∨ ¬(q ∨ r) ∨ ¬(¬p ∨ ¬q ∨ r)] ⇐⇒ [¬p ∨ (¬q ∧ ¬r) ∨ (p ∧ q ∧ ¬r)] ⇐⇒ [(¬q ∧ ¬r) ∨ [¬p ∨ (p ∧ q ∧ ¬r)]] ⇐⇒ [(¬q ∧ ¬r) ∨ [(¬p ∨ p) ∧ (¬p ∨ (q ∧ ¬r))]] ⇐⇒ [(¬q ∧ ¬r) ∨ [T0 ∧ (¬p ∨ (q ∧ ¬r))]] ⇐⇒ [(¬q ∧ ¬r) ∨ (¬p ∨ (q ∧ ¬r))] ⇐⇒ [¬p ∨ ((¬q ∧ ¬r) ∨ (q ∧ ¬r))] ⇐⇒ [¬p ∨ (¬r ∧ (q ∨ ¬q))] ⇐⇒ [¬p ∨ ¬r]. (b) (p ∧ q) → r Answer: ¬[(p ∧ q) → r] ⇐⇒ ¬[¬(p ∧ q) ∨ r] ⇐⇒ [(p ∧ q) ∧ ¬r]. (c) p → (¬q ∧ r) Answer: ¬[p → (¬q ∧ r)] ⇐⇒ [p ∧ ¬(¬q ∧ r)] ⇐⇒ [p ∧ (q ∨ ¬r)]. (d) p ∨ q ∨ (¬p ∧ ¬q ∧ r) Answer: ¬[p ∨ q ∨ (¬p ∧ ¬q ∧ r)] ⇐⇒ [¬p ∧ ¬q ∧ ¬(¬p ∧ ¬q ∧ r)] ⇐⇒ [¬p ∧ ¬q ∧ (p ∨ q ∨ ¬r)] ⇐⇒ [¬p ∧ ¬q ∧ ¬r]. Question 2. [Exercises 2.2 # 18] Give the reasons for each step in following simplification of compound statements. Answer: (a) [(p ∨ q) ∧ (p ∨ ¬q)] ∨ q ⇐⇒ [p ∨ (q ∧ ¬q)] ∨ q ⇐⇒ (p ∨ F0 ) ∨ q ⇐⇒ p ∨ q Justification Distributive Law Inverse Law Identity Law (b) (p → q) ∧ [¬q ∧ (r ∨ ¬q)] ⇐⇒ (p → q) ∧ ¬q ⇐⇒ (¬p ∨ q) ∧ ¬q ⇐⇒ ¬q ∧ (¬p ∨ q) ⇐⇒ (¬q ∧ ¬p) ∨ (¬q ∧ q) ⇐⇒ (¬q ∧ ¬p) ∨ F0 ⇐⇒ ¬q ∧ ¬p ⇐⇒ ¬(q ∨ p) Justification Absorption and Commutative Laws Implication p → q ⇐⇒ ¬p ∨ q Commutative Law Distributive Law Inverse Law Identity Law DeMorgan’s Laws Question 3. ¬p → ¬q ¬q → ¬r (a) ¬r → ¬p ∴ p↔q 1. 2. 3. 4. 5. 6. 7. Proof: 8. 9. 10. 11. 12. 13. 14. 15. (b) ((p ↔ q) ∧ (q ↔ r)) → (p ↔ r) Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Steps ¬p → ¬q ¬q → ¬r ¬r → ¬p q ¬¬q ¬¬p p q→p ¬q → ¬p p ¬¬p ¬¬q q p→q p↔q Reasons Premise Premise Premise Premise for Hypothetical Reasoning 4, Double Negation 1, 5, Modus Tollens 6, Double Negation 4–7, Hypothetical Reasoning 2, 3, (Hypothetical) Syllogism Premise for Hypothetical Reasoning 10, Double Negation 11, 9, Modus Tollens 12, Double Negation 10–13, Hypothetical Reasoning 8, 14, Equivalence Introduction (p ↔ q) ∧ (q ↔ r) p↔q q↔r (p → q) ∧ (q → p) (q → r) ∧ (r → q) p→q q→r p→r r→q q→p r→p p↔r Premise 1, Conjunctive Simplification 1, Conjunctive Simplification 2, Equivalence Elimination 3, Equivalence Elimination 4, Conjunctive Simplification 5, Conjunctive Simplification 6, 7, (Hypothetical) Syllogism 5, Conjunctive Simplification 4, Conjunctive Simplification 9, 10, (Hypothetical) Syllogism 8, 11, Equivalence Introduction (¬p ∧ ¬q) ∨ (¬p ∧ ¬r) (c) (s ∧ t) → p ∴ ¬s ∨ ¬t (q ∧ r) ∨ (s ∧ ¬t) (d) t → ¬(p ∧ q) ∴ t → ¬p Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. (¬p ∧ ¬q) ∨ (¬p ∧ ¬r) (s ∧ t) → p ¬p ∧ ¬q ¬p (¬p ∧ ¬q) → ¬p ¬p ∧ ¬r ¬p (¬p ∧ ¬r) → ¬p ¬p ∨ ¬p ¬p ¬(s ∧ t) ¬s ∨ ¬t Premise Premise Premise for Hypothetical Reasoning 3, Conjunctive Simplification 3–4, Hypothetical Reasoning Premise for Hypothetical Reasoning 6, Conjunctive Simplification 6–7, Hypothetical Reasoning 1, 5, 8, Constructive Dilemma 9, Idempotence 2, 10, Modus Tollens 11, DeMorgan’s Laws Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. (q ∧ r) ∨ (s ∧ ¬t) t → ¬(p ∧ q) t ¬(p ∧ q) ¬p ∨ ¬q ¬¬t ¬s ∨ ¬¬t ¬(s ∧ ¬t) q∧r q ¬¬q ¬p t → ¬p Premise Premise Premise for Hypothetical Reasoning 2, 3, Modus Ponens 4, DeMorgan’s Laws 3, Double Negation 6, Disjunctive Amplification 7, DeMorgan’s Laws 1, 8 Disjunctive Syllogism 9, Conjunctive Simplification 10, Double Negation 5, 11, Disjunctive Syllogism 3–12, Hypothetical Reasoning (e) ((p ↔ q) ∧ (q ↔ p)) → (p ∨ q) is invalid. Falsifying interpretation: p = 0 and q = 0. (p → q) ↔ r (f) ¬r ∴ ¬(p ∨ q) is invalid. Falsifying interpretation: p = 1, q = 0, and r = 0. p → (r ∧ q) r → (s ∨ t) (g) ¬s ∴ t is invalid. Falsifying interpretation: p = 0, q = 0, r = 0, s = 0, and t = 0. (¬p ∨ q) → r s ∨ ¬q ¬t (h) p→t (¬p ∧ r) → ¬s ∴ ¬q Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. (¬p ∨ q) → r s ∨ ¬q ¬t p→t (¬p ∧ r) → ¬s ¬p ¬p ∨ q r ¬p ∧ r ¬s ¬q Premise Premise Premise Premise Premise 3, 4, Modus Tollens 6, Disjunctive Amplification 1, 7, Modus Ponens 6, 8, Conjunction 5, 9, Modus Ponens 2, 10, Disjunctive Syllogism p∨q q→r (p ∧ s) → t (i) ¬r ¬q → (u ∧ s) ∴ t ¬p → (r ∧ ¬s) t→s u → ¬p (j) ¬w u∨w ∴ ¬t p→q r∨s ¬s → ¬t ¬q ∨ s (k) ¬s (¬p ∧ r) → u w∨t ∴ u∧w Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. p∨q q→r (p ∧ s) → t ¬r ¬q → (u ∧ s) ¬q p u∧s s p∧s t Premise Premise Premise Premise Premise 2, 4, Modus Tollens 1, 6, Disjunctive Syllogism 5, 6, Modus Ponens 8, Conjunctive Simplification 7, 9, Conjunction 3, 10, Modus Ponens Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. ¬p → (r ∧ ¬s) t→s u → ¬p ¬w u∨w u ¬p r ∧ ¬s ¬s ¬t Premise Premise Premise Premise Premise 4, 5, Disjunctive Syllogism 3, 6, Modus Ponens 1, 7, Modus Ponens 8, Conjunctive Simplification 2, 9, Modus Tollens Proof: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. p→q r∨s ¬s → ¬t ¬q ∨ s ¬s (¬p ∧ r) → u w∨t r ¬q ¬p ¬p ∧ r u ¬t w u∧w Premise Premise Premise Premise Premise Premise Premise 2, 5, Disjunctive Syllogism 4, 5, Disjunctive Syllogism 1, 9, Modus Tollens 8, 10, Conjunction 6, 11, Modus Ponens 3, 5, Modus Ponens 7, 13, Disjunctive Syllogism 12, 14, Conjunction Question 4. [Exercises 2.4 # 8] Let p(x), q(x), and r(x) denote the following open statements. p(x) : q(x) : x2 − 8x + 15 = 0 x is odd r(x) : x>0 For the universe of all integers, determine the truth or falsity of each of the following statements. If a universal statement is false, give a counterexample. If an existential statement is true, give an example. Note that p(x) holds iff x = 3 ∨ x = 5. (a) ∀x [p(x) → q(x)] Answer: True. (b) ∀x [q(x) → p(x)] Answer: False. Counterexample: x = 7. (c) ∃x [p(x) → q(x)] Answer: True. Antecedent is false for x = 2. (d) ∃x [q(x) → p(x)] Answer: True. Antecedent is false for x = 4. (e) ∃x [r(x) → p(x)] Answer: True. Antecedent is false for x = 0. (f) ∀x [¬q(x) → ¬p(x)] Answer: True. This is the contrapositive of (a). (g) ∃x [p(x) → (q(x) ∧ r(x))] Answer: True. Antecedent is false for x = 2. (h) ∀x [(p(x) ∨ q(x)) → r(x)] Answer: False. Counterexample: x = −1. Question 5. [Exercises 2.4 # 10] For the following program segment, m and n are integer variables. The variable A is a two-dimensional array A[1, 1], . . . , A[1, 20], . . . , A[10, 1], . . . , A[10, 20], with 10 rows (indexed from 1 to 10) and 20 columns (indexed from 1 to 20). for m := 1 to 10 do for n := 1 to 20 do A[m, n] := m + 3 ∗ n Write the following statements in symbolic form. (The universe for the variable m contains only the integers from 1 to 10 inclusive; for n the universe consists of the integers from 1 to 20 inclusive.) Let the universe for the variable i be the set of integers 0 ≤ i ≤ 10, and let the universe for the variable j be the set of integers 0 ≤ j ≤ 20. (a) All entries of A are positive. Answer: ∀m ∀n A[m, n] > 0 (b) All entries of A are positive and less than or equal to 70. Answer: ∀m ∀n (A[m, n] > 0) ∧ (A[m, n] ≤ 70) ⇐⇒ ∀m ∀n (0 < A[m, n] ≤ 70) (c) Some of the entries of A exceed 60. Answer: ∃m ∃n A[m, n] > 60 (d) The entries in each row of A are sorted into (strictly) ascending order. Answer: ∀m ∀j ∀n [(j < n) → (A[m, j] < A[m, n])] ⇐⇒ ∀m ∀n [(1 ≤ n < 19) → (A[m, n] < A[m, n + 1])] (e) The entries in each column of A are sorted into (strictly) ascending order. Answer: ∀i ∀m ∀n [(i < m) → (A[i, n] < A[m, n])] ⇐⇒ ∀m ∀n [(1 ≤ m < 9) → (A[m, n] < A[m + 1, n])] (f) The entries in the first three rows of A are distinct. Answer: ∀i ∀j ∀m ∀n [(i < 4) ∧ (m < 4) ∧ (i 6= m ∨ j 6= n)] → (A[i, j] 6= A[m, n]) Question 6. [Exercises 2.5 # 8] In this question, use only the reasons listed in Question 3 above, and the rules of Universal Specification (p. 106), Universal Generalization (p. 110), Existential Specification (p. 117) and Existential Generalization (p. 117). (a) Let p(x), q(x) be open statements in the variable x, with a given universe. Prove that ∀x p(x) ∨ ∀x q(x) =⇒ ∀x [p(x) ∨ q(x)] . [That is, prove that when the statement ∀x p(x) ∨ ∀x q(x) is true, then the statement ∀x [p(x) ∨ q(x)] is true.] (b) Find a counterexample for the converse in part (a). That is, find open statements p(x) and q(x) and a universe such that ∀x [p(x) ∨ q(x)] is true, while ∀x p(x) ∨ ∀x q(x) is false. Solution: (a) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. ∀x p(x) ∨ ∀x q(x) ∀x p(x) p(a) p(a) ∨ q(a) ∀x [p(x) ∨ q(x)] ∀x p(x) → ∀x [p(x) ∨ q(x)] ∀x q(x) q(a) p(a) ∨ q(a) ∀x [p(x) ∨ q(x)] ∀x q(x) → ∀x [p(x) ∨ q(x)] (∀x [p(x) ∨ q(x)]) ∨ (∀x [p(x) ∨ q(x)]) ∀x [p(x) ∨ q(x)] Premise Premise for Hypothetical Reasoning (Constructive Proof) 2, Universal Specification 3, Disjunctive Amplification 4, Universal Generalisation 2–5, Hypothetical Reasoning, premise 2 is discharged Premise for Hypothetical Reasoning (Constructive Proof) 7, Universal Specification 8, Disjunctive Amplification 9, Universal Generalisation 7–10, Hypothetical Reasoning, premise 7 is discharged 1, 6, 11, Constructive Dilemma 12, Law of Idempotence (b) Let p(x) : x is male and q(x) : x is female for the universe of discourse of all humans, then ∀x [p(x) ∨ q(x)] is true and ∀x p(x) ∨ ∀x q(x) is false. Question 7. [Exercises 2.5 # 10] Provide the missing reasons for the steps verifying the following argument: ∀x [p(x) ∨ q(x)] ∃x ¬p(x) ∀x [¬q(x) ∨ r(x)] ∀x [s(x) → ¬r(x)] ∴ ∃x ¬s(x) Solution: The missing reasons are given in boldface in the table below. Steps (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) ∀x [p(x) ∨ q(x)] ∃x ¬p(x) ¬p(a) p(a) ∨ q(a) q(a) ∀x [¬q(x) ∨ r(x)] ¬q(a) ∨ r(a) q(a) → r(a) r(a) ∀x [s(x) → ¬r(x)] s(a) → ¬r(a) r(a) → ¬s(a) ¬s(a) ∴ ∃x ¬s(x) Reasons Premise Premise Step (2) and the definition of the truth for ∃x ¬p(x). [Here a is an element (replacement) from the universe for which ¬p(x) is true.] The reason for this step is also referred to as the Rule of Existential Specification or Rule of Existential Elimination. 1, Universal Specification 3, 4, Disjunctive Syllogism Premise 6, Universal Specification 8 is logically equivalent to 7 5, 8, Modus Ponens Premise 10, Universal Specification 11, Contraposition, Double Negation 9, 12, Modus Ponens Step (13) and the definition of the truth for ∃x ¬s(x). The reason for this step is also referred to as the Rule of Existential Generalization or Rule of Existential Introduction. Question 8. [Exercises 2.5 # 14] Prove that for every integer n, if n is odd, then n2 is odd. Solution: Let n be an arbitrary integer and suppose that n is odd, then there exists an integer j ∈ Z such that n = 2j + 1, so that n2 = (2j + 1)2 = 4j 2 + 4j + 1 = 2(2j 2 + 2j) + 1. Therefore, n2 = 2k + 1 for some k ∈ Z, and n2 is an odd integer. The result follows from the rule of universal generalization. Question 9. [Exercises 2.5 # 24] Let n be an integer. Prove that n is even if and only if 31n + 12 is even. Solution: In order to show that the given biconditional statement is true, we have to show two implications. → Let n be an even integer, then there is an integer k such that n = 2k, and therefore 31n + 12 = 31(2k) + 12 = 2(31k + 6) is an even integer, since 31k + 6 is an integer. ← Let n be an integer, and suppose that 31n + 12 is an even integer, then there is an integer k such that 31n + 12 = 2k, and therefore 31n = 2k − 12 = 2(k − 6), so that 31n is an even integer, since k − 6 is an integer. We showed in class that ∀k, ` ∈ Z odd(k) · odd(`) → odd(k · `) , so that if n is odd, this implies that 31n is odd, which is a contradiction. Therefore, n must be even, since we showed also that every integer is either even or odd, but not both. Thus, n is even if and only if 31n + 12 is even. Question 10. [Exercises 3.1 # 8] For A = { 1, 2, 3, 4, 5, 6, 7 }, determine the number of (a) subsets of A Answer: 27 = 128. (b) nonempty subsets of A Answer: 27 − 1 = 127, we exclude ∅. (c) proper subsets of A Answer: 27 − 1 = 127, we exclude A. (d) nonempty proper subsets of A Answer: 27 − 1 − 1 = 126. (e) subsets of A containing three elements Answer: 73 . (f) subsets of A containing 1, 2 Answer: For each subset containing 1 and 2, we have 25 choices for the remaining 5 elements in the set, so there are 25 subsets of A containing both 1 and 2. (g) subsets of A containing five elements, including 1, 2 Answer: For each such subset, since the elements 1 and 2 are already in the subset, we have 53 ways to choose 3 more elements from the remaining 5 elements, so there are 53 subsets of A containing 5 elements, including 1 and 2. (h) subsets of A with an even number of elements Answer: 70 + 72 + 74 + 76 = 26 . (i) subsets of A with an odd number of elements Answer: 71 + 73 + 75 + 77 = 26 . Note: For the last two parts of this problem, we used the fact that for any positive integer n, n n X X n n = = 2n−1 , k k k=0 k even k=0 k odd and you are invited to show this. Question 11. [Exercises 3.2 #8] For sets A, B, C ⊆ U, investigate the truth or falsity of each statement using Venn diagrams and, in addition, provide a proof of each true statement using element arguments, and a counterexample for each false statement. (a) A 4 (B ∩ C) = (A 4 B) ∩ (A 4 C) (b) A − (B ∪ C) = (A − B) ∩ (A − C) (c) A 4 (B 4 C) = (A 4 B) 4 C Solution: (a) The shaded portion of the figure on the left represents the set A 4 (B ∩ C), while in the figure on the right it represents the set (A 4 B) ∩ (A 4 C). A B A C C A ∆ (B B C) ( A ∆ B) ( A∆ C) It appears that the two sets are not equal, and in order to show this, we need only construct the following three sets: A = {0, 2, 3}, B = {0, 1}, and C = {1, 3}. In this case A 4 (B ∩ C) = { 0, 1, 2, 3 } and the two sets are not equal. and (A 4 B) ∩ (A 4 C) = { 1, 2 } (b) In the Venn diagram below, the shaded portion of the figure on the left represents the set A − (B ∪ C), while in the figure on the right it represents the set (A − B) ∩ (A − C). A B A C C A B (B C) (A B) (A C) In order to show that the two sets are equal, we will show that x ∈ A − (B ∪ C) if and only if x ∈ (A − B) ∩ (A − C). Let x ∈ A − (B ∪ C), then x ∈ A and x 6∈ B ∪ C, so that x 6∈ B ∧ x 6∈ C; thus, x ∈ A − B ∧ x ∈ A − C, that is, x ∈ (A − B) ∩ (A − C). We have shown that A − (B ∪ C) ⊆ (A − B) ∩ (A − C). Conversely, suppose that x ∈ (A − B) ∩ (A − C), then x ∈ A − B ∧ x ∈ A − C, so that x ∈ A, but x 6∈ B and x 6∈ C, that is, x 6∈ B∪C; thus, x ∈ A−(B∪C). We have shown that (A−B)∩(A−C) ⊆ A−(B∪C). From the definition of set equality, we have A − (B ∪ C) = (A − B) ∩ (A − C) for all subsets of the universal set U. (c) In the Venn diagram below, the shaded portion of the figure represents both the set A 4 (B 4 C), and the set (A 4 B) 4 C. A B C A ∆ ( B ∆ C ) = ( A ∆ B) ∆ C The membership table for the sets A ∆ B, B ∆ C, A ∆ (B ∆ C), and (A ∆ B) ∆ C, is given below. A B C 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 A∆B B∆C 0 0 0 1 1 1 1 0 1 0 1 1 0 1 0 0 A ∆ (B ∆ C) (A ∆ B) ∆ C 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 Since the last two columns in the membership tables are identical, then the two sets are equal, that is, A ∆ (B ∆ C) = (A ∆ B) ∆ C. Question 12. [Exercises 3.2 # 11] Provide a proof of each statement below (not its dual) using element arguments. (a) U = (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) (b) A = A ∩ (A ∪ B) (c) A ∪ B = (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) (d) A = (A ∪ B) ∩ (A ∪ ∅) Solution: (a) Since A and B are subsets of the universal set U, then we have the containment (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ⊆ U. Now let x ∈ U be arbitrary, then either x ∈ A or x 6∈ A, and (i) if x ∈ A, then either x ∈ B, or x 6∈ B, so that x ∈ (A ∩ B) ∪ (A ∩ B), (ii) if x 6∈ A, then either x ∈ B or x 6∈ B, so that x ∈ (A ∩ B) ∪ (A ∩ B). Therefore, x ∈ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B), and we have the containment U ⊆ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B), by the definition of set equality, we have U = (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B). (b) Note that if x ∈ A then x ∈ A and x ∈ A ∪ B, so that x ∈ A ∩ (A ∪ B), that is, A ⊆ A ∩ (A ∪ B). On the other hand, if x ∈ A ∩ (A ∪ B), then x ∈ A, so that A ∩ (A ∪ B) ⊆ A, and by the definition of set equality we have A = A ∩ (A ∪ B). (c) Note that if x ∈ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B), then x ∈ A or x ∈ B, so that x ∈ A ∪ B, and therefore (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ⊆ A ∪ B. On the other hand, if x ∈ A ∪ B, then (i) if x ∈ A, then x ∈ B or x 6∈ B, so that x ∈ (A ∩ B) ∪ (A ∩ B), and (ii) if x 6∈ A, since x ∈ A ∪ B, we must have x ∈ B, so that x ∈ A ∩ B. Thus, x ∈ (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B), so that (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B) ⊆ A ∪ B, and by the definition of set equality we have A ∪ B = (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B). (d) Note that if x ∈ A, then x ∈ A ∪ B and x ∈ A ∪ ∅, so that x ∈ (A ∪ B) ∩ (A ∪ ∅), and A ⊆ (A ∪ B) ∩ (A ∪ ∅). On the other hand, if x ∈ (A ∪ B) ∩ (A ∪ ∅), then x ∈ A ∪ ∅, so that x ∈ A, and (A ∪ B) ∩ (A ∪ ∅) ⊆ A, and by the definition of set equality, we have A = (A ∪ B) ∩ (A ∪ ∅). We could have used part (b) for this problem as follows, A = A ∩ (A ∪ B) = (A ∪ ∅) ∩ (A ∪ B) = (A ∪ B) ∩ (A ∪ ∅) since A = A ∪ ∅. Question 13. [Exercises 3.3 # 2] A manufacturer of 2000 automobile batteries is concerned about defective terminals and defective plates. If 1920 of her batteries have neither defect, 60 have defective plates, and 20 have both defects, how many batteries have defective terminals? Solution: Let U be the set of all 2000 automobile batteries. Let T be the set of all batteries with defective terminals and let P be the set of all batteries with defective plates. We have |T ∪ P | = 1920 |P | = 60 |T ∩ P | = 20, so that |T ∪ P | = |U| − |T ∪ P | = 2000 − 1920 = 80. Now, since |T ∪ P | = |T | + |P | − |T ∩ P |, then |T | = |T ∪ P | − |P | + |T ∩ P | = 80 − 60 + 20 = 40, and there are 40 batteries with defective terminals. Question 14. [Exercises 3.4 # 14] The freshman class of a private engineering college has 300 students. It is known that 180 can program in Java, 120 in Visual BASIC† , 30 in C++, 12 in Java and C++, 18 in Visual BASIC and C++, 12 in Java and Visual BASIC, and 6 in all three languages. (a) A student is selected at random. What is the probability that she can program in exactly two languages? (b) Two students are selected at random. What is the probability that they can (i) both program in Java? (ii) both program only in Java? Solution: Using the given information, we can fill in the regions in the Venn diagram as shown below. 300 J VB 6 162 96 6 6 12 6 C++ † Visual BASIC is a trademark of the Microsoft Corporation. U (a) In this case our experiment consists of choosing a student at random from the sample space U a and observing in which computer laguages the student can program. There are 6 students who can program in both Java and Visual BASIC and only these languages, 6 students who can program in both Java and C++ and only these, and 12 students who can program in both C++ and Visual BASIC and only these. So there are 24 students who can program in exactly 2 languages. If each of the 300 students in Ua is equally likely to be selected, then we can assign to each student the probability 1 1 = , |Ua | 300 and if A ⊆ Ua is the event that a student selected at random can program in exactly two languages, then |A| 24 = = 0.0800. Prob(A) = |Ua | 300 (b) If our experiment is to select two students at random, since there are 300 students, the sample space Ub now consists of all possible pairs of students, and if each pair is equally likely to be selected, then we can assign to each pair the probability 1 1 . = 300 |Ub | 2 (i) If B ⊆ Ub is the event that a pair of students selected at random can program in Java, then since there are 180 students who can program in Java, we have 180 |B| = 2 and the probability that a pair of students selected at random can program in Java is 180 |B| 180 · 179 2 = Prob(B) = = = 0.3592. 300 |Ub | 300 · 299 2 (ii) Let C ⊆ Ub be the event that a pair of students selected at random can program in Java and only Java, then since there are 162 students who can program in Java and in no other language, we have 162 |C| = 2 and the probability that a pair of students selected at random can program in Java and only Java is 162 162 · 161 |C| 2 = Prob(C) = = = 0.2908. 300 |Ub | 300 · 299 2 Question 15. [Exercises 3.4 # 16] (a) If the letters in the acronym W Y S I W Y G are arranged in a random manner, what is the probability that the arrangement starts and ends with the same letter? (b) What is the probability that a randomly generated arrangement of the letters in W Y S I W Y G has no pair of consecutive identical letters? Solution: The sample space U consists of all linear arrangements of the letters in the acronym W Y S I W Y G and if each such arrangement is equally likely to occur, the we can assign to each arrangment the probability 1 = |U| 1 2! · 2! = 7 7! 22111 of occurring. (a) If E ⊆ U is the event that an arrangement starts and ends with the letter W, then 5 5! |E| = = , 2! 2111 and if F ⊆ U is the event that an arrangement starts and ends with the letter Y, then 5 5! = . |F | = 2111 2! Since the events E and F are mutually exclusive, by the rule of sum, the number of arrangements that start and end with the same letter is |E ∪ F | = |E| + |F | = 5! 5! + = 5!, 2! 2! and therefore the probability that a linear arrangement of the letters of the acronym W Y S I W Y G start and end with the same letter is Prob(E ∪ F ) = |E ∪ F | 2! · 2! · 5! 4 2 = = = . |U| 7! 7·6 21 (b) Let A ⊆ U be the event that an arrangement of the letters of the acronym W Y S I W Y G contains consecutive W ’s, and let B ⊆ U be the event that an arrangement contains consecutive Y ’s, then 6! 6 |A| = |B| = = , 21111 2! and for the arrangements with both consecutive W ’s and consecutive Y ’s, we have 5 |A ∩ B| = = 5!. 11111 Now, since |A ∪ B| = |A| + |B| − |A ∩ B|, the number of arrangements with at least one pair of consecutive identical letters is |A ∪ B| = 6! 6! + − 5!. 2! 2! Therefore, the number of linear arrangements with no pair of consecutive identical letters is |A ∩ B| = |A ∪ B| = |U| − |A ∪ B| = |U| − |A| − |B| + |A ∩ B| = 7! 6! 6! − − + 5! 2! · 2! 2! 2! and the probability that an arrangement of the letters in the acronym W Y S I W Y G has no pair of consecutive identical letters is 6! 6! 7! − − + 5! |A ∩ B| . Prob A ∩ B = = 2! · 2! 2! 2! 7! |U| 2! · 2!