Section 4. Number Theory 4.. 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 = 6; 7 + = 8 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. a is odd k, a = 2k + () b is odd l, b = 2l + (2) WUCT2 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 = 2s 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 = = 2 ( 2k + ) + ( 2l + ) = 2l + 2k + 2 ( l + k + ) = 2s s = RHS a + b is even by (), (2) Distributivity = l + k + WUCT2 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. Also, k > 0 (as n > 2) and k. [If k were equal to, then n = 2. However, we know that n > 2.] Therefore, we have positive numbers 2 and k where and k, 2. n = 2k 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. WUCT2 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 = b a = b 2 2 Note: You MUST give a counterexample. A general disproof doesn t work as the values a = b = 0 are a counterexample to the disproof. WUCT2 Numbers 77
4.2. Divisibility 4.2.. 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 Exercise: d / n Write the definition of divisibility using logic notation. WUCT2 Numbers 78
Examples: Is 6 a divisor of 32? Yes. 32 = 6 ( 2), 2. If l and l 0, does l 0? Yes. 0 = l 0, 0. Find all values of a such that a. We need to show k, = ak a =. k Need k = ± giving a = = ±. k ± What is the relationship between a and b if a b and b a, for a, b? b a = bl = b k ak = bl kl = ( k = l = ) ( k = l = ) ( k = l = ) ( a = b) ( k = l = ) ( a = b) a = ± b a = b k = kl WUCT2 Numbers 79
Exercises: If a, b, is 3 a + 3b divisible by 3? Let a, b, c, x, y. If b a and b c, does ( ax cy) b +? Why? a, b, is it true that a b implies a b? Does 4 5? WUCT2 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 ( ) ( 2) Show that a c, that is, find m such that c = ma. Now, c = = bl ( ka) l = ( kl) a = ma a c by(2) by() by associativity and commutativity wherem = kl WUCT2 Numbers 8
4.2.3. Theorem: Divisibility by a Prime Every integer n > is divisible by some prime number. Exercise: Write the theorem of divisibility by a prime using logic notation. Proof: We need to show: Let n, n >. n,( n > a primenumber p, p n) 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 r, s, < r < n and < s < n n = r. s WUCT2 Numbers 82
Consider r, again there are two possibilities: > A. If r is prime, let p = r. Then p r and r n so p n by transitivity of divisibility B. If r is not prime, then r, < s < r 2 s2, < r 2 < r and r =. r2 s2 Consider r, again there are two possibilities 2 > A. If r 2 is prime, let p = r 2. Then p r 2 and r 2 r and r n so p n by transitivity of divisibility. B. If r 2 is not prime, then we factorise as with r 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. 2 WUCT2 Numbers 83
Thus, we obtain the listr r 2 r 3, K, r k where n > r K > > r 2 > r 3 > r k and each n The list ends when r k is prime. r i. 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 = 9 9 = 3 3 3 is prime Let p = 3 Exercise: Find a prime factor of 48. WUCT2 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: Therefore, p n is the largest prime number. Consider X p p p K p. Clearly Since = 2 3 n + X > pn. p =, p = 3,, 2 2 K pn 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: Similarly, X p X p 2 = p2 p3 K pn + p. p 2 2, so p / X = p p3 K pn +., so p 2 / X p p 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. WUCT2 Numbers 85
4.3. Quotient Remainder Theorem Exercise: Evaluate the following division without using decimals. (Nor a calculator!) 4 We can express the previous division as = 4 2 + 3. Note that the remainder, 3, is less than 4. 4.3.. 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: WUCT2 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 d n S 0 If n < 0, we can select k = n: ( d ) n n d = n 0, since n < 0 and 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 n dq = r n = dq + r k = q WUCT2 Numbers 87
We prove Suppose r < d by contradiction. r d. n d( q + ) = n dq d = r d 0 Since n dq = r, n d( q +) 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. r d, was wrong, and so B. Uniqueness: Prove that for n = dq + r, r and q are unique. Suppose that: n n = = dq + r dq + r q q, r r (2) () 0 = d( q q d( q q ) + r r ) = r r () (2) Now q,q and q q q q.. WUCT2 Numbers 88
r r d since r r (3) i.e. and r 0 r < d d < r 0 0 r d < r r < d < d r < d This contradicts (3), so our assumption is wrong. q = q r =, 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. WUCT2 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 3 + 2 q = 3, r = 2 n = 32, d = 9 32 = 9 ( 4) + 4 q = 4, r = 4 WUCT2 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 WUCT2 Numbers 9
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 + ) Let n. Now, n and 2 > 0 are integers, so we apply the Quotient- Remainder Theorem to get: q, r, n = 2q + r, 0 r < 2. For 0 r < 2 to be true, r = 0 or r =. Therefore, n = 2 q + 0 = 2q or n = 2 q + and the result follows. WUCT2 Numbers 92
4.4. The Fundamental Theorem of Arithmetic 4.4.. Theorem: The Fundamental Theorem of Arithmetic If a and a > then a can be factorised in a unique way in the form where p p, a = p p α p α2 2 p α3 3... α p k k, 2, K k are each prime numbers and α i for each i =, 2, K, k. Example: Write the following numbers in terms of their prime factors. 32 32 2 6 2 8 2 4 5 32 = 2 2 2 WUCT2 Numbers 93
924 924 2 462 2 23 3 77 924 = 2 2 3 7 7 Exercises: Write the following numbers in terms of their prime factors. 300 WUCT2 Numbers 94
2772 5093 WUCT2 Numbers 95
4.5. Finding Prime Numbers 4.5.. 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 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 + Example: 7 = 0.82 = 0 Exercise: Find 200 WUCT2 Numbers 96
Example: Find all primes between and 00. A. 00 = 0. Primes to 0 are: 2, 3, 5, 7 B. List the numbers 00 noting the primes 2, 3, 5, 7. 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 00 WUCT2 Numbers 97
C. (i) Delete multiples of 2 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 00 (ii) Delete multiples of 3 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 00 WUCT2 Numbers 98
(iii) Delete multiples of 5 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 00 (iv) Delete multiples of 7 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 00 WUCT2 Numbers 99
D. Primes: 2, 3, 5, 7,, 3, 7, 9, 23, 29, 3, 37, 4, 43, 47, 53, 59, 6, 67, 7, 73, 79, 83, 89, 97. Exercise: Find all primes between 0 and 200. A. B. C. 0 02 03 04 05 06 07 08 09 0 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 3 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 200 D. WUCT2 Numbers 00