Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Section 4. 4.1. Number Theory Introduction This section demonstrates some different techniques of proving some general statements. Examples: • Prove that the sum of any two odd numbers is even. Firstly you should check a few examples to confirm (for yourself) that the statement is true. 3 + 5 = 8 ; 9 + 7 = 16 ; 7 + 11 = 18 Write down what you are asked to prove in “mathematical language” (if it is not already). ∀a , b ∈ , a , b are odd ⇒ a + b is even Next, write down everything you know [related to the problem] and what they mean. Note that this also includes what you can assume – such as Claim(k) in Mathematical Induction. WUCT121 a is odd ⇒ ∃k ∈ , a = 2k + 1 (1) b is odd ⇒ ∃l ∈ , b = 2l + 1 ( 2) Numbers 74 Write down what you are trying to prove, and what that means (i.e. what you have to “get to”). Prove that a + b is even, that is ∃s ∈ , a + b = 2 s What you do at this point varies from proof to proof. Whenever you have an equality, it is often best to start with the LHS and work to the RHS. LHS = a + b = (2k + 1) + (2l + 1) by (1), (2) = 2l + 2k + 2 = 2(l + k + 1) Distributivity = 2s s = l + k + 1∈ = RHS ∴ a + b is even WUCT121 Numbers 75 • Prove that 2 is the only even prime. Clearly, 2 is an even number and a prime number. To prove that 2 is the only even prime requires a proof by contradiction. We must suppose the opposite of what we are proving, then follow the logical arguments to arrive at a contradictory statement. Suppose there exists another even prime, n, such that n > 2 . Then, ∃k ∈ , n = 2k . Now, 2 > 0 and 2 ≠ 1 . Also, k > 0 (as n > 2 ) and k ≠ 1. [If k were equal to 1, then n = 2 . However, we know that n > 2 .] Therefore, we have positive numbers 2 and k where n = 2k and k ≠ 1, 2 ≠ 1 . Thus, by definition, n is composite. This is a contradiction, as we said n is prime. Therefore, there does not exist an even prime n such that n > 2 , and so 2 is the only even prime. WUCT121 Numbers 76 Exercise: Determine if the following statements are true or false. In each case prove your answer • ∀n ∈ , n is prime ⇒ n is odd • ∀a , b ∈ , a 2 = b 2 ⇒ a = b Note: You MUST give a counterexample. A “general disproof” doesn’t work as the values a = b = 0 are a counterexample to the “disproof”. WUCT121 Numbers 77 4.2. Divisibility 4.2.1. Definition: Divisibility If n and d are integers and d ≠ 0 , then n is divisible by d if and only if n = d × k for some k ∈ . We write d | n and say that “d is a divisor of n.” Alternative expressions include: “d is a factor of n.” “d divides n.” “n is a multiple of d.” “n is divisible by d.” When n is not divisible by d we write d /| n Exercise: Write the definition of divisibility using logic notation. WUCT121 Numbers 78 Examples: • Is − 16 a divisor of 32? Yes. 32 = −16 × (−2), − 2 ∈ . • If l ∈ and l ≠ 0 , does l | 0 ? Yes. 0 = l × 0, 0 ∈ . • Find all values of a ∈ such that a | 1. We need to show ∃k ∈ , 1 = ak ⇔ a = Need • 1 . k 1 1 ∈ ⇔ k = ±1 giving a = = ±1. k ±1 What is the relationship between a and b if a | b and b | a , for a, b ∈ ? b = ak ⇔ a = b k a = bl b ∴ = bl ⇒ 1 = kl k kl = 1 ⇒ (k = l = 1) ∨ (k = l = −1) (k = l = 1) ⇒ (a = b ) (k = l = −1) ⇒ (a = −b ) ∴ a = ±b WUCT121 Numbers 79 Exercises: • If a, b ∈ , is 3a + 3b divisible by 3? • Let a , b, c, x, y ∈ . If b | a and b | c , does b | (ax + cy )? Why? • a, b ∈ , is it true that a | b implies a ≤ b ? • Does 4 | 15 ? WUCT121 Numbers 80 4.2.2. Definition: Transitivity of Divisibility For all integers a, b and c, if a | b and b | c , then a | c . Exercise: Write the definition of transitivity of divisibility using logic notation. Proof: We know: a | b ⇒ ∃k ∈ , b = ka b | c ⇒ ∃l ∈ , c = bl (1) (2) Show that a | c , that is, find m ∈ such that c = ma . Now, c = bl = ( ka )l = ( kl )a = ma ∴a |c WUCT121 by( 2) by(1) by associativity and commutativity where m = kl ∈ Numbers 81 4.2.3. Theorem: Divisibility by a Prime Every integer n > 1 is divisible by some prime number. Exercise: Write the theorem of divisibility by a prime using logic notation. Proof: We need to show: ∀n ∈ , ( n > 1 ⇒ ∃ a prime number p, p | n ) Let n ∈ , n > 1. Then there are two possibilities: a. If n is prime, let p = n . Then p | n and the result follows. b. If n is not prime, then ∃r1 , s1 ∈ ,1 < r1 < n and 1 < s1 < n n = r 1 s1 . WUCT121 Numbers 82 Consider r 1 > 1, again there are two possibilities: A. If r 1 is prime, let p = r 1 . Then p | r 1 and r 1| n so p | n by transitivity of divisibility B. If r 1 is not prime, then ∃r 2 , s 2 ∈ ,1 < r 2 < r 1 and 1 < s 2 < r 1 r1 = r 2 s2 . Consider r 2 > 1, again there are two possibilities A. If r 2 is prime, let p = r 2 . Then p | r 2 and r 2| r 1 and r 1| n so p | n by transitivity of divisibility. B. If r 2 is not prime, then we factorise as with r 1 and n. We continue in this way until we find a prime factor. This process will finish after a finite number of steps because each new factor is less than the previous one and greater than 1. WUCT121 Numbers 83 Thus, we obtain the list r 1 r 2 r 3 ,K , r k where n > r 1 > r 2 > r 3 > K > r k and each r i | n . The list ends when r k is prime. Therefore, let p = r k , then p | n and the result follows. Example: Find a prime factor of 693. 693 = 9 × 77 9 and 77 are not prime Let r 1 = 9 9 = 3×3 ∴ Let p = 3 3 is prime Exercise: Find a prime factor of 48. WUCT121 Numbers 84 4.2.4. Theorem: Infinite Number of Primes The number of primes is infinite. Proof: Suppose there is a finite number of primes; that is, we can list all prime numbers as follows: p1 = 2, p 2 = 3,K , p n Therefore, p n is the largest prime number. Consider X = p1 p 2 p3 K p n + 1. Clearly X > p n . Since p n is the largest prime, X must be composite so, by the Theorem of Divisibility by a Prime, X is divisible by a prime. Consider: X 1 1 = p 2 p3 K p n + . ∉ , so p1 /| X p1 p1 p1 X 1 1 = p1 p3 K p n + . ∉ , so p 2 /| X p2 p2 p2 Similarly, p 3 /| X . p 4 /| X , …, p n /| X . Therefore, no prime number divides X. This is a contradiction, so our assumption must be incorrect. Therefore, since the number of primes is not finite, it must be infinite. WUCT121 Numbers 85 4.3. Quotient Remainder Theorem Exercise: Evaluate the following division without using decimals. (Nor a calculator!) 4 11 We can express the previous division as 11 = 4 × 2 + 3 . Note that the remainder, 3, is less than 4. 4.3.1. Theorem: The Quotient-Remainder Theorem. If n and d > 0 are both integers, then there exist unique integers q and r such that n = dq + r and 0 ≤ r < d . Proof: We know that n, d ∈ , and d > 0 . The proof of this theorem involves proving two main things: WUCT121 Numbers 86 A. Existence: Prove that: ∃q, r ∈ , n = dq + r , 0 ≤ r < d . Let S = {n − dk : n − dk ≥ 0, k ∈ }. We want to show S is nonempty. If n ≥ 0 , we can select k = 0 : n −0⋅d = n ≥ 0 ∴n −0⋅d ∈S If n < 0 , we can select k = n : n − n ⋅ d = n(1 − d ) ≥ 0, since n < 0 and 1 − d ≤ 0 ∴n − n⋅d ∈S Therefore S is nonempty. Note that S ⊆ 0 and that 0 is well-ordered. Therefore by the well-ordering principle, S contains a least element r. Then for some specific integer k = q n − dq = r ∴ n = dq + r WUCT121 Numbers 87 We prove r < d by contradiction. Suppose r ≥ d . n − d ( q + 1) = n − dq − d = r−d ≥0 Since n − dq = r , n − d (q + 1) would be a nonnegative integer in S that would be smaller than r. But r is the smallest integer in S. We have a contradiction. Therefore our assumption, r ≥ d , was wrong, and so r<d. Uniqueness: B. Prove that for n = dq + r , r and q are unique. Suppose that: n = dq + r n = dq1 + r 1 (1) q1 ≠ q, r 1 ≠ r (2) 0 = d ( q − q1 ) + r − r 1 (1) − ( 2) ∴ d ( q − q1 ) = r 1 − r Now q, q1 ∈ and q1 ≠ q . ∴ q − q1 ≥ 1. WUCT121 Numbers 88 ∴ r1 − r ≥ d since r1 ≠ r (3) 0≤r<d ∴ −d < −r ≤ 0 and 0 ≤ r1 < d ∴ − d < r1 − r < d i.e. r1 − r < d This contradicts (3), so our assumption is wrong. ∴ q1 = q, r 1 = r Therefore for n = dq + r , r and q are unique. Summary of Proof: The proof of this theorem involved proving two main things: Existence: ∃q, r ∈ , n = dq + r , 0 ≤ r < d Let S = {n − dk : n − dk ≥ 0 and k ∈ }. Apply well-ordering to get a least value r with corresponding k = q , so that n − dq = r . Prove that r < d by assuming r ≥ d and showing that this gives a smaller element of S, which contradicts the fact that r is the least element of S. WUCT121 Numbers 89 Uniqueness: For n = dq + r , r and q are unique. (i.e. the only ones). Assume that there are two values each for q and r, and prove by contradiction that the values are really the same. The Quotient-Remainder Theorem says that when we divide any integer n by any positive integer d, there will be a quotient q and a remainder r, where 0 ≤ r < d . Example: Find values for q, r ∈ , such that n = dq + r , 0 ≤ r < d , for the following: • n = 54, d = 4 54 = 4 × 13 + 2 ∴ q = 13, r = 2 • n = −32, d = 9 − 32 = 9 × ( −4) + 4 ∴ q = −4, r = 4 WUCT121 Numbers 90 Exercises: Find values for q, r ∈ , such that n = dq + r , 0 ≤ r < d , for the following: • n = −54, d = 4 • n = 54, d = 70 WUCT121 Numbers 91 4.3.2. Result: Even or Odd Every integer is either even or odd. Proof: We must prove the statement ∀n ∈ , n is even ∨ n is odd i.e. ∀n ∈ , (∃k ∈ , n = 2k ) ∨ (∃l ∈ , n = 2l + 1 ) Let n ∈ . Now, n and 2 > 0 are integers, so we apply the QuotientRemainder Theorem to get: ∃q, r ∈ , n = 2q + r , 0 ≤ r < 2 . For 0 ≤ r < 2 to be true, r = 0 or r = 1. Therefore, n = 2q + 0 = 2q or n = 2q + 1 and the result follows. WUCT121 Numbers 92 4.4. The Fundamental Theorem of Arithmetic 4.4.1. Theorem: The Fundamental Theorem of Arithmetic If a ∈ and a > 1 then a can be factorised in a unique way in the form a = p1α1 p 2 α 2 p 3α 3 ... p k α k where p1, p 2, K , p k are each prime numbers and α i ∈ for each i = 1, 2,K , k . Example: Write the following numbers in terms of their prime factors. • 32 32 2 16 2 8 2 4 2 2 32 = 25 WUCT121 Numbers 93 • 924 924 2 462 2 231 3 77 7 11 924 = 22 × 3 × 7 × 11 Exercises: Write the following numbers in terms of their prime factors. • 1300 WUCT121 Numbers 94 • 2772 • 50193 WUCT121 Numbers 95 4.5. Finding Prime Numbers 4.5.1. Algorithm: The Sieve of Eratosthenes. The Sieve of Eratosthenes is a method of finding primes up to n as follows. A. List all the primes up to ⎣ n⎦ B. Write down all integers from 1 to n, noting the listed primes C. Delete all multiples of the listed primes D. The remaining values are the prime numbers up to n. Note: ⎣ x ⎦ is the floor function and is defined as: ⎣ x ⎦ is the greatest integer that is less than or equal to x. That is ⎣ x ⎦ = n, where n ∈ , n ≤ x < n + 1 Example: ⎣ 117 ⎦ = ⎣10.82⎦ = 10 Exercise: Find ⎣ WUCT121 200 ⎦ Numbers 96 Example: Find all primes between 1 and 100. A. ⎣ 100 ⎦ = 10 . Primes to 10 are: 2, 3, 5, 7 B. List the numbers 1 – 100 noting the primes 2, 3, 5, 7. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 20 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 WUCT121 Numbers 97 C. (i) Delete multiples of 2 1 2 3 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 20 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 4 5 6 7 8 91 92 93 94 95 96 97 98 99 100 (ii) Delete multiples of 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 20 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 WUCT121 Numbers 98 (iii) Delete multiples of 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 20 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 (iv) Delete multiples of 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 WUCT121 Numbers 99 D. Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97. Exercise: Find all primes between 101 and 200. A. B. C. 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 D. WUCT121 Numbers 100