CS336 Homework Assignment ♯3 Solutions Section 1.5 20. U = Z, N(x) : x is negative, P (x) : x is positive a) ∀x∀y[N(x) ∧ N(y) → P (xy)] ] b) ∀x∀y[P (x) ∧ P (y) → P ( x+y 2 c) ∃x∃y[N(x) ∧ N(y) ∧ ¬N(x − y)] d) ∀x∀y[|x + y| ≤ |x| + |y|] 36 abd a) U = all people, P(x): x has lost more than 1000 dollars playing the lottery Original statement: ¬∃xP (x) Negation: ∃xP (x) Negation in English: Someone has lost more than 1000 dollars playing the lottery. b) C(x, y): x has chatted with y, U = students in this class Original: ∃x∃y[C(x, y) ∧ ∀z[C(x, z) → y = z]] Negation: ∀x∀y[¬C(x, y) ∨ ∃z[C(x, z) ∧ y 6= z]] Negation in English: Every student has either chatted with no one in the class or with at least two students. d) U = all students, P(x): x has solved every exercise in this book Original: ∃xP (x) Negation: ∀x¬P (x) Negation in English: No student has solved every exercise in this book. 46. ∃x∀y(x ≤ y 2 ). What is the truth value? a)U = R+ F b) U = Z T c) U = R − {0} T Section 1.6 24. Step 3 does not follow from step 2 - simplification has been used incorrectly. Likewise, step 5 does not follow from step 2. Section 1.7 8. Prove: If n is a perfect square, then n + 2 is not a perfect square. Proof: Assume that n is a perfect square. So n = m2 for some integer m ≥ 0. If n = 0, then n + 2 = 2 is not a perfect square. So assume n ≥ 1, and so m ≥ 1. Then the smallest perfect square which is bigger than n is (m + 1)2 , and (m + 1)2 = m2 + 2m + 1 = n + 2m + 1 ≥ n + 2 + 1 = n + 3 > n + 2. Therefore m2 = n < n + 2 < (m + 1)2 , so n + 2 is not a perfect square. 10. Use a direct proof to show that the product of two rational numbers is rational. 1 Proof: Let x, y be arbitrary rational numbers. Then by definition of rational number, x = m n and y = rs , where m, n, r, s ∈ Z and n and s are non-zero. Then xy = m ( r ) = mr , where n s ns mr, ns ∈ Z since m, r, n, s ∈ Z, and ns 6= 0 since n and s are non-zero. Therefore xy is rational. 12. Prove: the product of a nonzero rational number and any irrational number is irrational. Proof: Let x, y be arbitrary real numbers. Assume that x is a nonzero rational number and y is irrational. Assume by way of contradiction that xy is rational. So x = m , where m, n are n nr nonzero integers, and xy = rs , where r, s ∈ Z, and s 6= 0. Since x 6= 0, y = (1/x)(xy) = ms , where nr, ms ∈ Z since n, r, m, s ∈ Z, and ms 6= 0 since m 6= 0 and s 6= 0. Thus y is rational. Contradiction! 18. Prove that if n is an integer and 3n + 2 is even, then n is even, using a) contraposition Proof: Let n be an arbitrary integer. Assume that n is odd, i.e., n = 2k + 1 for some integer k. We must show that 3n + 2 is odd. Since n = 2k + 1, 3n + 2 = 3(2k + 1) + 2 = 6k + 5 = 2(3k + 2) + 1, where 3k + 2 ∈ Z since k ∈ Z. So 3n + 2 is odd. b) contradiction Proof: Let n be an arbitrary integer. Assume by way of contradiction that 3n + 2 is even and n is odd. Then n = 2k + 1 for some integer k, and so 3n + 2 = 3(2k + 1) + 2 = 6k + 5 = 2(3k + 2) + 1, where 3k + 2 ∈ Z since k ∈ Z. So 3n + 2 is odd. So 3n + 2 is odd and even. Contradiction! Section 5.3 2bc b)f(0) = 3, f(n+1) = 3f(n)+7 for n = 0, 1, ... f(1) = 3(3)+7 = 16, f(2) = 3(16)+7 = 55, f(3) = 3(55)+7 = 172 c) f(0) = 3, f(n+1) = f (n)2 − 2f (n) − 2 f(1) = 9-6-2 = 1, f(2) = 1-2-2 = -3, f(3) = 9+6-2 = 13 8. a) Base Case: a1 = 2 Recursive Step: an+1 = an + 4 for n = 1, 2, ... b)Base Step: a1 = 0 Recursive Step: an+1 = an + 2(−1)n+1 for n = 1, 2, ... c) Base Case: a1 = 2 Recursive Step: an+1 = an + 2(n + 1) for n = 1, 2, 3, .... d) Base step: a1 = 1 Recursive step: an+1 = an + 2n + 1 for n = 1, 2, 3, ... 2 10. Base step: Sm (0) = m Recursive step: Sm (n + 1) = Sm (n) + 1 for n = 0, 1, ... 12. Prove that f12 + f22 + ... + fn2 = fn fn+1 for all n ≥ 1. Proof: Base case(n = 1): f12 = 12 = 1 = 1(1) = f1 f2 Induction hypothesis: Let k ≥ 1 be arbitrary. Assume that f12 + ...fk2 = fk fk+1 . 2 2 So f12 + ... + fk2 + fk+1 = fk fk+1 + fk+1 by IH = fk+1(fk + fk+1 ) = fk+1(fk+2 ) by definition of the fibonnaci sequence 24. a) Define the set S by Base step: 1 ∈ S Recursive step: If a ∈ S, then a + 2 ∈ S. b) Define the set S by Base step: 3 ∈ S Recursive step: If a ∈ S, then 3a ∈ S. c) Define the set S by Base step: x ∈ S, and c ∈ S for any integer constant c Recursive step: If p ∈ S and q ∈ S, then ps, p + s, p − s ∈ S. 26. a) (2, 3), (3, 2); (4, 6), (5, 5), (6, 4); (6, 9), (7, 8), (8, 7), (9, 6); (8, 12), (9, 11), (10, 10), (11, 9), (12, 8); (10, 15), (11, 14), (12, 13), (13, 12), (14, 11), (15, 10) b) Let P (n) be the statement that 5|a + b whenever (a, b) ∈ S is obtained by n applications of the recursive step. Basis Step: P (0) is true, because only (0, 0) ∈ S and 0 + 0 = 5 × 0, 5|0 + 0 IH: Assume that 5|a + b whenever (a, b) ∈ S is obtained by k ≥ 0 or fewer applications of the recursive step. Inductive Step: Consider an element (c, d) obtained with k + 1 applications of the recursive step. Assume (a, b) is an element obtained with k or fewer applications of the recursive step and is the one to construct (c, d). 3 Case (c + d) = (a + 2, b + 3): c + d = (a + 2) + (b + 3) = a + b + 5 = 5t + 5 where t ∈ Z (by IH) = 5(t + 1) Case (c + d) = (a + 3, b + 2): c + d = (a + 3) + (b + 2) = a + b + 5 = 5t + 5 where t ∈ Z (by IH) = 5(t + 1) Therefore, in both cases, 5|c + d. c) Basis step: For (0, 0) ∈ S, then 5|0 + 0 Inductive step: Assume 5|a + b holds for arbitrary (a, b) ∈ S. Then it also holds for all (a + 2, b + 3) and (a + 3, b + 2) because (a + 2) + (b + 3) = (a + 3) + (b + 2) = a + b + 5 = 5t + 5 = 5(t + 1), where t ∈ Z. 28a. S = {(a, b)|a ∈ Z+ , b ∈ Z+ , a + b is odd} Basis step: (1, 2) ∈ S and (2, 1) ∈ S Recursive step: If (a, b) ∈ S, then (a + 1, b + 1), (a, b + 2), (a + 2, b) ∈ S. 32. a) Basis step: ones(λ) = 0 Recursive step: ones(sb) = ones(s) + x, where x = 0 when b = ‘0′ and x = 1 when b = ‘1′ b) Let P (t) be ones(st) = ones(s) + ones(t), s, t ∈ Σ∗ , Σ = {‘0′ , ‘1′ } Base: Show P (λ) is true. That is, ones(sλ) = ones(s) = ones(s) + 0 = ones(s) + ones(λ) IH: Assume P (t) is true for arbitrary t ∈ Σ∗ . We must show that P (tb) is true, where b ∈ Σ. Recursive Step: Show ones(stb) = ones(s) + ones(tb). ones(stb) = ones(st) + x where x = 0 when b = ‘0′ and x = 1 when b = ‘1′ (by the recursive definition of ones(w)) = ones(s) + ones(t) + x (by IH) = ones(s) + ones(tb) (by the recursive definition of ones(w)) Section 3.2 2. a) No b) Yes c) No 14. a) No b) Yes c) Yes d) Yes 4 e) Yes f) Yes 5