Wednesday, February 21 Today we will begin Course Notes Chapter 5 (Number Theory). 1
Return to Chapter 5 In discussing Methods of Proof (Chapter 3, Section 2) we introduced the divisibility relation from Chapter 5: Let a, b, be integers; then a b if and only if there is an integer k such that ak = b. We also introduced the modular congruence relation from Chapter 5: For integers a, b, and positive integer m, a b (mod m) if and only if m a b. These relations, and further concepts from number theory, are at the heart of some fundamental ideas in computing, including cryptography. 2
The Division Algorithm Let a be an integer and d be a positive integer. Then there are unique integers q and r, with 0 r<d, such that a = qd + r. In the relation a = qd + r, a is called the, d is called the, q is called the, and r is called the. Note that the Division Algorithm isn t really an algorithm, but that is the commonly used name for this theorem. As the following examples suggest, finding q and r for a particular a and d can be done using an algorithmic approach, which is probably the basis for the name. 3
EXAMPLE Let a = 61, d = 13; find q and r according to the division algorithm. (You may have already completed this exercise in your head; the following systematic approach indicates the association between this theorem and the word algorithm.) To find q, and then nonnegative r, we can carry out the following sequence of calculations of the form kd for integers k until kd exceeds a. 0 13 = 1 13 = 2 13 = 3 13 = 4 13 = 5 13 = 4
EXAMPLE Let a = 21, d = 6; find q and r according to the division algorithm. True/false: q = 3 The approach taken in the previous example can be helpful in the case where a is negative; remember that r must be nonnegative and less than d (= 6). 0 6 = 1 6 = 2 6 = 3 6 = 4 6 = 5
An operation derived from the Division Algorithm In the expression a = qd + r we say that r = a modulo d or r = a mod d That is, a mod d is the remainder according to the Division Algorithm when the integer a is divided by the positive integer d. Referring to the results of the previous examples, we say that 61 mod 13 = 21 mod 6 = Beware: most calculators and programming languages have a feature is that like the mod operation (frequently denoted a % d ); exactly how these functions work can vary from one device or language to another, but they tend to not align with the mathematical definition of a mod d, which insists, among other things, that d must be positive and a mod d must be nonnegative and less than d. Note that a mod d is an operation, unlike a b (mod m), which is a relation. The two concepts are connected to one another however. 6
Theorem Let a, b, be integers and let m be a positive integer. a b (mod m) if and only if a mod m = b mod m. Here is an example of what this theorem is stating. Let m = 5, a = 28, b = 53. Then a mod m = 28 mod 5 = b mod m = 53 mod 5 = Also note that a b (mod m) because We will prove one direction of the biconditional theorem above. The proof of the other direction is similar. Prove: For integers a, b, and positive integer m, if a mod m = b mod m, then a b (mod m). 7
Number theory: more definitions and theorems The greatest common divisor of integers a, b, denoted GCD(a, b), is the largest positive integer d such that d a and d b. The least common multiple of integers a, b, denoted LCM(a, b), is the smallest positive integer d such that a d and b d. An integer p 2 is prime if the only positive divisors of p are 1 and p. An integer n 2 that is not prime is composite. If n is composite, then n is the product of integers greater than 1 but less than n. The Fundamental Theorem of Arithmetic states that every integer n 2 can be expressed as the product of prime factors, and this representation is unique when the prime factors are listed in nondescending order (we will prove part this theorem, after we have studied mathematical induction). Example: 40 = 52 = In middle school you were (probably) taught to use the prime factorizations of a, b to build GCD(a, b) and LCM(a, b). 8
Finding gcd(a, b) is an important step in solving many problems. Eventually, we will introduce a much more efficient method (the Euclidean algorithm). There are infinitely many prime numbers. This claim might seem obvious to you, but that fact that a claim seems obvious doesn t guarantee that it is true. A proof guarantees that a claim is true. The following proof is from Euclid, roughly 2000 years ago. He proved the equivalent claim: If S is any finite set of prime numbers, there is at least one prime number not included in S. The proof makes use of the Fundamental Theorem of Arithmetic, and the Division Algorithm. 9
There is no known formula or function that will automatically generate prime numbers. Generating very large prime numbers is an important part of public key cryptography. The methods used today involve are probabilistic: stated simplistically, they involve generating a very large, random odd number (easy to do), then applying various tests to decide whether there is a high probability that the number is prime. One formula that, at first, seems to generate prime numbers is: 2 p 1, where p is prime. 2 2 1 = 3 is prime 2 3 1 = 7 is prime 2 5 1 = 31 is prime 2 7 1 = 127 is prime but, alas 2 11 1 = 127 = 2047 = 23 89 is not prime. A prime number that does have the form 2 p 1 is called a Mersenne Prime. For example, 127 = 2 7 1 is a Mersenne prime. 17 is a prime, but not a Mersenne prime. 2047 = 2 11 1 is not a Mersenne prime, because 2047 is not prime. 10