Maths 4 Number Theory Notes 2012 Chris Smyth, University of Edinburgh ed.ac.uk

Similar documents
Corollary 4.2 (Pepin s Test, 1877). Let F k = 2 2k + 1, the kth Fermat number, where k 1. Then F k is prime iff 3 F k 1

f(n) = f(p e 1 1 )...f(p e k k ).

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

Math 4400/6400 Homework #8 solutions. 1. Let P be an odd integer (not necessarily prime). Show that modulo 2,

MATH342 Practice Exam

MATH 361: NUMBER THEORY EIGHTH LECTURE

Number Theory Naoki Sato

HENSEL S LEMMA KEITH CONRAD

Practice Final Solutions

Math 261 Exam 2. November 7, The use of notes and books is NOT allowed.

MA3H1 TOPICS IN NUMBER THEORY PART III

By Evan Chen OTIS, Internal Use

The Euler Phi Function

Chapter 3. Number Theory. Part of G12ALN. Contents

DIRICHLET S THEOREM ON PRIMES IN ARITHMETIC PROGRESSIONS. 1. Introduction

Representing Integers as the Sum of Two Squares in the Ring Z n

Math 104B: Number Theory II (Winter 2012)

The Hasse Minkowski Theorem Lee Dicker University of Minnesota, REU Summer 2001

MATH 3240Q Introduction to Number Theory Homework 7

3 Properties of Dedekind domains

PRIME NUMBERS YANKI LEKILI

ANALYTIC NUMBER THEORY AND DIRICHLET S THEOREM

MA3H1 Topics in Number Theory. Samir Siksek

MATH 361: NUMBER THEORY ELEVENTH LECTURE

QUADRATIC RECIPROCITY

Practice Final Solutions

Algebraic Number Theory

1 Integers and the Euclidean algorithm

Quadratic Residues, Quadratic Reciprocity. 2 4 So we may as well start with x 2 a mod p. p 1 1 mod p a 2 ±1 mod p

QUADRATIC RECIPROCITY

ON THE LEAST SIGNIFICANT p ADIC DIGITS OF CERTAIN LUCAS NUMBERS

On the Multiplicative Order of a n Modulo n

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

Elementary Analysis in Q p

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES 2018

CERIAS Tech Report The period of the Bell numbers modulo a prime by Peter Montgomery, Sangil Nahm, Samuel Wagstaff Jr Center for Education

MAT 311 Solutions to Final Exam Practice

Introductory Number Theory

PartII Number Theory

Chapter 2 Arithmetic Functions and Dirichlet Series.

t s (p). An Introduction

DIRICHLET S THEOREM ABOUT PRIMES IN ARITHMETIC PROGRESSIONS. Contents. 1. Dirichlet s theorem on arithmetic progressions

Introduction to Arithmetic Geometry Fall 2013 Lecture #10 10/8/2013

Mersenne and Fermat Numbers

MATH 2710: NOTES FOR ANALYSIS

2 Asymptotic density and Dirichlet density

Pythagorean triples and sums of squares

DISCRIMINANTS IN TOWERS

2 Asymptotic density and Dirichlet density

Almost 4000 years ago, Babylonians had discovered the following approximation to. x 2 dy 2 =1, (5.0.2)

MAS 4203 Number Theory. M. Yotov

QUADRATIC RECIPROCITY

Jacobi symbols and application to primality

Characteristics of Fibonacci-type Sequences

Elementary Number Theory

x 2 a mod m. has a solution. Theorem 13.2 (Euler s Criterion). Let p be an odd prime. The congruence x 2 1 mod p,

Algebraic number theory LTCC Solutions to Problem Sheet 2

ERRATA AND SUPPLEMENTARY MATERIAL FOR A FRIENDLY INTRODUCTION TO NUMBER THEORY FOURTH EDITION

RECIPROCITY LAWS JEREMY BOOHER

MATH 371 Class notes/outline October 15, 2013

A CONCRETE EXAMPLE OF PRIME BEHAVIOR IN QUADRATIC FIELDS. 1. Abstract

HOMEWORK # 4 MARIA SIMBIRSKY SANDY ROGERS MATTHEW WELSH

GAUSSIAN INTEGERS HUNG HO

We collect some results that might be covered in a first course in algebraic number theory.

On the Rank of the Elliptic Curve y 2 = x(x p)(x 2)

Math 5330 Spring Notes Prime Numbers

p-adic Measures and Bernoulli Numbers

An Overview of Witt Vectors

(Workshop on Harmonic Analysis on symmetric spaces I.S.I. Bangalore : 9th July 2004) B.Sury

Dirichlet s Theorem on Arithmetic Progressions

Mobius Functions, Legendre Symbols, and Discriminants

MATH 361: NUMBER THEORY THIRD LECTURE

Part II. Number Theory. Year

An Estimate For Heilbronn s Exponential Sum

Multiplicative group law on the folium of Descartes

Factorability in the ring Z[ 5]

Summary Slides for MATH 342 June 25, 2018

MATH 371 Class notes/outline September 24, 2013

MATH 152 NOTES MOOR XU NOTES FROM A COURSE BY KANNAN SOUNDARARAJAN

A Curious Property of the Decimal Expansion of Reciprocals of Primes

QUADRATIC RESIDUES AND DIFFERENCE SETS

Primes - Problem Sheet 5 - Solutions

Sets of Real Numbers

I(n) = ( ) f g(n) = d n

MATH 210A, FALL 2017 HW 5 SOLUTIONS WRITTEN BY DAN DORE

δ(xy) = φ(x)δ(y) + y p δ(x). (1)

.4. Congruences. We say that a is congruent to b modulo N i.e. a b mod N i N divides a b or equivalently i a%n = b%n. So a is congruent modulo N to an

6 Binary Quadratic forms

AN INTRODUCTION TO GAUSS S NUMBER THEORY. Andrew Granville

SQUAREFREE VALUES OF QUADRATIC POLYNOMIALS COURSE NOTES, 2015

University of Bristol - Explore Bristol Research. Peer reviewed version. Link to published version (if available): 10.

Number Theory. Lectured by V. Neale Michaelmas Term 2011

ON FREIMAN S 2.4-THEOREM

THUE-VINOGRADOV AND INTEGERS OF THE FORM x 2 + Dy 2. Contents. Introduction Study of an Elementary Proof

Frobenius Elements, the Chebotarev Density Theorem, and Reciprocity

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

INTRODUCTION TO GAUSS S NUMBER THEORY. Andrew Granville

Applied Cryptography and Computer Security CSE 664 Spring 2018

Elliptic Curves Spring 2015 Problem Set #1 Due: 02/13/2015

A review of the foundations of perfectoid spaces

Transcription:

Maths 4 Number Theory Notes 202 Chris Smyth, University of Edinburgh c.smyth @ ed.ac.uk 0. Reference books There are no books I know of that contain all the material of the course. however, there are many texts on Number Theory in the library. Here are a small selection of them. Course in -adic analysis by Alain M. Robert, Sringer GTM 2000. Library: QA24 Rob. A friendly introduction to number theory by J. H. Silverman, Prentice Hall, 200. QA24 Sil Introduction to the theory of numbers by G.H. Hardy and E.M. Wright. QA24 Har. Introduction to the theory of numbers by Ivan Niven and Herbert S. Zuckerman. QA24 Niv. Introduction to number theory by Lo-keng Hua Sringer-Verlag, 982. QA24 Hua. The integer art (= floor function Definition. For x R, x denotes the floor, or integer art of x. It is defined as the largest integer x. So we have x x < x +. The grah of x is a staircase function, constant on [n, n + and a jum of at n, for each n Z. Note that for x > 0, x is the number of ositive integers x. Alternative notation is [x]. It looks like a trivial function, but it satisfies some surrising identities (as well as some not-so-surrising ones! Proosition.. For x R and n N we have (i k + x = k + x for k Z, x R. (ii l + δ = l n n for l N and 0 δ <. n (iii x + x + + x + 2 + + x + n = nx. n n n Proof. (i and (ii are easy. For (iii, note that if it is true for x then, using (i, it is true for x + k, k Z (k is added to both sides, so we can assume that 0 x <.

2 Now write x = l + δ (0 δ < for l/n the largest rational with denominator n that n n is x. Then 0 l < n and for j = 0,,..., n x + j l = n n + δ + j n l + j = (using (ii n = { if j n l; 0 otherwise. So the LHS of (iii sums to l. But its RHS is nx = l + nδ = l, as nδ <. Hence RHS=LHS. Proosition.2. Let r,...,r k R. Then k k r i r i i= i= k r i + k. Proof. If it s true for all r i [0, then it s true for all r i (just add an integer N to some r i, k which adds N to r i and N to i= r i. Do this for each i.. So we can assume that all r i [0,, giving all r i = 0 and 0 k i= r k i < k and hence 0 i= r i k. These two inequalities are both best ossible of their tye, since the left one has equality when all the r i are integers, and the right one has equality when all the r i are in [ k,. k Corollary.3. Let n = n + + n k, where the n i are in N 0 = N {0}. Then the multinomial coefficient ( n n! = n,...,n k n!n 2!...n k! = B say, is an integer. Proof. From Problem Sheet, Q8(a we know that for each rime the ower of that divides n! is n j=, a finite sum. So the ower of dividing B is j n k ( ni n k ni = j= j i= j= j i= j= 0, by the above Proosition, on utting r i = n i / j. Thus B is divisible by a nonnegative ower of for every rime, so must be an integer. Another way to rove that this number is an integer is to show that it is the coefficient of x n...x n k k in the exansion of (x + + x k n. Say that, q N are corime (or relatively rime if gcd(, q =. j i= j

Proosition.4. Let and q be two corime odd ositive integers. Then 2 k= kq + 2 q l= l = q q 2 2. We shall see later that this result will be used in the roof of the Law of Quadratic Recirocity. Proof. Consider the rectangle with corners (0, 0, (/2, 0, (0, q/2 and (/2, q/2. (Suggest you draw it, along with its diagonal from (0, 0 to (/2, q/2, and the horizontal axis the k-axis, the vertical axis the l-axis. The diagonal is then the line with equation l = kq/. We count the number of integer lattice oints (k, l strictly inside this rectangle in two different ways. First we note that these oints form a rectangle with corners 2 q (,, ( 2 q,, (,, ( 2 2, q 2, so that there are of them in all. 2 On the other hand, we count searately those below and above the diagonal. Below the diagonal we have, for k =,... kq that is the number of oints (k, l with l kq, 2 i.e., below the diagonal, in the kth column. So the total is 2 kq k= To count the number of lattice oints above the diagonal, we fli the diagram over, reversing the rôles of and q, and of k and l. Then we get that the number of oints above the diagonal is q 2 l=. It remains to check that there are no lattice oints actually on l q the diagonal. For if the integer lattice oint (k, l were on the diagonal l = kq/ we would have l = kq so that, as and q are corime, k. But k <, so this is imossible. As an exercise, can you state and rove the variant of this result in the case that and q, while still odd, need not be corime? One should also be aware of the following variants of x : The ceiling of x, x, is the least integer x. Note that x = x. The nearest integer to x (no standard notation can be defined either as x + 2, where then the nearest integer to is, or as x, where then the nearest 2 2 integer to is 0. 2 2. Congruences Recall that x a (mod m means that m (x a, or that x = a + km for some k Z. Recall too that if a, b Z then there are a, b Z such that aa + bb = gcd(a, b. The numbers a, b can be found using the Extended Euclidean Algorithm, which you may recall from your First Year. In articular, when gcd(a, b = there are a, b Z such that aa + bb =. Then aa (mod b, so that a is the inverse of a (mod b.. 3

4 2.. Chinese Remainder Theorem. Theorem 2. (Chinese Remainder Theorem. Given m,..., m k N with gcd(m i, m j = (i j ( airwise corime, and a,...,a k Z, then the system of congruences has a solution x Z. x a (mod m x a 2 (mod m 2. x a k (mod m k Proof. In fact x can be constructed exlicitly. For i =,...,k define m i to be the inverse (mod m i of m...m i m i+...m k, so that m... m i m im i+...m k (mod m i. Then x = k i= a im...m i m i m i+... m k a i (mod m i for i =,..., k, because every term excet the ith is divisible by m i. Then, if x 0 is one solution to this set of congruences, it s easy to see (how? that the general solution is x = x 0 + lm m k for any integer l. In articular, there is always a choice of l giving a unique solution x in the range 0 x < m m k of the set of congruences. Q. If the m i not airwise corime, what is the condition on the a i s so that the set of congruences above again has a solution x? One answer: factorize each m i as a roduct of rime owers: m i = j where the j s are the rime factors of i m i, and the r ji are all 0. Then relace the congruence x a i (mod m i by the set of congruences x a i (mod r ji j for each j (justify!. Next, collect together all the congruences whose modulus is a ower of the same rime, say (changing notation! x a (mod n,...,x a l (mod n l. Then if these congruences are airwise consistent, we need only take the one with the largest modulus ( n l say. So we end u taking just one congruence for each, and so the moduli we take are all airwise corime. (Two congruences x a (mod m and x a 2 (mod n with m n (note: same in both are airwise consistent if a 2 a (mod m. If some such air of congruences are not consistent, then that air of congruences, and hence the original set of congruences, has no solution. An examle of an inconsistent air of congruences is x 0 (mod 2, x (mod 4. Lemma 2.2. (i The congruence ax b (mod m has a solution x Z if and only if gcd(a, m b; in this case the number of solutions x is gcd(a, m. (ii If x a (mod m and x b (mod m then x gcd(a,b (mod m. r ji j,

Proof. (i Put g = gcd(a, m. Then b = ax + km shows that g b. Conversely, if g b then ax b (mod m and g g g gcd(a, m = (justify!. So a has an inverse (mod m g g g g ( and x b a g g (mod m. g The g different solutions to ax b (mod m are then x 0 +k m for k = 0,,..., g g, for any solution x 0 of a x b (mod m. g g g (ii We have gcd(a, b = aa + bb say, by the Extended Euclidean algorithm, so x gcd(a,b = x aa +bb = (x a a (x b b (mod m. 2.2. Solving equations in F. We now restrict our congruences to a rime modulus, and consider the solutions of equations f(x = 0 for f(x F [x] and x F. Since F = Z/(, this is equivalent, for f(x Z[x], of solving f(x 0 (mod for x {0,, 2,..., }. Theorem 2.3. A nonzero olynomial f F [x] of degree n has at most n roots x in F. Proof. Use induction: for n =, f(x = ax + b say, with a 0, whence f(x = 0 has a solution x = a b in F. Now assume n and that the result holds for n. Take f(x F [x] of degree n +. If f = 0 has no roots x F the the result is certainly true. Otherwise, suose f(b = 0 for some b F. Now divide x b into f(x, (i.e., one ste of the Euclidean algorithm for olynomials to get f(x = (x bf (x + r say, where f is of degree n, and r F. Putting x = b shows that r = 0. Hence f(x = (x bf (x, where f has, by the induction hyothesis, at most n roots x F. So f has at most n + roots x F, namely b and those of f = 0. Hence the result is true for n + and so, by induction, true for all n. Note that the roof, and hence the result, holds equally well when F is relaced by any field F. However, it does not hold when the coefficients of f lie in a ring with zero divisors. For instance, on relacing F by the ring Z/8Z, the equation x 2 0 (mod 8 has four solutions x =, 3, 5, 7 (mod 8. Question. Where in the above roof was the fact that we were working over a field used? 2.3. F is cyclic! Denote by F the multilicative grou F \ {0}, using the field multilication (and forgetting about its addition. We need some grou theory at this stage. Recall that the exonent of a finite grou G is the least e N such that g e = for each g G. Let C r denote the cyclic grou with r elements: C r = {, g, g 2,...,g r g r = }. Here Proosition 2.4. Let G be a finite abelian grou with #G elements. If G is noncyclic then its exonent is < #G. Proof. For the roof, recall the Fundamental Theorem of Abelian Grous, which tells us that any such G is isomorhic to a roduct C n C n2 C n3 C nk C nk 5

6 of cyclic grous, for some k N and integers n,...,n k all > and such that n n 2, n 2 n 3,..., n k n k. Hence all n i s divide n k and so n k is the exonent of G. However, #G = n n 2...n k, which is greater than n k as k >. Proosition 2.5. For an odd rime, the grou F is cyclic (of size of course. Proof. Suose F were noncyclic. Then, by the revious Proosition, there would exist an exonent e < such that x e = for each x F. But then the equation xe = would have more than e solutions in F, contradicting Theorem 2.3. A generator g of the cyclic grou F ( an odd rime is called a rimitive root (mod. Then we can write F = g. 2.4. Number of rimitive roots. Given a rime, how many ossible choices are there for a generator g of F? To answer this, we need to define Euler s ϕ-function. Given a ositive integer n, ϕ(n is defined as the cardinality of the set {k : k n and gcd(k, n = }. So for instance ϕ( =, ϕ(6 = 2 and ϕ( = for rime. Proosition 2.6. For an odd rime, there are ϕ( rimitive roots (mod. Proof. Take one rimitive root g. Then g k is again a rimitive root iff (g k l = g in F for some l, i.e., g kl =. But g n = iff ( n. So g k is a rimitive root iff kl 0 (mod. This is imossible (why? if gcd(k, >, while if gcd(k, = then the extended Euclidean algorithm will give us l. 2.5. Quadratic residues and nonresidues. Take an odd rime, and r F. If the equation x 2 = r has a solution x F then r is called a quadratic residue (mod. If there is no such solution x, then r is called a quadratic nonresidue (mod. Proosition 2.7. Take an odd rime, and g a rimitive root (mod. Then the quadratic residues (mod are the even owers of g, while the quadratic nonresidues (mod are the odd owers of g. (So there are of each. 2 In articular, ( g k = ( k. Proof. Suose r F, with r = gk say. If k is even then r = (g k/2 2, so that r is a quadratic residue (mod. Conversely, if x = g l, x 2 = r, then g 2l k =, so that 2l k is a multile of, which is even. So k is even. 2.6. The Legendre symbol. Let be an odd rime, and r F. Then the Legendre symbol is defined as ( { r if r is a quadratic residue; = if r is a quadratic nonresidue.

7 Note that, on utting r = g k we see that ( { g k = ( k = if k is even; if k is odd. Next, recall Fermat s Theorem: that r = for all r F. This is simly a consequence of F being a grou of size (order. (We know that g #G = for each g in a finite grou G. Proosition 2.8 (Euler s Criterion. For an odd rime and r F we have in F that ( r = r 2. ( Proof. If r = g k then for k even r 2 = g k 2 = (g k/2 = k/2 =, while if k is odd, k is not a multile of, so r 2. However, r = by Fermat, 2 so r 2 = ± and hence r 2 =. So, by Proosition 2.7, we have (, as required. In articular (r =, for an odd rime, we have ( { = ( ( /2, if (mod 4 =, if (mod 4. Lemma 2.9. Let be an odd rime, and a, b be integers not divisible by. We have ( ( a b ( a b (mod imlies that = ; ( ( ( ab a b (2 = ; ( ( ( (3 =, =. a 2 a 2 b Proof. Let g be a rimitive root (mod. Then follow easily. b ( g k = ( k, from which the results 2.7. Taking nth roots in F. Take an odd rime and g a fixed rimitive root (mod. Then for any B F we define the index (old-fashioned word or discrete logarithm (current jargon of B, written ind B or log B, as the integer b {0,,..., 2} such that B = g b in F. Clearly the function log deends not only on but also on the choice of the rimitive root g. Proosition 2.0. Given n N and B F, the equation X n = B in F has a solution X F iff gcd(n, log B. When gcd(n, log B then the number of distinct solutions X of X n = B in F is gcd(n,.

8 Proof. Write B = g b, X = g x, so that g nx = g b, giving nx b (mod. Now aly Lemma 2.2(i to this congruence. For large rimes, the roblem of finding the discrete logarithm log B of B aears to be an intractable roblem, called the Discrete Logarithm Problem. Many techniques in Crytograhy deend on this suosed fact. See e.g., htt://en.wikiedia.org/wiki/discrete logarithm 3. Arithmetic functions 3.. Arithmetic functions. These are functions f : N N or Z or maybe C, usually having some arithmetic significance. An imortant subclass of such functions are the multilicative functions: such an f is multilicative if f(nn = f(nf(n for all n, n N with n and n corime (gcd(n, n =. Proosition 3.. If f is multilicative and n,...,n k are airwise corime (gcd(n i, n j = for all i j then f(n n 2...n k = f(n f(n 2...f(n k. This is readily roved by induction. Corollary 3.2. If n factorises into distinct rime owers as n = e... e k k f(n = f( e...f( e k k. So multilicative functions are comletely determined by their values on rime owers. Some examles of multilicative functions are The -detecting function (n, equal to at n = and 0 elsewhere obviously multilicative; τ(n = d n, the number of divisors of n; σ(n = d n d, the sum of the divisors of n. Proosition 3.3. The functions τ(n and σ(n are both multilicative. Proof. Take n and n corime, with l,...,l τ(n the divisors of n, and l,...,l τ(n the divisors of n. Then all the τ(nτ(n numbers l i l j are all divisors of nn. Conversely, if m divides nn then m = ll, where l n and l n. (Write m as a roduct of rime owers, and then l will be the roduct of the rime owers where the rime divides n, while l will be the roduct of the rime owers where the rime divides n. Note that n and n, being corime, have no rime factors in common. So l is some l i and l is some l j, so all factors of nn are of the form l i l j. Thus τ(nn = τ(nτ(n, and σ(nn = i,j l i l j = ( i l j ( j l j = σ(nσ(n. then

Given an arithmetic function f, define its sum over divisors function F(n = d n f(d. Proosition 3.4. If f is multilicative, and n = e then 9 F(n = n ( + f( + f( 2 + + f( e. (2 Further, F is also multilicative. Proof. Exanding the RHS of (2, a tyical term is n f(e, where 0 e e. But, by the multilicivity of f, this is simly f(d, where d = d n e is a divisor of n. Conversely, every divisor of n is of this form, for some choice of exonents e. Hence the RHS of (2 is equal to d n f(d, which is F(n. Next, taking n and n corime, we see that (2 immediately imlies that F(nF(n = F(nn, i.e., that F is multilicative. Proosition 3.5. Euler s ϕ-function ϕ(m is multilicative. Proof. Take n and n corime, and let {i : i n, gcd(i, n = } = {a < a 2 < < a ϕ(n }, the reduced residue classes mod n. Similarly, let {j : j n, gcd(j, n = } = {a < a 2 < < a ϕ(n }. If x {, 2,..., nn } and gcd(x, nn = then certainly gcd(x, n = gcd(x, n =, so that x a i (mod n x a j (mod n (3 for some air a i, a j. Conversely, given such a air a i, a j we can solve (3 using the CRT to get a solution x {, 2,..., nn } with gcd(x, nn =. Thus we have a bijection between such x and such airs a i, a j. Hence In assing, mention #{such x} = ϕ(nn = #{a i, a j } = ϕ(nϕ(n. Proosition 3.6 (Euler s Theorem. If a, n N and gcd(a, n = then a ϕ(n (mod n. Proof. This is because the reduced residue classes mod n form a multilicative grou (Z/nZ of size(order ϕ(n. So, in this grou, a ϕ(n =. Note that on utting n = rime we retrieve Fermat s Little Theorem a (mod. [In fact the exonent of the grou (Z/nZ is usually smaller than ϕ(n. To give the exonent, we need to define a new function ψ on rime owers by ψ = ϕ on odd rime

0 owers, and at 2 and 4, while ψ(2 e = 2 ϕ(2e if e 3. Then the exonent of (Z/nZ is lcm : e n ψ( e. This follows from the isomorhism (Z/nZ = (Z/ e Z : e n and the fact that (Z/ e Z has exonent ψ( e.] Proosition 3.7. We have ϕ(n = n ( n. Proof. Now ϕ( k = k k (why?, which = ( k Corollary 3.2. The Möbius function µ(n is defined as { 0 if 2 n for some rime ; µ(n = ( k if n = 2... k for distinct rimes i., so the result follows from In articular, µ( = and µ( = for a rime. It is immediate from the definition that µ is multilicative. Then, alying (2, we see that d n µ(d = (n. Integers with µ(n = ± are called squarefree. The Möbius function arises in many kinds of inversion formulae. The fundamental one is the following. Proosition 3.8 (Möbius inversion. If F(n = d n f(d we have f(n = d n µ(n/df(d. (n N then for all n N Proof. Simlify d n µ(n/df(d = d n µ(n/d k d f(k (n N by interchanging the order of summation to make k n the outer sum. But a simler roof is given below. 3.2. Dirichlet series. For an arithmetic function f, define its Dirichlet series D f (s by f(n D f (s = n. s n= Here s C is a arameter. Tyically, such series converge for Rs >, and can be meromorhically continued to the whole comlex lane. However, we will not be concerned with analytic roerties of Dirichlet series here, but will regard them only as generating functions for arithmetic functions, and will maniulate them formally, without regard to convergence. The most imortant examle is for f(n = (n N, which gives the Riemann zeta function ζ(s = n= n s. Also, taking f(n = n (n N gives ζ(s. (Check!. Proosition 3.9. If f is multilicative then D f (s = ( + f( + f(2 + + f(k +... = s 2s ks say. D f, (s, (4

Proof. Exanding the RHS of (4, a tyical term is for n = r i= e i i f( e f(e 2 2...f(er r e e 2 2... er r, using the fact that f is multilicative. = f(n n s Such a roduct formula D f (s = D f,(s over all rimes is called an Euler roduct for D f (s. For examle ζ(s = ( + + s + + 2s +... = ks on summing the Geometric Progression (GP. Hence also ζ(s = ( s µ(n = = D n s µ (s, on exanding out the roduct. Proosition 3.0. We have ( a k k s where c n = k n a kb n/k. k ( l b l l s n= Proof. On multilying out the LHS, a tyical term is a k = ( n c n n s, (, s k bl s l = a kb n/k, s n s where kl = n. So all airs k, l with kl = n contribute to the numerator of the term with denominator n s. Corollary 3.. We have D F (s = D f (sζ(s. Proof. Aly the Proosition with a k = f(k and b l =. Corollary 3.2 ( Möbius inversion again. We have f(n = d n µ(n/df(d for all n N. Proof. From Corollary 3. we have ( D f (s = D F (s ζ(s = k ( F(k k s l ( µ(l = l s n where c n = k n F(kµ(n/k. But D f(s = f(n n=, so, on comaring coefficients, n s f(n = k n F(kµ(n/k. We now comute the Dirichlet series for a few standard functions. [Part (a is already roved above.] c n n s,

2 Proosition 3.3. We have (a D µ (s = ζ(s ; (b D ϕ (s = ζ(s ζ(s ; (c D τ (s = ζ(s 2 ; (d D σ (s = ζ(s ζ(s. Proof. (c Now (b Now D ϕ (s = = = ( + ϕ( ( + + ϕ(2 + + ϕ(k s 2s s ( + s ( s = (s ζ(s =. ζ(s D τ (s = = = = ζ(s 2 ( + τ( + 2 2s +... ks + + k k +... ks, on summing the GP s, on simlification +... ks + τ(2 + + τ(k s 2s ( + 2 + 3 s + + k + +... 2s ks ( s 2 using ( x 2 = (k + x k (d This can be done by the same method as (b or (c a good exercise! But, given that we know the answer, we can work backwards more quickly: ( ( k ζ(s ζ(s = = k n k = D k s l s n s σ (s, n using Pro. 3.0 k l 3.3. Perfect numbers. A ositive integer n is called erfect if it is the sum of its roer (i.e., excluding n itself divisors. Thus σ(n = 2n for n erfect. k=0

Proosition 3.4. An even number n is erfect iff it of the form n = 2 (2 for some rime with the roerty that 2 is also rime. Prime numbers of the form 2 are called Mersenne rimes. (Unsolved roblem: are there infinitely many such rimes? It is easy to check that σ(2 (2 = 2 (2 when 2 is rime. The converse is more difficult I leave this as a tricky exercise: you need to show that if k 2 and 2 k... l is erfect then l = and = 2 k. (It s easy to rove that if 2 k is rime then so is k. It is an unsolved roblem as to whether there are any odd erfect numbers. See e.g., htt://en.wikiedia.org/wiki/perfect number for lots on this roblem. 4. Primality testing 4.. Introduction. Factorisation is concerned with the roblem of develoing efficient algorithms to exress a given ositive integer n > as a roduct of owers of distinct rimes. With rimality testing, however, the goal is more modest: given n, decide whether or not it is rime. If n does turn out to be rime, then of course you ve (trivially factorised it, but if you show that it is not rime (i.e., comosite, then in general you have learnt nothing about its factorisation (aart from the fact that it s not a rime!. One way of testing a number n for rimality is the following: suose a certain theorem, Theorem X say, whose statement deends on a number n, is true when n is rime. Then if Theorem X is false for a articular n, then n cannot be rime. For instance, we know (Fermat that a n (mod n when n is rime and n a. So if for such an a we have a n (mod n, then n is not rime. This test is called the Pseudorime Test to base a. Moreover, a comosite number n that asses this test is called a Pseudorime to base a. (It would be good if we could find a Theorem Y that was true iff n was rime, and was moreover easy to test. Then we would know that if the theorem was true for n then n was rime. A result of this tye is the following (also on a roblem sheet: n is rime iff a n (mod n for a =, 2,..., n. This is, however, not easy to test; it is certainly no easier than testing whether n is divisible by a for a =,...,n. 4.2. Proving rimality of n when n can be factored. In general, rimality tests can only tell you that a number n either is comosite, or can t tell. They cannot confirm that n is rime. However, under the secial circumstance that we can factor n, rimality can be roved: Theorem 4. ( Lucas Test, as strengthened by Kraitchik and Lehmer. Let n > have the roerty that for every rime factor q of n there is an integer a such that a n (mod n but a (n /q (mod n. Then n is rime. Proof. Define the subgrou G of (Z/nZ to be the subgrou generated by all such a s. Clearly the exonent of G is a divisor of n. But it can t be a roer divisor of n, for then it would divide some (n /q say, which is imossible as a (n /q (mod n for the a corresonding to that q. Hence G has exonent n. But then 3

4 n #G #(Z/nZ = ϕ(n. Hence ϕ(n = n, which immediately imlies that n is rime. Corollary 4.2 (Pein s Test, 877. Let F k = 2 2k +, the kth Fermat number, where k. Then F k is rime iff 3 F k 2 (mod F k. Proof. First suose that 3 F k 2 (mod F k. We aly the theorem with n = F k. So n = 2 2k and q = 2 only, with a = 3. Then 3 F k 2 (mod F k and (on squaring 3 Fk (mod F k, so all the conditions of the Theorem are satisfied. Conversely, suose that F k is rime. Then, by Euler s criterion and quadratic recirocity (see Chater 5 we have 3 F k 2 as 2 is not a square (mod 3. ( 3 F k = ( Fk 3 = ( 2 =, 3 We can use this to show that F 0 = 3, F = 5, F 2 = 7, F 3 = 257 and F 4 = 65537 are all rime. It is known that F k is comosite for 5 k 32, although comlete factorisations of F k are known only for 0 k, and there are no known factors of F k for k = 20 or 24. Heuristics suggest that there may be no more k s for which F k is rime. 4.3. Carmichael numbers. A Carmichael number is a (comosite number n that is a seudorime to every base a with a n and gcd(a, n =. Since it it immediate that a n (mod n when gcd(a, n >, we see that Carmichael numbers are seudorimes to as many ossible bases as any comosite number could be. They are named after the US mathematician Robert Carmichael (879 967. [But even finding an a with gcd(a, n > gives you a factor of n. (Imagine that n is around 0 300 and is a roduct of three 00-digit rimes such a s are going to be few and far between!] For examles of Carmichael numbers, see roblem sheet 3. 4.4. Strong seudorimes. Given n > odd and an a such that a n (mod n, factorise n as n = 2 f q, where q is odd, f and consider the sequence S = [a q, a 2q, a 4q,...,a 2fq ], taken (mod n. If n is rime then, working left to right, either a q (mod n, in which case S consists entirely of s, or the number before the first must be. This is because the number following any x in the sequence is x 2, so if x 2 (mod n for n rime, then x ± (mod n. (Why? A comosite number n that has this roerty, (i.e., is a seudorime to base a and for which either S consists entirely of s or the number before the first in S is is called a strong seudorime to base a. Clearly, if n is a rime or seudorime but not a strong seudorime, then this stronger test roves that n isn t rime. This is called the Miller-Rabin Strong Pseudorime Test. Perhas surrisingly:

Theorem 4.3. If n is a seudorime to base a but not a strong seudorime to base a, with say a 2tq (mod n but a 2t q ± (mod n, then n factors nontrivially as n = g g 2, where g = gcd(a 2t q, n and g 2 = gcd(a 2t q +, n. Proof. For then we have, for n = 2 f q and some t f, that a 2tq (mod n but a 2t q ± (mod n. Now a 2tq = AB 0 (mod n, where A = (a 2t q and B = (a 2t q +, and neither A nor B is divisible by n. Hence g is a nontrivial ( or n factor of n. Since g n, we have gcd(g, g 2 = gcd(n, g, g 2 = gcd(n, g, g 2 g = gcd(n, g, 2 =, the last ste because n is odd. Hence any rime dividing n can divide at most one of g and g 2. So from n = e, say, and n AB, we see that each rime ower e dividing n divides recisely one of A or B, and so divides recisely one of g or g 2. Hence g g 2 = n. Examle. Take n = 362, a seudorime to base a = 2. We have n = 2 2 7905, 2 7905 333 (mod n and 2 580 2 3620 (mod n, so n is not a strong seudorime to base 2. Then g = gcd(n, 332 = 03 and g 2 = gcd(n, 334 = 307, giving n = 03 307. Note that if n = n n 2 where n and n 2 are corime integers, then by the Chinese Remainder Theorem we can solve each of the four sets of equations x ± (mod n x ± (mod n 2 to get four distinct solutions of x 2 (mod n. For instance, for n = 35 get x = ± or ±6. For the examle n = 362 above, we have 333 (mod 03 and 333 (mod 307, so that four distinct solutions of x 2 (mod 362 are ± and ±333. So what is haening when the strong seudorime test detects n as being comosite is that some x S is a solution to x 2 (mod n with x ± (mod n because x (mod n and x (mod n 2 for some corime n, n 2 with n n 2 = n. And then both gcd(x, n (divisible by n and gcd(x +, n (divisible by n 2 are nontrivial factors of n. 4.5. Strong seudorimes to the smallest rime bases. It is known that 2047 is the smallest strong seudorime to base 2; 373653 is the smallest strong seudorime to both bases 2, 3; 2532600 is the smallest strong seudorime to all bases 2, 3, 5; 3250375 is the smallest strong seudorime to all bases 2, 3, 5, 7; 252302898747 is the smallest strong seudorime to all bases 2, 3, 5, 7, ; 3474749660383 is the smallest strong seudorime to all bases 2, 3, 5, 7,, 3; 345500772832 is the smallest strong seudorime to all bases 2, 3, 5, 7,, 3, 7. (In fact 345500772832 is also a strong seudorime to base 9. 5

6 Hence any odd n < 345500772832 that asses the strong seudorime test for all bases 2, 3, 5, 7,, 3, 7 must be rime. So this rovides a cast-iron rimality test for all such n. 4.6. Primality testing in olynomial time. In 2002 the Indian mathematicians Agrawal, Kayal and Saxena invented an algorithm, based on the study of the olynomial ring (Z/nZ[x], that was able to decide whether a given n was rime in time O((log n 6+ε. (Here the constant imlied by the O deends on ε and so could go to infinity as ε 0. (Search for AKS algorithm on web. 4.7. The Lucas-Lehmer rimality test for Mersenne numbers. Given an odd rime, let M = 2, a Mersenne number (and a Mersenne rime iff it is rime. [It is an easy exercise to rove that if is comosite, then so is M.] Define a sequence S, S 2,...,S n,... by S = 4 and S n+ = Sn 2 2 for n =, 2,.... so we have S = 4, S 2 = 4, S 3 = 94, S 4 = 37634, S 5 = 4637954,.... There is a very fast test for determining whether or not M is rime. Theorem 4.4 ( Lucas-Lehmer Test. For an odd rime, the Mersenne number M is rime iff M divides S. So M 3 = 7 is rime as 7 S 2, M 5 = 3 is rime as 3 S 4,... In this way get M rime for = 3, 5, 7, 3, 7, 9, 3, 6, 89, 07, 27, 52, 607, 279, 2203,228,... (47th 432609. There may be others between the 4st and 47th. [as at October 202.] For the roof, we need two lemmas. Lemma 4.5. Put ω = 2 + 3 and ω = 2 3. Then ωω = (immediate and for n =, 2,.... S n = ω 2n + ω 2n The roof is a very easy induction exercise. Lemma 4.6. Let r be a rime (mod 3 and (mod 8 (i.e., 7 (mod 24. Then ω r+ 2 (mod r. (So it s equal to a + b 3 where a (mod r and b 0 (mod r. Proof. Put τ = + 3 2 and τ = 3 2.

Then we immediately get ττ =, τ 2 = ω and τ 2 = ω. Next, from τ 2 = + 3 we have (τ 2 r = ( + 3 r, so that r ( τ r 2 r r 2 2 = + ( 3 j + 3 r 2 3 j j= + 3 r 2 3 (mod r, (5 as r ( r j. Since r (mod 8 we have ( 2 r 2 2 = ( r2 8 (mod r, r using Euler s Criterion, and Pro. 5.3. Further, since r (mod 3 and r (mod 4 we have ( 3 r 3 ( ( r 2 = ( r 3 r 2 3 2 = ( (mod r, 3 using Euler s Criterion again, and also Quadratic Recirocity (Th. 5.. So, from (5, we have successively the last ste using τ 2 = ω. τ r 2 3 (mod r τ r τ (mod r τ r+ ττ = (mod r ω r+ 2 (mod r, Proof of Theorem 4.4. M rime M S. Assume M rime. Aly Lemma 4.6 with r = M, which is allowed as M (mod 8 and M ( (mod 3. So ω M+ 2 = ω 2 (mod M (6 and, using Lemma 4.5, including ω = ω, we have ( (ω S = ω 2 2 + ω 2 2 = ω 2 2 2 2 ω 2 2 + = ω 2 2 7 ( ω 2 + 0 (mod M, (7 the last ste using (6. M S M rime. Assume M S but M comosite. We aim for a contradiction. Then M will have a rime divisor q (say with q 2 M. ( Z[ 3] Now consider the multilicative grou G = of units of the ring Z[ 3]. Then (q (q G has coset reresentatives consisting of numbers a + b 3 with a, b {0,, 2,..., q } that are also invertible (mod q. So G is a grou of size (order at most q 2, with multilication defined modulo q. From ω(ω + q 3 (mod q we see that ω = 2 + 3 is invertible, and so ω G. [Strictly seaking, the coset ω (mod q G.]

8 Now, using M S we see that (7 holds even when M is comosite, so we have successively that ω 2 + 0 (mod M, ω 2 (mod q and ω 2 (mod q. Hence the order of ω in G is 2. Then 2 #G q 2 M = 2 2, a contradiction. Hence M must be rime. In ractice, to test M for rimality using Theorem 4.4, one doesn t need to comute S j (j =, 2,...,, but only the much smaller (though still large! numbers S j (mod M (j =, 2,...,. A good source of information on Mersenne numbers is htt://rimes.utm.edu/mersenne/index.html 5. Quadratic Recirocity ( a 5.. Introduction. Recall that the Legendre symbol is defined for an odd rime and integer a corime to as ( { a if a is a quadratic residue = otherwise; (mod ; Recall too that for a, b corime to (ab = ( a ( b (easily roved by writing a, b as owers of a rimitive root, and that, by Euler s Criterion, ( { = ( ( /2, if (mod 4 =, if (mod 4. Theorem 5. ( Law of Quadratic Recirocity (Legendre, Gauss. For distinct odd rimes and q we have ( ( q = ( 2 q 2. q ( (Thus q ( = q ( unless and q are both (mod 4, in which case q ( = There are now 240 recorded roofs of this (not all different, including six by Gauss see htt://www.rzuser.uni-heidelberg.de/ hb3/rchrono.html. We ll give one of Gauss s roofs, using Lemma 5.2 ( Gauss s Lemma. For an odd rime, ut =, and let a be an integer 2 corime to. Consider the sequence a, 2a, 3a,..., a, q.

reduced mod to lie in (, (a. Then = ( ν, where ν is the number of negative 2 2 numbers in this sequence. Proof. Now all of a, 2a, 3a,..., a are (mod to one of ±, ±2,...,±. Further, no two are equal, as ia ja (mod i j (mod ; none is minus another, as ia ja (mod i + j 0 (mod. So they must be ±, ±2,...,±, with each of, 2,..., occurring with a definite sign. Hence a 2a 3a... a (± (±2... (± (mod, giving and so, as (! is corime to, that a (! ( ν (! a ( ν (mod, (mod. Finally, using Euler s criterion (Pro. 2.8, we have ( a a ( ν (mod. ( Hence = ( ν. a ( We can use Gauss s Lemma to evaluate ( Proosition 5.3. For an odd rime we have 2. 2 = ( 2 8. (This is equal to when ± (mod 8, and to when ±3 (mod 8. Proof. There are four similar cases, deending on (mod 8. We give the details for 3 (mod 8, = 8l + 3 say. Then = 4l +, and, taking a = 2 in Gauss s Lemma, we see that for the sequence 2, 4, 6,..., 4l, 4l + 2,...,8l + 2 that this becomes 2, 4, 6,..., 4l, (4l +, (4l,..., 3, when reduced (mod into the range (,. This clearly has 2l ositive members, and 2 2 ( hence ν = 2l = 2l + negative members. Hence = ( 2l+ =. Doing the other three cases would be a good exercise! We now use Gauss s Lemma with a = q to rove the Law of Quadratic Recirocity. 2 9

20 Proof of Theorem 5.. Take distinct odd rimes and q. For k =, 2,..., write (one ste of the Euclidean algorithm say, where r k and Now, working in F we have kq = q k + r k (8 q k = kq. (9 {q, 2q,..., q} = {r, r 2,...,r } = {a, a 2,...,a t } { b, b 2,..., b ν }, as in Gauss s Lemma. So the a i s are in (0, and the b 2 i s are in (, 0. (In fact 2 t = ν, but not needed. Now ut a = t a i, b = i= So, by the definition of the a i s and b i s we have k= Now, in the roof of Gauss s Lemma we saw that so that and ν b i. i= r k = a b + ν. (0 {a, a 2,...,a t } {b, b 2,...,b ν } = {, 2,..., }, 2 q = 8 2 8 k= kq = + 2 + + = a + b. ( = q k + r k (using (8 k= k= = q k + a b + ν, (using (0. (2 k= Next, on subtracting (2 from ( we get 2 8 (q = q k 2b + ν. k=

Reducing this modulo 2 we have 0 k= q k ν (mod 2, or ν k= q k (mod 2. Thus Gauss s Lemma gives (q = ( ν = ( P k= q k = ( P k= kq, using (9. Now, reversing the rôles of and q we immediately get ( = ( P q l= l q, q where of course q = (q /2, and we ve relaced the dummy variable k by l. So ( ( n q P k= = ( kq + P q l= l q o, q which equals ( q, by Pro..4. 6. Reresentation of integers as sums of two squares Which n Z can be reresented as a sum n = x 2 + y 2 for x, y Z? Obviously need n 0. Can clearly assume that x and y are nonnegative. We have 0 = 0 2 +0 2, = 2 +0 2, 2 = 2 + 2, 4 = 2 2 + 0 2, 5 = 2 2 + 2, but no such reresentation for n = 3, 6 or 7. Imortant note: (2k 2 0 (mod 4, and (2k + 2 = 8 ( k+ 2 + (mod 8 (and so certainly (mod 4. 6.. The case n =, rime. Which rimes are the sum of two squares? Theorem 6.. An odd rime is a sum of two squares (of integers iff (mod 4. Proof. As x 2, y 2 0 or (mod 4, so x 2 +y 2 0 or or 2 (mod 4. Assuming = x 2 +y 2, then as is odd, we have (mod 4. ( Conversely, assume (mod 4, and, knowing that then =, take r N with r 2 (mod. Define f(u, v = u + rv and K =. Note that K < < K +, (3 as Z. Consider all airs (u, v with 0 u K and 0 v K. There are (K+ 2 > such airs, and so the multiset of all f(u, v for such u, v has, by the Pigeonhole Princile, two such airs (u, v (u 2, v 2 for which f(u, v f(u 2, v 2 (mod. Hence u + rv u 2 + rv 2 (mod u u 2 r(v v 2 (mod a rb (mod, say, where a = u v and b = v v 2 are not both 0. Hence a 2 b 2 (mod as r 2 (mod, so that (a 2 + b 2. But a K, b K, giving 0 < a 2 + b 2 2K 2 < 2. 2

22 So a 2 + b 2 =. 6.2. The general case. We now look at what haens if a rime (mod 4 divides a sum of two squares. Proosition 6.2. Let q 3 (mod 4 be rime, and q (x 2 + y 2. Then q x and q y, so that q 2 (x 2 + y 2. Proof. Assume that it is not the case that both x and y are divisible by ( q, say q x. Then from x 2 + y 2 0 (mod q we get (yx 2 (mod q, contradicting =. Proosition 6.3. If n is a sum of two squares and m is a sum of two squares then so is nm. Proof. If n = a 2 + b 2 and m = c 2 + d 2 then nm = (a 2 + b 2 (c 2 + d 2 = (ac bd 2 + (ad + bc 2. (This identity comes from comlex numbers: (a + ib(c + id = ac bd + i(ad + bc gives a + ib 2 c + id 2 = ac bd + i(ad + bc 2 and hence the identity. Corollary 6.4. If n = A 2 i n i where A, n i Z and each n i is a sum of two squares, then so is n. Proof. Use induction on i to get n/a 2 = i n i = a 2 + b 2 say. Then n = (Aa 2 + (Ab 2. We can now state and rove our main result. Theorem 6.5 ( Fermat. Write n in factorised form as n = 2 f 2 f (mod 4 q (mod 4 where (of course all the s and q s are rime. Then n can be written as the sum of two squares of integers iff all the g q s are even. Proof. If all the g q are even then n = A 2 (roduct of some s and also 2 if f 2 is odd. So we have n = A 2 i (a2 i +b2 i by Theorem 6. (using also 2 = 2 + 2 if f 2 odd. Hence, by Corollary 6.4, n is the sum of two squares. Conversely, suose q n = a 2 + b 2, where q (mod 4 is rime. Let q k be the highest ower of q dividing both a and b, so say a = q k a, b = q k b. Then n q 2k = a2 + b 2. n Now q, as otherwise q would divide both a q 2k and b, by Pro. 6.2. Hence q 2k is the highest ower of q dividing n, i.e., g q = 2k is even. Hence all the g q s are even. q gq, q

6.3. Related results. Proosition 6.6. If an integer n is the sum of two squares of rationals then it s the sum of two squares of integers. Proof. Suose that ( a 2 ( c 2 n = + b d for some rational numbers a/b and c/d. Then n(bd 2 = (da 2 + (bc 2. Hence, by Thm 6.5, for every rime q (mod 4 with q i n(bd 2, i must be even. But then if q l bd then q i 2l n, with i 2l even. Hence, by Thm 6.5 (in the other direction, n is the sum of two squares of integers. Corollary 6.7. A rational number n/m is the sum of two squares of rationals iff nm is the sum of two squares of integers. Proof. If nm = a 2 + b 2 for a, b Z then n ( ( a 2 2 b m m = +. m Conversely, if n ( a 2 ( c 2 m b = + d then ( am 2 ( cm 2 nm = +. b d Hence, by Pro. 6.6, nm is the sum of two squares of integers. 6.4. Finding all ways of exressing a rational as a sum of two rational squares. Now let h be a rational number that can be written as the sum of two squares of rationals. We can then describe all such ways of writing h. Theorem 6.8. Suose that h Q is the sum of two rational squares: h = s 2 + t 2, where s, t Q. Then the general solution of h = x 2 + y 2 in rationals x, y is ( x = s(u2 v 2 2uvt t(u 2 v 2 + 2uvs y =, (4 u 2 + v 2 u 2 + v 2 where u, v Z not both zero. Proof. We are looking for all oints (x, y Q 2 on the circle x 2 +y 2 = h. If (x, y is such a oint, then for x s the chord through (s, t and (x, y has rational sloe (t y/(s x. Conversely, take a chord through (s, t of rational sloe r, which has equation y = r(x s + t. Then for the intersection oint (x, y of the chord and the circle we have x 2 + (r(x s + t 2 = h, 23

24 which simlifies to x 2 ( + r 2 + 2rx(t rs + (r 2 s 2 2rst = 0, using the fact that t 2 h = s 2. This factorises as For x s we have and (x s(( + r 2 x + 2rt + s( r 2 = 0. x = s(r2 2rt + r 2 y = t + r(x s ( t(r 2 + 2sr =, + r 2 on simlification. Finally, substituting r = u/v gives (4. Note that v = 0 in (4 (i.e., r = gives the oint (r, s. Corollary 6.9. The general integer solution x, y, z of the equation x 2 + y 2 = nz 2 is (x, y, z = (a(u 2 v 2 2uvb, b(u 2 v 2 + 2uva, u 2 + v 2, where n = a 2 + b 2, with a, b, u, v Z, and u, v arbitrary. (If n is not the sum of two squares, then the equation has no nonzero solution, by Pro. 6.6. In articular, for n = = 2 +0 2, we see that the general integer solution to Pythagoras equation x 2 + y 2 = z 2 is (x, y, z = (u 2 v 2, 2uv, u 2 + v 2. For a socalled rimitive solution one with gcd(x, y = choose u, v with gcd(u, v = and not both odd. The same method works for Ax 2 + By 2 + Cz 2 = 0. 6.5. Sums of three squares, sums of four squares. Proosition 6.0. No number of the form 4 a (8k + 7, where a is a nonnegative integer, is the sum of three squares (of integers. Proof. Use induction on a. For a = 0: Now n 2 0, or 4 (mod 8, so a sum of three squares is or or 2 or 3 or 4 or 5 or 6 (mod 8, but 7 (mod 8. Assume result true for some integer a 0. If 4 a+ (8k + 7 = n 2 + n2 2 + n2 3 then all the n i must be even, and so = 4(n 2 + n 2 2 + n 2 3 say. But then 4a (8k + 7 = n 2 + n 2 2 + n 2 3, contrary to the induction hyothesis. In fact (won t rove Theorem 6. (Legendre 798, Gauss. All ositive integers excet those of the form 4 a (8k + 7 are the sum of three squares.

Assuming this result, we can show Corollary 6.2 (Lagrange 770. Every ositive integer is the sum of four squares. Proof. The only case we need to consider is n = 4 a (8k + 7. But then n (2 a 2 = 4 a (8k + 6 = 2 2k+ (4k + 3, which (being exactly divisible by an odd ower of 2 is not of the form 4 a (8k + 7, so is the sum of three squares. 7. Fermat s method of descent Around 640, Fermat develoed a method for showing that an equation had no integer solutions. In essence, the method is as follows: assume that the equation does have a solution. Pick the smallest (suitably defined one. Use the assumed solution to construct a smaller solution, contradicting the fact that the one you started with was the smallest. This contradiction roves that there is in fact no solution. The technique is called Fermat s method of descent. It is, in fact, a form of strong induction. (Why? We illustrate the method with one examle: Theorem 7.. The equation has no solution in ositive integers x, y, z. x 4 + y 4 = z 2 (5 Corollary 7.2 (Fermat s Last Theorem for exonent 4. The equation x 4 + y 4 = z 4 has no solution in ositive integers x, y, z. Proof of Theorem 7.. (From H. Davenort, The higher arithmetic. An introduction to the theory of numbers, Longmans 952,.62. Suose that (5 has such a solution. Assume we have a solution with z minimal. We can clearly assume that z is ositive and, i.e., that z >. If d = gcd(x, y > we can divide by d 4, relacing x by x/d, y by y/d and z by z/d 2 in (5, obtaining a solution with z smaller. So we must have gcd(x, y =. Now from Corollary 6.9 we know that X 2 + Y 2 = Z 2 has general solution (with gcd(x, Y =, ossibly after interchanging X and Y of where, q N and gcd(, q =, so X = 2 q 2 Y = 2q Z = 2 + q 2, x 2 = 2 q 2 y 2 = 2q z = 2 + q 2. As a square is 0 or (mod 4, and x is odd (because gcd(x, y =, we see that is odd and q is even, say q = 2r. So x 2 = 2 (2r 2 ( y 2 2 = r. Since gcd(, r = and r is a square, we have = v 2 and r = w 2 say, so x 2 + (2w 2 2 = v 4. 25

26 Note that, as gcd(, q =, we have gcd(x, q = = gcd(x, 2w 2. Hence alying Corollary 6.9 again x = 2 q 2 2w 2 = 2 q v 2 = 2 + q 2, where gcd(, q = and not both are odd. Say odd, q even. Thus w 2 = q, giving = v 2, q = r 2, say. Hence v 2 (= 2 + q2 = v4 + r4, which is another solution of (5! But v 2 = = z q 2 < z, giving v < z /4, so certainly v < z (as z >, contradicting the minimality of z. 8. -adic numbers 8.. Motivation: Solving x 2 a (mod n. Take an odd rime, and ( an integer a corime to. Then, as we know, x 2 a (mod has a solution x Z iff =. In this case we can suose that b 2 0 a (mod. We claim that then x2 a (mod n has a solution x for all n N. Assume that we have a solution x of x 2 a (mod n for some n. Then x is corime to, so that we can find x (x + a/x (mod 2 2n. (This is the standard Newton-Rahson iterative method x = x f(x/f (x for solving f(x = 0, alied to the olynomial f(x = x 2 a, but (mod 2n instead of in R or C. Then and x x = 2 ( x a x = 2x ( x 2 a 0 (mod n, x 2 a = (x 2 + 2a + a2 a 4 x 2 = ( x a 2 4 x = a 2 4x 2(x2 0 (mod 2n Thus, starting with x 0 such that x 2 0 a (mod 20, we get successively x with x 2 a (mod 2, x 2 with x 2 2 a (mod 22,..., x k with x 2 k a (mod 2k,..., with x k+ x k (mod 2k. So, writing the x i in base, we obtain x 0 = b 0 x = b 0 + b say, secified (mod 2 x 2 = b 0 + b + b 2 2 + b 3 3 say, secified (mod 4 x 3 = b 0 + b + b 2 2 + b 3 3 + b 4 4 + b 5 5 + b 6 6 + b 7 7 say, secified (mod 8, a

and so on. So, in any sense, is x = i= b i i a root of x 2 a (mod? It turns out that, yes, it is: x is a root of x 2 = a in the field Q of -adic numbers. 8.2. Valuations. In order to define the fields Q of -adic numbers for rimes, we first need to discuss valuations. A valuation on a field F is a ma from F to the nonnegative real numbers satisfying If in addition For each x F x = 0 iff x = 0; (ZERo For each x, y F xy = x y ; (HOMomorhism For each x, y F x + y x + y. (TRIangle For each x, y F x + y max( x, y, (MAXimum then is called a nonarchimedean valuation. A valuation that is not nonarchimedean, i.e., for which there exist x, y F such that x + y > max( x, y, is called archimedean. For instance the standard absolute value on R is archimedean because 2 = 2 = + > max(, =. Note that MAX is stronger than TRI in the sense that if MAX is true than TRI is certainly true. So to show that a valuation is nonarchimedean we only need to check that ZER, HOM and MAX hold. Proosition 8.. For any valuation on a field F we have = = and for n N (defined as the sum of n coies of the identity of F we have n = n and /n = / n. Further, for n, m N we have n/m = n / m. Proof. We have = 2 = 2, using HOM, so that = 0 or. But 0 by ZER, so =. Also = = ( 2 = 2 by HOM, so that = since > 0. Further, n = ( n = n = n = n, and from n (/n = we get n /n = =, so that /n = / n. Finally, from n/m = n (/m we get n/m = n /m = n / m. 8.3. Nonarchimedean valuations. From now on we restrict our attention to nonarchimedean valuations. Proosition 8.2 (Princile of Domination. Suose that we have a nonarchimedean valuation on a field F, and that x, y F with x y. Then Note the equal sign in this statement! x + y = max( x, y. Proof. Put s = x + y, and assume w.l.g. that x < y. Then s max( x, y = y, while y = s x max( s, x = max( s, x = s, since otherwise we d have y x. Hence s = y = max( x, y. 27

28 Corollary 8.3. Suose that x,...,x n F, with nonarchimedean. Then with equality if x > max( x 2,..., x n. x +...,+x n max( x,..., x n, Proof. Use induction, with the hel of MAX, for the inequality. For the equality, ut x = y and x 2 + + x n = x in the Princile of Domination. Corollary 8.4. For nonarchimedean and n Z we have n. Proof. Aly the Corollary above with all x i =. Then use n = n. Lemma 8.5. If is a nonarchimedean valuation on F, then so is α for any α > 0. Proof. It s easily checked that ZER, HOM and MAX still hold when the valuation we start with is taken to the α-th ower. [ The same does not aly to TRI we need 0 < α for TRI to still always hold.] 8.4. Nonarchimedean valuations on Q. Corollary 8.6. If is a nonarchimedean valuation on Q with n = for all n N then is trivial, i.e., x = 0 if x = 0 while x = if x 0. Proof. We then have x = 0 by ZER, while n/m = n / m = / =. We ll ignore trivial valuations from now on. Proosition 8.7. If is a nonarchimedean valuation on Q with n < for some n N, then there is a rime such that {n N : n < } = {n N : divides n}. Proof. Take the smallest ositive integer n such that n <. We know that n >. If n is comosite, say n = n 2 n 3 with < n 2, n 3 < n, then, by the minimality of n, we have n 2 = n 3 =, so that n = n 2 n 3 = = by HOM, a contradiction. Hence n is rime, = say. Then for any n with n < we can, by the division algorithm, write n = q + r where 0 r <. But then r = n q max( n, q = max( n, q <, as =, q and <. By the minimality of we must have r = 0, so that n. Next, we show that there is indeed a valuation on Q corresonding to each rime. We define by 0 = 0, = / and n = for n Z and corime to, and k n/m = k for n and m corime to. We call this the -adic valuation on Q. Proosition 8.8. The -adic valuation on Q is indeed a valuation. Proof. The definition of ensures that ZER and HOM hold. It remains only to check that MAX holds.

Let x = k n/m and y = k n /m,where n, m, n m are all corime to. Suose w.l.g. that k k. Then x = k n / m = k as n = m = and = /. Similarly y = k x. Hence x + y = k (nm + k k n m mm = k nm + k k n m k = max( x mm, y. 29 as m = m = and nm + k k n m, since nm + k k n m Z. [Note that the choice of = / is not articularly imortant, as by relacing by its α-th ower as in Lemma 8.5 we can make equal any number we like in the interval (0,. But we do need to fix on a definite value!] 8.5. The -adic comletion Q of Q. We first recall how to construct the real field R from Q, using Cauchy sequences. Take the ordinary absolute value on Q, and define a Cauchy sequence to be a sequence (a n = a, a 2,...,a n,... of rational numbers with the roerty that for each ε > 0 there is an N > 0 such that a n a n < ε for all n, n > N. We define an equivalence relation on these Cauchy sequences by saying that two such sequences (a n and (b n are equivalent if the interlaced sequence a, b, a 2, b 2,...,a n, b n,... is also a Cauchy sequence. [Essentially, this means that the sequences tend to the same limit, but as we haven t yet constructed R, where (in general the limit lies, we can t say that.] Having checked that this is indeed an equivalence relation on these Cauchy sequences, we define R to be the set of all equivalence classes of such Cauchy sequences. We reresent each equivalence class by a convenient equivalence class reresentative; one way to do this is by the standard decimal exansion. So, the class π will be reresented by the Cauchy sequence 3, 3., 3.4, 3.4, 3.45, 3.459,..., which we write as 3.459.... Further, we can make R into a field by defining the sum and roduct of two Cauchy sequences in the obvious way, and also the recirocal of a sequence, rovided the sequence doesn t tend to 0. [The general unique decimal reresentation of a real number a is a = ±0 k (d 0 + d 0 + d 2 0 2 + + d n 0 n +..., where k Z, and the digits d i are in {0,, 2,..., 9}, with d 0 0. Also, it is forbidden that the d i s are all = 9 from some oint on, as otherwise we get non-unique reresentations, e.g., = 0 0 (.00000... = 0 (9.99999....] We do the same kind of construction to define the -adic comletion Q of Q, excet that we relace the ordinary absolute value by in the method to obtain -Cauchy sequences. To see what we should take as the equivalence class reresentatives, we need the following result. Lemma 8.9. Any rational number m/n with m/n = can be -adically aroximated arbitrarily closely by a ositive integer. That is, for any k N there is an N N such that m/n N k.