m a 2 4 6 - chicks dig x-pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/ma246_wbs_1_0... ·...

36
M A 2 4 6 Number Theory Workbook 1 (with solutions) The Arithmetic of Congruence Classes (Making Clock Arithmetic Tick) Summer 2008 (written and devised by Trevor Hawkes and Alyson Stibbard) Aims of these workbooks: (a) To encourage you to teach yourself mathematics from written material, (b) To help you develop the art of independent study — working either alone, or co-operatively with other students, (c) To help you learn a mathematical topic, in this case Number Theory, through calculation and problem-solving. Copies of this workbook, both with and without solutions, can be found on Mathstuff.

Upload: trandat

Post on 26-Apr-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

M A

2 4

6 Number Theory

Workbook 1 (with solutions)

The Arithmetic of Congruence Classes(Making Clock Arithmetic Tick)

Summer 2008

(written and devised byTrevor Hawkes and Alyson Stibbard)

Aims of these workbooks:

(a) To encourage you to teach yourself mathematicsfrom written material,

(b) To help you develop the art of independent study— working either alone, or co-operatively withother students,

(c) To help you learn a mathematical topic, in thiscase Number Theory, through calculation andproblem-solving.

Copies of this workbook, both with and withoutsolutions, can be found on Mathstuff.

Page 2: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

In this course you will constantly get your hands dirty and, wehope, your brain engaged. You will be expected to calculate, toexperiment, and to explore, in order to uncover some of the secretsof the counting numbers 1,2,3,.. that have fascinated our ancestorssince the dawn of history.

Note: You will need a pocket calculator for some of the questions inthe workbooks, and are encouraged to use one for this purpose andto experiment with results and ideas in the course. Calculators areNOT needed and are NOT allowed in tests or in the examination.

Are You Ready?

To understand the material and do the problems in each section ofthis workbook, you will need to be on good terms with:Section 1: • division with remainder (a la Workbook 0)

• equivalence relations• equivalence classes• group axioms

Section 2: • the group (Zn, +)• group isomorphisms

Section 3: • Lagrange’s Theorem

These workbooks were orginally written and devised by Trevor Hawkes and

and Alyson Stibbard. Ben Carr designed the LATEX template and Rob Reid

converted their drafts into elegant print. Over the years, other lecturers andstudents have corrected a number of typos, mistakes and other infelicities.

Send corrections, ask questions or make comments at the mod-ule forum. You can join the MA246 forum by going tohttp://forums.warwick.ac.uk/wf/misc/welcome.jsp and signing in, click-ing the browse tab, and then following the path: Departments > Maths >

Modules > MA2xx modules > MA246 Number Theory.

Page 3: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

1 Finite Arithmetic

“The world is a circlewithout a beginning”— Lost Horizon

r

6

1

2

3

4

567

8

9

10

11 12

As the hand of the clocksweeps round, the hourskeep repeating themselves.In a thousand hours it willstill be no more than 12o’clock (what time will itbe?) In this workbook wewill think in circles as weapply our minds to finite(“clock”) arithmetic.

Some History:In 1801, when he was only 24 years old, Karl Friedrich Gauss (1777-1855) published a veryinfluential book called Disquisitiones Arithmeticae (Latin was still the common languagefor scientific and scholarly communication in those days). In this book, Gauss lays thefoundations of modern number theory. One of many remarkable achievements to be foundthere is a fully-fledged mathematical framework for the “arithmetic of remainders” (orthe “theory of congruences”, as it is known today). Gauss was the first to understandand exploit the power of this idea and, importantly, the first to devise a good notationfor working with it.

Two Practical Projects for Motivation

(a) Starting only with knowledge of

• today’s date and day of the week, and

• your date of birth,

work out on which day of the week you were born. (Answer at the end of thissection)

(b) A team of twelve frisbee players stand in a circle looking inwards. They fix a numbera > 0 and agree always to throw the frisbee to the player a places further round inthe circle in the clockwise direction. Thus, when a = 1, the frisbee is thrown to thenext person on the left.

(i) For which values of a do all the players get a turn?

(ii) For the other values of a, which of the players handle the frisbee?

(Answer at the end of Section 2)

2

Page 4: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Section Targets

(a) To describe three of the four operations of finitearithmetic;

addition, subtraction and multiplicationmodulo n,

where n is some fixed natural number.

(b) To understand the trickier, but more interesting,operation of ‘division modulo n’.

Parity

The parity of an integer is its

oddness or evenness. Thus −3

and 100 have odd parity, while 0

and 106 have even parity.

(1.1) Questions about odd and even integers

(a) Write down two odd integers and note the parityof their sum and their product.

(b) Give a precise definition of an even number andan odd number. Suppose m is even and n is odd.Use your definition to show that m+n is odd andmn is even.

(c) Complete the following addition and multiplica-tion tables:

+ even odd

even

odd

× even odd

even

odd

3

Page 5: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Answers to (1.1)

(a) −3, 5, for which,

(−3) + 5 = 2 (even)

(−3) × 5 = −15 (odd)

(b) An integer n is even if there exists an integer msuch that n can be written as n = 2m and aninteger k is odd if there exists an integer l suchthat k can be written as k = 2l + 1. Let m beeven and n odd. Then there exist integers r ands such that m = 2r and n = 2s + 1. Hence,

m + n = 2(r + s) + 1 is odd

m × n = 2r(2s + 1) is even

(c) The completed tables look like:

+ even odd

even

odd

even odd

odd even

× even odd

even

odd

even even

even odd

(1.2) Definition Let n be a natural number (n ∈ Z

and n > 0). We say two integers a and b are congruentmodulo n, and write

a ≡ b (mod n)

if n divides a − b, or, equivalently, if a = b + kn forsome k ∈ Z.

Examples

11 ≡ 5 (mod 2) since 11 = 5 + 3 × 2

−5 ≡ 3 (mod 4) since − 5 = 3 + (−2) × 4

4

Page 6: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Equivalence RelationsLook up the section “ClockArithmetic”in your Foundations

(Sets and Groups) lecture notesand read the proof that ‘congru-ence modulo n’ is an equivalencerelation. (Alternatively, justprove it for yourself bearingin mind that an equivalencerelation is reflexive, symmetricand transitive.)

Notice that 0 ≤ r < n iff 0 ≤

r ≤ n− 1 since r and n are both

integers,

(1.3) Questions on Congruences

(a) Show that 106 ≡ 1 (mod 7) and −37 ≡ −2(mod 5).

(b) For the given pairs (x, n) below, find a number rsatisfying x ≡ r (mod n) and 0 ≤ r < n:

(102, 3), (25, 4), (1001, 101), (1012, 9)

(Section 2 of Workbook 0 will help.)

(c) For the same pairs (x, n), find an r satisfying

{

x ≡ r (mod n)−n < r ≤ 0

(d) Explain how ‘division with remainder’ shows thateach integer is congruent modulo n to one andonly one of the integers 0, 1, . . . , n − 1

(e) Find an integer m satisfying n ≤ m ≤ n + 11 andm ≡ 7 (mod 12) in each of the following cases:

(i) n = 100

(ii) n = 106

(iii) n = −999

Division With Remainder

Make sure you have looked at

this section in Workbook 0.

Given integers a and b you need

to know how to find q and r such

that a = qb + r and 0 ≤ r < b.

Answers to (1.3) (a) 106 = 142857 × 7 + 1,−37 =−7 × 5 − 2. (b) You are looking for the remainderon division by n, as you did in Workbook 0. 102 =34 × 3 + 0 ⇒ r = 0, 25 = 6 × 4 + 1 ⇒ r = 1,1001 = 9 × 101 + 92 ⇒ r = 92, 9|1012 − 1 (why?)⇒ r = 1. (c) r = 0,−3,−9,−8. (d) ‘Division withremainder’ states that there exist integers q and rwith 0 ≤ r < n such that x = qn + r. Hence x ≡ r(mod n). If x ≡ s (mod n) with 0 ≤ s < n, then ndivides x − r and x − s and therefore divides theirdifference (x− r)− (x− s) = s− r. Since |s− r| < n,this can only happen if r = s. (e) (i) 103, (ii) 106 +3,(iii) −989.

5

Page 7: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Note: We write 10Z instead of10Z + 0, and 3Z − 2 instead of3Z + (−2)

What’s in a name? Two seem-

ingly different expressions can

represent the same set, e.g. 2Z+1

and 2Z−1 both represent the odd

numbers, so 2Z + 1 = 2Z − 1.

(1.4) Helpful Notation Let n be a fixed naturalnumber and m be an integer. We define

nZ + m = {nk + m : k ∈ Z}

E.g. 2Z + 1 = {2k + 1 : k ∈ Z} = {±1,±3,±5 . . .}is the set of odd numbers, 10Z = {10k : k ∈ Z} ={0,±10,±20, . . .} is the set of integers that are divis-ible by 10.

Given a set nZ + m, result (e)

tells you that any integer congru-

ent to m can be used to represent

it. Equivalently, (d) says that

any integer contained in nZ + m

can be used to represent it, so

you know at once that 2Z + 1 =

2Z + 5297, since 5297 is odd.

(1.5) Questions about this notation

(a) Write down two elements from each of the con-gruence classes 2Z − 1, 4Z + 3 and 7Z.

(b) Prove that m ∈ nZ + m.

(c) Find 3 different values of m such that 4Z + 3 =4Z + m.

(d) Prove that nZ + a = nZ + b iff a ∈ nZ + b.

(e) Hence show that nZ + a = nZ + b iff a ≡ b(mod n).

Division with Remainderrides again

The set nZ + r, (0 ≤ r < n), is

the set of all integers that leave a

remainder of r when divided by

n.

Answers to (1.5) (a) E.g. −1, 13 ∈ 2Z + 1,−3, 1 ∈4Z − 3, 0, 7 ∈ 7Z. (b) m = n × 0 + m ∈ nZ + m.(c) E.g. m = −5,−1, 203 (d) If nZ + a = nZ + b,then a ∈ nZ + b by part (b). If a ∈ nZ + b, thena = nk + b for some k ∈ Z. Suppose α ∈ nZ + a.Then for some k′ ∈ Z, α = nk′ + a = nk′ + nk + b =n(k′ + k) + b ∈ nZ + b. Suppose β ∈ nZ + b. Thenfor some k′′ ∈ Z, β = nk′′ + b = nk′′ + a − nk =n(k′′ − k) + a ∈ nZ + a. It follows that nZ + a =nZ + b. (e) a ≡ b (mod n) ⇐⇒ a = b + kn for somek ∈ Z ⇐⇒ a ∈ nZ + b ⇐⇒ nZ + a = nZ + b bypart (d).

6

Page 8: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

The sets Zn

For a given n, we define the setZn by

Zn = {nZ + m : m ∈ Z}

Zn isn’t as big as you might thinksince its elements are not all dis-tinct. For instance, once you col-lapse it down,

Z4 = {4Z, 4Z+1, 4Z+2, 4Z+3}

which has only four elements.

(1.6) Further Questions about nZ + m

(a) In each case, find an r satisfying 0 ≤ r < 10 suchthat 10Z + 111 = 10Z + r, 10Z− 2 = 10Z + r and10Z + 109 = 10Z + r.

(b) Prove that nZ + m contains a unique integer rsatisfying 0 ≤ r < n such that nZ+m = nZ+ r.

(c) For a given n, how many distinct sets of the formnZ + m are there? What are they? List them forn = 2.

(d) Prove that a ≡ b (mod n) iff a, b ∈ nZ + r forsome r satisfying 0 ≤ r < n.

Answers to (1.6) (a) 10Z+101 = 10Z+1, 10Z−2 =10Z + 8, 10Z + 109 = 10Z + 0 (b) By (1.3)(d), thereis a unique r = {0, 1, . . . , n − 1} such that m ≡ r(mod n). By (1.5)(d)(e), this is the unique r, (0 ≤r < n) such that nZ + m = nZ + r and r ∈ nZ + m.(c) nZ, nZ + 1, . . . , nZ + (n − 1) are the n distinctsets fo the form nZ + m. When n = 2, these are 2Z

and 2Z + 1. (d) If a ≡ b (mod n) then a, b ∈ nZ + aby (1.5)(b)(e). By (1.6)(b), there exists r(0 ≤ r < n)such that nZ + a = nZ + r. If a, b ∈ nZ + r, thennZ+r = nZ+a = nZ+b by (1.5)(d). Therefore a ≡ b(mod n) by (1.5)(e). You can also prove this resultdirectly as follows: Using division with remainder weknow that b = nk + r for some k ∈ Z, 0 ≤ r < n.Therefore a ≡ b (mod n) ⇒ a − b = nk′, (k′ ∈ Z) ⇒a−nk−r = nk′ ⇒ a = n(k+k′)+r ⇒ a, b ∈ nZ+r.On the other hand, a, b ∈ nZ + r ⇒ a = nk + r andb = nk′+r for some k′, (k′ ∈ Z) ⇒ a−b = n(k−k′) ⇒a ≡ b (mod n).

Equivalence Classes

If the first sentence in (1.7)

makes no sense, return to your

Foundations (Sets and Groups)

notes and re-read the section on

equivalence classes.

(1.7) Congruence Classes The equivalence rela-tion ‘congruent modulo n’ partitions the set Z ofintegers into a set of equivalence classes, called thecongruence classes modulo n. Each congruence classcontains all those integers that are congruent to eachother modulo n. From (1.6)(d) we can see that eachcongruence class is of the form nZ + r(0 ≤ r < n)and that Zn = {nZ, nZ + 1, . . . , nZ + (n − 1)} givesthe complete set of congruence classes modulo n.

7

Page 9: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Example: Z3

The three congruence classesmodulo 3 are

3Z = {0,±3,±6,±9 . . .}

3Z + 1 = {. . . ,−2, 1, 4, 7, . . .}

3Z + 2 = {. . . ,−1, 2, 5, 8, . . .}

Notice that these sets partition

Z.

(1.8) Questions on Congruence Classes

(a) List the congruence classes modulo 4.

(b) Choose an element a from 4Z + 1 and an elementb from 4Z + 3. Identify the congruence classesmodulo 4 containing a + b, a − b and ab.

(c) Now choose new elements α from 4Z + 1 and βfrom 4Z+3. Identify the congruence classes mod-ulo 4 containing α + β, α − β and αβ. Compareyour answers with (b). What do you notice?

(d) If a ≡ α (mod n) and b ≡ β (mod n), prove thata + b ≡ α + β (mod n), a − b ≡ α − β (mod n)and ab ≡ αβ (mod n).

Hint for (d):By definition,

a ≡ α (mod n)

means a = α+kn for some k ∈ Z

Answers to (1.8) (a) 4Z, 4Z + 1, 4Z + 2, 4Z + 3 (b)E.g. 1 ∈ 4Z + 1 and 3 ∈ 4Z + 3. We can see that1 + 3 = 4 ∈ 4Z, 1 − 3 = −2 ∈ 4Z + 2, 1 × 3 =3 ∈ 4Z + 3 (c) E.g. −3 ∈ 4Z + 1 and 7 ∈ 4Z + 3.In this case −3 + 7 = 4 ∈ 4Z,−3 − 7 = −10 ∈4Z + 2,−3 × 7 = −21 ∈ 4Z + 3. The sum, differenceand product belong to the same congruence classesas they did in the previous part. This is no accident,as we now see: (d) a = α + kn, b = β + k′n for somek, k′ ∈ Z. Therefore a+b = (α+β)+(k+k′)n, a−b =(α−β)+(k−k′)n, ab = αβ+(αk′+βk+kk′)n. Hence,a + b ≡ α + β (mod n), a − b ≡ α − β (mod n), andab ≡ αβ (mod n)

‘Finite’ Arithmetic

We are now in a position to

do arithmetic with congruence

classes.

(1.9) Adding, subtracting and multiplyingcongruence classes We now define three binary op-erations on the set Zn:

• Addition: (nZ + a) + (nZ + b) = nZ + (a + b)

• Subtraction: (nZ+a)− (nZ+ b) = nZ+(a− b)

• Multiplication: (nZ + a)(nZ + b) = nZ + ab

Warning: We can write the congruence class nZ+min many ways, e.g. 4Z + 3 = 4Z + 11 = 4Z − 9 andany one of the infinitely many elements in nZ + mcan play the role of the representative m. Since wehave used particular representatives to define addi-tion, subtraction and multiplication, we had bettercheck that we get the same answers when any otherrepresentatives are used.

8

Page 10: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Why it Works

The equations here show that

the definitions of addition, sub-

traction and multiplication do

not depend on how we represent

the congruence classes involved.

This is what we mean by say-

ing that the operations are well-

defined.

(1.10) Questions to show that addition, sub-traction, and multiplication are well-definedAssume that a, b, α and β are integers such that

nZ + a = nZ + α

nZ + b = nZ + β

Use (1.8)(d) and (1.5)(d) to prove that

• nZ + (a + b) = nZ + (α + β)

• nZ + (a − b) = nZ + (α − β)

• nZ + ab = nZ + αβ

ReminderIn (1.5)(e) we proved that

nZ + a = nZ + b ⇐⇒ a ≡ b

Answers to (1.10) By (1.5)(e), a ≡ α (mod n) andb ≡ β (mod n). Therefore, by (1.8)(d), a + b ≡α + β (mod n), a − b ≡ α − β (mod n) and ab ≡αβ (mod n). The result follows immediately from(1.5)(e)

The group structure of (Zn, +)

depends crucially on the group

structure of (Z, +).

(1.11) Remarks about group structure

(a) We proved in Foundations/Sets and Groups that(Zn, +) is a commutative group, with nZ as theneutral element 0 and nZ + (−r) the inverse ofnZ + r.

(b) Multiplication is a binary operation on Zn whichsatisfies the commutative and associative laws andhas a neutral element.

(c) However, when n > 1, Zn is not a group withrespect to multiplication because nZ, the neutralelement, does not have an inverse.

(d) The set Z∗

n = Zn\nZ of non-zero classes is a groupunder multiplication if and only if n is prime.(This fact will be justified later.)

9

Page 11: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Warning

The symbol r now has two mean-

ings: its usual meaning as the in-

teger r and its new meaning as

the congruence class nZ + r of

Zn.

(1.12) A new notation for the elements of Zn

We saw in (1.5) that each element nZ + m of Zn

contains a unique integer r such that nZ+m = nZ+rand 0 ≤ r < n. We now denote the congruence classnZ + r simply by r, so that

Zn = {0, 1, . . . , r − 1}

To avoid ambiguity we need new symbols +n and×n to denote the binary operations of addition andmultiplication in Zn. Thus,

r +n s = nZ + (r + s)

r ×n s = nZ + rs

(1.13) Example

12Z − 3 = 12Z + 9 = 9

12Z + 20 = 12Z + 8 = 8

9 +12 8 = 12Z + 17 = 12Z + 5 = 5

9 ×12 8 = 12Z + 72 = 12Z + 0 = 0

Reminder

In Part (g) of (1.14) the notation

Z∗

5 means the set of four non-zero

elements of Z5.

(1.14) Questions on the new labels{0, 1, . . . , n − 1} for the elements of Zn

(a) Write down the “new labels” for 4Z + 2, 4Z +3, 4Z + 5 and 4Z + 6.

(b) Find the unique r in (4Z+2)+(4Z+3) satisfying0 ≤ r ≤ 3.

(c) What is 2 +4 3 and 2 ×4 3?

(d) Which elements of Z6 = {0, 1, . . . , 5} represent1 +6 2 +6 . . . +6 5 and 1 ×6 2 ×6 . . . ×6 5?

(e) Quickly work out 99 ×100 99 ×100 . . . ×100 99 (99terms) in Z100.

(f) In Zn, show that r+n s is either r+ s or r+ s−n.

(g) Using the notation of (1.12), construct the addi-tion table for (Z5, +5) and the multiplication tablefor (Z∗

5,×5).

10

Page 12: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Answers to (1.14) (a) 2, 3, 1, 2, (b) r = 1, (c) 2 +4

3 = 1, 2 ×4 3 = 2, (d) 3, 0, (e) Working modulo 100,we have 99 ≡ −1 and therefore 9999 ≡ (−1)99 =−1 ≡ 99, (f) Since 0 ≤ r, s < n, either 0 ≤ r + s < n,in which case r +n s = nZ + (r + s) = r + s, orn ≤ r+ s < 2n, in which case r+n s = nZ+(r+ s) =nZ + (r + s) − n = (r + s) − n. (g)

+5 0 1 2 3 40 0 1 2 3 41 1 2 3 4 02 2 3 4 0 13 3 4 0 1 24 4 0 1 2 3

×5 1 2 3 41 1 2 3 42 2 4 1 33 3 1 4 24 4 3 2 1

(1.15) We have looked at the arithmetic of congru-ences from two different viewpoints. The first focusedon the congruence classes modulo n as the objects tobe added, subtracted, multiplied (and later on, di-vided). The second emphasised a set of labels for thecongruence classes 0, 1, . . . , (n − 1) which we manip-ulated according to the standard rule:

Calculate in Z and reduce modulo n.

The first approach contains an idea of dramatic im-portance, capable of powerful generalisation through-out mathematics (the idea of a quotient structure).The second approach is just a conventional practicalnotation for carrying out the calculations implied bythe first.

11

Page 13: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Summary of Section 1

Let n be a natural number.

• The congruence class nZ+m consists of the (infinitely many) integersthat are congruent to m modulo n.

• nZ + m = nZ + s for all s ∈ nZ + m.

• nZ + m contains a unique integer r satisfying 0 ≤ r < m. Everyinteger in nZ + m leaves a remainder r when divided by n.

• The sum of two congruence classes (nZ + a) + (nZ + b) is defined tobe the congruence class containing a + b, namely nZ + (a + b). The

definition does not depend on the choice of the representatives a andb. The same applies to the difference and product.

• If we denote nZ + r simply by r when 0 ≤ r < n, then Zn ={0, 1, . . . , r − 1}. Furthermore, the sum (difference, product) of twocongruence classes described this way is denoted by +n (−n,×n) to

distinguish it from the usual sum (difference, product) of two integers.Thus, for instance,

s −n t = nZ + (s − t)

where s and t on the left hand side of the equation denote elements

of Zn and on the right-hand side denote ordinary integers.

• In practice, the sum/difference/product of two elements s, t of Zn is

the remainder when the sum/difference/product of the integers s andt is divided by n.

12

Page 14: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

A solution to the birthday problemI (TOH) will illustrate the solution with my own birthday. I am writing this on Tuesday,17th March, 1998. I was born on 24th October, 1936. Let’s label the days of the week0, . . . , 6 starting with Monday as 0, and suppose that I was born on day d (0 ≤ d ≤ 6). Ifm days have passed since my birthday, then m + d ≡ 1 (mod 7) since today (Tuesday) isday 1. I need only calculate m modulo 7. Between my birthday and 24th October, 1997some 61 years have elapsed. The number of days in a normal year is 365 ≡ 1 (mod 7)and in a leap year 366 ≡ 2 (mod 7). Since 15 of the 61 years were leap years, the numberof days from 24/10/36 to 24/10/97 is congruent to

15 × 2 + (61 − 15) = 76 ≡ 6 (mod 7)

The number of days from 24/10/97 to today is congruent to 7(for Oct) +2(for Nov)+3(for Dec) +3(for Jan) +0(for Feb) +17(for Mar) = 32 ≡ 4 (mod 7). Putting these twocalculations together gives

m ≡ 6 + 4 ≡ 3 (mod 7)

and so 1 ≡ m + d ≡ 3 + d (mod 7). Hence, d ≡ 1− 3 = −2 ≡ 5 (mod 7), and therefore Iwas born on day 5 of the week, that is to say a Saturday. (I knew this anyway, becausemy mother told me that I was “Saturday’s child” that “works hard for a living”. Butusing modular arithmetic is less hard work than counting the days on your fingers!)

Exercise Work out the day of the week on which you were born. (Leap years are theones that are divisible by 4 excepting those divisible by 100 but including those divisibleby 400. The year 2000 was a leap year!)

13

Page 15: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

2 Solving Linear CongruencesMotivation: Return to the second project at the start of Section 1. Assign thenumbers 0, 1, . . . , 11 to the twelve frisbee players, counting in a clockwise direction.Assume that the frisbee starts with player 0 and is always thrown to the player a placesto the left (assuming the players are facing inwards). After x turns, the frisbee hasmoved ax places beyond its starting point and has therefore reached the player whosenumber is congruent to ax modulo 12. To ensure that every player gets a turn we mustbe able to solve the congruence

ax ≡ b (mod 12) (2.a)

for all values of b between 0 and 11

Section Targets To investigate solutions of the lin-ear congruence

ax ≡ b (mod n) (2.b)

where n is a natural number. (By a solution we meanan integral value of x satisfying this congruence forgiven integers a and b.) Specifically, we will do twothings:

(a) Decide for what values of a and n there is a solu-tion for all possible values of b. (In frisbee terms,this amounts to deciding for what number of play-ers and what length of throw we are guaranteedthat each player will get a turn.)

(b) Given a, b and n, decide whether or not there is asolution x. (this amounts to deciding whether aparticular player in a given frisbee game will geta turn.)

14

Page 16: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Note: If r ≡ s (mod n), then

rx ≡ sx (mod n). Hence, for in-

stance, 71x ≡ x (mod 7).

(2.1) Questions on some special cases of (2.b)

(a) By trial and error or simple cunning, find a so-lution to the following congruences whenever asolutions exists.

(i) 2x ≡ 3 (mod 5)

(ii) 2x ≡ 3 (mod 6)

(iii) 771x ≡ 71 (mod 7)

(iv) 22x ≡ 1 (mod 23)

(b) If x0 is the solution you found to congruence (i),check whether x0 +5 and x0−5 are also solutions.Deduce that (i) has infinitely many solutions.

(c) Describe all the solutions to congruence (iv) inpart (a).

Observe that the congruence

x ≡ y (mod n)

is equivalent to

−x ≡ −y (mod n).

Answers to (2.1)

(a)(i) x = 4

(ii) No solution because 2x− 3 is odd and cannotbe divisible by 6.

(iii) x = 1

(iv) x = −1

(b) The values x = 4 + 5 = 9 and x = 4 − 5 = −1both satisfy 2x ≡ 3 (mod 5). By induction thevalues 4+5n satisfy the congruence for all n ∈ Z.

(c) Since 22 ≡ −1 (mod 23), the congruence canbe written −x ≡ 1 (mod 23). Hence x ≡ −1(mod 23), and therefore x = 23n − 1 for somen ∈ Z. So the set of solutions is 23Z − 1.

15

Page 17: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(2.2) Questions on linear congruences with nosolution

(a) Find values of b for which the following linearcongruences have no solutions;

(i) 3x ≡ b (mod 6)

(ii) 14x ≡ b (mod 7)

(iii) 4x ≡ b (mod 8)

(iv) 10x ≡ b (mod 30)

(b) Now find all values of b for which the four congru-ences in (a) do have solutions.

A pattern is emerging here. Try

to formulate a necessary and suf-

ficient condition for the congru-

ence ax ≡ b (mod n) to have a

solution.

Answers to (2.2) Congruence (i) has no solutionswhen b is not a multiple of 3, for then 3x − b isnot divisible by 3 and therefore certainly not divis-ible by 6. The congruence (i) has a solution whenb = 0,±3,±6, . . .. Congruence (ii) can be rewritten0 = 0.x ≡ b (mod 7), and therefore has solution ifand only if b ∈ 7Z. Congruence (iii) has no solutionswhen b is odd or twice an odd number. It has a so-lution if b = 4c for some c ∈ Z. Congruence (iv) hasno solutions when b is not divisible by 2 or by 5. Ithas solutions when 10|b.

The following idea will give us a useful way of lookingat the congruence ax ≡ b (mod n):

A residue is an old-fashioned

word for a ‘remainder’.

(2.3) Definition Let n be a natural number. A com-plete set of residues modulo n is a subset S of Z con-taining exactly one element from each of the distinctcongruence classes,

nZ, nZ + 1, . . . , nZ + n − 1

Evidently S = {0, 1, . . . , n − 1} is a complete set ofresidues modulo n.

16

Page 18: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Hint for (c)Suppose a ∈ Z. Then

a ≡ r (mod n)

for some 0 ≤ r < n. It follows

from (1.8)(d) that a2 = r2 for

some 0 ≤ r < n.

(2.4) Questions on complete sets of residues

(a) Which of the following sets form a complete setof residues modulo 5?

(i) {−5,−4,−3,−2,−1}

(ii) {11, 22, 33, 44, 55}

(iii) {0,−1, 2,−3, 4}

(iv) {12, 22, 32, 42, 52}

(b) Find a complete set of residues modulo 6

(i) lying in the range (−110,−101),

(ii) consisting of integers differing from each otherby at least 100, and

(iii) lying in an arithmetic progression with com-mon difference 7.

(c) Is there a complete set of residues modulo p con-sisting of perfect squares

(i) when p = 7?

(ii) for any prime p?

Answers to (2.4)

(a)(i) Yes! The members of the sequence are con-gruent respectively to {0, 1, 2, 3, 4}; in fact anysequence of five consecutive integers is a com-plete set of residues modulo 5.

(ii) Yes.

(iii) No. (−1 ≡ 4 and 2 ≡ −3 (mod 5))

(iv) No. (42 = 16 ≡ 1 = 12 (mod 5))

(b)(i) {−106,−105,−104,−103,−102,−101} for in-stance.

(ii) {0, 101, 202, 303, 404, 505} for instance.

(iii) {0, 7, 14, 21, 28, 35} are congruent respec-tively to {0, 1, 2, 3, 4, 5} (mod 6).

(c)(i) No. For p = 7, each element of sucha set would be congruent to one of02, 12, 22, 32, 42, 52, 62 and hence to one of0, 1, 4, 2, 2, 4, 1 modulo 7. This is not a com-plete set of residues.

(ii) For p = 2, we have {02, 12}, but we shall seelater that for p ≥ 3 there is no complete set ofresidues consisting of perfect squares.

17

Page 19: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(2.5) Question characterising a complete set ofresidues (CSR) Let n ∈ N and S ⊆ Z. Prove thatthe following two conditions are together necessaryand sufficient for S to be a CSR modulo n.

(a) |S| = n and

(b) no two elements of S are congruent modulo n.

Answer to (2.5) Suppose |S| = n. Then S is not aCSR iff there exists a, b ∈ S such that a, b ∈ nZ + rfor some 0 ≤ r ≤ n − 1 which is the case iff a ≡ b(mod n) by (1.6)(d).

Something to note:

If b ≡ β (mod n) then ax ≡

β (mod n) iff ax ≡ b (mod n).

Furthermore, if a ≡ α (mod n)

and x ≡ y (mod n) then ax ≡

αy by 1.6. It follows that ax ≡ b

(mod n) iff αy ≡ b (mod n).

Given a, b and n, we wish to decide whether the linearcongruence

ax ≡ b (mod n)

has solutions. A key step in working this out is tofirst decide for what values of a and n the congruence

ax ≡ b (mod n)

has a solution x for all b. To make life easier, wenotice that the problem does not change if a, b andx are replaced with congruent values (mod n). (Fora justification of this statement, see the box on theleft.) When convenient, we can assume without lossof generality that a, b or x all lie in the set Sn ={0, 1, 2, . . . , n − 1}, i.e. that 0 ≤ a, b, x ≤ n − 1.

Now back to the problem of deciding when ax ≡ b(mod n) has a solution for all b. First notice that ifwe multiply the elements of Sn = {0, 1, 2, . . . , n − 1}by a we get a new set,

aSn = {0, a, 2a, . . . , (n − 1)a}

and so there will be solutions x ∈ Sn for all choicesof b ∈ Sn iff aSn contains elements congruent to eachelement of Sn, in other words iff aSn is a complete setof residues modulo n.

18

Page 20: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(2.6) Questions on when aSn is a complete setof residues Let n ∈ N and let Sn = {0, 1, . . . , n− 1}denote the basic set of residues modulo n.

(a) For each of the following values of n compute theset

aSn = {0, a, 2a, . . . , (n − 1)a}

for each a ∈ Sn and find all values of a for whichaSn is a complete set of residues modulo n.

(i) n = 4 (ii) n = 5 (iii) n = 6

(b) Use your calculations to decide whether the fol-lowing equations have a solution for all b ∈ Sn

and to find the value of x corresponding to eachb when a such solution exists.

(i) 3x ≡ b (mod 4)

(ii) 3x ≡ b (mod 5)

(iii) 3x ≡ b (mod 6)

(c) For n = 4, 5, 6 calculate hcf{a, n} for the valuesof a where,

(i) aSn is a complete set of residues (CSR)

(ii) aSn is not a CSR.

(d) Make a conjecture for a condition on a and n thatensures the congruence ax ≡ b (mod n) has a so-lution for all b ∈ Sn.

19

Page 21: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Note our use of the notation{0, 2, 4, 8} ≡ {0, 2} to mean thatthe elements of the first set areall congruent modulo n = 4 tothe elements in the second set.To save space, let’s agree towrite,

x ≡ y (n)

instead of

x ≡ y (mod n)

in future.

Answers to (2.6)

(a)(i) n = 4.

0.S4 = {0} is not a CSR

1.S4 = {0, 1, 2, 3} is a CSR

2.S4 = {0, 2, 4, 6} ≡ {0, 2} is not a CSR

3.S4 = {0, 3, 6, 9} ≡ {0, 3, 2, 1} is a CSR

Hence, aS4 is a CSR for a = 1, 3, but not fora = 0, 2

(ii) n = 5.

0.S5 = {0} is not a CSR

1.S5 = {0, 1, 2, 3, 4} is a CSR

2.S5 = {0, 2, 4, 6, 8}

≡ {0, 2, 4, 1, 3} is a CSR

3.S5 = {0, 3, 6, 9, 12}

≡ {0, 3, 1, 4, 2} is a CSR

4.S5 = {0, 4, 8, 12, 16}

≡ {0, 4, 3, 2, 1} is a CSR

Hence aS5 is a CSR for all a 6= 0.

(iii) n = 6.

0.S6 = {0} is not a CSR

1.S6 = {0, 1, 2, 3, 4, 5} is a CSR

2.S6 = {0, 2, 4, 6, 8, 10}

≡ {0, 2, 4} is not a CSR

3.S6 = {0, 3, 6, 9, 12, 15}

≡ {0, 3} is not a CSR

4.S6 = {0, 4, 8, 12, 16, 20}

≡ {0, 4, 2} is not a CSR

5.S6 = {0, 5, 10, 15, 20, 25}

≡ {0, 5, 4, 3, 2, 1} is a CSR

Hence aS5 is a CSR only for a = 1, 5.

20

Page 22: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

continued. . .

(b)(i) 3.S4 is a CSR and from calculations we seethat

3 × 0 ≡ 0(4) 3 × 3 ≡ 1(4)3 × 2 ≡ 2(4) 3 × 1 ≡ 3(4)

(ii)3 × 0 ≡ 0(5) 3 × 2 ≡ 1(5)3 × 4 ≡ 2(5) 3 × 1 ≡ 3(5)3 × 3 ≡ 4(5)

(iii) 3x ≡ 2 (mod 6) has no solutions for instance.

(c) n = 4:When a.S4 is a CSR, hcf{1, 4} = hcf{3, 4} =1. When aS4 is not a CSR, hcf{0, 4} =4, hcf{2, 4} = 2.n = 5:hcf{1, 5} = hcf{2, 5} = hcf{3, 5} = hcf{4, 5} = 1when aS5 is a CSR, hcf{0, 5} = 5 when aS5 is nota CSR.n = 6:When aS5 is a CSR, hcf{a, 6} = 1. Otherwise,hcf{2, 6} = 2, hcf{3, 6} = 3, hcf{4, 6} = 2

(d) Conjecture: The linear congruence,

ax ≡ b(n)

has solutions for all b ∈ Sn iff hcf{a, n} = 1.

We now want to prove the following:

(2.7) Lemma Let a and n be integers withhcf{a, n} = 1. Then

n divides ab if and only if n divides b.

21

Page 23: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Euclidean AlgorithmThis gives you a procedure forfinding the highest common fac-tor of two numbers. You canread all about it in your Sets andGroups/Foundations notes. Oneconsequence of the Euclidean al-gorithm is that if a and b are in-tegers, then there exist integersu and v such that

hcf{a, b} = ua + vb

We could appeal to the Fundamental Theorem ofArithmetic (FTA), factorising a and b in productsof prime powers and observing that the conditionhcf{a, n} = 1 implies that the primes involved in nare distinct from those involved in a. Then unique-ness of factorisation in the equation,

mn = ab

forces the prime powers in a to appear as prime pow-ers in m. But we are using a sledgehammer to cracka nut. A better approach (because it is both shorterand more basic) is to use the following consequenceof the Euclidean algorithm (which is also used in astandard proof of the FTA):

There exist integers u and v such that

ua + vn = hcf{a, n} = 1 (2.c)

Hint: If n divides ab, then n di-

vides uab + vnb.

(2.8) Question Prove Lemma 2.7

Answer to (2.8) The statement ‘n|b’ means b = cnfor some c ∈ Z. Hence ab = (ac)n and so n|ab.The statement ‘n|ab’ means ab = mn for some m ∈ Z.Hence uab + vnb = umn + vnb = (um + vb)n, and son divides uab + vnb = (ua + vn)b = 1.b = b.

We are now ready to prove the following theorem:

(2.9) Theorem Let n ∈ N and let a, b ∈ Z. Thelinear congruence,

ax = b (mod n)

has a solution for all values of b if and only ifhcf{a, n} = 1.

22

Page 24: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

By a contrapositive argument,

Step 1 shows that if ax ≡ b

(mod n) has a solution for all b,

then hcf{a, b} = 1.

(2.10) Question leading to a proof of Theo-rem 2.9 Fill in the details of the following proof:Step 1: If d = hcf{a, n} > 1 then d does not divideax − 1 and so ax ≡ 1(n) has no solution.Step 2: If hcf{a, n} = 1, then the elements of aSn ={0, a, 2a, . . . , (n−1)a} are pairwise incongruent mod-ulo n.Step 3: Hence the set aSn is a complete set of residues.Step 4: Therefore ax ≡ b (mod n) has a solution foreach b ∈ Z.

Answers to (2.10) Step 1: If d divides a, then d di-vides ax. If d were also a divisor of ax − 1, it woulddivide ax− (ax− 1) = 1, contrary to the suppositionthat d > 1. Finally ax ≡ 1(n) means that n, andtherefore every divisor of n, divides ax− 1; in partic-ular, d|ax − 1, which is not the case.Step 2: Suppose ra ≡ sa(n) with 0 ≤ r, s,≤ n − 1.Then n divides ra − sa = (r − s)a. It follows fromlemma 2.7 that n|(r − s), which forces r = s since|r − s| < n.Step 3: Since aSn = {0, a, 2a, . . . , (n − 1)a} containsn pairwise incongruent integers, it follows from (2.5)that aSn is a complete set of residues modulo n.Step 4: Consequently, aSn contains an element axwhich is congruent to b for any b ∈ {0, 1, . . . , n − 1}and hence for any b whatsoever.

We can now give the complete answer to the question,“when does the linear congruence ax ≡ b (mod n)have a solution?”

(2.11) Theorem Let n ∈ N and let a, b ∈ Z. Thelinear congruence

ax ≡ b (mod n)

has a solution if and only if

hcf{a, n} divides b (2.d)

23

Page 25: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(2.12) Question leading to a proof of Theo-rem 2.11 Fill in the details of the following proof:Let d = hcf{a, n} and write a = da and n = dn, ob-serving that hcf{a, n} = 1 (convince yourself of this).Step 1: If ax ≡ b(n) for some x ∈ Z, show that ddivides ax and ax − b and hence that d divides b.Step 2: Now suppose that d divides b and write db =b. Show that ax ≡ b(n) if

ax ≡ b(n) (2.e)

Step 3: Use Theorem 2.9 to conclude the proof.

Answers to (2.12) Step 1: We know d divides a,therefore d divides ax. Also d divides n and n dividesax − b, therefore d divides ax − b. Hence d dividesax − (ax − b) = b.Step 2: If ax ≡ b(n), then ax−b = nc for some integer

c. Consequently ax − b = d(ax − b) = dnc = nc, andso ax ≡ b(n).Step 3: Since hcf{a, n} = 1, congruence (2.e) has asolution and therefore ax ≡ b(n) has a solution byStep 2.

Project for further investigation If the congru-ence ax ≡ b (mod n) has a solution, it has infinitelymany solutions. Give a complete description of allthe solutions in this case.

Summary of Section 2

During the section, we worked steadily towards a necessary and sufficientcondition for the linear congruence

ax ≡ b (mod n)

to have a solution x ∈ Z, and came up with the answer: There exists asolution iff

hcf{a, n} divides b

We also discovered that ax ≡ b (mod n) has a solution for all b iffhcf{a, n} = 1. On the way we introduced and explored the fruitful idea ofa Complete Set of Residues (CSR) modulo n. We also used a consequenceof the Euclidean algorithm to prove that if n divides ab and hcf{a, n} = 1,then n divides b.

24

Page 26: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Solution to the Frisbee ProblemWe can now answer the question formulated at the beginning of this section in relationto Project (b). Every player gets a turn iff the congruence,

ax ≡ b (mod 12)

has a solution for all b ∈ {0, 1, . . . , 11}. By Theorem 2.9, this happens when hcf{a, 12} =1, i.e. for all a that are coprime with 12. These are precisely the integers in the congruenceclasses

12Z + 1, 12Z + 5, 12Z + 7, 12Z + 11.

Thus, everyone gets a turn if and only if the frisbee is consistently thrown either 1, 5, 7 or11 places round the circle (in either direction).Now decide, for the remaining values of a, which players get a turn.

25

Page 27: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

3 Moving the action to Zn

Section Targets

(a) To translate the work of the previous section tothe ringa

Zn = {0, 1, . . . , n − 1}

(b) To discuss,

• the concept of a unit in Zn

• the fact that these units form a group

• Euler’s phi-function, which determines theorder of this group

• Euler’s Theorem

• a special case, known as Fermat’s Little The-orem

aA ring is a set R with 2 binary operations: addition (+)and multiplication (juxtaposition). (R, +) has to be a commu-tative group, and the distributative laws must hold. Keep inmind Z as a prototype of a ring.

The congruence,

ax ≡ b (mod n) (3.a)

means that ax and b belong to the same congruenceclass and so nZ + ax = nZ + b. The rule for multi-plying congruence classes (see 1.9) gives nZ + ax =(nZ+a)(nZ+x), and if we suppose WLOG that a, xand b lie between 0 and n − 1 and then use the labela for the class nZ + a, etc. the congruence (3.a) canbe rewritten

a ×n x = b (3.b)

with a, x, b ∈ {0, 1, . . . , n − 1}.

Change of notation Let’s now agree to abandonthe fastidious notation +n and ×n and revert to themore familiar + (for addition in Zn as well as in Z)and juxtaposition (for multiplication in Zn as well asin Z). It will introduce ambiguity, but we will usuallybe able to see from the context whether we are work-ing in Zn or in Z. In this section, the emphasis willdefinitely be on Zn for some fixed n ∈ N. The abovetranslation from ‘congruences in Z’ to ‘equations inZn’ means we can rewrite Theorem 2.11 as follows.

26

Page 28: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(3.1) Theorem Let n ∈ N and let a, b ∈ Zn. Thenthe equation,

ax = b (3.c)

has a solution x ∈ Zn if and only if (now regarding aand b as integers) hcf{a, n} divides b.

Definition: The elementsu ∈ Zn such that uv = 1 forsome v ∈ Zn are called the units

of Zn.

Notice that unless n = 1, the ele-

ment 0 can never be a unit, which

is why we look for units in the

multiplication table of Z∗

n, rather

than in that of Zn

(3.2) Question about addition and multiplica-tion in Zn

(a) Complete the multiplication table for Z∗

n =Zn\{0} when n = 4 and n = 6 (you did n = 5 in(1.14)).

(b) Using the multiplication tables, list all the ele-ments u in Zn for which uv = 1 for some v in Zn

when n = 4, 5 and 6.

Observe that in the multiplica-

tion table of Z∗

n, every row and

every column contains either a 1

or a 0 but not both. Why do you

think this is?

Answers to (3.2)

(a)(i) ×4 1 2 31 1 2 32 2 0 23 3 2 1

(ii) ×6 1 2 3 4 51 1 2 3 4 52 2 4 0 2 43 3 0 3 0 34 4 2 0 4 25 5 4 3 2 1

(b) To find the pairs u and v with uv = 1, we lookfor 1’s in the multiplication tables:

(i) 1 and 3 are the units of Z4

(ii) 1, 2, 3 and 4 are all units of Z5

(iii) 1 and 5 are the units of Z6

27

Page 29: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

An element u in Zn is a unit iff the equation ux = 1has a solution, and by Theorem 3.1 this happens ifand only if hcf{u, n} = 1. This tells us exactly whatthe units of Zn are.

(3.3) Proposition The units of Zn are those ele-ments u ∈ {1, 2, . . . , n − 1} such that hcf{u, n} = 1.

(3.4) Notation For n ≥ 2, we will denote the set ofunits of Zn by Un. Thus

u ∈ Un if and only if hcf{u, n} = 1

(3.5) Questions about units

(a) Show that Un 6= ∅ for n ≥ 2

(b) Write down the units of

(i) Z8 (ii) Z9 (iii) Z10.

(c) Use the empty tables in the answer box below tofill in multiplication tables for U8, U9, U10.

(d) For each unit u in U8, work out the smallest nat-ural number m such that um = 1 (the order ofu).

(e) Now do the same for U10.

28

Page 30: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

In Z1 we find that 1 = 0, so the

concept of a unit gets a bit silly.

Notice that the entries in these

tables all belong to Un (n =

8, 9, 10). Thus multiplication is

a binary operation on Un. Why?

Answers to (3.5)

(a) If n ≥ 2, then 1 is a unit in Zn.

(b)(i) The units in Z8 are the elements in{1, 2, . . . , 7} which are coprime to 8, in otherwords, the odd numbers 1, 3, 5 and 7.

(ii) U9 = {1, 2, 4, 5, 7, 8}

(iii) U10 = {1, 3, 7, 9}

(c)

×8 1 3 5 71 1 3 5 73 3 1 7 55 5 7 1 37 7 5 3 1

×10 1 3 7 91 1 3 7 93 3 9 1 77 7 1 9 39 9 7 3 1

×9 1 2 4 5 7 81 1 2 4 5 7 82 2 4 8 1 5 74 4 8 7 2 1 55 5 1 2 7 8 47 7 5 1 8 4 28 8 7 5 4 2 1

continued. . .

(d) The non-identity units in Z8 all have order 2 (notethe 1’s down the diagonal).

(e) In Z10 1 has order 1, 9 has order 2, while 3 and 7have order 4.

In the previous question we saw that the product oftwo units in Zn, (n = 8, 9, 10) is another unit. Thereason is not hard to find. Let u1 and u2 be units inZn . Then u1v1 = 1 = u2v2 for suitable v1, v2 in Zn .Hence

(u1u2)(v1v2) = u1v1u2v2 = 1,

and it follows that u1u2 is also a unit in Zn . We havetherefore justified the following.

(3.6) Proposition Multiplication on Un is a binaryoperation; in other words, Un is closed under multi-plication.

29

Page 31: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Evidently (Un,×) has a neutral element 1, and everyelement u has an inverse v such that uv = vu = 1.The associative law for Un follows from the corre-sponding law for multiplication in Z. To spell thisout in detail,

A similar argument shows that

the commutative law for Un

(uv = vu) follows from the cor-

responding law for multiplication

in Z.

(uv)w = ((nZ + u)(nZ + v))(nZ + w)

= (nZ + uv)(nZ + w)

= nZ + (uv)w

= nZ + u(vw)

= (nZ + u)(nZ + vw)

= (nZ + u)((nZ + v)(nZ + w))

for all u, v, w,∈ Un. We have therefore justified thefollowing theorem.

(3.7) Theorem If n ≥ 2, the set Un is a commu-tativea group with respect to the binary operation ofmultiplication in Zn.

aRecall that a group satisfying the commutative law iscalled abelian after the Norwegian mathematician, Niels Hen-rik Abel (1802-1829)

The order |Un| of Un (i.e. the number of elements inUn) is given by Euler’s so-called phi-function,

φ : N −→ N

which is defined as follows:

(3.8) Definition

(a) An integer m is said to be relatively prime (orcoprime) to an integer n if hcf{m, n} = 1.

(b) For all n ∈ N, the value of φ(n) is the numberof positive integers not exceeding n that are rela-tively prime to n. In symbols, we have

φ(n) = |{m ∈ N : m ≤ n, hcf{m, n} = 1}|

We note in particular the following consequencesof this definition:

30

Page 32: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

(3.9) Corollary

(a) φ(1) = 1, and

(b) for n ≥ 2, the value of φ(n) is equal to |Un|, theorder of the group of units of Zn.

Two groups G and H are iso-

morphic if there is a bijection

f : G → H such that f(g1g2) =

f(g1)f(g2) for all g1, g2 ∈ G.

This is equivalent to saying that

there is a way of pairing off their

elements so that their multiplica-

tion tables look the same.

(3.10) Questions on φ(n)

(a) Work out φ(n) for 1 ≤ n ≤ 24.

(b) Write down the values of n in (a) with φ(n) =n − 1.

(c) What do you notice about the answer in (b)?

(d) Work out the orders of each of the elements in U5

and U10.

(e) We can identify U5 as a cyclic group by writing:

U5 = {1, 2, 3, 4} = {20, 21, 22, 23}

(since 23 = 3). Write U10 in a similar way andshow that the groups U5 and U10 are isomorphic.

Part (d) of (3.10) is a special case

of the fact that two cyclic groups

of the same order are isomorphic.

If G = {gi : 0 ≤ i ≤ n − 1} and

H = {hi : 0 ≤ i ≤ n − 1}then

the map f : gi → hi is an iso-

morphism.

Answers to (3.10)

(a)n 1 2 3 4 5 6 7 8

φ(n) 1 1 2 2 4 2 6 4

n 9 10 11 12 13 14 15 16φ(n) 6 4 10 4 12 6 8 8

n 17 18 19 20 21 22 23 24φ(n) 16 6 18 8 12 10 22 8

(b) n = 2, 3, 5, 7, 11, 13, 17, 19, 23

(c) They are precisely the prime values of n.

(d) In U5, 1 has order 1, 2 and 3 have order 4, and 4has order 2. In U10, 1 has order 1, 3 and 7 haveorder 4, and 9 has order 2.

(e) U10 = {1, 3, 7, 9} = {30, 31, 32, 33}, so the mapf : U5 → U10 defined by f(2i) = 3i is the desiredisomorphism.

31

Page 33: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Look for Lagrange’s Theorem

in your Foundations (Sets and

Groups) notes.

Recall: The order of a groupis the number of elements in thegroup. The order of a group el-ement g is the smallest naturalnumber m such that gm = 1.Consequently, the order of g isalso the order of

< g >= {1, g, g2, . . . , gm−1},

the subgroup generated by g.

If g is an element of order m in a group G (i.e.gm = 1), the powers 1, g, g2, . . . , gm−1 of g form asubgroup of G with m elements. (This is called thecyclic subgroup generated by g and is sometimes de-noted by <g>.) Lagrange’s Theorem states that theorder of a subgroup divides the order of the parentgroup. Hence m = |<g> | divides |G| and so

the order of a group is divisible by the orders ofeach of its elements.

A special case of this states that if u is a unit in Zn,then the order m of u divides the order φ(n) of thegroup of units Un, in other words, φ(n) = mm′ forsome m′ ∈ N. In particular, uφ(n) = umm′

= (um)m′

=1m′

= 1. This is the content of our next result.

(3.11) Euler’s Theorem

(a) If u is a unit in Zn, then uφ(n) = 1.

(b) For any integer m relatively prime to n,

mφ(n) ≡ 1 (mod n)

Part (b) of (3.11) is simply a restatement of part (a)in the language of congruences. If m = kn + m0,then hcf{m, n} = hcf{m0, n} (convince yourself ofthis). Suppose that hcf{m, n} = 1 and let m0 denotethe remainder when m is divided by n (1 ≤ m0 < n).Then

mφ(n) ≡ mφ(n)0 (mod n) (3.d)

and regarding m0 as an element of Un (sincehcf{m0, n} = 1), we have the following equation inZn:

mφ(n)0 = 1.

This equation can be written in the notation of con-gruences (with m0 ∈ Z) thus:

mφ(n)0 ≡ 1 (mod n). (3.e)

Part (b) is now the conjunction of the congruences(3.d) and (3.e).

32

Page 34: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

The special case when n is prime Now let n = p,a prime. If 1 ≤ u ≤ p − 1, evidently hcf{u, p} = 1and therefore

Up = {1, 2, . . . , (p − 1)}

and φ(p) = p−1. (you may have observed in (3.10)(c)that φ(p) = p−1 in the case when p is a prime). Thisgives the following special case of Euler’s Theorem;

Notation

p 6 | m means ‘p does not divide

m’.

(3.12) Fermat’s Little Theorem Let p be a prime.

(a) If p 6 | m, then

mp−1 ≡ 1 (mod p).

(b) For all integers m

mp ≡ m (mod p).

Example

216 ≡ 1 (mod 17). Equivalently,

217 ≡ 2 (mod 17), i.e. 17 divides

217 − 2. Check this on your cal-

culator.

If p 6 | m, then hcf{m, p} = 1, so part (a) follows di-rectly from Euler’s Theorem. For all integers m, ‘ei-ther p divides m or p divides mp−1 − 1 from part (a).Equivalently, p divides m(mp−1 − 1) = mp − m, asrequired in part (b).

33

Page 35: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Remark There are many proofs of Fermat’s LittleTheorem. Here are two more in outline.

(a) Prove (3.12)(b) by induction on m. The inductionstep uses (i) the binomial theorem

(m + 1)p − (m + 1) =

(mp − m) +p C1mp−1 +p C2m

p−2 + . . . +p Cp−1m

and also the fact that (ii) when p is a prime, thebinomial coefficient pCr is divisible by p whenever1 ≤ r ≤ p − 1.

(b) If p 6 | m, then hcf{p, m} = 1, and by (2.10){m, 2m, . . . , (p−1)m} is a complete set of residuesmod p. Hence

m× . . .×(p−1)m ≡ 1×2× . . .×(p−1) (mod p)

ormp−1(p − 1)! ≡ (p − 1)! (mod p)

whence p divides (p−1)!(mp−1−1). Since p cannotdivide (p− 1)!, it must therefore divide mp−1 − 1.

(3.13) Question Requiring Fermat’s LittleTheorem Suppose p is an odd prime. Show that

1p + 2p + . . . + pp ≡ 0 (mod p)

Answer to (3.13) We have

1p + 2p + . . . + pp ≡ 1 + 2 + . . . + p (mod p)

= p(p + 1)

2≡ 0 (mod p)

since p is odd and so (p + 1)/2 is an integer.

34

Page 36: M A 2 4 6 - Chicks Dig X-Pecclux.x-pec.com/files/mathstuff/2ndyear/numbertheory/MA246_wbs_1_0... · Section Targets (a) To describe three of the four operations of finite arithmetic;

Summary of Section 3

• We saw how to switch between congruences in Z and equations inZn = {0, 1, . . . , n − 1}.

• We investigated the elements u in Zn for which uv = 1 for somev ∈ Zn. These units form a group Un with respect to multiplication.

• The order of the group is φ(n) equals the number of integers m coprimewith n in the range 1 ≤ m ≤ n.

• Lagrange’s Theorem tells us that the multiplicative orders of the unitsin Zn divide the group order |Un| = φ(n), which translated into the

language of congruences implies that mφ(n) ≡ 1 (mod n) wheneverhcf{m, n} = 1. This is known as Euler’s Theorem.

• Fermat’s Little Theorem, which states that mp ≡ m (mod p) for all

primes p and for all m ∈ Z, is a special case of Euler’s Theorem.

35