• Tidak ada hasil yang ditemukan

PDF A Computational Introduction to Number Theory and Algebra ... - NISCAIR

N/A
N/A
Protected

Academic year: 2023

Membagikan "PDF A Computational Introduction to Number Theory and Algebra ... - NISCAIR"

Copied!
598
0
0

Teks penuh

(1)

A Computational Introduction to Number Theory and Algebra

(Version 2)

Victor Shoup

(2)
(3)

This PDF document contains hyperlinks, and one may navigate through it by click- ing on theorem, definition, lemma, equation, and page numbers, as well as URLs, and chapter and section titles in the table of contents; most PDF viewers should also display a list of “bookmarks” that allow direct access to chapters and sections.

(4)

Copyright © 2008 by Victor Shoup <[email protected]>

Theelectronicversion of this work is distributed under the terms and conditions of a Creative Commons license (Attribution-NonCommercial-NoDerivs 3.0):

You are free to copy, distribute, and display the electronic version of this work under the following conditions:

Attribution. You must give the original author credit.

Noncommercial. You may not use the electronic version of this work for commercial purposes.

No Derivative Works. You may not alter, transform, or build upon the electronic version of this work.

For any reuse or distribution, you must make these license terms clear to others.

Any of these conditions can be waived if you get permission from the author.

For more information about the license, visit

creativecommons.org/licenses/by-nd-nc/3.0.

All other rights reserved. In particular, the right to publish or distribute this work inprint formbelongs exclusively toCambridge University Press.

(5)

Contents

Preface pagex

Preliminaries xiv

1 Basic properties of the integers 1

1.1 Divisibility and primality 1

1.2 Ideals and greatest common divisors 5

1.3 Some consequences of unique factorization 10

2 Congruences 15

2.1 Equivalence relations 15

2.2 Definitions and basic properties of congruences 16

2.3 Solving linear congruences 19

2.4 The Chinese remainder theorem 22

2.5 Residue classes 25

2.6 Euler’s phi function 31

2.7 Euler’s theorem and Fermat’s little theorem 32

2.8 Quadratic residues 35

2.9 Summations over divisors 45

3 Computing with large integers 50

3.1 Asymptotic notation 50

3.2 Machine models and complexity theory 53

3.3 Basic integer arithmetic 55

3.4 Computing inZn 64

3.5 Faster integer arithmetic (∗) 69

3.6 Notes 71

4 Euclid’s algorithm 74

4.1 The basic Euclidean algorithm 74

4.2 The extended Euclidean algorithm 77

4.3 Computing modular inverses and Chinese remaindering 82 v

(6)

4.4 Speeding up algorithms via modular computation 84 4.5 An effective version of Fermat’s two squares theorem 86

4.6 Rational reconstruction and applications 89

4.7 The RSA cryptosystem 99

4.8 Notes 102

5 The distribution of primes 104

5.1 Chebyshev’s theorem on the density of primes 104

5.2 Bertrand’s postulate 108

5.3 Mertens’ theorem 110

5.4 The sieve of Eratosthenes 115

5.5 The prime number theorem . . . and beyond 116

5.6 Notes 124

6 Abelian groups 126

6.1 Definitions, basic properties, and examples 126

6.2 Subgroups 132

6.3 Cosets and quotient groups 137

6.4 Group homomorphisms and isomorphisms 142

6.5 Cyclic groups 153

6.6 The structure of finite abelian groups (∗) 163

7 Rings 166

7.1 Definitions, basic properties, and examples 166

7.2 Polynomial rings 176

7.3 Ideals and quotient rings 185

7.4 Ring homomorphisms and isomorphisms 192

7.5 The structure ofZn 203

8 Finite and discrete probability distributions 207

8.1 Basic definitions 207

8.2 Conditional probability and independence 213

8.3 Random variables 221

8.4 Expectation and variance 233

8.5 Some useful bounds 241

8.6 Balls and bins 245

8.7 Hash functions 252

8.8 Statistical distance 260

8.9 Measures of randomness and the leftover hash lemma (∗) 266

8.10 Discrete probability distributions 270

8.11 Notes 275

(7)

Contents vii

9 Probabilistic algorithms 277

9.1 Basic definitions 278

9.2 Generating a random number from a given interval 285

9.3 The generate and test paradigm 287

9.4 Generating a random prime 292

9.5 Generating a random non-increasing sequence 295

9.6 Generating a random factored number 298

9.7 Some complexity theory 302

9.8 Notes 304

10 Probabilistic primality testing 306

10.1 Trial division 306

10.2 The Miller–Rabin test 307

10.3 Generating random primes using the Miller–Rabin test 311 10.4 Factoring and computing Euler’s phi function 320

10.5 Notes 324

11 Finding generators and discrete logarithms inZp 327

11.1 Finding a generator forZp 327

11.2 Computing discrete logarithms inZp 329

11.3 The Diffie–Hellman key establishment protocol 334

11.4 Notes 340

12 Quadratic reciprocity and computing modular square roots 342

12.1 The Legendre symbol 342

12.2 The Jacobi symbol 346

12.3 Computing the Jacobi symbol 348

12.4 Testing quadratic residuosity 349

12.5 Computing modular square roots 350

12.6 The quadratic residuosity assumption 355

12.7 Notes 357

13 Modules and vector spaces 358

13.1 Definitions, basic properties, and examples 358

13.2 Submodules and quotient modules 360

13.3 Module homomorphisms and isomorphisms 363

13.4 Linear independence and bases 367

13.5 Vector spaces and dimension 370

14 Matrices 377

14.1 Basic definitions and properties 377

14.2 Matrices and linear maps 381

14.3 The inverse of a matrix 386

(8)

14.4 Gaussian elimination 388

14.5 Applications of Gaussian elimination 392

14.6 Notes 398

15 Subexponential-time discrete logarithms and factoring 399

15.1 Smooth numbers 399

15.2 An algorithm for discrete logarithms 400

15.3 An algorithm for factoring integers 407

15.4 Practical improvements 414

15.5 Notes 418

16 More rings 421

16.1 Algebras 421

16.2 The field of fractions of an integral domain 427

16.3 Unique factorization of polynomials 430

16.4 Polynomial congruences 435

16.5 Minimal polynomials 438

16.6 General properties of extension fields 440

16.7 Formal derivatives 444

16.8 Formal power series and Laurent series 446

16.9 Unique factorization domains (∗) 451

16.10 Notes 464

17 Polynomial arithmetic and applications 465

17.1 Basic arithmetic 465

17.2 Computing minimal polynomials inF[X]/(f)(I) 468

17.3 Euclid’s algorithm 469

17.4 Computing modular inverses and Chinese remaindering 472 17.5 Rational function reconstruction and applications 474

17.6 Faster polynomial arithmetic (∗) 478

17.7 Notes 484

18 Linearly generated sequences and applications 486

18.1 Basic definitions and properties 486

18.2 Computing minimal polynomials: a special case 490 18.3 Computing minimal polynomials: a more general case 492

18.4 Solving sparse linear systems 497

18.5 Computing minimal polynomials inF[X]/(f)(II) 500 18.6 The algebra of linear transformations (∗) 501

18.7 Notes 508

19 Finite fields 509

19.1 Preliminaries 509

(9)

Contents ix

19.2 The existence of finite fields 511

19.3 The subfield structure and uniqueness of finite fields 515

19.4 Conjugates, norms and traces 516

20 Algorithms for finite fields 522

20.1 Tests for and constructing irreducible polynomials 522 20.2 Computing minimal polynomials inF[X]/(f)(III) 525 20.3 Factoring polynomials: square-free decomposition 526 20.4 Factoring polynomials: the Cantor–Zassenhaus algorithm 530 20.5 Factoring polynomials: Berlekamp’s algorithm 538 20.6 Deterministic factorization algorithms (∗) 544

20.7 Notes 546

21 Deterministic primality testing 548

21.1 The basic idea 548

21.2 The algorithm and its analysis 549

21.3 Notes 558

Appendix: Some useful facts 561

Bibliography 566

Index of notation 572

Index 574

(10)

Preface

Number theory and algebra play an increasingly significant role in computing and communications, as evidenced by the striking applications of these subjects to such fields as cryptography and coding theory. My goal in writing this book was to provide an introduction to number theory and algebra, with an emphasis on algorithms and applications, that would be accessible to a broad audience. In particular, I wanted to write a book that would be appropriate for typical students in computer science or mathematics who have some amount of general mathematical experience, but without presuming too much specific mathematicalknowledge.

Prerequisites. The mathematical prerequisites are minimal: no particular math- ematical concepts beyond what is taught in a typical undergraduate calculus sequence are assumed.

The computer science prerequisites are also quite minimal: it is assumed that the reader is proficient in programming, and has had some exposure to the analysis of algorithms, essentially at the level of an undergraduate course on algorithms and data structures.

Even though it is mathematically quite self contained, the text does presup- pose that the reader is comfortable with mathematical formalism and also has some experience in reading and writing mathematical proofs. Readers may have gained such experience in computer science courses such as algorithms, automata or complexity theory, or some type of “discrete mathematics for computer science students” course. They also may have gained such experience in undergraduate mathematics courses, such as abstract or linear algebra. The material in these math- ematics courses may overlap with some of the material presented here; however, even if the reader already has had some exposure to this material, it nevertheless may be convenient to have all of the relevant topics easily accessible in one place;

moreover, the emphasis and perspective here will no doubt be different from that in a traditional mathematical presentation of these subjects.

x

(11)

Preface xi Structure of the text. All of the mathematics required beyond basic calculus is developed “from scratch.” Moreover, the book generally alternates between

“theory” and “applications”: one or two chapters on a particular set of purely mathematical concepts are followed by one or two chapters on algorithms and applications; the mathematics provides the theoretical underpinnings for the appli- cations, while the applications both motivate and illustrate the mathematics. Of course, this dichotomy between theory and applications is not perfectly main- tained: the chapters that focus mainly on applications include the development of some of the mathematics that is specific to a particular application, and very occasionally, some of the chapters that focus mainly on mathematics include a discussion of related algorithmic ideas as well.

In developing the mathematics needed to discuss certain applications, I have tried to strike a reasonable balance between, on the one hand, presenting the abso- lute minimum required to understand and rigorously analyze the applications, and on the other hand, presenting a full-blown development of the relevant mathemat- ics. In striking this balance, I wanted to be fairly economical and concise, while at the same time, I wanted to develop enough of the theory so as to present a fairly well-rounded account, giving the reader more of a feeling for the mathematical

“big picture.”

The mathematical material covered includes the basics of number theory (including unique factorization, congruences, the distribution of primes, and quadratic reciprocity) and of abstract algebra (including groups, rings, fields, and vector spaces). It also includes an introduction to discrete probability theory — this material is needed to properly treat the topics of probabilistic algorithms and cryp- tographic applications. The treatment of all these topics is more or less standard, except that the text only deals with commutative structures (i.e., abelian groups and commutative rings with unity) — this is all that is really needed for the purposes of this text, and the theory of these structures is much simpler and more transparent than that of more general, non-commutative structures.

The choice of topics covered in this book was motivated primarily by their applicability to computing and communications, especially to the specific areas of cryptography and coding theory. Thus, the book may be useful for reference or self-study by readers who want to learn about cryptography, or it could also be used as a textbook in a graduate or upper-division undergraduate course on (com- putational) number theory and algebra, perhaps geared towards computer science students.

Since this is an introduction, and not an encyclopedic reference for specialists, some topics simply could not be covered. One such, whose exclusion will undoubt- edly be lamented by some, is the theory of lattices, along with algorithms for and applications of lattice basis reduction. Another omission is fast algorithms for

(12)

integer and polynomial arithmetic — although some of the basic ideas of this topic are developed in the exercises, the main body of the text deals only with classical, quadratic-time algorithms for integer and polynomial arithmetic. However, there are more advanced texts that cover these topics perfectly well, and they should be readily accessible to students who have mastered the material in this book.

Note that while continued fractions are not discussed, the closely related prob- lem of “rational reconstruction” is covered, along with a number of interesting applications (which could also be solved using continued fractions).

Guidelines for using the text.

• There are a few sections that are marked with a “(∗),” indicating that the material covered in that section is a bit technical, and is not needed else- where.

• There are many examples in the text, which form an integral part of the book, and should not be skipped.

• There are a number of exercises in the text that serve to reinforce, as well as to develop important applications and generalizations of, the material presented in the text.

• Some exercises are underlined. These develop important (but usually sim- ple) facts, and should be viewed as an integral part of the book. It is highly recommended that the reader work these exercises, or at the very least, read and understand their statements.

• In solving exercises, the reader is free to use anypreviouslystated results in the text, including those in previous exercises. However, except where otherwise noted, any result in a section marked with a “(∗),” or in §5.5, need not and should not be used outside the section in which it appears.

• There is a very brief “Preliminaries” chapter, which fixes a bit of notation and recalls a few standard facts. This should be skimmed over by the reader.

• There is an appendix that contains a few useful facts; where such a fact is used in the text, there is a reference such as “see §An,” which refers to the item labeled “An” in the appendix.

The second edition. In preparing this second edition, in addition to correcting errors in the first edition, I have also made a number of other modifications (hope- fully without introducing too manynewerrors). Many passages have been rewrit- ten to improve the clarity of exposition, and many new exercises and examples have been added. Especially in the earlier chapters, the presentation is a bit more leisurely. Some material has been reorganized. Most notably, the chapter on prob- ability now follows the chapters on groups and rings — this allows a number of examples and concepts in the probability chapter that depend on algebra to be

(13)

Preface xiii more fully developed. Also, a number of topics have been moved forward in the text, so as to enliven the material with exciting applications as soon as possible;

for example, the RSA cryptosystem is now described right after Euclid’s algorithm is presented, and some basic results concerning quadratic residues are introduced right away, in the chapter on congruences. Finally, there are numerous changes in notation and terminology; for example, the notion of a family of objects is now used consistently throughout the book (e.g., a pairwise independent family of random variables, a linearly independent family of vectors, a pairwise relatively prime family of integers, etc.).

Feedback.I welcome comments on the book (suggestions for improvement, error reports, etc.) from readers. Please send your comments to

[email protected].

There is also a web site where further material and information relating to the book (including a list of errata and the latest electronic version of the book) may be found:

www.shoup.net/ntb.

Acknowledgments. I would like to thank a number of people who volunteered their time and energy in reviewing parts of the book at various stages: Joël Alwen, Siddhartha Annapureddy, John Black, Carl Bosley, Joshua Brody, Jan Camenisch, David Cash, Sherman Chow, Ronald Cramer, Marisa Debowsky, Alex Dent, Nelly Fazio, Rosario Gennaro, Mark Giesbrecht, Stuart Haber, Kristiyan Haralambiev, Gene Itkis, Charanjit Jutla, Jonathan Katz, Eike Kiltz, Alfred Menezes, Ilya Mironov, Phong Nguyen, Antonio Nicolosi, Roberto Oliveira, Leonid Reyzin, Louis Salvail, Berry Schoenmakers, Hovav Shacham, Yair Sovran, Panos Toulis, and Daniel Wichs. A very special thanks goes to George Stephanides, who trans- lated the first edition of the book into Greek and reviewed the entire book in prepa- ration for the second edition. I am also grateful to the National Science Foundation for their support provided under grants CCR-0310297 and CNS-0716690. Finally, thanks to David Tranah for all his help and advice, and to David and his colleagues at Cambridge University Press for their progressive attitudes regarding intellectual property and open access.

New York, June 2008 Victor Shoup

(14)

Preliminaries

We establish here some terminology, notation, and simple facts that will be used throughout the text.

Logarithms and exponentials

We write logxfor the natural logarithm ofx, and logbxfor the logarithm ofxto the baseb.

We writeexfor the usual exponential function, wheree≈2.71828 is the base of the natural logarithm. We may also write exp[x] instead ofex.

Sets and families

We use standard set-theoretic notation:∅denotes the empty set;xAmeans that x is an element, or member, of the setA; for two setsA,B, AB means that Ais a subset of B (withApossibly equal toB), and A ( B means thatAis a proper subset ofB (i.e.,AB butA 6=B). Further,ABdenotes the union of AandB,AB the intersection ofAandB, andA\B the set of all elements of Athat are not inB. IfAis a set with a finite number of elements, then we write

|A| for itssize, orcardinality. We use standard notation for describing sets; for example, if we define the setS:={−2,−1, 0, 1, 2}, then{x2:xS}={0, 1, 4}

and{xS:xis even}={−2, 0, 2}.

We writeS1× · · · ×Snfor theCartesian productof setsS1, . . . ,Sn, which is the set of alln-tuples (a1, . . . ,an), whereaiSifori=1, . . . ,n. We writeS×nfor the Cartesian product ofncopies of a setS, and forxS, we writex×n for the element ofS×nconsisting of ncopies ofx. (This notation is a bit non-standard, but we reserve the more standard notation Sn for other purposes, so as to avoid ambiguity.)

xiv

(15)

Preliminaries xv Afamilyis a collection of objects, indexed by some setI, called anindex set.

If for eachiI we have an associated objectxi, the family of all such objects is denoted by {xi}iI. Unlike a set, a family may contain duplicates; that is, we may havexi = xjfor some pair of indicesi,jwithi6= j. Note that while{xi}iI

denotes a family,{xi : iI}denotes the setwhose members are the (distinct) xi’s. If the index setIhas some natural order, then we may view the family{xi}iI

as being ordered in the same way; as a special case, a family indexed by a set of integers of the form{m, . . . ,n}or{m,m+1, . . .}is asequence, which we may write as{xi}ni=mor{xi}i=m. On occasion, if the choice of index set is not important, we may simply define a family by listing or describing its members, without explicitly describing an index set; for example, the phrase “the family of objectsa,b,c” may be interpreted as “the family{xi}3i=1, wherex1:=a,x2:=b, andx3:=c.”

Unions and intersections may be generalized to arbitrary families of sets. For a family{Si}iIof sets, the union is

[

iI

Si:={x:xSifor someiI}, and forI 6=∅, the intersection is

\

iI

Si:={x:xSifor alliI}.

Note that ifI = ∅, the union is by definition∅, but the intersection is, in general, not well defined. However, in certain applications, one might define it by a spe- cial convention; for example, if all sets under consideration are subsets of some

“ambient space,”, then the empty intersection is usually taken to be.

Two setsAandB are calleddisjointifAB = ∅. A family{Si}iI of sets is calledpairwise disjointifSiSj =∅for alli,jIwithi6=j. A pairwise disjoint family of non-empty sets whose union isSis called apartitionofS; equivalently, {Si}iI is a partition of a set S if eachSi is a non-empty subset ofS, and each element ofSbelongs to exactly oneSi.

Numbers

We use standard notation for various sets of numbers:

Z:=the set of integers={. . . ,−2,−1, 0, 1, 2, . . .}, Q:=the set of rational numbers={a/b:a,b∈Z,b6=0}, R:=the set of real numbers,

C:=the set of complex numbers.

(16)

We sometimes use the symbols ∞ and −∞ in simple arithmetic expressions involving real numbers. The interpretation given to such expressions should be obvious: for example, for every x ∈ R, we have −∞ < x < ∞, x+∞ = ∞, x− ∞ = −∞, ∞+∞ = ∞, and (−∞) +(−∞) = −∞. Expressions such as x·(±∞) also make sense, providedx6=0. However, the expressions∞ − ∞and 0· ∞have no sensible interpretation.

We use standard notation for specifying intervals of real numbers: fora,b∈R withab,

[a,b] :={x∈R:axb}, (a,b) :={x∈R:a < x < b}, [a,b) :={x∈R:ax < b}, (a,b] :={x∈R:a < xb}.

As usual, this notation is extended to allowa = −∞ for the intervals (a,b] and (a,b), andb=∞for the intervals [a,b) and (a,b).

Functions

We writef : AB to indicate that f is a function (also called a map) from a setA to a setB. IfA0A, then f(A0) := {f(a) : aA0} is the imageof A0 under f, andf(A) is simply referred to as the imageof f; if B0B, then f−1(B0) :={aA:f(a) ∈B0}is thepre-imageofB0underf.

A functionf :ABis calledone-to-oneorinjectiveiff(a) =f(b) implies a = b. The functionf is calledontoorsurjectiveiff(A) = B. The functionf is called bijectiveif it is both injective and surjective; in this case, f is called a bijection, or aone-to-one correspondence. Iff is bijective, then we may define the inverse function f−1 : BA, where for bB, f−1(b) is defined to be the unique aAsuch that f(a) = b; in this case, f−1 is also a bijection, and (f−1)−1=f.

IfA0A, then theinclusion mapfromA0toAis the functioni:A0Agiven by i(a) := afor aA0; whenA0 = A, this is called theidentity mapon A. If A0A,f0 : A0B,f : AB, andf0(a) = f(a) for allaA0, then we say thatf0is therestrictionofftoA0, and thatf is anextensionoff0toA.

Iff :AB andg :BC are functions, theircompositionis the function gf : AC given by (gf)(a) := g(f(a)) for aA. Iff : AB is a bijection, thenf−1fis the identity map onA, andff−1is the identity map on B. Conversely, iff :ABandg :BAare functions such thatgf is the identity map onAandfgis the identity map onB, thenf andgare bijections, each being the inverse of the other. Iff :AB andg :BC are bijections, then so isgf, and (gf)−1=f−1g−1.

Function composition is associative; that is, for all functions f : AB, g : BC, and h : CD, we have (hg) ◦f = h ◦(gf). Thus, we

(17)

Preliminaries xvii can simply write hgf without any ambiguity. More generally, if we have functionsfi : AiAi+1fori = 1, . . . ,n, wheren ≥ 2, then we may write their composition asfn◦ · · · ◦f1without any ambiguity. If eachfiis a bijection, then so isfn◦ · · · ◦f1, its inverse beingf1−1◦ · · · ◦fn−1. As a special case of this, ifAi =A andfi=f fori=1, . . . ,n, then we may writefn◦ · · · ◦f1asfn. It is understood thatf1 =f, and thatf0is the identity map onA. Iff is a bijection, then so isfn for every non-negative integer n, the inverse function offn being (f−1)n, which one may simply write asfn.

Iff : IS is a function, then we may viewf as the family {xi}iI, where xi :=f(i). Conversely, a family{xi}iI, where all of thexi’s belong to some set S, may be viewed as the functionf :ISgiven byf(i) :=xiforiI. Really, functions and families are the same thing, the difference being just one of notation and emphasis.

Binary operations

Abinary operation?on a setSis a function fromS×S toS, where the value of the function at (a,b) ∈S×Sis denoteda ? b.

A binary operation ?onS is called associative if for alla,b,cS, we have (a ? b) ? c = a ?(b ? c). In this case, we can simply write a ? b ? c without any ambiguity. More generally, for a1, . . . ,anS, where n ≥ 2, we can write a1?· · ·? anwithout any ambiguity.

A binary operation?on S is calledcommutativeif for alla,bS, we have a?b=b?a. If the binary operation?is both associative and commutative, then not only is the expressiona1?· · ·? anunambiguous, but its value remains unchanged even if we re-order theai’s.

If?is a binary operation onS, andS0S, thenS0is calledclosed under?if a ? bS0for alla,bS0.

(18)
(19)

1

Basic properties of the integers

This chapter discusses some of the basic properties of the integers, including the notions of divisibility and primality, unique factorization into primes, greatest com- mon divisors, and least common multiples.

1.1 Divisibility and primality A central concept in number theory isdivisibility.

Consider the integersZ= {. . . ,−2,−1, 0, 1, 2, . . .}. Fora,b∈Z, we say thata dividesbifaz=bfor somez∈Z. Ifadividesb, we writea|b, and we may say thatais adivisorofb, or thatbis amultipleofa, or thatbisdivisible bya. Ifa does not divideb, then we writea-b.

We first state some simple facts about divisibility:

Theorem 1.1. For all a,b,c∈Z, we have (i) a|a,1|a, and a|0;

(ii) 0|aif and only if a=0;

(iii) a|bif and only if −a|bif and only if a| −b;

(iv) a|banda|cimpliesa|(b+c);

(v) a|bandb|cimplies a|c.

Proof. These properties can be easily derived from the definition of divisibility, using elementary algebraic properties of the integers. For example,a | abecause we can writea·1=a; 1|abecause we can write 1·a=a;a|0 because we can writea·0=0. We leave it as an easy exercise for the reader to verify the remaining properties. 2

We make a simple observation: ifa | bandb 6= 0, then 1 ≤ |a| ≤ |b|. Indeed, ifaz = b 6= 0 for some integerz, thena 6= 0 andz 6= 0; it follows that|a| ≥ 1,

|z| ≥1, and so|a| ≤ |a||z|=|b|.

1

(20)

Theorem 1.2. For all a,b∈Z, we havea| band b|aif and only if ab. In particular, for everya∈Z, we havea|1if and only if a=±1.

Proof. Clearly, ifa = ±b, thena | bandb | a. So let us assume that a | band b|a, and prove thatab. If either ofaorbare zero, then the other must be zero as well. So assume that neither is zero. By the above observation,a | bimplies

|a| ≤ |b|, andb|aimplies|b| ≤ |a|; thus,|a|=|b|, and soab. That proves the first statement. The second statement follows from the first by settingb:=1, and noting that 1|a. 2

The product of any two non-zero integers is again non-zero. This implies the usualcancellation law: ifa,b, andcare integers such thata6=0 andab=ac, then we must haveb= c; indeed,ab =acimpliesa(bc) = 0, and soa 6= 0 implies bc=0, and henceb=c.

Primes and composites. Letnbe a positive integer. Trivially, 1 and ndividen.

Ifn > 1 and no other positive integers besides 1 andndividen, then we saynis prime. Ifn >1 butnis not prime, then we say thatniscomposite. The number 1 is not considered to be either prime or composite. Evidently,nis composite if and only ifn= abfor some integersa,bwith 1< a < nand 1< b < n. The first few primes are

2, 3, 5, 7, 11, 13, 17, . . . .

While it is possible to extend the definition of prime and composite to negative integers, we shall not do so in this text:whenever we speak of a prime or composite number, we mean a positive integer.

A basic fact is that every non-zero integer can be expressed as a signed product of primes in an essentially unique way. More precisely:

Theorem 1.3 (Fundamental theorem of arithmetic). Every non-zero integer n can be expressed as

npe11· · ·perr,

wherep1, . . . ,prare distinct primes and e1, . . . ,erare positive integers. Moreover, this expression is unique, up to a reordering of the primes.

Note that ifn = ±1 in the above theorem, thenr = 0, and the product of zero terms is interpreted (as usual) as 1.

The theorem intuitively says that the primes act as the “building blocks” out of which all non-zero integers can be formed by multiplication (and negation).

The reader may be so familiar with this fact that he may feel it is somehow “self evident,” requiring no proof; however, this feeling is simply a delusion, and most

(21)

1.1 Divisibility and primality 3 of the rest of this section and the next are devoted to developing a proof of this theorem. We shall give a quite leisurely proof, introducing a number of other very important tools and concepts along the way that will be useful later.

To prove Theorem 1.3, we may clearly assume thatnis positive, since otherwise, we may multiplynby−1 and reduce to the case wherenis positive.

The proof of the existence part of Theorem 1.3 is easy. This amounts to showing that every positive integer n can be expressed as a product (possibly empty) of primes. We may prove this by induction onn. Ifn = 1, the statement is true, as n is the product of zero primes. Now letn > 1, and assume that every positive integer smaller thann can be expressed as a product of primes. If nis a prime, then the statement is true, asnis the product of one prime. Assume, then, thatn is composite, so that there exista,b ∈Zwith 1< a < n, 1< b < n, andn= ab.

By the induction hypothesis, bothaandbcan be expressed as a product of primes, and so the same holds forn.

The uniqueness part of Theorem 1.3 is the hard part. An essential ingredient in this proof is the following:

Theorem 1.4 (Division with remainder property). Let a,b ∈ Z with b > 0.

Then there exist uniqueq,r∈Zsuch thata=bq+rand 0≤r < b.

Proof. Consider the setSof non-negative integers of the formabtwitht ∈Z. This set is clearly non-empty; indeed, ifa≥0, sett:= 0, and ifa <0, sett:= a.

Since every non-empty set of non-negative integers contains a minimum, we define rto be the smallest element ofS. By definition,ris of the formr = abq for someq∈Z, andr≥0. Also, we must haver < b, since otherwise,rbwould be an element ofSsmaller thanr, contradicting the minimality ofr; indeed, ifrb, then we would have 0≤rb=ab(q+1).

That proves the existence ofrandq. For uniqueness, suppose thata = bq+r anda = bq0+r0, where 0 ≤ r < band 0 ≤ r0 < b. Then subtracting these two equations and rearranging terms, we obtain

r0r=b(qq0).

Thus, r0r is a multiple of b; however, 0 ≤ r < b and 0 ≤ r0 < b implies

|r0r|< b; therefore, the only possibility isr0r =0. Moreover, 0 =b(qq0) andb6=0 impliesqq0=0. 2

Theorem 1.4 can be visualized as follows:

0 r b 2b 3b a 4b

(22)

Starting witha, we subtract (or add, ifais negative) the valuebuntil we end up with a number in the interval [0,b).

Floors and ceilings. Let us briefly recall the usual floorand ceiling functions, denotedb·candd·e, respectively. These are functions fromR(the real numbers) toZ. Forx∈R,bxcis the greatest integermx; equivalently,bxcis the unique integermsuch that mx < m+1, or put another way, such thatx = m+εfor someε ∈[0, 1). Also,dxeis the smallest integermx; equivalently,dxeis the unique integermsuch thatm−1< xm, or put another way, such thatx=mε for someε∈[0, 1).

The mod operator.Now leta,b∈Zwithb >0. Ifqandrare the unique integers from Theorem 1.4 that satisfya=bq+rand 0≤r < b, we define

amodb:=r;

that is,amodbdenotes the remainder in dividingabyb. It is clear thatb | aif and only ifamodb= 0. Dividing both sides of the equationa= bq+rbyb, we obtaina/b=q+r/b. Sinceq ∈Zandr/b∈[0, 1), we see thatq=ba/bc. Thus,

(amodb)=abba/bc.

One can use this equation to extend the definition ofamodbto all integersaand b, withb6=0; that is, forb <0, we simply defineamodbto beabba/bc.

Theorem 1.4 may be generalized so that when dividing an integeraby a positive integer b, the remainder is placed in an interval other than [0,b). Let x be any real number, and consider the interval [x,x+b). As the reader may easily verify, this interval contains preciselybintegers, namely,dxe, . . . ,dxe+b−1. Applying Theorem 1.4 witha− dxein place ofa, we obtain:

Theorem 1.5. Let a,b ∈ Zwith b > 0, and let x ∈ R. Then there exist unique q,r∈Zsuch thata=bq+rand r∈[x,x+b).

EXERCISE 1.1. Leta,b,d∈Zwithd6=0. Show thata|bif and only ifda|db.

EXERCISE 1.2. Letn be a composite integer. Show that there exists a prime p dividingn, withpn1/2.

EXERCISE 1.3. Letmbe a positive integer. Show that for every real numberx≥1, the number of multiples ofmin the interval [1,x] isbx/mc; in particular, for every integern≥1, the number of multiples ofmamong 1, . . . ,nisbn/mc.

EXERCISE 1.4. Letx∈R. Show that 2bxc ≤ b2xc ≤2bxc+1.

(23)

1.2 Ideals and greatest common divisors 5 EXERCISE 1.5. Letx∈Randn∈Zwithn >0. Show thatbbxc/nc=bx/nc; in particular,bba/bc/cc=ba/bccfor all positive integersa,b,c.

EXERCISE 1.6. Leta,b∈Zwithb <0. Show that (amodb) ∈(b, 0].

EXERCISE1.7. Show that Theorem 1.5 also holds for the interval (x,x+b]. Does it hold in general for the intervals [x,x+b] or (x,x+b)?

1.2 Ideals and greatest common divisors

To carry on with the proof of Theorem 1.3, we introduce the notion of anideal of Z, which is a non-empty set of integers that is closed under addition, and closed under multiplication by an arbitrary integer. That is, a non-empty setI ⊆Zis an ideal if and only if for alla,bIand allz∈Z, we have

a+bI and azI.

Besides its utility in proving Theorem 1.3, the notion of an ideal is quite useful in a number of contexts, which will be explored later.

It is easy to see that every idealI contains 0: sinceaI for some integer a, we have 0 = a·0 ∈I. Also, note that if an idealI contains an integera, it also contains−a, since−a = a·(−1) ∈I. Thus, if an ideal containsaandb, it also containsab. It is clear that{0}andZare ideals. Moreover, an idealI is equal toZif and only if 1∈I; to see this, note that 1 ∈Iimplies that for everyz∈Z, we havez= 1·zI, and henceI = Z; conversely, ifI = Z, then in particular, 1∈I.

Fora∈Z, defineaZ:={az:z∈Z}; that is,aZis the set of all multiples ofa.

Ifa=0, then clearlyaZ={0}; otherwise,aZconsists of the distinct integers . . . ,−3a,−2a,−a, 0,a, 2a, 3a, . . . .

It is easy to see that aZ is an ideal: for allaz,az0aZ andz00 ∈ Z, we have az+az0 = a(z+z0) ∈ aZ and (az)z00 = a(zz00) ∈ aZ. The idealaZis called theideal generated bya, and an ideal of the formaZfor somea ∈Zis called a principal ideal.

Observe that for all a,b ∈ Z, we have baZ if and only if a | b. Also observe that for every ideal I, we havebI if and only ifbZ ⊆ I. Both of these observations are simple consequences of the definitions, as the reader may verify. Combining these two observations, we see thatbZ⊆aZif and only ifa|b.

SupposeI1andI2are ideals. Then it is not hard to see that the set I1+I2:={a1+a2 :a1I1,a2I2}

(24)

is also an ideal. Indeed, supposea1+a2I1+I2andb1+b2I1+I2. Then we have (a1+a2)+(b1+b2)=(a1+b1)+(a2+b2)∈I1+I2, and for everyz∈Z, we have (a1+a2)z=a1z+a2zI1+I2.

Example 1.1. Consider the principal ideal 3Z. This consists of all multiples of 3;

that is, 3Z={. . . ,−9,−6,−3, 0, 3, 6, 9, . . .}. 2

Example 1.2. Consider the ideal 3Z+5Z. This ideal contains 3·2+5·(−1)=1.

Since it contains 1, it contains all integers; that is, 3Z+5Z=Z. 2

Example 1.3. Consider the ideal 4Z+6Z. This ideal contains 4·(−1)+6·1=2, and therefore, it contains all even integers. It does not contain any odd integers, since the sum of two even integers is again even. Thus, 4Z+6Z=2Z. 2

In the previous two examples, we defined an ideal that turned out upon closer inspection to be a principal ideal. This was no accident: the following theorem says that all ideals ofZare principal.

Theorem 1.6. Let I be an ideal of Z. Then there exists a unique non-negative integer dsuch that I=dZ.

Proof. We first prove the existence part of the theorem. IfI = {0}, thend = 0 does the job, so let us assume thatI 6= {0}. SinceIcontains non-zero integers, it must contain positive integers, since ifaI then so is−a. Letdbe the smallest positive integer inI. We want to show thatI=dZ.

We first show that IdZ. To this end, leta be any element inI. It suffices to show thatd | a. Using the division with remainder property, writea = dq+r, where 0≤r < d. Then by the closure properties of ideals, one sees thatr=adq is also an element of I, and by the minimality of the choice ofd, we must have r=0. Thus,d|a.

We have shown thatIdZ. The fact thatdZ ⊆ I follows from the fact that dI. Thus,I=dZ.

That proves the existence part of the theorem. For uniqueness, note that if dZ = eZfor some non-negative integer e, thend | e ande | d, from which it follows by Theorem 1.2 thatde; sincedandeare non-negative, we must have d=e. 2

Greatest common divisors. For a,b∈Z, we calld∈ Zacommon divisorofa andbifd|aandd|b; moreover, we call such adagreatest common divisorof aandbifdis non-negative and all other common divisors ofaandbdivided.

Theorem 1.7. For all a,b∈Z, there exists a unique greatest common divisor dof aand b, and moreover,aZ+bZ=dZ.

(25)

1.2 Ideals and greatest common divisors 7 Proof. We apply the previous theorem to the idealI :=aZ+bZ. Letd∈Zwith I =dZ, as in that theorem. We wish to show thatdis a greatest common divisor ofaandb. Note thata,b,dIanddis non-negative.

Since aI = dZ, we see that d | a; similarly,d | b. So we see that dis a common divisor ofaandb.

SincedI =aZ+bZ, there exists,t∈Zsuch thatas+bt=d. Now suppose a=a0d0andb=b0d0for somea0,b0,d0∈Z. Then the equationas+bt=dimplies thatd0(a0s+b0t)=d, which says thatd0 |d. Thus, any common divisord0ofaand bdividesd.

That proves thatdis a greatest common divisor ofaandb. For uniqueness, note that ife is a greatest common divisor ofa andb, thend | eande | d, and hence de; since bothdandeare non-negative by definition, we haved=e. 2

Fora,b∈Z, we write gcd(a,b) for the greatest common divisor ofaandb. We say thata,b∈Zarerelatively primeif gcd(a,b) =1, which is the same as saying that the only common divisors ofaandbare±1.

The following is essentially just a restatement of Theorem 1.7, but we state it here for emphasis:

Theorem 1.8. Leta,b,r∈Zand letd:=gcd(a,b). Then there exist s,t∈Zsuch that as+bt= rif and only if d| r. In particular,aand bare relatively prime if and only if there exist integerssandtsuch thatas+bt=1.

Proof. We have

as+bt=r for somes,t∈Z

⇐⇒ raZ+bZ

⇐⇒ rdZ (by Theorem 1.7)

⇐⇒ d|r.

That proves the first statement. The second statement follows from the first, setting r:=1. 2

Note that as we have defined it, gcd(0, 0) = 0. Also note that when at least one ofaorbare non-zero, gcd(a,b) may be characterized as thelargestpositive integer that divides bothaandb, and as thesmallestpositive integer that can be expressed asas+btfor integerssandt.

Theorem 1.9. Let a,b,c∈Zsuch that c|aband gcd(a,c)=1. Thenc|b.

Proof. Suppose that c | ab and gcd(a,c) = 1. Then since gcd(a,c) = 1, by Theorem 1.8 we haveas+ct= 1 for somes,t∈Z. Multiplying this equation by

(26)

b, we obtain

abs+cbt=b. (1.1)

Sincecdividesabby hypothesis, and sincecclearly dividescbt, it follows thatc divides the left-hand side of (1.1), and hence thatcdividesb. 2

Suppose thatpis a prime andais any integer. As the only divisors ofpare±1 and±p, we have

p|a =⇒ gcd(a,p)=p, and p-a =⇒ gcd(a,p)=1.

Combining this observation with the previous theorem, we have:

Theorem 1.10. Let pbe prime, and let a,b∈Z. Thenp|abimplies that p|aor p|b.

Proof. Assume thatp|ab. Ifp|a, we are done, so assume thatp-a. By the above observation, gcd(a,p)=1, and so by Theorem 1.9, we havep|b. 2

An obvious corollary to Theorem 1.10 is that ifa1, . . . ,ak are integers, and ifp is a prime that divides the producta1· · ·ak, thenp|aifor somei=1, . . . ,k. This is easily proved by induction onk. Fork =1, the statement is trivially true. Now letk >1, and assume that statement holds fork−1. Then by Theorem 1.10, either p|a1orp|a2· · ·ak; ifp|a1, we are done; otherwise, by induction,pdivides one ofa2, . . . ,ak.

Finishing the proof of Theorem 1.3.We are now in a position to prove the unique- ness part of Theorem 1.3, which we can state as follows: ifp1, . . . ,pr are primes (not necessarily distinct), andq1, . . . ,qsare primes (also not necessarily distinct), such that

p1· · ·pr =q1· · ·qs, (1.2) then (p1, . . . ,pr) is just a reordering of (q1, . . . ,qs). We may prove this by induction on r. Ifr = 0, we must haves = 0 and we are done. Now supposer > 0, and that the statement holds for r −1. Since r > 0, we clearly must have s > 0.

Also, asp1 obviously divides the left-hand side of (1.2), it must also divide the right-hand side of (1.2); that is, p1 | q1· · ·qs. It follows from (the corollary to) Theorem 1.10 thatp1 | qjfor somej = 1, . . . ,s, and moreover, sinceqjis prime, we must havep1 = qj. Thus, we may cancel p1 from the left-hand side of (1.2) andqj from the right-hand side of (1.2), and the statement now follows from the induction hypothesis. That proves the uniqueness part of Theorem 1.3.

(27)

1.2 Ideals and greatest common divisors 9 EXERCISE 1.8. LetIbe a non-empty set of integers that is closed under addition (i.e.,a+bIfor alla,bI). Show thatIis an ideal if and only if−aIfor all aI.

EXERCISE 1.9. Show that for all integersa,b,c, we have:

(a) gcd(a,b)=gcd(b,a);

(b) gcd(a,b)=|a| ⇐⇒ a|b;

(c) gcd(a, 0)=gcd(a,a)=|a|and gcd(a, 1)=1;

(d) gcd(ca,cb)=|c|gcd(a,b).

EXERCISE 1.10. Show that for all integersa,bwithd:= gcd(a,b) 6=0, we have gcd(a/d,b/d) =1.

EXERCISE 1.11. Letnbe an integer. Show that ifa,bare relatively prime integers, each of which dividesn, thenabdividesn.

EXERCISE 1.12. Show that two integers are relatively prime if and only if there is no one prime that divides both of them.

EXERCISE 1.13. Leta,b1, . . . ,bk be integers. Show that gcd(a,b1· · ·bk) = 1 if and only if gcd(a,bi) =1 fori=1, . . . ,k.

EXERCISE 1.14. Letpbe a prime andkan integer, with 0< k < p. Show that the binomial coefficient

p k

= p!

k!(pk)!, which is an integer (see §A2), is divisible byp.

EXERCISE 1.15. An integer a is calledsquare-free if it is not divisible by the square of any integer greater than 1. Show that:

(a) a is square-free if and only ifa = ±p1· · ·pr, where thepi’s are distinct primes;

(b) every positive integerncan be expressed uniquely asn=ab2, whereaand bare positive integers, andais square-free.

EXERCISE 1.16. For each positive integerm, letIm denote{0, . . . ,m−1}. Let a,bbe positive integers, and consider the map

τ : Ib×IaIab

(s,t)7→(as+bt) modab.

Showτis a bijection if and only if gcd(a,b)=1.

(28)

EXERCISE 1.17. Let a,b,c be positive integers satisfying gcd(a,b) = 1 and c ≥ (a− 1)(b− 1). Show that there exist non-negative integers s,t such that c=as+bt.

EXERCISE 1.18. For each positive integer n, let Dn denote the set of positive divisors ofn. Letn1,n2be relatively prime, positive integers. Show that the sets Dn1 ×Dn2 and Dn1n2 are in one-to-one correspondence, via the map that sends (d1,d2)∈Dn1 ×Dn2 tod1d2.

1.3 Some consequences of unique factorization

The following theorem is a consequence of just the existence part of Theorem 1.3:

Theorem 1.11. There are infinitely many primes.

Proof. By way of contradiction, suppose that there were only finitely many primes;

call themp1, . . . ,pk. Then setM := Qk

i=1piandN :=M +1. Consider a prime p that divides N. There must be at least one such prime p, since N ≥ 2, and every positive integer can be written as a product of primes. Clearly, p cannot equal any of thepi’s, since if it did, thenpwould divideM, and hence also divide NM =1, which is impossible. Therefore, the primepis not amongp1, . . . ,pk, which contradicts our assumption that these are the only primes. 2

For each primep, we may define the functionνp, mapping non-zero integers to non-negative integers, as follows: for every integern6=0, ifn=pem, wherep-m, thenνp(n) :=e. We may then write the factorization ofninto primes as

n=±Y

p

pνp(n),

where the product is over all primes p; although syntactically this is an infinite product, all but finitely many of its terms are equal to 1, and so this expression makes sense.

Observe that ifaandbare non-zero integers, then

νp(a·b) =νp(a)+νp(b) for all primesp, (1.3) and

a|b ⇐⇒ νp(a)≤νp(b) for all primesp. (1.4) From this, it is clear that

gcd(a,b)=Y

p

pmin(νp(a),νp(b)).

(29)

1.3 Some consequences of unique factorization 11 Least common multiples. For a,b ∈ Z, acommon multiple of a andb is an integer msuch thata | mandb | m; moreover, such anmis the least common multipleofa andbifmis non-negative andmdivides all common multiples of a and b. It is easy to see that the least common multiple exists and is unique, and we denote the least common multiple ofaandbby lcm(a,b). Indeed, for all a,b∈Z, if eitheraorbare zero, the only common multiple ofaandbis 0, and so lcm(a,b)=0; otherwise, if neitheranorbare zero, we have

lcm(a,b) =Y

p

pmax(νp(a),νp(b)),

or equivalently, lcm(a,b) may be characterized as the smallest positive integer divisible by bothaandb.

It is convenient to extend the domain of definition of νp to include 0, defining νp(0) :=∞. If we interpret expressions involving “∞” appropriately (see Prelimi- naries), then for arbitrarya,b∈Z, both (1.3) and (1.4) hold, and in addition,

νp(gcd(a,b))=min(νp(a),νp(b)) and νp(lcm(a,b))=max(νp(a),νp(b)) for all primesp.

Generalizing gcd’s and lcm’s to many integers. It is easy to generalize the notions of greatest common divisor and least common multiple from two integers to many integers. Leta1, . . . ,ak be integers. We call d ∈ Z a common divisor ofa1, . . . ,ak if d | ai fori = 1, . . . ,k; moreover, we call such a dthe greatest common divisor of a1, . . . ,ak if d is non-negative and all other common divi- sors ofa1, . . . ,ak divided. The greatest common divisor ofa1, . . . ,ak is denoted gcd(a1, . . . ,ak) and is the unique non-negative integerdsatisfying

νp(d)=min(νp(a1), . . . ,νp(ak)) for all primesp.

Analogously, we call m ∈ Z a common multiple of a1, . . . ,ak if ai | m for all i=1, . . . ,k; moreover, such anmis called the least common multiple ofa1, . . . ,ak

if mdivides all common multiples ofa1, . . . ,ak. The least common multiple of a1, . . . ,ak is denoted lcm(a1, . . . ,ak) and is the unique non-negative integermsat- isfying

νp(m)=max(νp(a1), . . . ,νp(ak)) for all primesp.

Finally, we say that the family{ai}ki=1ispairwise relatively primeif for all indices i,jwithi6= j, we have gcd(ai,aj) =1. Certainly, if{ai}ki=1 is pairwise relatively prime, andk >1, then gcd(a1, . . . ,ak)=1; however, gcd(a1, . . . ,ak) =1 does not imply that{ai}ki=1is pairwise relatively prime.

Gambar

Fig. 3.1. Division with Remainder Algorithm
Fig. 4.1. Bob’s data from the extended Euclidean algorithm 4.6.2 Application: Chinese remaindering with errors
Table 5.2. Values of π(x), li(x), and x/ log x

Referensi

Dokumen terkait

Pfukenyi D M 2003 Epidemiology of trematode infections in cattle in the Highveld and Lowveld communal grazing areas of Zimbabwe with emphasis on amphistomes, Fasciola gigantica and

This unit is more a special clinical department of a general hospital than a complete institute, such as its larger namesake at Baltimore, where so much space and time are given to