Chapter Two. Number Theory

Save this PDF as:

Size: px
Start display at page:

Transcription

1 Chapter Two Number Theory 2.1 INTRODUCTION Number theory is that area of mathematics dealing with the properties of the integers under the ordinary operations of addition, subtraction, multiplication and division. It is one of the oldest and, without dispute, one of the most beautiful branches of mathematics. Its problems and theorems have been studied by mathematicians, both amateur and professional, for well over 2000 years. In a large measure, the subject is characterized by the simplicity with which difficult problems can be stated and the ease with which they can be understood and appreciated by persons without much mathematical background. Thus it should come as no surprise that such problems have attracted the attention of professional mathematicians and amateurs alike. Many of the most basic and interesting problems in number theory involve prime numbers. Here is an example of one such problem: We prove in Section 2.4 that there are infinitely many prime numbers; but Are there infinitely many primes of the form n 2 + 1, where n Z +? For instance, the primes 2, 5, and 17 are of this form, since 2 = , 5 = , and 17 = This question is certainly easy to understand and yet, to this day, no one has determined the answer to it. Another famous problem, one with an intriguing history, is due to the famous French mathematician Pierre de Fermat ( ). To begin our discussion of it, recall from plane geometry the Pythagorean theorem, which says that the side lengths a, b, and c of a right triangle (where c is the length of the hypotenuse) satisfy the relation c 2 = a 2 + b 2 Triples (a, b, c) of positive integers that satisfy this relation and are called Pythagorean triples; the smallest and most well-known is (3, 4, 5). Are there infinitely many Pythagorean triples? Well, of course! Once we have one triple (a, b, c) we can get infinitely many others just by taking multiples of it; that is, look at (na, nb, nc) where n is any positive integer. Starting with the triple (3, 4, 5), for instance, we obtain (6, 8, 10), (9, 12, 15), and so on. But multiples of a given triple are not very interesting. So let s call a Pythagorean triple primitive provided it is not simply a multiple of some smaller triple. We then get a revised, and more interesting, question: Are there infinitely many primitive Pythagorean triples? It turns out that the answer is yes. In fact, Pythagoras himself is credited with the following result.

2 84 Chapter 2 Number Theory Theorem 2.1 (Pythagoras): If n is an odd integer, n 3, then is a primitive Pythagorean triple. (n, n2 1 2, n2 + 1 ) 2 Note that Pythagoras formula yields the following triples: (3, 4, 5), (5, 12, 13), (7,24,25),(9, 40, 41), (11, 60, 61), (13,84, 85),... However, it does not give us all the primitive triples, for example, (8, 15, 17) does not fit Pythagoras formula. For more on the problem of finding primitive Pythagorean triples, see Chapter Problems 19 and 20. Are you starting to think like a mathematician yet? Seeing that the equation z 2 = x 2 + y 2 has infinitely many solutions in the positive integers, it may seem natural to wonder about similar equations of higher degree. What about the equation z 3 = x 3 + y 3? Does this equation have any solutions in the positive integers? That is, are there any triples (a, b, c) of positive integers such that c 3 = a 3 + b 3? In general, let d be a positive integer, and consider the equation z d = x d + y d For d > 2, are there any solutions to equation in the positive integers? Fermat couldn t find any; in fact, he claimed, in 1637, to have proved the following assertion. Fermat s Conjecture: For d > 2, no solutions to equation exist in the positive integers. Now here s where the story gets interesting. Fermat had the practice of making notes in his copy of the works of the Greek mathematician Diophantus (circa A.D. 300). He would quite often write down, without proof, a result he had discovered. The preceding conjecture is one of these discoveries. In fact, it is the only one that mathematicians had, until very recently, been unable to prove. Tantalizing us even further, Fermat himself wrote, For this I have discovered a truly wonderful proof, but the margin is too small to contain it. Because of this claim the conjecture has been called Fermat s last theorem, or FLT for short. Many famous mathematicians worked on the Fermat conjecture. Euler, for example, proved the conjecture for the case d = 3. Fermat himself proved it for d = 4 and, in 1825, Legendre and Dirichlet independently proved it for d = 5. More recently, in 1983, Gerd Faltings proved a conjecture of Mordell which implies that, for each d > 2, there are only finitely many (possibly none!) solutions to equation in the positive integers. But, though many tried, no one was able to prove Fermat s conjecture until recently, that is. As is often the case in mathematics, failed attempts to prove the general Fermat conjecture were far from fruitless; they gave rise to a wealth of important mathematics, including a good portion of abstract algebra. Let us now fast-forward to the summer of A 40-year-old mathematics professor at Princeton University, Andrew Wiles, had just spent the last seven years working alone and in secrecy on the world s most famous unsolved math problem. Finally, a shout of Eureka! In fact, Wiles had managed to prove (he thought) an important special case of a very general conjecture known as

4 86 Chapter 2 Number Theory One of the most basic principles used in mathematics, especially in number theory, is the principle of well-ordering (PWO). This was introduced in Chapter 1, and we restate it now. Principle of Well-ordering: Every nonempty subset of Z + has a smallest element. It is not possible to prove the principle of well-ordering using the familiar properties satisfied by the integers under addition and multiplication. However, a little thought should convince you of its self-evident nature. Hence, the principle of well-ordering is adopted as an axiom, or basic assumption. To get a better grasp of the principle of well-ordering (or, well-ordering principle), let s find the smallest element of several nonempty subsets of Z +. Example 2.1: Find the smallest element of each of these nonempty subsets of Z +. (a) S 1 = {n Z + n is prime} (b) S 2 = {n Z + n is a multiple of 7} (c) S 3 = {n Z + n = m for some m Z} (d) S 4 = {n Z + n = 12s + 18t for some s, t Z} Solution: (a) The set S 1 is the set of primes, and the smallest prime is 2. (b) The set S 2 is the set of positive multiples of 7, and the smallest positive multiple of 7 is 7. (c) Here we must find the smallest positive integer n of the form m, where m is an integer. The number 110 = (0) is of this form and, as m increases, n decreases. In fact, as m takes on the values 0, 1, 2, 3,..., the values of n form the sequence 110, 93, 76, 59,..., 8, 9,... Hence, the smallest element of S 3 is 8. The number 8 just happens to be the remainder when 110 is divided by 17. This is more than just a coincidence, as is shown in the next section where the division algorithm is discussed. (d) In this part we are looking for the smallest positive number n of the form 12s + 18t, where s and t are integers. Note that 12s + 18t = 6(2s + 3t); thus, any element of S 4 must be a multiple of 6. Moreover, 6 = 12( 1) + 18(1), so that 6 S 4. This shows that 6 is the smallest element of S 4. The number 6 happens to be the greatest common divisor of 12 and 18, an idea that is explored in Section 2.3. We often make use of the following slight extension of the principle of well-ordering.

5 2.1 Introduction 87 Theorem 2.2: Any nonempty subset of the set {0, 1, 2, 3,...} of nonnegative integers has a smallest element. Proof: Let S be an arbitrary nonempty subset of the set of nonnegative integers. We consider two cases, depending on whether or not 0 S. In the first case, if 0 S, then clearly 0 is the smallest element of S (because 0 is the smallest nonnegative integer). In the second case, if 0 / S, then S is a nonempty subset of Z +. In this case the principle of well-ordering implies that S has a smallest element. In either case, then, S has a smallest element, and this completes the proof. Exercise Set Plato is credited with the following result: If n is a positive integer, n 3, then is a Pythagorean triple. (2n, n 2 1, n 2 + 1) (a) Verify this result. (b) Find the Pythagorean triples given by Plato s formula for n {3, 4, 5,..., 12}. Which of them are primitive? (c) Give a necessary and sufficient condition (on n) for Plato s formula to yield a primitive Pythagorean triple. (d) In what sense do the formulas of Plato and Pythagoras (Theorem 2.1) complement each other? 2. Using Fermat s last theorem, show that the equation has no solution (x, y, z) in the positive integers. 3. Prove Theorem 2.1. z 3 = 8x y 3 4. In general, a subset T of R is said to be well-ordered provided every nonempty subset of T has a smallest element. Determine whether these subsets of R are well-ordered. (a) (b) { 9, 6, 3, 0, 1, 2,3} (c) {0} Q + (d) 2Z (e) { 9, 8, 7, 6,...} 5. Find the smallest element of each subset of Z +. (a) A = {n Z + n = m 2 10m + 28 for some integer m} (b) B = {n Z + n = 5q + 2 for some integer q} (c) C = {n Z + n = m for some integer m} (d) D = {n Z + n = 5s + 8t for some integers s and t} 6. Let T, T 1, and T 2 denote arbitrary subsets of R. Referring to the definition given in Exercise 4, prove each of the following:

6 88 Chapter 2 Number Theory (a) If T is a finite subset of R, then T is well-ordered. (b) If T is well-ordered, then c + T is well-ordered for any real number c. (c) If T is well-ordered, then ct is well-ordered for any nonnegative real number c. (d) If T is a subset of Z and T itself has a smallest element, then T is well-ordered. (e) If T 1 T 2 and T 2 is well-ordered, then T 1 is well-ordered. 7. Verify that (20, 21, 29) is a primitive Pythagorean triple that results neither from the formula of Pythagoras nor from the formula of Plato. (Is it the smallest Pythagorean triple that is missed by both of these formulas? See Chapter Problem 20.) 2.2 DIVISION ALGORITHM One of the fundamental concepts included in any introduction to number theory is that of factoring integers. In particular, given an integer n > 1, we are interested in expressing n as a product of primes. For example, if n = 132, then n = Is it always possible to do this? Can it, for some n, be done in more than one way? Before these questions can be answered, it is necessary to define and work with certain fundamental terms, like factor and prime. Definition 2.1: Let a and b be integers, with a 0. We say that a divides b, denoted a b, provided there is an integer q such that b = aq. In this case we also say that a is a factor (or divisor) of b and we call b a multiple of a. Example 2.2: (a) 2 6, since 2 3 = 6. (b) 3 27, since ( 3)( 9) = 27. (c) 12 ( 72), since 12( 6) = 72. (d) 4 does not divide 7, since there is no integer q such that 4q = 7. (e) 8 does not divide 28, since there is no q Z such that ( 8)q = 28. (f) For which integers m is it true that 0 is a multiple of m? In order for m 0 to hold, there must exist an integer q such that mq = 0. Note that q = 0 works, since m 0 = 0. Thus, 0 is a multiple of m for every integer m. Now, if m is not zero and m is a factor of the integer n, then n/m is also a factor of n; in fact, n m m = n However, this won t work if m = 0. For this and other technical reasons, we do not allow 0 to be a factor. Note that, for any integer b > 1, both of the numbers 1 and b are positive factors of b. For some positive integers b these are the only positive factors of b.

7 2.2 Division Algorithm 89 Definition 2.2: An integer p > 1 is called a prime number (or, simply, a prime) provided the only positive factors of p are 1 and p. An integer n > 1 that is not prime is called a composite number (or, simply, a composite). Suppose that the integer n is composite. Then n > 1 and n is not prime. This means that n has a factor d such that 1 < d < n. Thus it follows that n = dq, where q is an integer and 1 < q < n. In general, we refer to factors such as d and q as proper factors (or proper divisors) of n, and we call 1 and n the trivial factors (or trivial divisors) of n. Example 2.3: The numbers 2 and 3 are prime, 4 = 2 2 is composite, 5 is prime, 6 = 2 3 is composite, 7 is prime, 8 = 2 4 is composite, and 9 = 3 3 is composite. The primes less than 100 are: 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 Primes are discussed further in Section 2.4. Example 2.4: Find the factors of 126. Solution: Note that so the set of positive factors of 126 is 126 = 2 63 = 3 42 = 6 21 = 7 18 = 9 14 S = {1, 2, 3, 6, 7,9,14,18,21,42,63,126} Moreover, for any integers a and b (a 0), if a is a factor of b then a is also a factor of b. It follows that the set of negative factors of 126 is 1S = { 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, 63, 126} A number of basic properties of the relation divides are used in this and subsequent chapters. The next theorem lists several of these properties. Theorem 2.3: The following implications hold for any integers a, b, and c, with a 0: 1. If a b, then a (bx) for any integer x. 2. If a b and b c, then a c. (Here, b 0.) 3. If a b and a c, then a (bx + cy) for any integers x and y. 4. If a b and b a, then a = b or a = b. (Here, b 0.) 5. If a b and b is nonzero, then a b. Proof: We give direct proofs of parts 2 and 4 and leave the remaining parts to Exercise 2; the proofs of parts 2 and 4 provide a good illustration of how the remaining parts are proved.

8 90 Chapter 2 Number Theory For part 2, assume a b and b c. Then there exist integers q 1 and q 2 such that b = aq 1 and c = bq 2. It follows (using substitution for b) that c = bq 2 = (aq 1 )q 2 = a(q 1 q 2 ) Thus, there exists an integer q, namely q = q 1 q 2, such that c = aq. Therefore, a c. For part 4, assume a b and b a. Then there exist integers q 1 and q 2 such that b = aq 1 and a = bq 2. Hence, we have that a = bq 2 = (aq 1 )q 2 = a(q 1 q 2 ) Since a 0, it follows that 1 = q 1 q 2 and, since q 1 and q 2 are integers, we have that either q 1 = q 2 = 1 or q 1 = q 2 = 1. Hence, a = ±b. Let us emphasize again the meaning of the statement a is a factor of b. This means that there is some integer q such that b = aq. You probably remember learning about long division in elementary school. In this process, one integer b, called the dividend, is divided by another integer a, called the divisor, to obtain a quotient q and a remainder r. For example, when b = 23 is long-divided by a = 7, we obtain a quotient of 3 and a remainder of 2. One then checks this by noting that 23 = 7(3) + 2. However, note that 23 can be expressed in the form 7q + r in other ways; for example, 23 = 7(4) + ( 5) = 7(2) + 9. Is it wrong to say that the quotient is 4 and the remainder is 5, or that the quotient is 2 and the remainder is 9? Well, yes it is, because, in long-dividing 23 by 7, one is taught to determine the largest quotient q for which the remainder r is nonnegative. This implies that the remainder must be less than the divisor. In fact, it should be remarked that, among all integer expressions of the form 23 7q, one chooses the smallest nonnegative one for the remainder. In general, given integers a and b with a > 0, there exist unique integers q and r such that b = aq + r, where 0 r < a. Analogous to what is stated above regarding 23 and 7, the remainder r will turn out to be the smallest nonnegative value of the expression b aq, where q Z. This property is known as the division algorithm, and in this context the integers a, b, q, and r are called the divisor, dividend, quotient, and remainder, respectively. Theorem 2.4 (Division Algorithm): Given integers a and b with a > 0, there exist integers q and r such that b = aq + r and 0 r < a. Moreover, q and r are uniquely determined by a and b. Proof: Let integers a and b be given with a > 0. We first show that there exist integers q and r such that b = aq + r and 0 r < a. In order to do this, we apply the extended version of the principleof well-ordering (Theorem 2.2) to the set S = {b ax x Z and b ax 0} So S is a set of nonnegative integers. In order to apply Theorem 2.2, we must show that S is nonempty. If b 0, then b S, since, letting x = 0, we obtain b = b a(0). Suppose, on the other hand, thatb < 0. Then b ab S, since letting x = b yields b ab = b(1 a) 0. Thus, in either case, S is nonempty. Therefore, by Theorem 2.2, S has a smallest element; call it r. Since r S, there is somex Z, say x = q, such that r = b aq. Thus, b = aq + r and, since r S, we have that r 0.

9 2.2 Division Algorithm 91 It remains to show that r < a. To do this, we proceed by contradiction and suppose that r a. Let t = r a. Then t 0 and, since a > 0, we have that t < r. Moreover, t = r a = (b aq) a = b (aq + a) = b a(q + 1) But this means that t S (let x = q + 1) and t < r, contradicting the fact that r is the smallest element of S. This completes the proof of the existence of q and r. We next show that the quotient q and the remainder r are uniquely determined by a and b. To show that there is a unique mathematical object with a given property, a standard technique is to suppose that there are two objects with the given property, and then show that the two objects must, in fact, be equal. So, suppose that aq 1 + r 1 = b = aq 2 + r 2, where q 1, r 1, q 2, and r 2 are integers and both 0 r 1 < a and 0 r 2 < a. We wish to show that q 1 = q 2 and r 1 = r 2. Assume, without loss of generality, that r 1 r 2 ; hence, r 2 r 1 0. Since aq 1 + r 1 = aq 2 + r 2, we obtain a(q 1 q 2 ) = r 2 r 1 Thus, a (r 2 r 1 ). Since 0 r 2 r 1 < a, it must be the case that r 2 r 1 = 0. Therefore, r 2 = r 1. Then, since a(q 1 q 2 ) = r 2 r 1 = 0 and a 0, we obtain that q 1 q 2 = 0, so that q 1 = q 2. This completes the proof. The proof of Theorem 2.4 is an existence proof. It concentrates on verifying the existence of integers q and r satisfying the properties stated in the theorem, rather than on giving a method for finding q and r. However, the proof implicitly suggests an algorithm for finding q and r from a and b, using only the operations of addition and subtraction. We give an informal description of this algorithm here, leaving further investigation of it to the exercises. If b 0, then consider the sequence b a(0), b a(1), b a(2),... of numbers obtained by starting with b and then repeatedly subtracting a. Since a > 0, the numbers in this sequence are eventually negative; r = b aq is the last nonnegative term in this sequence. On the other hand, if b < 0, then consider the sequence b a(0), b a( 1), b a( 2),... of numbers obtained by starting with b and then repeatedly adding a. The numbers in this sequence are eventually nonnegative; r = b aq is the first nonnegative term. (Note in this case that q 0.) The following corollary to Theorem 2.4 extends the division algorithm to handle the case of a negative divisor. Its proof is left to Exercise 10. Corollary 2.5: Given integers a and b with a 0, there exist uniquely determined integers q and r such that b = aq + r, where 0 r < a.

10 92 Chapter 2 Number Theory Example 2.5: In the context of Corollary 2.5, find q and r for the given a and b. (a) a = 17, b = 110 (b) a = 7, b = 59 (c) a = 11, b = 41 (d) a = 5, b = 27 (e) a = 13, b = 7 (f) a = 13, b = 7 Solution: (a) Since 110 = 17(6) + 8, we have that q = 6 and r = 8. (b) Since 59 = 7( 9) + 4, we have that q = 9 and r = 4. In this problem it is easy to make the mistake of saying q = 8 and r = 3, since 59 = 7( 8)+( 3). However, remember that any remainder is required to be nonnegative, so r = 3 can t be right. (c) In this part we find that q = 3 and r = 8. (d) Here we find that q = 6 and r = 3. Parts (e) and (f) are meant to illustrate the following general problem: Given integers a and b with 0 b < a, find q and r. This is actually an easy problem, since b = a(0) + b and b is a valid remainder; see Exercise 24. In part (e), for example, note that 7 = 13(0) + 7 and 0 7 < 13 Thus, q = 0 and r = 7. Similarly, in part (f), 7 = ( 13)(0)+7 and 0 7 < 13. Hence it follows that q = 0 and r = 7. Example 2.6: Show that any integer m is expressible in precisely one of the forms 3q, 3q + 1, or 3q + 2, where q is an integer. Solution: Apply Corollary 2.5 with dividend m and divisor 3 it states that there exist unique integers q and r such that m = 3q + r, where 0 r < 3. Hence r = 0, r = 1, or r = 2. Since r is uniquely determined, it follows that m is expressible in precisely one of the forms 3q, 3q + 1, or 3q + 2. Example 2.7: Show that the product of any two consecutive integers is even. Solution: According to the division algorithm (Corollary 2.5), every integer m is uniquely expressible in the form m = 2q + r, where 0 r < 2. Thus m is expressible in precisely one of the forms 2q or 2q + 1. If m = 2q, we call m an even integer, whereas if m = 2q + 1, we call m an odd integer. Now, consider two arbitrary consecutive integers, n and n + 1, say. We want to show that n(n + 1) is even. This means that we must show that n(n + 1) = 2k for some integer k. We consider two cases, depending on whether n itself is even or odd. In the first case, suppose that n is even, say n = 2q. Then n(n + 1) = 2q(2q + 1) = 2(2q 2 + q) This shows that n(n + 1) is even. (Here, k = 2q 2 + q.)

11 2.2 Division Algorithm 93 In the second case, suppose that n is odd, say n = 2q + 1. Then n(n + 1) = (2q + 1)(2q + 2) = 2(2q + 1)(q + 1) so again n(n + 1) is even. (In this case, k = (2q + 1)(q + 1).) In general, given an arbitrary positive integer n, the division algorithm tells us that every integer is expressible in precisely one of the following forms: nq, nq + 1, nq + 2,..., nq + (n 1) In much of the discussion that follows you need to make use of this idea, so be ready for it. The following example illustrates this point. Example 2.8: Show that the product of any two integers of the form 6k + 5 has the form 6k + 1. Solution: Let m 1 and m 2 be two integers of the form 6k + 5. This means that m 1 = 6k and m 2 = 6k for some integers k 1 and k 2. Thus, m 1 m 2 = (6k 1 + 5)(6k 2 + 5) = 36k 1 k k k = 36k 1 k k k = 6(6k 1 k 2 + 5k 1 + 5k 2 + 4) + 1 Therefore, m 1 m 2 has the form 6k + 1 (with k = 6k 1 k 2 + 5k 1 + 5k 2 + 4), as was to be shown. As already noted, if the division algorithm is applied to an integer m and the divisor 3, then the remainder r is precisely one of the numbers 0, 1, or 2. Define the sets S 0, S 1, and S 2 by S 0 = {3q q Z} = 3Z S 1 = {3q + 1 q Z} = 1 + 3Z S 2 = {3q + 2 q Z} = 2 + 3Z Then, for r {0, 1, 2}, S r is the set of all those integers m that yield a remainder of r when divided by 3. For instance, 11 = , so 11 S 2, whereas 11 = 3( 4) + 1, so 11 S 1. By the uniqueness of r, each integer m belongs to exactly one of the sets S 0, S 1, or S 2. It follows that: 1. Z = S 0 S 1 S 2 ; 2. The sets S 0, S 1, and S 2 are pairwise disjoint. Because these two properties hold, we say that {S 0, S 1, S 2 } is a partition of the set Z. important concept of partition is explored further in Chapter 4. In explicit form, S 0 = {... 9, 6, 3, 0, 3,6,9,...} S 1 = {... 8, 5, 2, 1, 4,7,10,...} S 2 = {... 7, 4, 1, 2, 5,8,11,...} Note that two integers are in the same set S r if and only if they differ by a multiple of 3. suggests the following general and important result. The This

12 94 Chapter 2 Number Theory Theorem 2.6: Let m 1, m 2, and n be integers, with n 0, and let the remainders upon division of m 1 and m 2 by n be r 1 and r 2, respectively. Then r 1 = r 2 if and only if n (m 2 m 1 ) Proof: Let m 1, m 2, and n be integers, with n 0, and let the remainders upon division of m 1 and m 2 by n be r 1 and r 2, respectively. To prove this result, we must prove the two implications: (1) If r 1 = r 2, then n (m 2 m 1 ). (2) If n (m 2 m 1 ), then r 1 = r 2. According to the division algorithm, for some integers q 1 and q 2. Thus, m 1 = nq 1 + r 1 and m 2 = nq 2 + r 2 m 2 m 1 = (nq 2 + r 2 ) (nq 1 + r 1 ) = n(q 2 q 1 ) + (r 2 r 1 ) We first prove (1) directly. Assume r 1 = r 2. Then r 2 r 1 = 0, and so m 2 m 1 = n(q 2 q 1 ) which shows that n (m 2 m 1 ). To complete the proof, we must prove implication (2). This is left to Exercise 8. Exercise Set In the context of Corollary 2.5, find q and r for the given a and b. (a) a = 11, b = 297 (c) a = 8, b = 77 (e) a = 5, b = 35 (b) a = 9, b = 63 (d) a = 6, b = 71 (f) a = 6, b = Prove Theorem 2.3, parts 1, 3, and 5. Also, prove part 4 as a corollary to part Let a, b, and c be integers, with a 0. Prove each of these implications: (a) If a b and a c, then a 2 (bc). (b) If a b, then a ( b) and ( a) b. 4. Prove that the following implication holds for any integers a, b, c, and d, with a and c nonzero: 5. Prove each of the following facts: If a b and c d, then (ac) (bd). (a) The square of any odd integer is of the form 4k + 1 (for some integer k). (b) The square of any integer is of the form 3k or 3k + 1.

13 2.2 Division Algorithm Let a, b, and c be arbitrary integers with a and c nonzero. Prove: If (ac) (bc), then a b. 7. Apply the result of part (a) of Exercise 5 to show that none of the numbers 11, 111, 1111, and is a perfect square. (Hint: Apply the division algorithm, with a divisor of 4.) Based on the result of this exercise, make a general conjecture regarding numbers of the form Complete the proof of Theorem 2.6. (Hint: Show that r 1 r 2 is a multiple of n and that 0 r 1 r 2 < n. It follows that r 1 r 2 = 0. Why?) 9. Let a, b, and c be arbitrary integers, with a 0. Prove or disprove: If a (bc), then either a b or a c. 10. Prove Corollary 2.5. (Hint: If a < 0, then a > 0, and we can apply Theorem 2.4 to find integers q and r such that b = ( a)q + r, where 0 r < a.) 11. Apply the result of part (b) of Exercise 5 to show that, for any integer m, 3m 2 1 is not a perfect square. 12. Prove that: (a) The sum of any two even integers is even. (b) The sum of any two odd integers is even. (c) The sum of any even integer and any odd integer is odd. 13. Prove: Given any three consecutive integers, (exactly) one of them is a multiple of 3. (Hint: Denote the three consecutive integers by m, m + 1, m + 2 and use the fact that m is expressible in exactly one of the forms 3q, 3q + 1, or 3q + 2.) 14. Prove that, for any integer m, m 3 m is a multiple of 3. (Hint: Note that m 3 m = m(m 2 1); if m is not a multiple of 3, what can be said about m 2 1?) 15. Prove: For any integer m, (exactly) one of the integers m, m + 4, m + 8, m + 12, m + 16 is a multiple of Let m represent an arbitrary integer. Prove: If m has the form 6q + 5 for some integer q, then mhas the form 3k + 2 for some integer k. What about the converse of this implication? 17. Prove the following results as corollaries to Theorem 2.3. (a) For any integer m, if m is even, then mx is even for any integer x. (b) For any positive integers m and n, if m n, then m n. 18. Other than 2, show that no positive integer of the form n is prime. (Hint: Apply the standard formula for factoring the sum of two cubes.) 19. Let p represent an arbitrary prime. Prove: If p has the form 3q + 1 for some integer q, then p has the form 6k + 1 for some integer k. (Hint: If p has the form 3q + 1, then p must be odd, so what can be said about q?) 20. Prove: If (a, b, c) is a Pythagorean triple, then one of a, b, or c is divisible by 3, one is divisible by 4, and one is divisible by 5. (For example, if a = 5, b = 12, and c = 13, then 3 b, 4 b, and 5 a.)

14 96 Chapter 2 Number Theory 21. In this exercise, we introduce the div and mod notation. Given integers a and b with a 0, Corollary 2.5 states that there exist uniquely determined integers q and r such that b = aq + r, where 0 r < a. In this context, we define the operators div and mod as follows: b div a = q b mod a = r Find b div a and b mod a for the pairs of integers a and b given in Exercise Given positive integers a and b, explain how to use a standard pocket calculator to compute 23. Let m 1 and m 2 be integers such that Find: b div a and b mod a m 1 div 5 = q 1 m 1 mod 5 = 2 m 2 div 5 = q 2 m 2 mod 5 = 3 (a) (m 1 + m 2 ) div 5 (b) (m 1 + m 2 ) mod 5 (c) (m 1 m 2 ) div 5 (d) (m 1 m 2 ) mod Given integers a and b with 0 b < a, find b div a and b mod a. 25. Compute each of the following. (a) 47 div 10 (b) 47 mod 10 (c) 47 div ( 10) (d) 47 mod ( 10) (e) ( 47) div 10 (f) ( 47) mod 10 (g) ( 47) div ( 10) (h) ( 47) mod ( 10) 26. Show, for a > 0, that b div ( a) = (b div a) and b mod ( a) = b mod a 27. Given that m 1 div 7 = q 1, m 1 mod 7 = 2, m 2 div 7 = q 2, and m 2 mod 7 = 6, find: (a) (m 1 + 5) div 7 (b) (m 1 + 5) mod 7 (c) (2m 1 ) div 7 (d) (2m 1 ) mod 7 (e) ( m 2 ) div 7 (f) ( m 2 ) mod 7 (g) (m 1 + m 2 ) div 7 (h) (m 1 + m 2 ) mod 7 (i) (2m 1 + 3m 2 ) div 7 (j) (2m 1 + 3m 2 ) mod 7 (k) (m 1 m 2 ) div 7 (l) (m 1 m 2 ) mod Let a and b be positive integers with 1 a b. (a) Find and verify a formula for ( b) div a in terms of b div a. (b) Find and verify a formula for ( b) mod a in terms of b mod a. 29. Let a and b be positive integers. (a) What is the smallest possible value for b div a? (b) What is the largest possible value for b div a?

15 2.3 Euclidean Algorithm 97 Given a and b, suppose one guesses a value q for b div a in the range of possible values. Note that, if 0 b aq < a, then b div a = q and b mod a = b aq. However: (c) If b aq < 0, what does this indicate about the guess q? (d) If b aq a, what does this indicate about the guess q? 30. Describe (and implement as a computer program) an algorithm that inputs integers a and b with a 0 and outputs b div a and b mod a. Base your algorithm on the results of Exercises 26, 28, and the remarks following the proof of Theorem Several computer programming languages, such as Ada and C++, have built in operators to compute b div a and b mod a for integers a and b. However, the results do not always agree with Definition 2.3. If you are familiar with a language that has such operators, write a short program to test them. 2.3 EUCLIDEAN ALGORITHM In this section we define the greatest common divisor of two integers and describe an efficient method for finding it, given the integers. Definition 2.3: Given integers a and b, the integer c 0 is called a common divisor (or common factor) of a and b provided both c a and c b. If a and b are not both zero, then we define the greatest common divisor (or greatest common factor) of a and b to be the largest common factor of a and b. The greatest common divisor of a and b is denoted by gcd(a, b). Let us make a few observations about gcd(a, b). First, since 1 a and 1 b, we have that Second, 1 gcd(a, b) gcd(b, a) = gcd(a, b) so we may, without loss of generality, assume that a b. Third, since gcd( a, b) = gcd(a, b) = gcd(a, b) we can assume that 0 a b. Finally note that, for b > 0, gcd(0, b) = b = gcd(b, b) Thus, in seeking gcd(a, b), it suffices to consider the case when 1 a < b; in this case, 1 gcd(a, b) a. In particular, this last statement implies that gcd(a, b) exists.

16 98 Chapter 2 Number Theory Example 2.9: Find: (a) gcd(12, 36) (b) gcd(18, 42) (c) gcd(15, 28) Solution: (a) Note that 12 is a factor of 36; hence gcd(12, 36) = 12. (b) The positive factors of 18 are 1, 2, 3, 6, 9, and 18; of these, only 1, 2, 3, and 6 are factors of 42. Therefore, gcd(18, 42) = 6. (c) The positive factors of 15 are 1, 3, 5, and 15. Of these, only 1 is a factor of 28. Thus, gcd(15, 28) = 1. Generalizing the result of part (a) of the preceding example, note that, for 1 a < b, gcd(a, b) = a if and only if a b For 1 a < b, a simple-minded method for finding d = gcd(a, b) is to search the list of numbers a, a 1, a 2,..., 2, 1, looking for the largest one that is a common factor of a and b. In the worst case (when gcd(a, b) = 1), this method would take a steps to find d, where each step consists of determining whether a given positive integer is a common factor of a and b. In a number of practical applications (e.g., data encryption) in which gcd(a, b) must be computed, a might be a number on the order of Even with a fast computer that performs, say, steps per second, finding gcd(a, b) by this method could take seconds in the worst case. Since there are less than 10 8 seconds in a year, this is a very long time far longer than the estimated age of the universe! Fortunately, there is a much faster method, which goes way back to Euclid ( 300 B.C.), and is based on repeated application of the division algorithm. For this method, assume we are given integers a and b with 0 a < b; we wish to find gcd(a, b). First of all, let s handle the easy case; namely, if a = 0, then gcd(a, b) = b. To handle the case when a > 0, we make use of the following lemma. Lemma 2.7: For integers a and b with 0 < a b, let r = b mod a. Then gcd(a, b) = gcd(r, a) Proof: Let d 1 = gcd(a, b) and d 2 = gcd(r, a) We wish to show that d 1 = d 2. We do this by showing that d 1 d 2 and d 2 d 1. Let q = b div a. Then b = aq + r. Since b = a(q) + r(1), by Theorem 2.3, part 3, any common factor of a and r is also a factor of b. Hence, d 2 is a factor of b, and thus d 2 is a common factor of a and b. Therefore, d 2 d 1. (Why?)

17 2.3 Euclidean Algorithm 99 Similarly, since r = b aq = a( q) + b(1), any common factor of a and b is also a factor of r. Hence, d 1 is a factor of r, and thus d 1 is a common factor of a and r. It follows that d 1 d 2. Now consider finding gcd(a, b) when 0 < a b. By the division algorithm, there exist (unique) integers q and r such that b = aq + r, with 0 r < a. By Lemma 2.7, we see that gcd(a, b) = gcd(r, a) This observation forms the basis for a procedure known as the Euclidean algorithm. Note that, for a > 0, we replace the problem of finding gcd(a, b) with the problem of finding gcd(r, a). In the sense that r < a and a < b, this new problem constitutes a reduced form of the original problem. But, you may ask, How do I now find gcd(r, a)? The answer is, Apply the same reasoning again! That is, if r = 0, then gcd(r, a) = a. Otherwise, let r be the remainder when a is divided by r; then gcd(r, a) = gcd(r, r). The Euclidean algorithm is an example of a recursive algorithm, because it operates by reducing a (nontrivial) instance of a given type of problem to a smaller instance of the same type of problem. Euclidean Algorithm: Given integers a and b with 0 a b: 0. If a = 0, then gcd(a, b) = b; 1. Otherwise, let r be the remainder when b is divided by a; then gcd(a, b) = gcd(r, a). Example 2.10: Use the Euclidean algorithm to compute gcd(64, 148). Solution: Since 64 > 0, we apply the division algorithm to 64 and 148, obtaining 148 = 64(2) + 20, namely, a quotient of 2 and a remainder of 20. By step 1 of the algorithm, then, gcd(64, 148) = gcd(20, 64) Next 20 > 0, so now we divide 64 by 20, obtaining a quotient of 3 and a remainder of 4. So, by step 1 of the algorithm, gcd(20, 64) = gcd(4, 20) Still 4 > 0, so we apply the recursive step again. Dividing 20 by 4 yields a quotient of 5 and a remainder of 0, so that gcd(4, 20) = gcd(0, 4) Finally, gcd(0, 4) = 4. Therefore, putting all of the steps together, we see that gcd(64, 148) = gcd(20, 64) = gcd(4, 20) = gcd(0, 4) = 4 It is the repeated application of Lemma 2.7 that indicates the general form of the Euclidean algorithm. Let s look at this form more carefully. Suppose that a and b are positive integers with a < b. We begin by setting r 0 = b and r 1 = a. We then successively apply the division algorithm as follows:

18 100 Chapter 2 Number Theory r 0 = r 1 q 1 + r 2 0 r 2 < r 1 r 1 = r 2 q 2 + r 3 0 r 3 < r 2.. r k 1 = r k q k + r k+1 0 r k+1 < r k. Consider the values r 0, r 1, r 2,..., r k 1, r k, r k+1,.... In view of the requirement in the division algorithm that any remainder be less than its corresponding divisor, we see that these numbers form a strictly decreasing sequence of integers; namely, that r 0 > r 1 > r 2 > > r k 1 > r k > r k+1 > However, the above sequence of remainders can t go on forever, because each remainder is nonnegative, and it s impossible to have an infinite, strictly decreasing sequence of nonnegative integers. Hence, there must be some positive integer n + 1 such that r n+1 = 0, and so the above list of relations can be rewritten as follows: Then we obtain r 0 = r 1 q 1 + r 2 0 r 2 < r 1 r 1 = r 2 q 2 + r 3 0 r 3 < r 2.. r n 2 = r n 1 q n 1 + r n 0 r n < r n 1 r n 1 = r n q n + r n+1 r n+1 = 0 gcd(a, b) = gcd(r 2, a) = gcd(r 3, r 2 ) = = gcd(r n+1, r n ) = gcd(0, r n ) = r n It can be shown (see Chapter Problem 30) that the Euclidean algorithm requires not more than 2 log 2 a divisions to compute gcd(a, b). For a on the order of , this bound is on the order of 200(log 2 10) 665. So the Euclidean algorithm is very efficient! Given integers a and b, a linear combination of a and b (over Z) is any expression of the form as + bt with s, t Z. Our next result provides an important characterization of gcd(a, b), showing that it is the smallest positive integer that can be expressed as a linear combination of a and b. The proof of the theorem applies the division algorithm in a strong way, and also makes use of the principle of well-ordering.. Theorem 2.8: Let a and b be integers, not both 0. Then gcd(a, b) is the smallest positive integer expressible as a linear combination of a and b. Proof: Consider the set S = {ax + by x, y Z and ax + by > 0} If we let x = a and y = b, then ax + by = a 2 + b 2 > 0 (since not both a and b are zero). Thus, the set S is nonempty. By the principle of well-ordering, S has a smallest element; call it d. So d is the smallest positive integer expressible as a linear combination of a and b, say, d = as + bt, where s, t Z. To show that d = gcd(a, b), we must verify the following:

19 2.3 Euclidean Algorithm d is a common divisor of a and b; 2. If c is any common divisor of a and b, then c d. To show 1, we first apply the division algorithm to a and d, obtaining integers q and r such that a = dq + r, with 0 r < d. To show that d a, it suffices to show that r = 0. Since d = as + bt, we have that r = a dq = a (as + bt)q = a(1 sq) + b( tq) where both 1 sq and tq are integers. So r is a linear combination of a and b. But r < d, and d is the smallest positive linear combination of a and b, so r can t be positive. Hence, r = 0, as we wished to show. In a completely analogous way, it can be shown that d b. Next, to show 2, let c be any common divisor of a and b. If c < 0, then clearly c d, so we may assume that c > 0. Since c is a common divisor of a and b, it follows from Theorem 2.3, part 3, that c is a divisor of any linear combination of a and b; in particular, c d. Then, since both c and d are positive, it follows from part 5 of Theorem 2.3 (more directly, from Exercise 17, part (b) of Exercise Set 2.2), that c d. This completes the proof. So, given integers a and b, not both zero, there exist integers s and t such that gcd(a, b) = as + bt We have an efficient algorithm, namely, the Euclidean algorithm, for finding gcd(a, b). Is there some way to extend this algorithm so that it also finds the integers s and t? Indeed there is, and it is called the extended Euclidean algorithm. We illustrate the general form of the extended Euclidean algorithm by looking at a particular example. In particular, let s compute d = gcd(141, 486) and find integers s and t such that d = 141s + 486t. Recall that d is the last nonzero remainder obtained in the process of applying the Euclidean algorithm. There is an especially nice way to display the remainders and quotients obtained along the way. In the general case, where 0 < a < b, if r n is the last nonzero remainder, then d = r n, and we can display the results in the following table (recall that r 0 = b and r 1 = a): b a r 2 r 3 r 4 r n 0 q 1 q 2 q 3 q 4 q n It is easy to see how the relations obtained from our successive application of the division algorithm give rise to the entries in this table. Namely, for 0 k < n, we have the relation r k = r k+1 q k+1 + r k+2 and in the table this information is entered into successive columns as follows: r k r k+1 r k+2 q k+1 In our particular example, with a = 141 and b = 486, you should verify that the following table is obtained:

20 102 Chapter 2 Number Theory Thus, we see that d = gcd(141, 486) = 3. The method for determining the values of s and t such that 3 = 141s + 486t makes use of the above table. The idea is to express each remainder r k, 0 k n, as a linear combination of a and b. That is, for each k, 0 k n, we wish to find integers s k and t k such that r k = as k + bt k Then, when k = n, we obtain the desired relation expressing d as a linear combination of a and b. So the method generates two additional sequences: s 0, s 1, s 2,..., s n and t 0, t 1, t 2,..., t n. These two sequences are added as rows to the table, so that in general the table looks like this: b a r 2 r n 0 q 1 q 2 q n s 0 s 1 s 2 s n t 0 t 1 t 2 t n To get things started, we need to find values for s 0, t 0, s 1, and t 1 such that b = r 0 = as 0 + bt 0 a = r 1 = as 1 + bt 1 That s easy! Simply let s 0 = 0, t 0 = 1, s 1 = 1, and t 1 = 0. It s also easy to obtain the values of s 2 and t 2. By the division algorithm, r 2 = b aq 1 = a( q 1 ) + b(1) Hence, s 2 = q 1 and t 2 = 1. So far, then, our general table looks like this: b a r 2 r 3 r n 0 q 1 q 2 q 3 q n 0 1 q 1 s 3 s n t 3 t n In our particular example, when a = 141 and b = 486, we have the following so far: s 3 s t 3 t 4 It is important to understand that each column of this table indicates how to express the remainder in that column as a linear combination of a and b. For example, in the above table, the column corresponding to k = 2 indicates that 63 = 141( 3) + 486(1)

21 2.3 Euclidean Algorithm 103 Next, we need to determine values for s 3 and t 3 such that 15 = r 3 = as 3 +bt 3. To do this, we first make use of the division algorithm to express r 3 in terms of r 1 and r 2. Recall that r 1 = r 2 q 2 + r 3 ; hence: 15 = r 3 = r 1 r 2 q 2 = (2) We then use the values already found for s 1, s 2, t 1, and t 2 to replace each of r 1 and r 2 in the above expression by a linear combination of a and b. In the general case, this gives us: r 3 = r 1 r 2 q 2 = (as 1 + bt 1 ) (as 2 + bt 2 )q 2 = a(s 1 s 2 q 2 ) + b(t 1 t 2 q 2 ) and so we see that s 3 = s 1 s 2 q 2 and t 3 = t 1 t 2 q 2. In our particular example, we find that r 3 = 15 = (2) = [ 141(1) + 486(0) ] [ 141( 3) + 486(1) ] (2) = 141(1 ( 3)2) + 486(0 1(2)) = 141(7) + 486( 2) Thus, s 3 = 7 and t 3 = 2. (Check that 15 = 141(7) + 486( 2).) Try to notice a general pattern in the above expressions for s 3 and t 3. Can you guess what the expressions for s 4 and t 4 are? Let s work it out. Again the division algorithm is the key, because from it we know that r 2 = r 3 q 3 + r 4. Hence, r 4 = r 2 r 3 q 3 = (as 2 + bt 2 ) (as 3 + bt 3 )q 3 = a(s 2 s 3 q 3 ) + b(t 2 t 3 q 3 ) Thus, s 4 = s 2 s 3 q 3 and t 4 = t 2 t 3 q 3. In our example, then, we find that s 4 = s 2 s 3 q 3 = 3 7(4) = 31 t 4 = t 2 t 3 q 3 = 1 ( 2)(4) = 9 Hence, r 4 = 3 = 141( 31) + 486(9). (Check this!) Since d = r 4, our example is complete. In summary, our results indicate that d = 3, s = 31, and t = 9, and here is the complete table: Let us now return to consideration of the extended Euclidean algorithm in the general case. As already noted, the results from an application of the algorithm can be displayed in table form as follows: b a r 2 r k 1 r k r k+1 r n 0 q 1 q 2 q k 1 q k q k+1 q n s 0 s 1 s 2 s k 1 s k s k+1 s n t 0 t 1 t 2 t k 1 t k t k+1 t n Suppose that the above table has been completed through column k, except for the value of q k, and we next wish to find q k and then fill in the values of r k+1, s k+1, and t k+1 in column k + 1. If we understand how this is done, then we understand how the extended Euclidean algorithm works in general. Now then, we know how to obtain q k and r k+1, since these are the quotient and remainder, respectively, obtained by dividing r k 1 by r k. Hence it follows that r k 1 = r k q k + r k+1, and we

22 104 Chapter 2 Number Theory use this relation and the values from columns k 1 and k to find s k+1 and t k+1. This is done as follows: r k+1 = r k 1 r k q k = (as k 1 + bt k 1 ) (as k + bt k )q k = a(s k 1 s k q k ) + b(t k 1 t k q k ) Thus, s k+1 = s k 1 s k q k and t k+1 = t k 1 t k q k. In summary, the sequence s 0, s 1, s 2,..., s n 1 is defined by s 0 = 0 s 1 = 1 s k+1 = s k 1 s k q k, for k = 1, 2,..., n 1 We say that the sequence is defined recursively by the initial values s 0 = 0 and s 1 = 1 and the recurrence relation (or recurrence formula) s k+1 = s k 1 s k q k. Similarly, the sequence t 0, t 1, t 2,..., t n 1 is defined recursively by the following initial values and recurrence relation: t 0 = 1 t 1 = 0 t k+1 = t k 1 t k q k, for k = 1, 2,..., n 1 In words, to obtain the value of s in a given column, multiple the value of s in the preceding column by the quotient in that column, and then subtract this product from the value of s in the column two columns before the given one. Similarly, to obtain the value of t in a given column, multiply the value of t in the preceding column by the quotient in that column, and then subtract this product from the value of t two columns before. Example 2.11: Use the extended Euclidean algorithm to find d = gcd(1407, 3255) and integers s and t such that d = 1407s t. Solution: First, we successively apply the division algorithm to obtain the first two rows of the table: So we see that d = gcd(1407, 3255) = 21. Now we must complete the third and fourth rows of the table using the initial values and recurrence relations for the s and t values. It is recommended that you complete the third row first, and then do the fourth row. Completing the third row, you should get For example, s = s 4 = s 2 s 3 q 3 = 2 (7)5 = 2 35 = 37. We then do the fourth row; see if you get

Topics in Number Theory

Chapter 8 Topics in Number Theory 8.1 The Greatest Common Divisor Preview Activity 1 (The Greatest Common Divisor) 1. Explain what it means to say that a nonzero integer m divides an integer n. Recall

The Equation x 2 + y 2 = z 2

The Equation x 2 + y 2 = z 2 The equation x 2 + y 2 = z 2 is associated with the Pythagorean theorem: In a right triangle the sum of the squares on the sides is equal to the square on the hypotenuse. We

2. Integers and Algorithms Euclidean Algorithm. Euclidean Algorithm. Suppose a and b are integers

2. INTEGERS AND ALGORITHMS 155 2. Integers and Algorithms 2.1. Euclidean Algorithm. Euclidean Algorithm. Suppose a and b are integers with a b > 0. (1) Apply the division algorithm: a = bq + r, 0 r < b.

Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that. a = bq + r and 0 r < b.

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that a = bq + r and 0 r < b. We re dividing a by b: q is the quotient and r is the remainder,

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

Further linear algebra. Chapter I. Integers.

Further linear algebra. Chapter I. Integers. Andrei Yafaev Number theory is the theory of Z = {0, ±1, ±2,...}. 1 Euclid s algorithm, Bézout s identity and the greatest common divisor. We say that a Z divides

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof. Harper Langston New York University

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof Harper Langston New York University Proof and Counterexample Discovery and proof Even and odd numbers number n from Z is called

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES 2016 47 4. Diophantine Equations A Diophantine Equation is simply an equation in one or more variables for which integer (or sometimes rational) solutions

Prime Numbers. Chapter Primes and Composites

Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are

Section 4.2: The Division Algorithm and Greatest Common Divisors

Section 4.2: The Division Algorithm and Greatest Common Divisors The Division Algorithm The Division Algorithm is merely long division restated as an equation. For example, the division 29 r. 20 32 948

8 Divisibility and prime numbers

8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,

Practice Problems for First Test

Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the human mind will never penetrate.-

a = bq + r where 0 r < b.

Lecture 5: Euclid s algorithm Introduction The fundamental arithmetic operations are addition, subtraction, multiplication and division. But there is a fifth operation which I would argue is just as fundamental

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

SECTION 10-2 Mathematical Induction

73 0 Sequences and Series 6. Approximate e 0. using the first five terms of the series. Compare this approximation with your calculator evaluation of e 0.. 6. Approximate e 0.5 using the first five terms

Pythagorean Triples Pythagorean triple similar primitive

Pythagorean Triples One of the most far-reaching problems to appear in Diophantus Arithmetica was his Problem II-8: To divide a given square into two squares. Namely, find integers x, y, z, so that x 2

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

Congruences. Robert Friedman

Congruences Robert Friedman Definition of congruence mod n Congruences are a very handy way to work with the information of divisibility and remainders, and their use permeates number theory. Definition

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

Chapter 6. Number Theory. 6.1 The Division Algorithm

Chapter 6 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,

4 Number Theory I: Prime Numbers

4 Number Theory I: Prime Numbers Number theory is the mathematical study of the natural numbers, the positive whole numbers such as 2, 17, and 123. Despite their ubiquity and apparent simplicity, the natural

CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010

CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010 1. Greatest common divisor Suppose a, b are two integers. If another integer d satisfies d a, d b, we call d a common divisor of a, b. Notice that as

Section 6-2 Mathematical Induction

6- Mathematical Induction 457 In calculus, it can be shown that e x k0 x k k! x x x3!! 3!... xn n! where the larger n is, the better the approximation. Problems 6 and 6 refer to this series. Note that

4.2 Euclid s Classification of Pythagorean Triples

178 4. Number Theory: Fermat s Last Theorem Exercise 4.7: A primitive Pythagorean triple is one in which any two of the three numbers are relatively prime. Show that every multiple of a Pythagorean triple

A farmer raises rabbits. Each rabbit gives birth when 2 months old and then each month there after.

Fibonacci Problem: A farmer raises rabbits. Each rabbit gives birth when 2 months old and then each month there after. Question: How many rabbits will the farmer have after n months? Try it on small numbers.

Algebra for Digital Communication

EPFL - Section de Mathématiques Algebra for Digital Communication Fall semester 2008 Solutions for exercise sheet 1 Exercise 1. i) We will do a proof by contradiction. Suppose 2 a 2 but 2 a. We will obtain

It is time to prove some theorems. There are various strategies for doing

CHAPTER 4 Direct Proof It is time to prove some theorems. There are various strategies for doing this; we now examine the most straightforward approach, a technique called direct proof. As we begin, it

Pythagorean Triples. Chapter 2. a 2 + b 2 = c 2

Chapter Pythagorean Triples The Pythagorean Theorem, that beloved formula of all high school geometry students, says that the sum of the squares of the sides of a right triangle equals the square of the

In a triangle with a right angle, there are 2 legs and the hypotenuse of a triangle.

PROBLEM STATEMENT In a triangle with a right angle, there are legs and the hypotenuse of a triangle. The hypotenuse of a triangle is the side of a right triangle that is opposite the 90 angle. The legs

ON THE FIBONACCI NUMBERS

ON THE FIBONACCI NUMBERS Prepared by Kei Nakamura The Fibonacci numbers are terms of the sequence defined in a quite simple recursive fashion. However, despite its simplicity, they have some curious properties

12 Greatest Common Divisors. The Euclidean Algorithm

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan 12 Greatest Common Divisors. The Euclidean Algorithm As mentioned at the end of the previous section, we would like to

Mathematics of Cryptography

CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter

4. Number Theory (Part 2)

4. Number Theory (Part 2) Terence Sim Mathematics is the queen of the sciences and number theory is the queen of mathematics. Reading Sections 4.8, 5.2 5.4 of Epp. Carl Friedrich Gauss, 1777 1855 4.3.

MATH 289 PROBLEM SET 4: NUMBER THEORY

MATH 289 PROBLEM SET 4: NUMBER THEORY 1. The greatest common divisor If d and n are integers, then we say that d divides n if and only if there exists an integer q such that n = qd. Notice that if d divides

Continued fractions and good approximations.

Continued fractions and good approximations We will study how to find good approximations for important real life constants A good approximation must be both accurate and easy to use For instance, our

CS103X: Discrete Structures Homework Assignment 2: Solutions

CS103X: Discrete Structures Homework Assignment 2: Solutions Due February 1, 2008 Exercise 1 (10 Points). Prove or give a counterexample for the following: Use the Fundamental Theorem of Arithmetic to

2 The Euclidean algorithm

2 The Euclidean algorithm Do you understand the number 5? 6? 7? At some point our level of comfort with individual numbers goes down as the numbers get large For some it may be at 43, for others, 4 In

CS/Math 240: Introduction to Discrete Mathematics Fall 2015 Instructors: Beck Hasti, Gautam Prakriya Reading 7 : Program Correctness 7.1 Program Correctness Showing that a program is correct means that

MATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS

1 CHAPTER 6. MATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS 1 INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW MATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS 1 Introduction Recurrence

PYTHAGOREAN TRIPLES PETE L. CLARK

PYTHAGOREAN TRIPLES PETE L. CLARK 1. Parameterization of Pythagorean Triples 1.1. Introduction to Pythagorean triples. By a Pythagorean triple we mean an ordered triple (x, y, z) Z 3 such that x + y =

11 Ideals. 11.1 Revisiting Z

11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(

1 Die hard, once and for all

ENGG 2440A: Discrete Mathematics for Engineers Lecture 4 The Chinese University of Hong Kong, Fall 2014 6 and 7 October 2014 Number theory is the branch of mathematics that studies properties of the integers.

Homework 5 Solutions

Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which

Homework until Test #2

MATH31: Number Theory Homework until Test # Philipp BRAUN Section 3.1 page 43, 1. It has been conjectured that there are infinitely many primes of the form n. Exhibit five such primes. Solution. Five such

Chapter Three. Functions. In this section, we study what is undoubtedly the most fundamental type of relation used in mathematics.

Chapter Three Functions 3.1 INTRODUCTION In this section, we study what is undoubtedly the most fundamental type of relation used in mathematics. Definition 3.1: Given sets X and Y, a function from X to

Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

Elementary Number Theory

Elementary Number Theory Ahto Buldas December 3, 2016 Ahto Buldas Elementary Number Theory December 3, 2016 1 / 1 Division For any m > 0, we define Z m = {0, 1,... m 1} For any n, m Z (m > 0), there are

SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

SYSTEMS OF PYTHAGOREAN TRIPLES CHRISTOPHER TOBIN-CAMPBELL Abstract. This paper explores systems of Pythagorean triples. It describes the generating formulas for primitive Pythagorean triples, determines

1. R In this and the next section we are going to study the properties of sequences of real numbers.

+a 1. R In this and the next section we are going to study the properties of sequences of real numbers. Definition 1.1. (Sequence) A sequence is a function with domain N. Example 1.2. A sequence of real

MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS

INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS STEVEN HEILMAN Contents 1. Homework 1 1 2. Homework 2 6 3. Homework 3 10 4. Homework 4 16 5. Homework 5 19 6. Homework 6 21 7. Homework 7 25 8. Homework 8 28

PYTHAGOREAN TRIPLES KEITH CONRAD 1. Introduction A Pythagorean triple is a triple of positive integers (a, b, c) where a + b = c. Examples include (3, 4, 5), (5, 1, 13), and (8, 15, 17). Below is an ancient

Integers and Rational Numbers

Chapter 6 Integers and Rational Numbers In this chapter, we will see constructions of the integers and the rational numbers; and we will see that our number system still has gaps (equations we can t solve)

Five fundamental operations. mathematics: addition, subtraction, multiplication, division, and modular forms

The five fundamental operations of mathematics: addition, subtraction, multiplication, division, and modular forms UC Berkeley Trinity University March 31, 2008 This talk is about counting, and it s about

MATH 289 PROBLEM SET 1: INDUCTION. 1. The induction Principle The following property of the natural numbers is intuitively clear:

MATH 89 PROBLEM SET : INDUCTION The induction Principle The following property of the natural numbers is intuitively clear: Axiom Every nonempty subset of the set of nonnegative integers Z 0 = {0,,, 3,

Solutions to Practice Problems

Solutions to Practice Problems March 205. Given n = pq and φ(n = (p (q, we find p and q as the roots of the quadratic equation (x p(x q = x 2 (n φ(n + x + n = 0. The roots are p, q = 2[ n φ(n+ ± (n φ(n+2

Appendix F: Mathematical Induction

Appendix F: Mathematical Induction Introduction In this appendix, you will study a form of mathematical proof called mathematical induction. To see the logical need for mathematical induction, take another

Instructor: Bobby Kleinberg Lecture Notes, 5 May The Miller-Rabin Randomized Primality Test

Introduction to Algorithms (CS 482) Cornell University Instructor: Bobby Kleinberg Lecture Notes, 5 May 2010 The Miller-Rabin Randomized Primality Test 1 Introduction Primality testing is an important

Theorem3.1.1 Thedivisionalgorithm;theorem2.2.1insection2.2 If m, n Z and n is a positive

Chapter 3 Number Theory 159 3.1 Prime Numbers Prime numbers serve as the basic building blocs in the multiplicative structure of the integers. As you may recall, an integer n greater than one is prime

CHAPTER 5: MODULAR ARITHMETIC

CHAPTER 5: MODULAR ARITHMETIC LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN 1. Introduction In this chapter we will consider congruence modulo m, and explore the associated arithmetic called

MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

Course Notes for Math 320: Fundamentals of Mathematics Chapter 3: Induction.

Course Notes for Math 320: Fundamentals of Mathematics Chapter 3: Induction. February 21, 2006 1 Proof by Induction Definition 1.1. A subset S of the natural numbers is said to be inductive if n S we have

Course notes on Number Theory

Course notes on Number Theory In Number Theory, we make the decision to work entirely with whole numbers. There are many reasons for this besides just mathematical interest, not the least of which is that

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures

Number Theory Hungarian Style Cameron Byerley s interpretation of Csaba Szabó s lectures August 20, 2005 2 0.1 introduction Number theory is a beautiful subject and even cooler when you learn about it

Lecture 3. Mathematical Induction

Lecture 3 Mathematical Induction Induction is a fundamental reasoning process in which general conclusion is based on particular cases It contrasts with deduction, the reasoning process in which conclusion

Chapter 1 Basic Number Concepts

Draft of September 2014 Chapter 1 Basic Number Concepts 1.1. Introduction No problems in this section. 1.2. Factors and Multiples 1. Determine whether the following numbers are divisible by 3, 9, and 11:

NUMBER THEORY AMIN WITNO

NUMBER THEORY AMIN WITNO ii Number Theory Amin Witno Department of Basic Sciences Philadelphia University JORDAN 19392 Originally written for Math 313 students at Philadelphia University in Jordan, this

Chapter 11 Number Theory

Chapter 11 Number Theory Number theory is one of the oldest branches of mathematics. For many years people who studied number theory delighted in its pure nature because there were few practical applications

k, then n = p2α 1 1 pα k

Powers of Integers An integer n is a perfect square if n = m for some integer m. Taking into account the prime factorization, if m = p α 1 1 pα k k, then n = pα 1 1 p α k k. That is, n is a perfect square

Review for Final Exam

Review for Final Exam Note: Warning, this is probably not exhaustive and probably does contain typos (which I d like to hear about), but represents a review of most of the material covered in Chapters

Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

Settling a Question about Pythagorean Triples

Settling a Question about Pythagorean Triples TOM VERHOEFF Department of Mathematics and Computing Science Eindhoven University of Technology P.O. Box 513, 5600 MB Eindhoven, The Netherlands E-Mail address:

Solutions to Homework Set 3 (Solutions to Homework Problems from Chapter 2)

Solutions to Homework Set 3 (Solutions to Homework Problems from Chapter 2) Problems from 21 211 Prove that a b (mod n) if and only if a and b leave the same remainder when divided by n Proof Suppose a

3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

ORDERS OF ELEMENTS IN A GROUP

ORDERS OF ELEMENTS IN A GROUP KEITH CONRAD 1. Introduction Let G be a group and g G. We say g has finite order if g n = e for some positive integer n. For example, 1 and i have finite order in C, since

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Breaking The Code Ryan Lowe Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and a minor in Applied Physics. As a sophomore, he took an independent study

New Zealand Mathematical Olympiad Committee Divisibility and Primes Arkadii Slinko 1 Introduction The theory of numbers is devoted to studying the set N = {1, 2, 3, 4, 5, 6,...} of positive integers, also

SUM OF TWO SQUARES JAHNAVI BHASKAR

SUM OF TWO SQUARES JAHNAVI BHASKAR Abstract. I will investigate which numbers can be written as the sum of two squares and in how many ways, providing enough basic number theory so even the unacquainted

Stanford University Educational Program for Gifted Youth (EPGY) Number Theory. Dana Paquin, Ph.D.

Stanford University Educational Program for Gifted Youth (EPGY) Dana Paquin, Ph.D. paquin@math.stanford.edu Summer 2010 Note: These lecture notes are adapted from the following sources: 1. Ivan Niven,

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Chapter 23 Squares Modulo p Revised Version of Chapter 23 We learned long ago how to solve linear congruences ax c (mod m) (see Chapter 8). It s now time to take the plunge and move on to quadratic equations.

Factoring & Primality

Factoring & Primality Lecturer: Dimitris Papadopoulos In this lecture we will discuss the problem of integer factorization and primality testing, two problems that have been the focus of a great amount

The last three chapters introduced three major proof techniques: direct,

CHAPTER 7 Proving Non-Conditional Statements The last three chapters introduced three major proof techniques: direct, contrapositive and contradiction. These three techniques are used to prove statements

Squares and Square Roots

SQUARES AND SQUARE ROOTS 89 Squares and Square Roots CHAPTER 6 6.1 Introduction You know that the area of a square = side side (where side means the length of a side ). Study the following table. Side

3. QUADRATIC CONGRUENCES 3.1. Quadratics Over a Finite Field We re all familiar with the quadratic equation in the context of real or complex numbers. The formula for the solutions to ax + bx + c = 0 (where

Fractions and Decimals

Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first

= 2 + 1 2 2 = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

Instructions. Answer each of the questions on your own paper, and be sure to show your work so that partial credit can be adequately assessed. Credit will not be given for answers (even correct ones) without

Lecture 13 - Basic Number Theory.

Lecture 13 - Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that A divides B, denoted

This section demonstrates some different techniques of proving some general statements.

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

Introduction. Appendix D Mathematical Induction D1

Appendix D Mathematical Induction D D Mathematical Induction Use mathematical induction to prove a formula. Find a sum of powers of integers. Find a formula for a finite sum. Use finite differences to

It is not immediately obvious that this should even give an integer. Since 1 < 1 5

Math 163 - Introductory Seminar Lehigh University Spring 8 Notes on Fibonacci numbers, binomial coefficients and mathematical induction These are mostly notes from a previous class and thus include some

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

Finite Sets. Theorem 5.1. Two non-empty finite sets have the same cardinality if and only if they are equivalent.

MATH 337 Cardinality Dr. Neal, WKU We now shall prove that the rational numbers are a countable set while R is uncountable. This result shows that there are two different magnitudes of infinity. But we