Docsity

Assignment 3 Solutions - Constructing Proofs | CS 1050, Assignments of Computer Science

Toggle sidebar
bg1
Homework 3 Solutions
Section 3.1
10. There is an integer n such that 2n2 - 5n + 2 is prime.
This statement is true. Suppose n = 3. Then 2n2 - 5n + 2 = 2*32 - 5*3 + 2 = 18 - 15 + 2 =
5; 5 is a prime number.
13. For all integers m and n, if 2m + n is odd then m and n are both odd.
Let m = 2 and n = 1. Then 2m + n = 2*2 + 1 = 5. Since the number 5 is odd, our selected
m and n should both be odd. But m = 2 is even, which contradicts the statement.
28. Claim For all integers n, if n is odd then n2 is odd.
Proof
Suppose n is odd. By definition of odd, n = 2k + 1 for some integer k.
n2 = (2k + 1) 2 (By substitution of n)
= (2k + 1)(2k + 1) (Algebra)
= 4k2 + 4k + 1 (Algebra)
= 2(2k2 + 2k) + 1 (Algebra)
Let m = 2k2 + 2k.
= 2m + 1 (By substitution of 2k2 + 2k)
Note that m is an integer because the square of an integer is an integer, the product of two
integers is an integer, and the sum of two integers is an integer.
Since m is an integer, 2m + 1 is an odd by definition of an odd integer. Additionally,
since 2m + 1 = n2 and 2m + 1 is odd, n2 is odd. Recall that we started with an odd integer
n. Therefore, if n is an odd integer, then n2 is odd.
38. The mistake in the "proof" is that the same symbol, k, is used to represent two
different quantities. By setting both m and n equal to 2k, the proof specifies that m = n,
and therefore, it only deduces the conclusion thin case m = n. If m n, the conclusion is
not always true. For instance, 6 + 4 = 10, but 10 4k for any integer k.
45. Claim The difference of any two odd integers is even.
Proof
Suppose m and n are any odd integers. By definition of odd, m = 2r + 1 and n = 2s + 1 for
some integers r and s.
pf3
pf4
pf5

Partial preview of the text

Download Assignment 3 Solutions - Constructing Proofs | CS 1050 and more Assignments Computer Science in PDF only on Docsity!

Homework 3 Solutions Section 3.

10. There is an integer n such that 2n^2 - 5n + 2 is prime. This statement is true. Suppose n = 3. Then 2n^2 - 5n + 2 = 23^2 - 53 + 2 = 18 - 15 + 2 = 5; 5 is a prime number. 13. For all integers m and n, if 2m + n is odd then m and n are both odd. Let m = 2 and n = 1. Then 2m + n = 2*2 + 1 = 5. Since the number 5 is odd, our selected m and n should both be odd. But m = 2 is even, which contradicts the statement. 28. Claim For all integers n, if n is odd then n^2 is odd. Proof Suppose n is odd. By definition of odd, n = 2k + 1 for some integer k. n^2 = (2k + 1) 2 (By substitution of n) = (2k + 1)(2k + 1) (Algebra) = 4k^2 + 4k + 1 (Algebra) = 2(2k^2 + 2k) + 1 (Algebra) Let m = 2k^2 + 2k. = 2m + 1 (By substitution of 2k^2 + 2k) Note that m is an integer because the square of an integer is an integer, the product of two integers is an integer, and the sum of two integers is an integer. Since m is an integer, 2m + 1 is an odd by definition of an odd integer. Additionally, since 2m + 1 = n^2 and 2m + 1 is odd, n^2 is odd. Recall that we started with an odd integer n. Therefore, if n is an odd integer, then n^2 is odd. 38. The mistake in the "proof" is that the same symbol, k, is used to represent two different quantities. By setting both m and n equal to 2k, the proof specifies that m = n, and therefore, it only deduces the conclusion thin case m = n. If m  n, the conclusion is not always true. For instance, 6 + 4 = 10, but 10  4k for any integer k. 45. Claim The difference of any two odd integers is even. Proof Suppose m and n are any odd integers. By definition of odd, m = 2r + 1 and n = 2s + 1 for some integers r and s.

m - n = (2r + 1) - (2s + 1) (By substitution of m, n) = 2r + 1 - 2s - 1 (Algebra) = 2r - 2s (Algebra) = 2(r - s) (Algebra) Let k = r - s. = 2k Note that k is an integer since the difference of two integers is an integer. So 2k is even by definition of an even integer. Recall that we started with two odd integers m and n. Therefore, since 2k = m - n (where m - n is the difference of two odd integers), the difference of any two odd integers is even. Section 3.

10. Assume m and n are both integers and that n0. Explain why (5m + 12n)/(4n) must be a rational number. Recall that a number r is rational if and only if it can be expressed as the quotient of two integers with a nonzero denominator. Let a = (5m + 12n). Note that a is an integer because the product of two integers is an integer and the sum of two integers is an integer. Let b = (4n). Note that b is an integer because the product of two integers is an integer. Moreover, since n  0, b  0. By substitution, (5m + 12n)/(4n) = a/b, where a and b are integers and b is not equal to zero. That is, (5m + 12n)/(4n) can be expressed as the quotient of two integers with a nonzero denominator. Therefore, by definition of a rational number, (5m + 12n)/(4n) = a/ b is rational. 21. If a is any odd integer, a^2 + a is even. This statement is true. Notice that a^2 = a*a is the product of two odd integers. By statement 3 of example 3.2.3, the product of any two odd integers is odd. Thus a^2 is odd. Since a^2 is odd, a^2 + a is the sum of two odd numbers. By statement 2 of example 3.2.3, the sum of any two odd integers is even. Therefore, a^2 + a is even. 35. The fourth sentence claims that r + s is a fraction because it is the sum of two fractions. But the statement that the sum of two fractions is a restatement of what is to be proved. Hence this proof begs the question by assuming what is to be proved.

Given any integer n, by the quotient-remainder theorem with d = 3, n = 3q, or n = 3q + 1, or n = 3q + 2. [To show that the product of any two consecutive integers has the form 3k or 3k + 2 for some integer k, we will consider each case for n.] Case 1 Suppose n = 3q. Then n(n + 1) = (3q)((3q) + 1) (By substitution of n) = 9q^2 + 3q (Algebra) = 3(3q^2 + q) (Algebra) Note that 3q^2 + q is an integer since the squares, products, and sums of integers are integers. Therefore, when n = 3q for some integer q, n(n + 1) has the form 3k for some integer k. Case 2 Suppose n = 3q + 1. Then n(n + 1) = (3q + 1)((3q + 1) + 1) (By substitution of n) = (3q + 1)(3q + 2) (Algebra) = 9q^2 + 9q + 2 (Algebra) = 3(3q^2 + 3q) + 2 (Algebra) Note that 3q^2 + 3q is an integer since the squares, products, and sums of integers are integers. Therefore, when n = 3q + 1 for some integer q, n(n + 1) has the form 3k + 2 for some integer k. Case 3 Suppose n = 3q + 2. Then n(n + 1) = (3q + 2)((3q + 2) + 1) (By substitution of n) = (3q + 2)(3q + 3) (Algebra) = 9q^2 + 15q + 6 (Algebra) = 3(3q^2 + 5q + 2) (Algebra) Note that 3q^2 + 5q + 2 is an integer since the squares, products, and sums of integers are integers. Therefore, when n = 3q + 2 for some integer q, n(n + 1) has the form 3k for some integer k. Thus, for n of the form 3q, 3q + 1, or 3q + 2, n(n + 1) has the form 3k or 3k + 1 for some integer k. Recall that we used quotient-remainder theorem with d = 3 to represent any integer n as one of these three forms. We can therefore conclude that given any integer n, n(n + 1) has the form 3k or 3k + 1 for some integer k (which was the claim to be proven).

40. Claim For any integer n, n(n^2 -1)(n + 2) is divisible by 4. Proof

Suppose n is any integer. To prove the claim we will perform a case-wise decomposition of n. [The set of integers can be partitioned into even and odd integers, so we will consider the case where n is odd and the case where n is even.] Case 1 Suppose n is even. Then by definition of an even integer, n = 2k for some integer k. Then n(n^2 -1)(n + 2) = (2k)((2k) 2 - 1)((2k) + 2) (By substitution of n) = (2k)(4k^2 - 1)(2k + 2) (Algebra) = (4)(k)(4k^2 - 1)(k + 1) (Algebra) = (4)(4k^3 - k)(k + 1) (Algebra) = 4(4k^4 + 4k^3 - k^2 - k) (Algebra) Note that 4k^4 + 4k^3 - k^2 - k is an integer since the powers, products, and sums of integers are integers. Therefore, when n = 2k for some integer k, n(n^2 -1)(n + 2) is equal to 4 times an integer, and is therefore divisible by 4. Case 2 Suppose n is odd. Then by definition of an odd integer, n = 2k + 1 for some integer k. Then n(n^2 -1)(n + 2) = (2k + 1)((2k + 1) 2 - 1)((2k + 1) + 2) (By substitution of n) = (2k + 1)(4k^2 + 4k)(2k + 3) (Algebra) = (4)(2k + 1)(k^2 + k)(2k + 3) (Algebra) = 4(2k + 1)(k^2 + k)(2k + 3) (Algebra) Note that (2k + 1)(k^2 + k)(2k + 3) is an integer since the powers, products, and sums of integers are integers. Therefore, when n = 2k + 1 for some integer k, n(n^2 -1)(n + 2) is equal to 4 times an integer, and is therefore divisible by 4. Combining the results of these cases, we can therefore conclude that if n is even or if n is odd, n(n^2 -1)(n + 2) is divisible by 4. That is, if n is any integer, n(n^2 -1)(n + 2) is divisible by 4 (which was the claim to be proven). Section 3.

16. For all real numbers x, floor(x^2 ) = (floor(x)) 2. This statement is false. Let x = sqrt(2). Then floor(x^2 ) = floor((sqrt(2) 2 )) = floor(2) = 2, but (floor(sqrt(2))) 2 = (floor(1.41)) 2 = (1) 2 = 1, which contradicts the statement. 22. For all real numbers x and y, ceil(xy) = ceil(x) * floor(y). This statement is false. Let x = 2, y = sqrt(2). Then ceil(2*sqrt(2)) = ceil(2.82) = 3, but ceil(2) * floor(sqrt(2)) = 2 * 1 = 2, which contradicts the statement.