Docsity

Number Theory: Divisibility, Prime Numbers, and Congruences, Study notes of Number Theory

Partial preview of the text

Download Number Theory: Divisibility, Prime Numbers, and Congruences and more Study notes Number Theory in PDF only on Docsity!

Elementary Number Theory

A revision by Jim Hefferon, St Michael’s College, 2003-Dec

of notes by W. Edwin Clark, University of South Florida, 2002-Dec

LATEX source compiled on January 5, 2004 by Jim Hefferon, [email protected].

License restriction claimed by W. Edwin Clark. Copyleft 2002: “Copyleft means that unrestricted redistribution and modification are permitted, provided that all copies and derivatives retain the same permissions. Specifically no commerical use of these notes or any revisions thereof is permitted.”

Preface

Mathematics is the queen of sciences and arithmetic the queen of mathematics

Carl Friedrich Gauss

Number theory, known to Gauss as “arithmetic,” studies the properties of the integers:... − 3 , − 2 , − 1 , 0 , 1 , 2 , 3.... Although the integers are familiar, and their properties might therefore seem simple, it is instead a very deep subject. For example, here are some problems in number theory that remain unsolved. (Recall that a prime number is an integer greater than 1 whose only positive factors are 1 and the number itself.) Note that these problems are simple to state — just because a topic is accessibile does not mean that it is easy.

  1. (Goldbach’s Conjecture) Is every even integer n > 2 the sum of two primes?
  2. (Twin Prime Conjecture) Are there are infinitely many twin primes? (Twin primes differ by 2, like 11 and 13.)
  3. Are there infinitely many primes of the form n^2 + 1? Of the form 2n^ − 1? (Ones of this form are Mersenne primes.) Of the form 2^2

n

  • 1? (These are Fermat primes.)
  1. Are there infinitely many primes whose digits are all 1’s? (Numbers of this form are repunits.)
  2. Are there infinitely many perfect numbers? (An integer is perfect if it is the sum of its proper divisors; 6 is perfect because 1 + 2 + 3 = 6.)
  3. (3n + 1 Conjecture) Consider the function f defined by: f (n) = 3n + 1 if n is odd and f (n) = n/2 if n is even. Does the sequence of iterates f (n), f (f (n)), f (f (f (n))),... always contain 1, no matter what starting value n is used?
  4. Is there a fast algorithm for factoring large integers?

So the subject is not simple. However it is accessible, and beautiful.

iii

iv PREFACE

A caution In some areas a person needs to learn by starting from first princi- ples. The first course in Calculus is like that; students learn limits first to avoid getting nutty ideas about nxn−^1 , But other areas are best mastered by diving right in. In this book you dive into mathematical arguments. Number Theory is right for this in part because of its accessibility. But always keep in mind the caution: do not underestimate the material. You will find this subject hard, albiet rewarding.

Prerequisites We require only Calculus I. Even that requirement is not strict (limits come up, as do the rules of logarithm manipultion), so the main purpose of the prerequisite is that we expect that with it comes a certain amount of mathematical maturity, including familiarity with basic set theory and some function facts.

Other resources The Internet contains much interesting and current infor- mation about number theory; see the Bibliography. The websites by Chris Caldwell [2] and by Eric Weisstein [13] are especially good. To see what is going on at the frontier of the subject, you may take a look at some recent issues of the Journal of Number Theory which you will find in any university library.

  • 1 Divisibility Preface iii
  • 2 Prime Numbers
  • 3 Division
  • 4 Greatest Common Divisor
  • 5 Bezout’s Lemma
  • 6 The Euclidean Algorithm
  • 7 The Fundamental Theorem
  • 8 Distribution of Primes
  • 9 Fermat Primes and Mersenne Primes
  • 10 The Functions σ and τ
  • 11 Perfect Numbers and Mersenne Primes
  • 12 Congruences
  • 13 Divisibility Tests
  • 14 More Properties of Congruences
  • 15 Residue Classes
  • 16 Zm and Complete Residue Systems
  • 17 Addition and Multiplication in Zm
  • 18 The Group of Units
  • 19 The Chinese Remainder Theorem vi CONTENTS
  • 20 Fermat’s Little Theorem
  • 21 Probabilistic Primality Tests
  • 22 Representations in Other Bases
  • 23 Computation of aN mod m
  • 24 Public Key Cryptosystems
  • A Proof by Induction
  • B Axioms for Z
  • C Some Properties of R

Chapter 1

Divisibility

In this book, all numbers are integers, unless specified otherwise. Thus in the next definition, d, n, and k are integers.

1.1 Definition The number d divides the number n if there is a k such that n = dk. (Alternate terms are: d is a divisor of n, or d is a factor of n, or n is a multiple of d.) This relationship between d and n is symbolized d | n. The symbol d - n means that d does not divide n.

Note that the symbol d | n is different from the fraction symbol d/n. It is also different from n/d because d | n is either true or false, while n/d is a rational number.

1.2 Theorem (Divisibility Properties) For all numbers n, m, and d, (1) d | 0 (2) 0 | n =⇒ n = 0 (3) 1 | n (4) (Reflexivity property) n | n (5) n | 1 =⇒ n = 1 or n = − 1 (6) (Transitivity property) d | n and n | m =⇒ d | m (7) (Multiplication property) d | n =⇒ ad | an (8) (Cancellation property) ad | an and a 6 = 0 =⇒ d | n (9) (Linearity property) d | n and d | m =⇒ d | an + bm for all a and b (10) (Comparison property) If d and n are positive and d | n then d ≤ n

proof. For the first item, take k = 0. For the second, if 0 | n then n = 0·k = 0. The next item holds because we can take n as the k in the definition. Re- flexivity is similar: n = n · 1 shows that it holds. The next property follows immediately from Basic Axiom 3 for Z, from the first Appendix. For Transitivity, assume the d | n and that n | m. Then n = dk 1 and m = nk 2 for some k 1 , k 2 ∈ Z. Substitute to get m = nk 2 = (dk 1 )k 2. By the Associative Property of Multiplication, (dk 1 )k 2 = d(k 1 k 2 ), which shows that d divides m.

Chapter 2

Prime Numbers

2.1 Definition An integer p ≥ 2 is prime if it has no positive divisors other than 1 and itself. An integer greater than or equal to 2 that is not prime is composite.

Note that 1 is neither prime nor composite.

2.2 Lemma An integer n ≥ 2 is composite if and only if it has factors a and b such that 1 < a < n and 1 < b < n.

proof. Let n ≥ 2. The ‘if’ direction is obvious. For ‘only if’, assume that n is composite. Then it has a positive integer factor a such that a 6 = 1, a 6 = n. This means that there is a b with n = ab. Since n and a are positive, so is b. Hence 1 ≤ a and 1 ≤ b. By Theorem 1.2, a ≤ n and b ≤ n. Since a 6 = 1 and a 6 = n we have 1 < a < n. If b = 1 then a = n, which is not possible, so b 6 = 1. If b = n then a = 1, which is also not possible. So 1 < b < n, finishing this half of the argument. qed

2.3 Lemma If n > 1 then there is a prime p such that p | n.

proof. Let S denote the set of all integers greater than 1 that have no prime divisor. We must show that S is empty. If S is not empty then by the Well-Ordering Property it has a smallest member; call it m. Now m > 1 and has no prime divisor. Then m cannot be prime (as every number is a divisor of itself). Hence m is composite. Therefore by Lemma 2.2, m = ab where 1 < a < m and 1 < b < m. Since 1 < a < m, the factor a is not a member of S. So a must have a prime divisor p. Then p | a and a | m, so by Theorem 1.2, p | m. This contradicts the assumption that m has no prime divisor. So the set S must be empty. qed

2.4 Theorem (Euclid’s Theorem) There are infinitely many primes.

proof. Assume, to get a contradiction, that there are only a finitely many primes p 1 = 2, p 2 = 3,... , pn. Consider the number N = p 1 p 2 · · · pn + 1.

4 CHAPTER 2. PRIME NUMBERS

Since p 1 ≥ 2, clearly N ≥ 2. So by Lemma 2.3, N has a prime divisor p. That prime must be one of p 1 ,... , pn since that list was assumed to be exhaustive. However, observe that the equation

N = pi (p 1 p 2 · · · pi− 1 pi+1 · · · pn) + 1

along with 0 ≤ 1 < pi shows by Lemma 3.2 that n is not divisible by pi. This is a contradiction; it follows that the assumption that there are only finitely many primes is not true. qed

2.5 Remark Eucild’s Theorem, and its proof, is often cited as an example of the beauty of Mathematics.

2.6 Theorem If n > 1 is composite then n has a prime divisor p ≤

n.

proof. Let n > 1 be composite. Then n = ab where 1 < a < n and 1 < b < n. We claim that at least one of a or b is less than or equal to

n. For if not then a >

n and b >

n, and hence n = ab >

n ·

n = n, which is impossible. Suppose, without loss of generality, that a ≤

n. Since 1 < a, by Lemma 2. there is a prime p such that p | a. Hence, by Transitivity in Theorem 1.2, since a | n we have p | n. By Comparison in Theorem 1.2, since p | a we have p ≤ a ≤

n. qed

We can use Theorem 2.6 to help compute whether an integer is prime. Given n > 1, we need only try to divide it by all primes p ≤

n. If none of these divides n then n must be prime.

2.7 Example Consider the number 97. Note that

100 = 10. The primes less than 10 are 2, 3, 5, and 7. None of these divides 97, and so 97 is prime.

6 CHAPTER 3. DIVISION

We still must prove that q and r are unique. Assume that there are two quotient, remainder pairs

a = bq 1 + r 1 with 0 ≤ r 1 < b

and a = bq 2 + r 2 with 0 ≤ r 2 < b.

Subtracting

0 = a − a = (bq 1 + r 1 ) − (bq 2 + r 2 ) = b(q 1 − q 2 ) + (r 1 − r 2 )

implies that

(3.1) r 2 − r 1 = b(q 1 − q 2 ).

We must show that the two pairs are equal, that r 1 = r 2 and q 1 = q 2. To obtain a contradiction, suppose otherwise. First suppose that r 1 6 = r 2. Then one must be larger than the other; without loss of generality assume that r 2 > r 1. Then

0 ≤ r 1 < r 2 < b

and so r 2 −r 1 < b. But (3.1) shows that b divides r 2 −r 1 and by the Comparison property of Theorem 1.2 this implies that b ≤ r 2 − r 1. This is the desired contradiction and so we conclude that r 1 = r 2. With that, from equation 3.1 we have 0 = b(q 1 −q 2 ). Since b > 0, this gives that q 1 −q 2 = 0 and so q 1 = q 2. qed

3.2 Corollary The number d divides the number n if and only if on division of n by d the remainder is 0.

proof. If the remainder is 0 then n = dq + 0 = dq shows that d | n. For the other half, if d | n then for some k we have n = dk = dk + 0 (with 0 ≤ 0 < d) and the fact that the quotient, remainder pair is uniqus shows that k and 0 must be the quotient and the remainder. qed

That corollary says that Theorem 3.1 generalizes the results on divisibility. For instance, fix b = 3. Then, given a, instead of only being able to say that a is divisible or not, we can give a finer description: a leaves a remainder of 0 (this is the case where b | a), or 1, or 2.

3.3 Definition For b > 0 define a mod b = r where r is the remainder when a is divided by b.

For example 23 mod 7 = 2 since 23 = 7 · 3 + 2 and −4 mod 5 = 1 since −4 = 5 · (−1) + 1.

Chapter 4

Greatest Common Divisor

4.1 Definition An integer is a common divisor of two others if it divides both of them.

We write C(a, b) for the set of numbers that are common divisors of a and b.

4.2 Definition The greatest common divisor of two nonzero integers a and b, gcd(a, b), is the largest integer that divides both, except that gcd(0, 0) = 0.

The exception is there because every number divides zero, and so we specially define gcd(0, 0) to be a convienent value.

4.3 Example The set of common divisors of 18 and 30 is

C(18, 30) = {− 1 , 1 , − 2 , 2 , − 3 , 3 , − 6 , 6 }.

So, gcd(18, 30) = 6.

4.4 Lemma gcd(a, b) = gcd(b, a).

proof. Clearly the two sets C(a, b) and C(b, a) are equal. It follows that their largest elements are equal, that is, that gcd(a, b) = gcd(b, a). qed

4.5 Lemma gcd(a, b) = gcd(|a|, |b|).

proof. If a = 0 and b = 0 then |a| = a and |b| = b, and so in this case gcd(a, b) = gcd(|a|, |b|). Suppose that one of a or b is not 0. Lemma 1.4 shows that d | a ⇔ d | |a|. It follows that the two sets C(a, b) and C(|a|, |b|) are the same set. So the largest member of that set, the greatest common divisor of a and b, is also the greatest common divisor of |a| and |b|. qed

4.6 Lemma If a 6 = 0 or b 6 = 0, then gcd(a, b) exists and satisfies

0 < gcd(a, b) ≤ min{|a|, |b|}.

Chapter 5

Bezout’s Lemma

5.1 Definition A number c is a linear combination of the numbers a and b if c = as + bt for some s and t.

5.2 Example The number c = 16 is a linear combination of a = 2 and b = 5 since taking s = 3 and t = 2 gives 16 = 3 · 2 + 2 · 5. The number 21 is not a linear combination of 2 and 4, since in the equation 21 = s · 2 + t · 4 the right side is divisible by 2 while the left is not. (That is, there are no integers s and t; we can solve the equation with rational numbers that are not integral.)

Thus, the Linearity statement in the Divisibility Properties theorem says that if d divides a and b, then d divides all linear combinations of a and b. So the greatest common divisor, gcd(a, b), divides every member of L(a, b), the set of all linear combinations of a and b. The next result says that gcd(a, b) is itself a member of L(a, b).

5.3 Lemma (Bezout’s Lemma) The greatest common divisor of two num- bers is a linear combination of those two: for all integers a and b there exist integers s and t such that gcd(a, b) = sa + tb.

proof. If a and b are 0 then s and t may be anything since gcd(0, 0) = 0 = s · 0 + t · 0. So we may assume that a 6 = 0 or b 6 = 0. Consider the set L(a, b) = {na + mb : n, m ∈ Z} of all linear combinations of a and b. Denote the set of positive members of L(a, b) by L+(a, b). Note that L(a, b) contains a, −a, b and −b, and since a 6 = 0 or b 6 = 0, at least one of these four numbers is positive. Therefore L+(a, b) is not empty. Because of this, by the Well-Ordering Property for N, we know that the set L+(a, b) contains a smallest positive integer; call it d. We will show that d is the greatest common divisor of a and b. That will finish the argument because d is a linear combination of a and b as it is a member of L. Since d ∈ L+(a, b) we have d = sa + tb for some integers s and t. Let g = gcd(a, b). Then g | a and g | b, so by the Linearity property of Theorem 1.2, we have g | (sa+tb), that is, g | d. Since g and d are positive, by the Comparision property of Theorem 1.2, we have that g ≤ d.

10 CHAPTER 5. BEZOUT’S LEMMA

If we show that d is a common divisor of a and b, then we will have that d ≤ g (as g is the greatest of the common divisors), and so we will have shown that g = d. To show that d | a, write a = dq + r where 0 ≤ r < d and compute

r = a − dq = a − (sa + tb)q = (1 − sq)a + (−tq)b.

to conclude that r ∈ L(a, b). Thus, if r were to be strictly greater than 0 then r would be a member of L+(a, b). But this cannot be, since r is strictly less than d and d is the smallest integer in L+(a, b). So we must have that r = 0. That is, a = dq, and hence d | a. A similar argument shows that d | b. Thus, d is indeed a common divisor of a and b, and d = g = gcd(a, b). qed

5.4 Example Notice that 1 = gcd(2, 3) and 1 = (−1)2 + 1 · 3. Notice also that 1 = 2 · 2 + (−1)3. So the numbers s and t in Bezout’s Lemma are uniquely determined. In fact, as we will see later that for each pair a, b there are infinitely many s and t.

5.5 Corollary The set L(a, b) of all linear combinations of a and b equals the set of multiples of gcd(a, b).

proof. We observed above that any member of L(a, b) is a multiple of gcd(a, b). For the converse, consider the multiple k·gcd(a, b), apply Bezout’s Lemma to get s, t ∈ Z so that gcd(a, b) = sa + tb, and substitute: k · gcd(a, b) = k · (sa + tb) = (ks)a + (kt)b. qed

5.6 Lemma If a | bc and a is relatively prime to b then a | c.

proof. Since gcd(a, b) = 1, by Bezout’s Lemma there are coefficients s and t such that 1 = as+bt. Multiply both sides by c to get c = cas+cbt = a(cs)+(bc)t. Note that a | a(cs) and that a | bc by assumption, so Theorem 1.2 gives that a divides the linear combination a(cs) + (bc)t = c. qed

Observe that 6 | (4 · 9) but 6 - 4 and 6 - 9 (6 is not relatively prime to 4, and is also not relatively prime to 9). Thus the condition of relative primality is needed in that lemma. We can completely characterize L(a, b).

5.7 Lemma Fix a, b ∈ Z. If gcd(a, b) | c then the equation sa + tb = c has infinitely many solution pairs s, t, which have the form

s = s 0 − j · (b/d), t = t 0 + j · (a/d) j ∈ Z

where s 0 , t 0 is any particular solution pair.

proof. First assume that a solution pair s 0 , t 0 exists, to show that any pair of numbers of that form also solve the equation. Plug them into the equation.

(s 0 −j(b/d))·a+(t 0 +j(a/d))·b = (s 0 a+t 0 b)+j(−(ab/d)+(ab/d)) = s 0 a+t 0 b = c

12 CHAPTER 5. BEZOUT’S LEMMA

Chapter 6

The Euclidean Algorithm

We can efficiently compute the greatest common divisor of two numbers. We first reduce the problem. Since gcd(a, b) = gcd(|a|, |b|) (and gcd(0, 0) = 0), we need only give a method to compute gcd(a, b) where a and b are nonneg- ative. And, since gcd(a, b) = gcd(b, a), it is enough for us to give a method for a ≥ b ≥ 0.

6.1 Lemma If a > 0 then gcd(a, 0) = a.

proof. Since every integer divides 0, C(a, 0) is just the set of divisors of a. The largest divisor of a is |a|. Since a is positive, |a| = a, and so gcd(a, 0) = a. qed

The prior lemma reduces the problem of computing gcd(a, b) to the case where a ≥ b > 0.

6.2 Lemma If a > 0 then gcd(a, a) = a.

proof. Obviously, a is a common divisor. By Lemma 4.6, gcd(a, a) ≤ |a| and since a is positive, |a| = a. So a is the greatest common divisor. qed

We have now reduced the problem to the case a > b > 0. The central result is next.

6.3 Lemma Let a > b > 0. If a = bq + r, then gcd(a, b) = gcd(b, r).

proof. It suffices to show that the two sets C(a, b) and C(b, r) are equal, because then they must have the same greatest member. To show that the sets are equal we will show that they have the same members. First, suppose that d ∈ C(a, b), so that d | a and d | b. Note that r = a − bq. By Theorem 1.2(3) we have that d | r. Thus d | b and d | r, and so d ∈ C(b, r). We have shown that any member of C(a, b) is a member of C(b, r), that is, that C(a, b) ⊆ C(b, r). For the other containment, assume that d ∈ C(b, r) so that d | b and d | r. Since a = bq + r, Theorem 1.2(3) applies again to shows that d | a. So d | a and d | b, and therefore d ∈ C(a, b). qed