Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas


Intro Abstract Algebra , Notas de estudo de Matemática

Apostila de Algebra Abstrata Autor Paul Garrett Sumário (1) Basic Algebra of Polynomials (2) Induction and the Well-ordering Principle (3) Sets (4) Some counting principles (5) The Integers (6) Unique factorization into primes (7) (*) Prime Numbers (8) Sun Ze's Theorem (9) Good algorithm for exponentiation (10) Fermat's Little Theorem (11) Euler's Theorem, Primitive Roots, Exponents, Roots (12) (*) Public-Key Ciphers (13) (*) Pseudoprimes and Primality Tests (14) Vectors and matrices (15) Mot

Tipologia: Notas de estudo

2011

Compartilhado em 29/10/2011

filipe-ribeiro-carneiro-11
filipe-ribeiro-carneiro-11 🇧🇷

1 documento

1 / 200

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
Intro Abstract Algebra
c
1997-8, Paul Garrett, garr[email protected]du
http://www.math.umn.edu/~garrett/
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe Intro Abstract Algebra e outras Notas de estudo em PDF para Matemática, somente na Docsity!

Intro Abstract Algebra

c 1997-8, Paul Garrett, [email protected] http://www.math.umn.edu/~garrett/

Contents

(1) Basic Algebra of Polynomials

(2) Induction and the Well-ordering Principle

(3) Sets

(4) Some counting principles

(5) The Integers

(6) Unique factorization into primes

(7) (*) Prime Numb ers

(8) Sun Ze's Theorem

(9) Go o d algorithm for exp onentiation

(10) Fermat's Little Theorem

(11) Euler's Theorem, Primitive Ro ots, Exp onents, Ro ots

(12) (*) Public-Key Ciphers

(13) (*) Pseudoprimes and Primality Tests

(14) Vectors and matrices

(15) Motions in two and three dimensions

(16) Permutations and Symmetric Groups

(17) Groups: Lagrange's Theorem, Euler's Theorem

(18) Rings and Fields: de nitions and rst examples

(19) Cyclotomic p olynomials

(20) Primitive ro ots

(21) Group Homomorphisms

(22) Cyclic Groups

(23) (*) Carmichael numb ers and witnesses

(24) More on groups

(25) Finite elds

(26) Linear Congruences

(27) Systems of Linear Congruences

(28) Abstract Sun Ze Theorem

(29) (*) The Hamiltonian Quaternions

(30) More ab out rings

(31) Tables

X

0 in

n i

xni^ y i

Notice that 

n n

n 0

There are standard identities which are useful in anticipating factorization of sp ecial p olynomials and sp ecial forms of numb ers:

x^2 y 2 = (x y )(x + y )

x^3 y 3 = (x y )(x^2 + xy + y 2 ) x^3 + y 3 = (x + y )(x^2 xy + y 2 )

x^4 y 4 = (x y )(x^3 + x^2 y + xy 2 + y 3 )

x^5 y 5 = (x y )(x^4 + x^3 y + x^2 y 2 + xy 3 + y 4 )

x^5 + y 5 = (x + y )(x^4 x^3 y + x^2 y 2 xy 3 + y 4 )

and so on. Note that for odd exp onents there are two identities while for even exp onents there is just one.

#1.1 Factor x^6 y 6 in two di erent ways.

#1.2 While we mostly know that x^2 y 2 has a factorization, that x^3 y 3 has a factorization, that x^3 + y 3

has, and so on, there is a factorization that seldom app ears in `high scho ol': x^4 + 4 y 4 has a factorization into two quadratic pieces, each with 3 terms! Find this factorization. Hint:

x^4 + 4 y 4 = (x^4 + 4 x^2 y 2 + 4 y 4 ) 4 x^2 y 2 = (x^2 + 2 y 2 )^2 (2xy )^2

2. Induction and the Well-ordering Principle

The meaning of the word `induction' within mathematics is very di erent from the collo quial sense!

First, let P (n) b e a statement involving the integer n, which may b e true or false. That is, at this p oint we have a grammatical ly correct sentence, but are making no general claims ab out whether the sentence is true, true for one particular value of n, true for al l values of n, or anything. It's just a sentence.

Now we intro duce some notation that is entirely compatible with our notion of function, even if the present usage is a little surprising. If the sentence P (n) is true of a particular integer n, write

P (n) = true

and if the sentence asserts a false thing for a particular n, write

P (n) = false

That is, we can view P as a function, but instead of pro ducing numbers as output it pro duces either true' orfalse' as values. Such functions are called b o olean.

This style of writing, even if it is not what you already knew or learned, is entirely parallel to ordinary English, is parallel to programming language usage, and has many other virtues.

Caution: There is an another, older tradition of notation in mathematics which is somewhat di erent, which is and which is harder to read and write unless you know the trick, since it is not like ordinary English at all. In that other tradition, to write P (n)' is to assert that the sentenceP (n)' is true. In the other tradition, to say that the sentence is false you write :P (n)' or  P (n)'.

So, yes, these two ways of writing are not compatible with each other. To o bad. We need to make a choice, though, and while I once would have chosen what I call the `older' tradition, now I like the rst way b etter, for several reasons. In any case, you should b e alert to the p ossibility that other p eople may cho ose one or the other of these writing styles, and you have to gure it out from context!

Principle of Induction

 If P (1) = true, and

 if P (n) = true implies P (n + 1) = true for every p ositive integer n,

 then P (n) = true for every p ositive integer n.

Caution: The second condition do es not directly assert that P (n) = true, nor do es it directly assert that P (n + 1) = true. Rather, it only asserts a relative thing. That is, more generally, with some sentences A and B (involving n or not), an assertion of the sort

(A implies B ) = true

does not assert that A = true nor that B = true, but rather can b e re-written as conditional assertion

if (A = true) then B = true

In other words we prove that an implication is true.

The left-hand side is just what we want, but the right hand side is not. But we hope that it secretly is what we want; that is, we hope that

1 2 n(n + 1) + (n + 1) =

(n + 1)((n + 1) + 1)

We have to check that this is true.

This raises an auxiliary question, which is easy enough to answer once we make it explicit: how would a person go about proving that two polynomials are equal? The answer is that b oth of them should b e simpli ed and rearranged in descending (or ascending) p owers of the variable, and then check that corre- sponding coecients are equal. (And this description de nitely presumes that we have p olynomials in just one variable.)

In the present example it's not very hard to do this rearranging: rst, one side of the desired equality simpli es and rearranges to

1 2

n(n + 1) + (n + 1) =

n^2 +

n + n + 1 =

n^2 +

n + 1

On the other hand, the other side of the desired equality simpli es and rearranges to

Or we can try to b e a little lucky and just directly rearrange one side of the desired equality of p oly- nomials into the other: in simple situations this works, and if you have some luck, but is not the general approach. Still, we can manage it in this example:

1 2

n(n + 1) + (n + 1) = (

n + 1)(n + 1) =

(n + 2)(n + 1) =

(n + 1)(n + 2) =

(n + 1)((n + 1) + 1)

Thus, we can conclude that if

1 + 2 + 3 + 4 + : : : + (n 2) + (n 1) + n =

n(n + 1)

then

1 + 2 + 3 + 4 + : : : + (n 2) + (n 1) + n + (n + 1) =

(n + 1)((n + 1) + 1)

which is the implication we must prove to complete the induction step. Thus, we conclude that this formula really do es hold for all p ositive integers n.

In this example, we used the fact that we knew what we were supposed to be getting to help us do the elementary algebra to complete the induction step. We certainly needed to know what the right formula was before attempting to prove it! This is typical of this sort of argument!

In some circumstances, a seemingly di erent pro of concept works b etter:

Well-Ordering Principle Every non-empty subset of the p ositive integers has a least element.

This Well-Ordering Principle sounds completely inno cuous, but it is provably logical ly equivalent to the Principle of Induction. Another logically equivalent variant is:

Let P b e a prop erty that an integer may or may not have. If P (1) = true, and if P (m) = true for all m < n implies that P (n) = true, then P holds for al l integers.

In the other notation, this would b e written

Let P b e a prop erty that an integer may or may not have. If P (1), and if P (m) for all m < n implies that P (n), then P holds for al l integers.

#2.3 Prove by induction that

1 + 2 + 3 + : : : + n =

n(n + 1)

#2.4 Prove by induction on n that

xn^ 1 = (x 1)(xn^1 + xn^2 + xn^3 + : : : + x^2 + x + 1)

Hint: To do the induction step, notice that

xn+1^ 1 = xn+1^ x + x 1 = x(xn^ 1) + (x 1)

#2.5 Prove by induction that

12 + 22 + 32 + : : : + n^2 =

n^3 +

n^2 +

n

#2.6 Prove by induction the following relation among binomial co ecients:

n k

n

k 1

n + 1 k

for integers 0 < k  n.

#2.7 (*) Prove by induction that

(1 + 2 + 3 + : : : + n)^2 = 13 + 23 + 33 + : : : + n^3

#2.8 (**) How would one systematically obtain the \formula" for 1 k^ + 2 k^ + 3 k^ + : : : + (n 1)k^ + nk^ for a

xed p ositive integer exp onent k?

A subset T of a set S is a set all of whose elements are elements of S. This is written T  S or S  T. So always S  S and   S. If T  S and T 6 =  and T 6 = S , then T is a prop er subset of S. Note that the empty set is a subset of every set. For a subset T of a set S , the complement of T (inside S ) is

T c^ = S T = fs 2 S : s 62 T g

Sets can also b e elements of other sets. For example, fQ; Z; R; Cg is the set with 4 elements, each of which is a familiar set of numb ers. Or, one can check that

ff 1 ; 2 g; f 1 ; 3 g; f 2 ; 3 gg

is the set of two-element subsets of f 1 ; 2 ; 3 g.

The intersection of two sets A; B is the collection of all elements which lie in both sets, and is denoted A \ B. Two sets are disjoint if their intersection is . If the intersection is not empty, then we may say that the two sets meet. The union of two sets A; B is the collection of all elements which lie in one or the other of the two sets, and is denoted A [ B.

Note that, for example, 1 6 = f 1 g, and ff 1 gg 6 = f 1 g. That is, the set fag with sole element a is not the same thing as the item a itself.

An ordered pair (x; y ) is just that, a list of two things in which there is a rst thing, here x, and a second thing, here y. Two ordered pairs (x; y ) and (x^0 ; y 0 ) are equal if and only if x = x^0 and y = y 0.

The (cartesian) pro duct of two sets A; B is the set of ordered pairs (a; b) where a 2 A and b 2 B. It is denoted A  B. Thus, while fa; bg = fb; ag might b e thought of as an unordered pair, for ordered pairs (a; b) 6 = (b; a) unless by chance a = b.

In case A = B , the cartesian p ower A  B is often denoted A^2. More generally, for a xed p ositive integer n, the nth^ cartesian p ower An^ of a set is the set of ordered n-tuples (a 1 ; a 2 ; : : : ; an ) of elements ai of A.

Some very imp ortant examples of cartesian p owers are those of R or Q or C, which arise in other contexts as well: for example, R^2 is the collection of ordered pairs of real numb ers, which we use to describ e p oints in the plane. And R^3 is the collection of ordered triples of real numb ers, which we use to describ e p oints in three-space.

The p ower set of a set S is the set of subsets of S. This is sometimes denoted by P S. Thus,

P  = f;g

P f 1 ; 2 g = f; f 1 g; f 2 g; f 1 ; 2 gg

Intuitively, a function f from one set A to another set B is supp osed to b e a `rule' which assigns to each element a 2 A an element b = f (a) 2 B. This is written as

f : A! B

although the latter notation gives no information ab out the nature of f in any detail.

More rigorously, but less intuitively, we can de ne a `function' by really telling its graph: the formal de nition is that a function f : A! B is a subset of the pro duct A  B with the prop erty that for every a 2 A there is a unique b 2 B so that (a; b) 2 f. Then we would write f (a) = b.

This formal de nition is worth noting at least b ecause it should make clear that there is absolutely no requirement that a function b e describ ed by any recognizable or simple `formula'.

As a silly example of the formal de nition of function, let f : f 1 ; 2 g! f 2 ; 4 g b e the function multiply- by-two', so that f (1) = 2 and f (2) = 4. Then theocial' de nition would say that really f is the subset of the pro duct set f 1 ; 2 g  f 2 ; 4 g consisting of the ordered pairs (1; 2); (2; 4). That is, formally the function f is the set f = f(1; 2); (2; 4)g

Of course, no one often really op erates this way.

A function f : A! B is surjective (or onto) if for every b 2 B there is a 2 A so that f (a) = b. A function f : A! B is injective (or one-to-one) if f (a) = f (a^0 ) implies a = a^0. That is, f is injective if for every b 2 B there is at most one a 2 A so that f (a) = b. A map is a bijection if it is b oth injective and surjective.

The numb er of elements in a set is its cardinality. Two sets are said to have the same cardinality if there is a bijection b etween them. Thus, this is a trick so that we don't have to actually count two sets to see whether they have the same numb er of elements. Rather, we can just pair them up by a bijection to achieve this purp ose.

Since we can count the elements in a nite set in a traditional way, it is clear that a nite set has no bijection to a proper subset of itself. After all, a prop er subset has fewer elements.

By contrast, for in nite sets it is easily p ossible that proper subsets have bijections to the whole set. For example, the set A of al l natural numb ers and the set E of even natural numb ers have a bijection b etween them given by n! 2 n

But certainly E is a proper subset of A! Even more striking examples can b e arranged. In the end, we take as de nition that a set is in nite if it has a bijection to a prop er subset of itself.

Let f : A! B b e a function from a set A to a set B , and let g : B! C b e a function from the set B to a set C. The comp osite function g  f is de ned to b e

(g  f )(a) = g (f (a))

for a 2 A.

The identity function on a non-empty set S is the function f : S! S so that f (a) = a for all a 2 A. Often the identity function on a set S is denoted by idS.

Let f : A! B b e a function from a set A to a set B. An inverse function g : B! A for f (if such g exists at all) is a function so that (f  g )(b) = b for all b 2 B , and also (g  f )(a) = a for all a 2 A. That is, the inverse function (if it exists) has the two prop erties

f  g = idB g  f = idA

An inverse function to f , if it exists at all, is usually denoted f ^1. (This is not at all the same as 1 =f !)

Prop osition: A function f : A! B from a set A to a set B has an inverse if and only if f is a bijection. In that case, the inverse is unique (that is, there is only one inverse function).

Proof: We de ne a function g : B! A as follows. Given b 2 B , let a 2 A b e an element so that f (a) = b. Then de ne g (b) = a. Do this for each b 2 B to de ne g. Note that we use the surjectivity to know that there exists an a for each b, and the injectivity to b e sure of its uniqueness.

To check that g  f = idA , compute: rst, for any a 2 A, f (a) 2 B. Then g (f (a)) is, by de nition, an element a^0 2 A so that f (a^0 ) = f (a). Since f is injective, it must b e that a^0 = a. To check that f  g = 1 , take b 2 B and compute: by de nition of g , g (b) is an element of A so that f (g (b)) = b. But that is (after all) just what we want. Done.

That is, in terms of analytic geometry, two p oints are equivalent if and only if they lie on the same vertical line. Veri cation of the three required prop erties in this case is easy, and should b e carried out by the reader.

Let  b e an equivalence relation on a set S. For x 2 S , the  - equivalence class x containing x is the subset x = fx^0 2 S : x^0  xg

The set of equivalence classes of  on S is denoted by

S= 

(as if we were taking a quotient of some sort). Every element z 2 S is certainly contained in an equivalence class, namely the equivalence class of all s 2 S so that s  z.

Note that in general an equality x = y of equivalence classes x ; y is no indication whatso ever that x = y. While it is always true that x = y implies x = y , in general there are many other elements in x than just x itself. Prop osition: Let  b e an equivalence relation on a set S. If two equivalence classes x; y have any common element z , then x = y.

Proof: If z 2 x \ y , then z  x and z  y. Then for any x^0 2 x , we have

x^0  x  z  y

so x^0  y by transitivity of . Thus, every element x^0 2 x actually lies in y. That is, x  y. A symmetrical argument, reversing the roles of x and y , shows that y  x. Therefore, x = y. Done.

It is imp ortant to realize that while we tend to refer to an equivalence class in the notational style x for some x in the class, there is no requirement to do so. Thus, it is legitimate to say \an equivalence class A for the equivalence relation  on the set S ".

But of course, given an equivalence class A inside S , it may b e convenient to nd x in the set S so that x = A. Such an x is a representative for the equivalence class. Any element of the subset A is a representative, so in general we certainly should not imagine that there is a unique representative for an equivalence class.

Prop osition: Let  b e an equivalence relation on a set S. Then the equivalence classes of  on S are mutually disjoint sets, and their union is all of S.

Proof: The fact that the union of the equivalence classes is the whole thing is not so amazing: given x 2 S , x certainly lies inside the equivalence class

fy 2 S : y  xg

Now let A and B b e two equivalence classes. Supp ose that A \ B 6 = , and show that then A = B (as sets). Since the intersection is non-empty, there is some element y 2 A \ B. Then, by the de nition of \equivalence class", for all a 2 A we have a  y , and likewise for all b 2 B we have b  y. By transitivity, a  b. This is true for all a 2 A and b 2 B , so (since A and B are equivalence classes) we have A = B. Done.

A set S of non-empty subsets of a set S whose union is the whole set S , and which are mutually disjoint, is called a partition of S. The previous prop osition can b e run the other direction, as well: Prop osition: Let S b e a set, and let S b e a set of subsets of S , so that S is a partition of S. De ne a relation  on S by x  y if and only if there is X 2 S so that x 2 X and y 2 X. That is, x  y if and only if they b oth lie in the same element of S. Then  is an equivalence relation, and its equivalence classes are the elements of S.

Proof: Since the union of the sets in S is the whole set S , each element x 2 S is contained in some X 2 S. Thus, we have the re exivity prop erty x  x. If x  y then there is X 2 S containing b oth x and y , and certainly y  x, so we have symmetry.

Finally, the mutual disjointness of the sets in S assures that each y 2 S lies in just one of the sets from S. For y 2 S , let X b e the unique set from S which contains y. If x  y and y  z , then it must b e that x 2 X and z 2 X , since y lies in no other subset from S. Then x and z b oth lie in X , so x  z , and we have transitivity.

Veri cation that the equivalence classes are the elements of S is left as an exercise. Done.

#3.9 How many elements in the set f 1 ; 2 ; 2 ; 3 ; 3 ; 4 ; 5 g? How many in the set f 1 ; 2 ; f 2 g; 3 ; f 3 g; 4 ; 5 g? In f 1 ; 2 ; f 2 ; 3 g; 3 ; 4 ; 5 g?

#3.10 Let A = f 1 ; 2 ; 3 ; 4 ; 5 g and B = f 3 ; 4 ; 5 ; 6 ; 7 g. List (without rep etition) the elements of the sets A [ B , A \ B , and of fx 2 A : x 62 B g.

#3.11 List all the elements of the power set (set of subsets) of f 1 ; 2 ; 3 g.

#3.12 Let A = f 1 ; 2 ; 3 g and B = f 2 ; 3 g. List (without rep etition) all the elements of the cartesian product set A  B.

#3.13 How many functions are there from the set f 1 ; 2 ; 3 g to the set f 2 ; 3 ; 4 ; 5 g?

#3.14 How many injective functions are there from f 1 ; 2 ; 3 g to f 1 ; 2 ; 3 ; 4 g?

#3.15 How many surjective functions are there from f 1 ; 2 ; 3 ; 4 g to f 1 ; 2 ; 3 g?

#3.16 Show that if f : A! B and g : B! C are functions with inverses, then g  f has an inverse, and this inverse is f ^1  g ^1.

#3.17 Show that for a surjective function f : A! B there is a right inverse g , meaning a function g : B! A so that f  g = idB (but not necessarily g  f = idA .)

#3.18 Show that for an injective function f : A! B there is a left inverse g , meaning a function g : B! A so that g  f = idA (but not necessarily f  g = idB .)

#3.19 Give a bijection from the collection 2 Z of even integers to the collection Z of al l integers.

#3.20 (*) Give a bijection from the collection of al l integers to the collection of non-negative integers.

#3.21 (**) Give a bijection from the collection of all p ositive integers to the collection of all rational numb ers.

#3.22 (**) This illustrates a hazard in a to o naive notion of \rule" for forming a set. Let S b e the set of all sets which are not an element of themselves. That is, let

S = f sets x : x 62 xg

Is S 2 S or is S 62 S? (Hint: Assuming either that S is or isn't an element of itself leads to a contradiction. What's going on?)

choices for the rst subset, 

n k

k

for the second, 

n 2 k

k

for the third, up to 

n (` 1)k

k

for the th subset. But since ordering of these subsets is accidentally counted here, we have to divide by! to have the actual numb er of families. There is some cancellation among the factorials, so that the actual numb er is n!

! (k !)^ (n `k )!

#4.23 How many di erent ways are there to reorder the set f 1 ; 2 ; 3 ; 4 g?

#4.24 How many choices of 3 things from the list 1 ; 2 ; 3 ; : : : ; 9 ; 10 (without replacement)?

#4.25 How many subsets of f 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 g with exactly 4 elements?

#4.26 How many di erent choices are there of an unordered pair of distinct numb ers from the set

f 1 ; 2 ; : : : ; 9 ; 10 g? How many choices of ordered pair?

#4.27 How many di erent choices are there of an ordered triple of numb ers from the set f 1 ; 2 ; : : : ; 9 ; 10 g?

#4.28 How many subsets of all sizes are there of a set S with n elements? (Hint: Go down the list of all elements in the set: for each one you have 2 choices, to include it or to exclude it. Altogether how many choices?)

#4.29 How many pairs of disjoint subsets A; B each with 3 elements inside the set f 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 g?

5. The Integers

 Divisibility

 The division/reduction algorithm

 Euclidean algorithm

 Unique factorization

 Multiplicative inverses mo dulo m

 Integers mo dulo m

5.1 The integers

For two integers d; n, the integer d divides n (or is a divisor of n) if n=d is an integer. This is equivalent to there b eing another integer k so that n = k d. As equivalent terminology, we may also (equivalently) say that n is a multiple of d if d divides n.

A divisor d of n is prop er if it is not n nor 1. A multiple N of n is prop er if it is neither n. The notation djn

is read as `d divides n'. Notice that any integer d divides 0, since d  0 = 0. On the other hand, the only integer 0 divides is itself.

A p ositive integer is prime if it has no prop er divisors. That is, it has no divisors but itself, its negative, and 1. Usually we only pay attention to positive primes.

The following is the simplest but far from most ecient test for primality. It do es have the virtue that if a numb er is not prime then this pro cess nds the smallest divisor d > 1 of the numb er.

Prop osition: A p ositive integer n is prime if and only if it is not divisible by any of the integers d with 1 < d 

p n.

Proof: First, if djn and 2 < d 

p n, then the integer n=d satis es p n 

n d



n 2

(where we are lo oking at inequalities among real numb ers!). Therefore, neither of the two factors d nor n=d is  1 nor n. So n is not prime.

On the other hand, supp ose that n has a prop er factorization n = d  e, where e is the larger of the two factors. Then d =

n e



n d

gives d^2  n, so d 

p n. Done.

Two integers are relatively prime or coprime if for every integer d if djm and djn then d = 1. Also we may say that m is prime to n if they are relatively prime. For a p ositive integer n, the numb er of p ositive

meaning that N mo d m' has, as we will see later. Usually the context will make clear what the phraseN mo d m' means, but watch out. We will use a notation which is fairly compatible with many computer languages: write x % m

for x reduced mo dulo m

Reductions mo d m can b e computed by hand by the familiar long division algorithm. For m and N b oth positive, even a simple hand calculator can b e used to easily compute reductions. For example: divide N by m, obtaining a decimal. Remove (by subtracting) the integer part of the decimal, and multiply back by n to obtain the reduction mo d m of N.

The pro cess of reduction mo d m can also b e applied to negative integers. For example,

10 % 7 = 4 since 10 = (2)  7 + 4

10 % 5 = 0 since 10 = (2)  5 + 0

15 % 7 = 6 since 15 = (3)  7 + 6

But neither the hand algorithm nor the calculator algorithm mentioned ab ove give the correct output directly: for one thing, it is not true that the reduction mo d m of N is the negative of the reduction mo d m of N. And all our reductions mo d m are supp osed to b e non-negative, b esides. For example,

10 = 1  7 + 3

shows that the reduction of 10 mo d 7 is 3, but if we simply negate b oth sides of this equation we get

10 = (1)  7 + (3)

That -3' do es not t our requirements. The trick is to add another multiple of 7 to that-3', while subtracting it from the (1)  7, getting 10 = ( 1 1)  7 + ( 3 + 7)

or nally 10 = (2)  7 + 4

And there is one last `gotcha': in case the remainder is 0, as in

14 = 2  7 + 0

when we negate to get 14 = (2)  7 + 0

nothing further needs to b e done, since that 0 is already in the right range. (If we did add another 7 to it, we'd b e in the wrong range). Thus, in summary, let r b e the reduction of N mo d m. Then the reduction of N mo d m is m r if r 6 = 0, and is 0 if r = 0.

The mo dulus can b e negative, as well: however, it happ ens that always the reduction of N mo dulo m is just the reduction of N mo d jmj, so this intro duces nothing new.

Note that by our de nition the reduction mo d m of any integer is always non-negative. This is at variance with several computer languages, where the reduction of a negative integer N is the negative of the reduction of N. This di erence has to b e rememb ered when writing co de.

Last, let's prove existence and uniqueness of the quotient and remainder in the assertion of the Reduc- tion/Division Algorithm:

Prop osition: Given a non-zero integer m and arbitrary integer n, there are unique integers q and r so that 0  r < jmj and n = q  m + r

Proof: For simplicity, we'll do the pro of just for m > 0. The case that m < 0 is very similar. For xed n and m, let X b e the collection of all integers of the form n x  m. Since x can b e p ositive or negative, and since m is not 0, X contains b oth p ositive and negative integers. Let r b e the least p ositive integer in X , and let q b e the corresp onding `x', so that n q m = r.

First, we claim that 0  r < jmj. If r  jmj, then r m  0. Since r m is writeable as n (q + 1)m, it is in the collection X. But r m < r , contradicting the fact that r is the smallest p ositive integer in X. Thus, it could not have b een that r  jmj, and we conclude that r < jmj, as desired.

Next, we prove uniqueness of the q and r. Supp ose that

q m + r = q 0 m + r 0

with 0  r < 0 and 0  r 0 < 0. By symmetry, we can supp ose that r  r 0 (if not, reverse the roles of r and r 0 in the discussion). Then (q 0 q )  m = r 0 r

and r 0 r  0. If r 0 r 6 = 0 then necessarily q q 6 = 0, but if so then

r 0 r = jr 0 r j = jq 0 q j  jmj  1  jmj

(Again, r 0 r = jr 0 r j since r 0 r  0). But

r 0 r  r 0 < jmj

Putting these together, we get the imp ossible

jmj  r 0 r < jmj

This contradicts the supp osition that r 6 = r 0. Therefore, r = r 0. Then, from (q 0 q )m = r 0 r = 0 (and m 6 = 0) we get q 0 = q , as well. This proves the uniqueness. Done.

Remark: The assertion that any (non-empty) collection of p ositive integers has a least element is the Well-Ordering Principle for the p ositive integers.

Prop osition: Let n and N b e two integers, with mjN. Then for any integer x

(x % N ) % n = x % n

Proof: Write N = k n for some integer k , and let x = Q  N + R with 0  R < jN j. This R is the reduction of x mo d N. Further, let R = q  n + r with 0  r < jnj. This r is the reduction of R mo d n. Then

x = QN + R = Q(k n) + q n + r = (Qk + q )  n + r

So r is also the reduction of x mo dulo m. Done.