<<

Outline properties Parity: Even and Odd The -Remainder Theorem

Assorted Theorems

Alice E. Fischer

CSCI 1166 Discrete for Computing March 19-29, 2018 Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem

1 Integer properties

2 Parity: Even and Odd

3 The Quotient-Remainder Theorem Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem N: The Natural

N = Z nonneg = 0, 1, 2, 3,... Thm 1. There is no largest integer: ∀x ∈ Z ∃y ∈ Z, x < y There is no largest natural number: ∀x ∈ N ∃y ∈ N, x < y There is no smallest integer: ∀x ∈ Z ∃y ∈ Z, x > y There IS a smallest natural : 0. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Theorem 1: There is no greatest integer.

Proof: Just suppose there is a greatest integer, N. Therefore ∀n ∈ Z, N ≥ n. Let M = N + 1. M is an integer since it is a sum of two , and M > N. Thus M is an integer greater than N, our supposed greatest integer. So we have a contradiction, N is the greatest and it is not. Therefore the original supposition is false, meaning that the theorem is true. Theorems 2 and 3 are proved similarly. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Even and Odd

Definition: Even integer. An integer n is even iff ∃x ∈ Z, n = 2x Definition: Odd integer. An integer n is odd iff ∃x ∈ Z, n = 2x + 1.

Theorem 2: An integer n is odd iff ∃x ∈ Z, n = 2x − 1. 2x − 1 = 2x − 2 + 1 = 2(x − 1) + 1 Let y = x − 1. Then n = 2y + 1, where y is an integer. ∴ n is odd. You may use this theorem in your proofs. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Parity

Definition: The parity of an integer refers to whether the integer is even or odd. Even numbers have even parity, odd numbers have odd parity.

Clearly, “parity” is related to the ability to organize things into pairs. For example, suppose you have 13 gray socks. The number 13 has odd parity, so you have 6 pairs and one odd sock. If you have 10 white socks, you have 5 pairs. The number 10 has even parity, so it comes out even, with no socks left over. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Parity of Consecutive Integers

Theorem 3: Consecutive integers have opposite parity. Proof by into cases: Let m be any integer, and let n = m + 1 Case 1: Suppose m has even parity. Then m = 2x for some integer x. So n = m + 1 = 2x + 1 and n is therefore odd. Case 2: Suppose m has odd parity. Then m = 2x + 1 for some x ∈ Z. So n = m + 1 = 2x + 1 + 1 = 2x + 2 = 2(x + 1) and n is therefore even. m and n have opposite parity in both cases, and there are no other cases. ∴ consecutive integers have opposite parity. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Even and Odd Theorem Summary

List of theorems about even and odd:

4 Zero is even. 5 −1 is not even. 6 If a and b are even, then a + b is even. 7 If a and b are odd, then a + b is even. 8 If a and b are even, then ab is even. 9 If a and b are odd, then ab is odd. 10 For all integers, n, if n2 is even, then n is even. 11 For all integers, n, if n2 is odd, then n is odd. 12 ∀m∀n ∈ Z, if m × n is even, then either m or n is even. 13 ∀m∀n ∈ Z, if m + n is even, then m and n are both even or both odd.

14 Every integer is either even or odd. Proofs for all are given below. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Proofs about Even and Odd

4 Zero is even. By definition, 0 is even iff ∃x ∈ Z, 0 = 2x. So take x = 0; then 2x = 0.

5 −1 is not even. Because ∀x ∈ Z, −1 6= 2x.

6 If a and b are even, then a + b is even. Being even, a = 2x and b = 2y for some x and y. a + b = (2x + 2y) = 2 × (x + y) and (x + y) is an integer due to closure of addition.

7 If a and b are odd, then a + b is even. Being odd, a = 2x + 1 and b = 2 × y + 1 for some x and y. a + b = (2x + 1 + 2y + 1) = (2x + 2y + 2) = 2 × (x + y + 1) so (a + b) is an even integer. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Proofs about Even and Odd, continued

8 If a and b are even, then ab is even By definition, a = 2x and b = 2y for some x and y. ab = (2x × 2y) = 2 × (2xy) and (2xy) is an integer due to closure of multiplication.

9 If a and b are odd, then ab is odd. By definition, a = 2x + 1 and b = 2 × y + 1 for some x and y. ab = (2x + 1) × (2y + 1) = (4xy + 2x + 2y + 1) = 2 × (2xy + x + y) + 1 and (2xy + x + y) is an integer due to closure. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 10. To Be Even: Proof by Contraposition

∀n ∈ Z, if n2 is even, then n is even.

Since this is a universal statement involving a condition, it is also possible to prove this by contraposition. The contrapositive is: ∀n ∈ Z, if n is NOT even, then n2 is NOT even.

For all integers, n, if n is odd, then n2 is odd, since all integers are even or odd. Since n is odd, it can be represented as n = 2k + 1. So, n2 = (2k + 1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1. And since 2k2 + 2k is an integer via closure, this indicates that n2 must be odd by definition. So the contrapositive statement is true, therefore the original theorem is true. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 10. To Be Even: Proof by Contradiction

For all integers, n, if n2 is even, then n is even.

A proof by contradiction. Suppose there is an integer, n, where n2 is even, but n is not. Since all integers are either even or odd, n must be odd, and can be represented as n = 2k + 1. So, n2 = (2k + 1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1. And since 2k2 + 2k is an integer via closure, this indicates that n2 must be odd, by definition. But n2 was assumed to be even. This contradiction indicates the original theorem is true. Proof by contradiction. Suppose there is an integer, n, where n2 is odd, but n is not. Since all integers are either even or odd, n must be even, and can be represented as n = 2k. So, n2 = (2k)2 = 4k2 = 2(2k2). And since 2k2 is an integer via closure, this indicates that n2 must be even by definition. But n2 was assumed to be odd. This contradiction indicates the original theorem is true.

Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 11. To Be Odd

For all integers, n, if n2 is odd, then n is odd. Try proving this yourself. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 11. To Be Odd

For all integers, n, if n2 is odd, then n is odd. Try proving this yourself.

Proof by contradiction. Suppose there is an integer, n, where n2 is odd, but n is not. Since all integers are either even or odd, n must be even, and can be represented as n = 2k. So, n2 = (2k)2 = 4k2 = 2(2k2). And since 2k2 is an integer via closure, this indicates that n2 must be even by definition. But n2 was assumed to be odd. This contradiction indicates the original theorem is true. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 12. Even Products

For all integers, m and n, if m × n is even, then m is even or n is even.

Proof by contraposition. The contrapositive: For all integers, m and n, if m is odd and n is odd, then m × n is odd. By definition, m = 2k + 1 and n = 2j + 1, for integers k and j. So, m × n = (2k + 1)(2j + 1) = 4kj + 2k + 2j + 1 = 2(2kj + k + j) + 1. And since 2kj + k + j is an integer via closure, this indicates that m × n must be odd by definition. Since the contrapositive is true, the original theorem is true. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem 13. Even Sums

∀m, n ∈ Z, if m + n is even, then m and n are both even or both odd. Proof by contradiction. Suppose m and n, are an odd integer an even integer. Case 1: m is even and n is odd. 1 By definition, m = 2k and n = 2j + 1, for integers k and j. 2 So, m + n = 2k + 2j + 1 = 2(k + j) + 1. 3 And since k + j is an integer via closure, this indicates that m + n must be odd by definition. 4 But m + n was assumed to be even, so this is a contradiction. Case 2: m is odd and n is even. 1 By definition, m = 2k + 1 and n = 2j, for integers k and j. 2 So, m + n = 2k + 1 + 2j = 2(k + j) + 1. 3 The rest of this case is the same as Case 1. All cases yield a contradiction, so the original theorem is true. Proof by contradiction. Suppose there are integers, m and n, where m × n is even, and m is odd and n is odd. By definition, m = 2k + 1 and n = 2j + 1, for integers k and j. So, m × n = (2k + 1)(2j + 1) = 4kj + 2k + 2j + 1 = 2(2kj + k + j) + 1. And since 2kj + k + j is an integer via closure, this indicates that m × n must be odd by definition. But m × n was assumed to be even, so this is a contradiction. Thus the supposition is false and the original theorem is true.

Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem And again by Contradiction.

For all integers, m and n, if m × n is even, then m is even or n is even. Try proving this yourself. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem And again by Contradiction.

For all integers, m and n, if m × n is even, then m is even or n is even. Try proving this yourself.

Proof by contradiction. Suppose there are integers, m and n, where m × n is even, and m is odd and n is odd. By definition, m = 2k + 1 and n = 2j + 1, for integers k and j. So, m × n = (2k + 1)(2j + 1) = 4kj + 2k + 2j + 1 = 2(2kj + k + j) + 1. And since 2kj + k + j is an integer via closure, this indicates that m × n must be odd by definition. But m × n was assumed to be even, so this is a contradiction. Thus the supposition is false and the original theorem is true. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Lemma 1.

Given any integer k, k2 + k is even. Proof by division into cases. Case 1. Suppose k is even. Then k = 2x for some integer x. k2 is also even. The square of an even number is even. (Thm8) k2 + k is even. The sum of two even numbers is even. (Thm6) Case 2: Suppose k is odd. Then k = 2x + 1 for some integer x. k2 is also odd. The square of an odd number is odd. (Thm9) k2 + k is even. The sum of two odd numbers is even. (Thm7) Therefore, whether k is odd or even, k2 + k is even. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Definition: Divides

For any integers, a, b, b divides a if b is a factor of a .

We write b divides a as b|a.

Please do not get this mixed up with b/a, which is a division problem. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Definitions and Comparison to C

n ∈ Z and d ∈ Z + Let n = dq + r, where 0 ≤ r < d

q is called the quotient of n/d r is called the remainder of n/d In mathematics, n modulo d = r Note: In mathematics, n modulo d is always a positive number. In C or C++, if n and d are both integers, n/d = q In C or C++, n%d = r if n and d have the same sign. Otherwise, n%d = n − dq, an integer between −d and 0. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Practice with the Definitions

Below, n is the numerator and d the denominator of a fraction. 1 n = 17, d = 3, q = 5, dq = 15, r = 2. 2 n = −17, d = 3, q = −6, dq = −18, r = 1. 3 n = 17, d = −3. Not allowed because d ∈ Z+ 4 n = −17, d = −3. Not allowed because d ∈ Z+

Note that, in case 2, the answers for q and r are different from the C analogs, n/d and n%d . Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Euclid’s Lemma

For any composite integer, c = a × b, and any prime, p, if p | c then p | a or p | b, or both.

This lemma first appeared as proposition 30 in Book VII of Euclid’s Elements. A proof is beyond the scope of this course. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Lemma 3: a Quotient and a Remainder exist.

∀n ∈ Z, ∀d ∈ Z +, ∃ q and r ∈ Z such that n = dq + r and 0 ≤ r < d

1 Choose any integer n ∈ Z and any integer d ∈ Z + 2 Use real division to compute x = n/d 3 Let q = bxc and r = n − dq. Then n = dq + r. 4 0 ≤ x − bxc < 1. // bxc < x and always within 1 of x. 5 0 ≤ n/d − q < 1. // Substitute equals, lines 2 and 3. 6 0 ≤ n − dq < d. // Multiply all sides by d > 0 7 0 ≤ r < d. // Substitute equals, line 3 8 Q.E.D. by lines 3 and 7. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem The Quotient-Remainder Theorem (QRThm).

∀n ∈ Z, ∀d ∈ Z +, ∃ unique q and r ∈ Z such that n = dq + r and 0 ≤ r < d Lemma 3 shows that q, r exist. We must show uniqueness.

1 Assume there are two different combinations of q and r that satisfy the constraints. Call them q1, r1, q2, and r2. So n = dq1 + r1 and 0 ≤ r1 < d n = dq2 + r2 and 0 ≤ r2 < d

2 0 = d(q2 − q1) + (r2 − r1) (Subtract 1st line from 2nd.)

3 If q1 = q2 then 0 = (r2 − r1), so r2 = r1. Contradiction.

4 Also, if r1 = r2 then 0 = (q2 − q1), so q2 = q1. Contradiction.

Continued on the next page. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem The Quotient-Remainder Theorem – page 2.

5 Then q2 − q1 and r2 − r1 are non-zero integers. // Lines 3, 4.

6 |q2 − q1| ≥ 1, so |d(q2 − q1)| ≥ d.

7 |r2 − r1| < d therefore it is a contradiction to say that 0 = d(q2 − q1) + (r2 − r1) 8 There are no more cases. We reached a contradiction in all cases. The original theorem is true. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Theorem 14: Every integer is either even or odd.

Proof: Choose any integer, n. There are unique q and r such that n/2 = 2q + r. (QRThm) If r = 0 then n is even because 2 difides r If r = 1 then n is odd. No other remainders are possible for n/2. ∴ n is either even or odd. Outline Integer properties Parity: Even and Odd The Quotient-Remainder Theorem Applying Divisibility

Lunaville is a town with at least 100 men, where exactly 2/3 of those men are married to 3/5 of the women. (One to one!) What is the least number of men and women that could live there?

Let m = the number of men. 3 | m. (Premise) Let w = the number of women. 5 | w. (Premise) 2m/3 = 3w/5. (Premise; 1–1 marriages.) So m = 9w/10 and w = 10m/9. (Arithmetic.) But m and w are integers, so w must be divisible by 10 and m must be divisible by 9. So try m=108, the first number > 100 and divisible by 9. Then the number of women would be 10 ∗ 108/9 = 120. 2/3m = 72 and 3/5m = 72, so there are 72 married couples.