Notes for Number Theory Here Are the Notes I Wrote up for a Number Theory Course I Taught
Total Page:16
File Type:pdf, Size:1020Kb
1 Notes for Number Theory Here are the notes I wrote up for a number theory course I taught. The notes cover elementary number theory but don’t get into anything too advanced. My approach to things is fairly informal. I like to explain the ideas behind everything without getting too formal and also without getting too wordy. If you see anything wrong (including typos), please send me a note at [email protected]. Last updated: March 20, 2021. Contents 1 Divisibility 4 1.1 Definition of divisibility...............................................4 1.2 The division algorithm................................................5 1.3 The modulo operation................................................7 1.4 The greatest common divisor............................................7 1.5 Gcds and linear combinations...........................................9 1.6 The extended Euclidean algorithm........................................9 1.7 A few example proofs................................................ 11 1.8 The least common multiple............................................. 11 1.9 Relatively prime integers.............................................. 12 1.10 The gcd and lcm of more than two integers................................... 13 1.11 Some useful facts about divisibility and gcds.................................. 13 2 Primes 15 2.1 The fundamental theorem of arithmetic..................................... 15 2.2 There are infinitely many primes.......................................... 17 2.3 Finding primes..................................................... 17 2.4 The prime number theorem............................................. 18 2.5 Twin primes...................................................... 19 2.6 Prime gaps....................................................... 19 2.7 Finding large primes................................................. 19 2.8 Prime-generating formulas............................................. 20 2.9 Primes and arithmetic progressions........................................ 22 2.10 Fermat numbers.................................................... 22 2.11 Sophie Germain primes............................................... 22 2.12 Goldbach’s conjecture................................................ 22 2.13 Some sums....................................................... 23 2.14 The Riemann hypothesis............................................... 24 2.15 Number-theoretic functions............................................. 25 3 Modular arithmetic 29 3.1 Working with congruences............................................. 30 2 CONTENTS 3 3.2 Powers.......................................................... 32 3.3 Some further examples of modular arithmetic................................. 34 3.4 Fermat’s little theorem................................................ 34 3.5 Euler’s theorem.................................................... 36 3.6 Formal definition and inverses........................................... 36 3.7 Wilson’s theorem................................................... 37 3.8 Solving congruences................................................. 38 3.9 Solving linear Diophantine equations....................................... 40 3.10 The Chinese remainder theorem.......................................... 42 3.11 Order.......................................................... 44 3.12 Primitive roots..................................................... 45 3.13 Decimal expansions.................................................. 47 3.14 Quadratic Reciprocity................................................ 48 4 Cryptography 54 4.1 Diffie-Hellman key exchange............................................ 54 4.2 RSA cryptography................................................... 55 4.3 Elliptic curve cryptography............................................. 57 5 Special numbers 60 5.1 Perfect numbers and Mersenne primes...................................... 60 5.2 Pythagorean triples.................................................. 62 6 Primality testing and factoring 64 6.1 Primality testing.................................................... 64 6.2 Factoring........................................................ 66 Chapter 1 Divisibility 1.1 Definition of divisibility One of the most basic concepts in number theory is that of divisibility. The concept is familiar: 14 is divisible by 7, even numbers are divisible by 2, prime numbers are only divisible by themselves and 1, etc. Here is the formal definition: Definition 1. An integer d is a divisor of an integer n if there exists an integer k such that n = dk. We say that n is divisible by d, or that d divides n, and write d n. j For example, 20 is divisible by 4 because we can write 20 = 4 5; that is n = dk, with n = 20, d = 4, and k = 5. The equation n = dk is the key part of the definition. It gives us· a formula that we can associate with the concept of divisibility. This formula is handy when it comes to proving things involving divisibility. If we are given that n is divisible by d, then we write that in equation form as n = dk for some integer k. If we need to show that n is divisible by d, then we need to find some integer k such that n = dk. Here are a few example proofs: 1. Suppose we want to prove the simple fact that if n is even, then n2 is even as well. 2 2 2 Proof. Even numbers are divisible by 2, so we can write n = 2k for some integer k. Then n = (2k) = 4k , 2 2 2 2 which we can write as n = 2(2k ). We have written n as 2 times some integer, so we see that n is divisible by 2 (and hence even). 2. Prove that if a b and b c, then a c j j j 2 Proof. Since a b and b c we can write b = a j and c = bk for some integers j and k. Plug the first equation into the secondj to get cj = (a j)k, which we can rewrite as c = a(jk). So we see that a c, since we have written c as a multiple of a. j 3. Prove that if a b, then ac bc, for any integer c. j j Proof. Since a b, we can write b = ak for some integer k. Multiply both sides of this equation by c to get (ac)k = bc. Thisj equation tells us that ac bc, which is what we want. j 2Note that we must use different integers here since the integer j that works for a b does not necessarily equal the integer k that works for b c. j j 4 CHAPTER 1. DIVISIBILITY 5 Here are a couple of other divisibility examples: 1. Disprove: If a (b + c), then a b or a c. j j j Solution. All we need is a single counterexample. Setting a = 5, b = 3, and c = 7 does the trick. 2. Find a divisor of 359951 besides 1 and itself. Solution. The only answers are 593 and 607. It would be tedious to find them by checking divisors starting 2 2 with 2, 3, etc. A better way is to use the algebraic fact x y = (x y)(x + y). This fact is very useful in number theory. − − With a little cleverness, we might notice that 359951 is 360000 49, which is 6002 72. We can factor this into (600 7)(600 + 7), or 593 607. − − − × 1.2 The division algorithm The division algorithm, despite its name, it is not really an algorithm. It states that when you divide two numbers, there is a unique quotient and remainder. Specifically, it says the following: Theorem 1. Let a, b Z with b > 0. Then there exist unique q, r Z such that a = bq + r and 0 r < b. 2 2 ≤ The integers q and r are called the quotient and remainder. For example, if a = 27 and b = 7, then q = 3 and r = 6. That is, 27 7 is 3 with a remainder of 6, or in equation form: 27 = 7 3 + 6. The proof of the theorem is not difficult and can÷ be found in number theory textbooks. · One of the keys here is that the remainder is less than b. Here are some consequences of the theorem: 1 • Taking b = 2, tells us all integers are of the form 2k or 2k + 1 (i.e., every integer is either odd or even). • Taking b = 3, all integers are of the form 3k, 3k + 1, or 3k + 2. • Taking b = 4, all integers are of the form 4k, 4k + 1, 4k + 2, or 4k + 3. • For a general b, all integers are of the form bk, bk + 1, . , or bk + (b 1). − These are useful for breaking things up into cases. Here are a few examples: 3 1. Suppose we want to show that n n is always divisible by 3. We can break things up into cases n = 3k, n = 3k + 1, and n = 3k + 2, like below:− 3 3 3 n = 3k : (3k) 3k = 27k 3k = 3(9k k), − 3 − 3 −2 3 n = 3k + 1 : (3k + 1) (3k + 1) = 27k + 9k + 3k + 1 3k 1 = 3(9k 3k), 3 − 3 2 − − −3 2 n = 3k + 2 : (3k + 2) (3k + 2) = 27k + 18k + 12k + 8 3k 2 = 3(9k + 6k + 3k + 2). − − − We see that in each case, n3 n is divisible by 3. By the division algorithm, these are the only cases we need to check, since every integer− must be of one of those three forms. 2. Prove that every perfect square is of the form 4k or 4k + 1. Proof. Every integer n is of the form 2k or 2k + 1. 2 2 2 If n = 2k, then we have n = 4k , which is of the form 4k. 2 2 2 If n = 2j + 1, then we have n = 4k + 4k + 1 = 4(k + k) + 1, which is of the form 4k + 1. 1We use k instead of q here out of convention. 2We are being a bit informal here with the notation. When we say the number is of the form 4k, the k is different from the k used in n = 2k. What we’re really saying here is that the number is of the form 4 times some integer. A more rigorous way to approach this might be 2 2 2 2 to let n = 2j, compute n = 4j and say n = 4k, with k = j . CHAPTER 1. DIVISIBILITY 6 3. A prime number is a number greater than 1 whose only divisors are 1 and itself. Prove that every prime greater than 3 is of the form 6k + 1 or 6k + 5. Proof. Every integer is of the form 6k, 6k + 1, 6k + 2, 6k + 3, 6k + 4, or 6k + 5. An integer of form 6k is divisible by 6. A integer of the form 6k + 2 is divisible by 2 as it can be written as 2(3k + 1). Similarly, an integer of the form 6k + 3 is divisible by 3 and an integer of the form 6k + 4 is divisible by 2. None of these forms can be prime (except for the integers 2 and 3, which we exclude), so the only forms left that could be prime are 6k + 1 and 6k + 5.