CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University Name: ID#: Section #: Score: / 4 Unit 7: Direct Proof Introduction 1. The statement below is true. Rewrite the statement with the quantification implicit as If, then, and also write the first sentence of a proof (the starting point ) and the last sentence of a proof (the conclusion to be shown ). For all integers m, if m > 1, then 0 < 1 m < 1. If an integer is greater than 1, then its reciprocal is between 0 and 1. Start of proof: Suppose m is any integer such that m > 1. Conclusion to be shown: 0 < 1 m < 1. 2. Prove the following statement: The difference of any even integer minus any odd integer is odd. Proof: Suppose a is any even integer and b is any odd integer. We must show that a b is odd. By definition of even and odd, a = 2r and b = 2s + 1 for some integers r and s. By substitution and algebra, a b = 2r (2s + 1) = 2r 2s 1 = 2(r s 1) + 1 Let t = r s 1. Then t is an integer because differences of integers are integers. Thus a b = 2t + 1, where t is an integer, and so, by definition of odd, a b is odd. CSE 215 R01/R02/R06 Page 1 of 6
3. Prove the following statement: Suppose that n is any even integer. Then ( 1) n = 1. Proof: Suppose n is any even integer. Then n = 2k for some integer k. Hence, ( 1) n = ( 1) 2k by substitution = (( 1) 2 ) k by a law of exponents = 1 k because ( 1) 2 = 1 = 1 because 1 raise to any power equals 1. This is what we wanted to show. 4. Prove that the following statement is false: There exists an integer m 3 such that m 2 1 is prime. The negation of the statement is For all integers m 3, m 2 1 is not prime. Proof of the negation: Suppose m is any integer with m 3. By basic algebra, m 2 1 = (m 1)(m + 1). Because m 3, both m 1 and m + 1 are positive integers greater than 1, and each is smaller than m 2 1. So m 2 1 is a product of two smaller positive integers, each greater than 1, and hence m 2 1 is not prime. CSE 215 R01/R02/R06 Page 2 of 6
Unit 8: Direct Proofs Involving Rational Numbers 5. Consider the statement: The negative of any rational number is rational. a. Write the statement formally using a quantifier and a variable. real numbers r, if r is rational then r is rational. Or: r, if r is a rational number then r is rational. Or: rational numbers r, r is rational. b. Determine whether the statement is true or false and justify your answer. The statement is true. Proof: Suppose r is a rational number. We must show that r is rational. By definition of rational, r = a b Then r = a b = a b by algebra for some integers a and b with b 0. by substitutions But since a is an integer, so is a (being the product of 1 and a). Hence, r is a quotient of integers with a nonzero denominator, and so r is rational 6. Prove that for any rational numbers r and s, 2r + 3s is rational. Suppose r and s are any rational numbers. Both 2 and 3 are integers, and are therefore rational numbers. Now, the product any two rational numbers is a rational number. (We proved this in class.) Therefore, both 2r and 3s are rational. We also know that the sum of two rational numbers is rational. (We proved this in class too.) Therefore, 2r + 3s is rational. CSE 215 R01/R02/R06 Page 3 of 6
Unit 9: Direct Proofs Involving Divisibility and the Quotient-Remainder Theorem 7. Prove that for all integers a, b and c, if a b and a c then a (b + c). Proof: Suppose a, b and c are any integers such that a b and a c. We must show that a (b + c). By definition of divides, b = ar and c = as for some integers r and s. Then b + c = ar + as = a(r + s) by algebra. Let t = r + s. Then t is an integer (being a sum of integers), and thus b + c = at where t is an integer. By definition of divides, then, a (b + c). 8. True or false: For all integers a, b and c, if a is a factor of c then ab is a factor of c. Prove your answer. The statement is false. Counterexample: Let a = 2, b = 3 and c = 8. Then a c because 2 divides 8, but ab c because ab = 6 and 6 does not divide 8. 9. Use the unique factorization theorem to write 1,176 in standard factored form. 1176 = 2 3 3 7 2 10. Suppose that in standard factored form, a = p e 1 1 p e 2 2 p e k k, where k is a positive integer; p 1, p 2,..., p k are prime numbers; and e 1, e 2,..., e k are positive integers. What is the standard factored form for a 2? p 2e 1 1 p 2e 2 2 p 2e k k CSE 215 R01/R02/R06 Page 4 of 6
11. If a and b are integers and 12a = 25b, does 12 b? Does 25 a? Explain. Because 12a = 25b, the unique factorization theorem guarantees that the standard factored forms of 12a and 25b must be the same. Thus 25b contains the factors 2 2 3(= 12). But since neither 2 nor 3 divide 25, the factors 2 2 3 must all occur in b, and hence 12 b. Similarly, 12a contains the factors 5 2 = 25, and since 5 is not a factor of 12, the factors 5 2 must occur in a. So 25 a. 12. Suppose a is an integer. If a mod 7 = 4, what is 5a mod 7? In other words, if division of a by 7 gives a remainder of 4, what is the remainder when 5a is divided by 7? Because a mod 7 = 4, the remainder obtained when a is divided by 7 is 4, and so a = 7q + 4 for some integer q. Multiplying this equation through by 5 gives that 5a = 35q + 20 = 35q + 14 + 6 = 7(5q + 2) + 6. Because q is an integer, 5q + 2 is also an integer, and so 5a = 7 (an integer) + 6. Thus, because 0 6 < 7, the remainder obtained when 5a is divided by 7 is 6, and so 5a mod 7 = 6. CSE 215 R01/R02/R06 Page 5 of 6
13. Use the quotient-remainder theorem with d = 3 to prove that the product of any three consecutive integers is divisible by 3. Suppose n, n+1 and n+2 are any three consecutive integers. We must show that n(n+1)(n+2) is divisible by 3. By the quotient-remainder theorem, n can be written in one of the three forms: 3q, 3q + 1 or 3q + 2 for some integer q. Case 1 (n = 3q): In this case, n(n + 1)(n + 2) = 3q(3q + 1)(3q + 2) = 3 [q(3q + 1)(3q + 2)] Let m = q(3q + 1)(3q + 2). Then m is an integer because q is an integer, and sums and products of integers are integers. By substitution, n(n + 1)(n + 2) = 3m where m is an integer. And so, by definition of divisible, n(n + 1)(n + 2) is divisible by 3. Case 2 (n = 3q + 1): In this case, n(n + 1)(n + 2) = (3q + 1)((3q + 1) + 1)((3q + 1) + 2) = (3q + 1)(3q + 2)(3q + 3) = (3q + 1)(3q + 2)3(q + 1) = 3 [(3q + 1)(3q + 2)(q + 1)] Let m = (3q + 1)(3q + 2)(q + 1). Then m is an integer because q is an integer, and sums and products of integers are integers. By substitution, n(n + 1)(n + 2) = 3m where m is an integer. And so, by definition of divisible, n(n + 1)(n + 2) is divisible by 3. Case 3 (n = 3q + 2): In this case, n(n + 1)(n + 2) = (3q + 2)((3q + 2) + 1)((3q + 2) + 2) = (3q + 2)(3q + 3)(3q + 4) = (3q + 2)3(q + 1)(3q + 4) = 3 [(3q + 2)(q + 1)(3q + 4)] Let m = (3q + 2)(q + 1)(3q + 4). Then m is an integer because q is an integer, and sums and products of integers are integers. By substitution, n(n + 1)(n + 2) = 3m where m is an integer. And so, by definition of divisible, n(n + 1)(n + 2) is divisible by 3. In all three cases, n(n + 1)(n + 2) is divisible by 3. But by the quotient-remainder theorem, one of these cases must occur. Therefore, the product of any three consecutive integers is divisible by 3. CSE 215 R01/R02/R06 Page 6 of 6