Docsity

CS1050 Homework 3 Answers: Proofs about Even Numbers and Rational Numbers, Assignments of Computer Science

Toggle sidebar
bg1
CS1050 HW 3 Answer Key
2) [20 points]
Use an indirect proof to prove that if 3n + 2 is even, then n is even.
The contrapositive of the statement is "If n is odd, then 3n + 2 is odd." Assume n is odd.
Then $kŒZ such that n = 2k + 1. It follows that 3n + 2 = 3(2k + 1) + 2 = 6k + 3 + 2 = 6k
+ 5 = (6k + 4) + 1 = 2(3k + 2) + 1. 3k + 2 is an integer, therefore 3n + 2 is odd by the
definition of an odd integer. Since we have proven the contrapositive, the original
statement, " if 3n + 2 is even, then n is even" is also true.
3). [20 points]
Prove that the product of two rational numbers is rational.
Let s,t be rational numbers. Then $(a,b,c,d) ŒZ where b,d ≠ 0 such that s = a/b and t =
c/d. It follows that s*t = (a/b)*(c/d) = (ac/bd). Then s*t is rational because ac, bd ŒZ and
b*d ≠ 0. Thus the product of two rational numbers is rational.
4) [30 points]
Prove or disprove that the product of a nonzero rational number and an irrational
number is irrational.
We will use a proof by contradiction, assuming that the product of a nonzero rational
number and an irrational number is rational. Let x be a nonzero rational number and y be
an irrational number. Then x = a/b where a,b ŒZ and a,b ≠ 0. By our assumption, x*y is
rational and so x*y = c/d where c,d ŒZ and d ≠ 0. It follows that x*y = (a/b)*y = c/d.
Solving for y, we get y = (cb)/(da). However, cb,da ŒZ and da ≠ 0, which means that we
have a rational number equal to an irrational number--a contradiction. Thus our
assumption was false and x*y must be irrational, proving that the product of a nonzero
rational number and an irrational number is irrational.
1) (p Æ q) Æ r [10 points]
p q r p Æ q (p Æ q) Æ r
TTTT T
T T F T F
T F T F T
T F F F T
F T T T T
F T F T F
F F T T T
FFFT F
There are 5 minterms, giving the following disjunctive normal form:
(p Ÿ q Ÿ r ) ⁄ (p Ÿ ÿq Ÿ r) ⁄ (p Ÿ ÿq Ÿ ÿr) ⁄(ÿp Ÿ q Ÿ r) ⁄ (ÿp Ÿ ÿq Ÿ r).
pf3

Partial preview of the text

Download CS1050 Homework 3 Answers: Proofs about Even Numbers and Rational Numbers and more Assignments Computer Science in PDF only on Docsity!

**CS1050 HW 3 Answer Key

  1. [20 points] Use an indirect proof to prove that if 3n + 2 is even, then n is even.** The contrapositive of the statement is "If n is odd, then 3n + 2 is odd." Assume n is odd. Then $kŒZ such that n = 2k + 1. It follows that 3n + 2 = 3(2k + 1) + 2 = 6k + 3 + 2 = 6k
  • 5 = (6k + 4) + 1 = 2(3k + 2) + 1. 3k + 2 is an integer, therefore 3n + 2 is odd by the definition of an odd integer. Since we have proven the contrapositive, the original statement, " if 3n + 2 is even, then n is even" is also true. 3). [20 points] Prove that the product of two rational numbers is rational. Let s,t be rational numbers. Then $(a,b,c,d) ŒZ where b,d ≠ 0 such that s = a/b and t = c/d. It follows that st = (a/b)(c/d) = (ac/bd). Then st is rational because ac, bd ŒZ and bd ≠ 0. Thus the product of two rational numbers is rational. 4) [30 points] Prove or disprove that the product of a nonzero rational number and an irrational number is irrational. We will use a proof by contradiction, assuming that the product of a nonzero rational number and an irrational number is rational. Let x be a nonzero rational number and y be an irrational number. Then x = a/b where a,b ŒZ and a,b ≠ 0. By our assumption, xy is rational and so xy = c/d where c,d ŒZ and d ≠ 0. It follows that xy = (a/b)y = c/d. Solving for y, we get y = (cb)/(da). However, cb,da ŒZ and da ≠ 0, which means that we have a rational number equal to an irrational number--a contradiction. Thus our assumption was false and x*y must be irrational, proving that the product of a nonzero rational number and an irrational number is irrational. 1) (p Æ q) Æ r [10 points] p q r p Æ q (p Æ q) Æ r T T T T T T T F T F T F T F T T F F F T F T T T T F T F T F F F T T T F F F T F There are 5 minterms, giving the following disjunctive normal form: (p Ÿ q Ÿ r ) ⁄ (p Ÿ ÿ q Ÿ r) ⁄ (p Ÿ ÿ q Ÿ ÿ r) ⁄ ( ÿ p Ÿ q Ÿ r) ⁄ ( ÿ p Ÿ ÿ q Ÿ r).

5) [20 points] Prove or disprove that " n Œ Z ≥ 0, 2n^ + 1 is prime. If we can find at least one counterexample, then the statement is false. A counterexample is 2^3 + 1 = 9 = 3*3, which is composite. 6) [40 points] Prove that the square of an integer not divisible by 5 leaves a remainder of 1 or 4 when divided by 5. We can use a proof by cases, considering the cases that correspond to the possible remainders when an integer is divided by 5. This yields 5 cases for an integer n. n = 5k, n = 5k +1, n = 5k+2, n = 5k+3, n = 5k+4, where k ŒZ. To complete the proof, we will look at each case individually. Case 1: n = 5k For this case, n is divisible by 5 and is not considered. Case 2: n = 5k + 1 For some integer k, n = 5k + 1. It follows that n 2 = (5k + 1) 2 = 25k 2

  • 10k + 1 = 5(5k 2
  • 2k) + 1. 5k 2
  • 2k is an integer, so when n 2 is divided by 5, there is a remainder of 1. Case 3: n = 5k + 2 For some integer k, n = 5k + 2. It follows that n 2 = (5k + 2) 2 = 25k 2
  • 20k + 1 = 5(5k 2
  • 4k) + 4. 5k 2
  • 4k is an integer, so when n 2 is divided by 5, there is a remainder of 4. Case 4: n = 5k + 3 For some integer k, n = 5k + 3. It follows that n 2 = (5k + 3) 2 = 25k 2
  • 30k + 9 = 5(5k 2
  • 6k + 1) + 4. 5k 2
  • 6k + 1 is an integer, so when n 2 is divided by 5, there is a remainder of 4. Case 5: n = 5k + 4 For some integer k, n = 5k + 4. It follows that n 2 = (5k + 4) 2 = 25k 2
  • 40k + 16 = 5(5k 2
  • 8k + 3) + 1. 5k 2
  • 8k + 3 is an integer, so when n 2 is divided by 5, there is a remainder of 1. Thus we have shown that the square of an integer not divisible by 5 leaves a remainder of 1 or 4 when divided by 5. 7) [10 points per part--20 total] Prove that if n is a positive integer, then n is even if an only if 7n + 4 is even.