46
Lecture 1 An Introduction to Numbers Summary We started today by getting to know the policies and expectations in the course. All of this is available already on the syllabus, but if you have any questions don't be shy about emailing Andy. We also spent some time introducing ourselves briefly; this will be continued as you post your own profiles for Homework 0. Afterwards, we started talking about the basics in number theory, starting with the axioms. We finished by introducing the notion of divisibility for the integers. The Axioms of Number Theory When trying to build a mathematical discipline from the ground up, one needs to describe the fundamental objects and operations in the discipline and then define the basic properties these objects will obey. These properties are called axioms, and they are the "ground rules" the objects and operations must satisfy. With axioms in place, one can then start proving theorems by manipulating the axioms. In number theory, the basic objects of interest are integers. You might know these objects as whole numbers. In this class we'll denote the set of all integers as : (1) The basic operations we have on the integers are addition, subtraction and multiplication. We've avoided division since division doesn't behave very well on the integers: the quotient of two integers is frequently not another integer. We also have basic tools for comparing integers, namely equality and inequality. With the fundamental objects, operations and comparisons in place, we can start writing down the basic rules they all satisfy. Here's the list that we were able to come up with in class: for any (reflexivity of equality); for any , if and then (transitivity of equality); for any , implies (symmetry of equality); for any , the sum is an integer (closure under addition) [note: we didn't mention this in class]; 1

Teorija Na Broevi

Embed Size (px)

DESCRIPTION

Diskretna matematika

Citation preview

Page 1: Teorija Na Broevi

Lecture 1 An Introduction to Numbers

Summary

We started today by getting to know the policies and expectations in the course. All of

this is available already on the syllabus, but if you have any questions don't be shy

about emailing Andy. We also spent some time introducing ourselves briefly; this will

be continued as you post your own profiles for Homework 0. Afterwards, we started

talking about the basics in number theory, starting with the axioms. We finished by

introducing the notion of divisibility for the integers.

The Axioms of Number Theory

When trying to build a mathematical discipline from the ground up, one needs to

describe the fundamental objects and operations in the discipline and then define the

basic properties these objects will obey. These properties are called axioms, and they

are the "ground rules" the objects and operations must satisfy. With axioms in place,

one can then start proving theorems by manipulating the axioms.

In number theory, the basic objects of interest are integers. You might know these

objects as whole numbers. In this class we'll denote the set of all integers as :

(1)

The basic operations we have on the integers are addition, subtraction and

multiplication. We've avoided division since division doesn't behave very well on the

integers: the quotient of two integers is frequently not another integer. We also have

basic tools for comparing integers, namely equality and inequality.

With the fundamental objects, operations and comparisons in place, we can start

writing down the basic rules they all satisfy. Here's the list that we were able to come

up with in class:

for any (reflexivity of equality);

for any , if and then (transitivity of equality);

for any , implies (symmetry of equality);

for any , the sum is an integer (closure under addition) [note:

we didn't mention this in class];

1

Page 2: Teorija Na Broevi

for any , the product is an integer (closure under multiplication)

[note: we didn't mention this in class];

for any , (associativity of addition);

for any , (associativity of multiplication);

for any , (distributivity);

for any , (commutativity of addition);

for any , (commutativity of multiplication);

for any , (additive identity) [note: we didn't mention this in

class];

for any , (multiplicative identity) [note: we didn't mention this

in class];

for any there exists so that (additive identity);

for any with , then implies (cancellation of

multiplication);

for any , implies (substitution for multiplication);

for any , if and only if (substitution for a

cancellation of addition);

ddition;

for any , exactly one of the following is true (1) (2) (3)

(Trichotomy law);

for any , if then ;

for any , if and , then ;

for any , if and , then ; and

if is a nonempty set of positive integers, then has a least element (Well

ordering principle).

The last axiom — the well ordering principle — probably sticks out as the ugly

duckling of the bunch, and it certainly isn't one which most people think of when

rattling off basic properties of the integers. It is, however, essential to what we'll be

doing in class, as it is logically equivalent to mathematical induction — a tool that

we'll be using with some frequency in this course.

Playing around with the axioms

Our list of axioms is a little redundant, meaning that we could probably prove some of

the axioms we've listed in terms of the other axioms. In this sense, it doesn't pass the

usual mathematical aesthetic. To see that this is true, you can try to use the other

axioms listed above to prove

Theorem: For any ,

2

Page 3: Teorija Na Broevi

In class, we sketched a proof of the following result

Theorem: For any nonzero , if satisfies , then

Proof: We started by noting that we could assume a is either greater than or less than

0; by trichotomy we know that one of (1) (2) or (3) is true, and if

we had then we'd be done with the theorem. By a similar token we know that

or , since is ruled out by assumption. So we broke things into 4

cases based on whether or and whether or .

Case I: and

In this case, one of our axioms on inequality tells us that . This contradicts the

fact that , and so we know this case is impossible.

One could proceed with analyzing the other cases, each time you would find a

contradiction to the given equality . At the end, one concludes that all the

possibilities lead to a contradiction, and hence neither nor are possible.

This leaves only , the desired result.

Though working through axiomatic proofs is good exercise for building your proof-

muscles, in practice we won't be quite so explicit in our use of these familiar axioms

during class. This won't present any real problems since you are more accustomed to

manipulating these axioms then perhaps you realize.

Putting the Elementary in Number Theory

With the basic ground rules set, we had a chance to talk about the most important

property of integers in this whole class: divisibility. It is the study of this property

which makes the number theory we'll study "elementary." One can think of divisibility

as the attempt to carry division into the realm of the integers, made appropriately

cautious to reflect the fact that the integers don't always behave so well under

division.

An integer d is said to divide an integer a if there exists an integer q so that a = dq. If

d divides a we write , and if d does not divide a then we write .

An example

This definition should agree with your own intuitive notion of divisibility in the

integers, so hopefully it isn't too surprising. To see an example in action, notice that

since we can find an integer q to solve the equation

(2)

3

Page 4: Teorija Na Broevi

in this case, the integer q is simply 2.

A non-example

Let's try to prove that . For this, we need to show that we cannot find an integer

n

(3)

q satisfying the equatio

For this notice that ; for any integer q satisfying we have (a

n one of ave

(4)

slight modification o our axioms), and hence we h

ikewise we know that L , and for all integers q satisfying we get

(5)

Since all integers fall into one of the categories we have described, we conlude that

for any integer q, and so .

Lecture 2 Introducing Divisibility

Summary

Today we continued our discussion of divisibility and its basic properties. We saw

Divisibility Continued

Last class previous we defined the notion of divisibility in the integers as follows:

some examples of how to put these properties into practice to prove exciting new

results which might otherwise be quite difficult. Today's lecture culminated in the

statement and proof of the division algorithm, one of the foundational results in

number theory.

4

Page 5: Teorija Na Broevi

Definition: An integer d is said to divide an integer a if there exists some integer q

satisfying the equation .

of

Some Examples

and We already saw proofs in class on Wednesday. Most divisibility

statements will seem pretty obvious to you just by inspection, but the one exception

ent lvinmight be divisibility statem s invo g 0. Below we provide a few examples.

dsince the equation oesn't have any solution; any value you plug in

for q will still make the right hand side 0.

is true for some integer-value of q (in fact, it's since the equation

true for all q!).

. does h ion, namely ave a solutsince

The c f eve

isibility by using the terms even and odd.

ase o ns and odds

We also single out a special case of div

Specifically, we have

Definition: An integer a is even if , and an integer a is odd if .

of ers which satisfy

a = 2k for some integer k. Indeed, we have the following

You might also be used to thinking even integers as those numb a

Lemma: An integer a is even if and only if there exists so that .

e defi f divisi and

evenness.

Our proof of this result will require us to simply recall th nitions o blity

Proof:

We know that an integer a is even if and only if ; this is just the definition of

that evenness. We also know if and only if there exists an integer k so that

; this is just the definition of divisibility. H e we have enc

(1)

as desired.

You'll extend th is problem in your homework when you show that all odd numbers can

be written in the form .

5

Page 6: Teorija Na Broevi

Properties of Divisibility

There are a handful of properties of divisibility which are handy to remember;

ou want to try to divide one integer into

another. You can also think of these lemmas as good exercise for the definitions we've

wn

basically, these are good tools to use when y

encountered in the class: none of the proofs require much more than writing do

definitions, so they are a good chance for you to get used to the new terminology

we've covered.

Lemma: For , if and then .

Proof: We're told that and . By the definition of divisibility, this means we

that

have

an integer d so (using the first divisibility condition), and

an integer e so that (using the second divisibility condition).

(2)

Substituting appropriately, this means that

Since de is an integer, this equation tells us that as desired.

Lemma: For , if and , then .

Proof: Again, we start by just writing down the definitions. In this case, we're told

that and , which m we have eans

an integer d so that (using the first divisibility condition), and

e so that an integer (using the second divisibility condition).

(3)

Hence we have

Since md+ne is an integer, this equation tells us that .

There was another basic property of division we mentioned that allo ed us to

e statement of

this result is

w

compare the size of a divisor to the size of the integer it is dividing. Th

6

Page 7: Teorija Na Broevi

Lemma: If for a nonzero integer a, then .

We didn't prove this result, but it might show up on your homework.

rick

rmining when

an integer is divisible by 17. You can think of this as a cousin of the old "casting our

u use to determine whether a given integer is divisible by 9. This

new rule says

A Neat T

One of the examples of divisibility we gave in class was a rule for dete

nines" rule that yo

Theorem: An integer is divisible by 17 if and only if is divisible by 17.

Proof: First, ass . Since ume that is obvious, our result on

integral linear combinations tells us that

(4)

In the other direction, assume that we are told that , and we want to

. Now since we know that prove , our result on integral linear

combinations tells us that

(5)

Example

To see this result in practice, notice that we have 221 = 22(10)+1. Since

, we can conclude that .

A Final Divisibility Result

We finished off with ivisibility proof, when we showed that one last example of a d

. For every positive integer n, we have

Proof: We proved this result by induction, starting with the base case . In this

case it's easy to see that the statement is true: .

7

Page 8: Teorija Na Broevi

For the inductive step, we'll assume we know that , and we' to use this

to prove that

ll try

. In order to do thi e'ls, w l try to simplify the

expression into something more user friendly; we decided the bast

way to do this was to just expand the term , which gives us

(6)

by induction and Since due to our clever

factorization, our result on integral that linear combinations tells us

as well.

The Division Algorithm

The following result, though it seems pretty basic, is actually extremely powerful,

g greatest common divisors (Section 1.3) but

f modular arithmetic (Chapter 2).

giving rise not just to a method for findin

also laying the foundation for the notion o

The Division Algorithm: For a positive integer d and an arbitrary integer a, there exist

unique integers q and r with and .

Proof of the division algorithm:

Part 1: Existence

We start by defining the set

(7)

and we claim that S has at least one non-negative element. To back up this claim,

that

if

notice

then we can take and find that ;

otherwise , in which case taking shows that .

Now since d is positive by assumption we know that , and so the

product is either a positive number (if ) or (if ).

In either case we see that is a non-negative element of

ordering principle tells us that S contains a least non-ne e element. We'll call this

element r, and notice that r takes the form

S.

In either case we see that S contains a non-negative element, and hence the well

gativ

8

Page 9: Teorija Na Broevi

(8)

Hence we get . To show this satisfies the conditions of the division

ithm, we simply need to show that . The condition algor is satisfied

since r is chosen to be non-negative, so we only need to ve y rif .

To see that , assume to the contrary that , and we'll derive a

contradiction. In this case we have that

(9)

by assumption we have Since is a non-negative element of S which is smaller

r. This is a contradiction to the selection of r as the smallest non-negative

element of S, so we must conclude that

than

as desired.

rt of

uppo

Part 2: Uniqueness

To finish the proof we need to show that the q and r we found in the previous pa

the theorem are, indeed, unique. Hence s se we have

(10)

This tells us that

, and therefore that . But since we also have

by our conditions , we are in the

e divisor d has larger absolute value than the number it is dividing

into — namely,

scenario where th

. This tells us that we must have , and hence

.

With this in hand, we see that the equation then becomes

. Usin cancellation law of multiplication, w e have . g the e therefor

Lectur

st class period we talked at length about divisibility and the division algorithm.

day we moved on to discuss the concept of greatest common divisors. We finished

e 3 Greatest Common Divisors

Recap and Summary

La

To

9

Page 10: Teorija Na Broevi

by describing some properties that gr

(surprisingly powerful) result that the gc

eatest common divisors enjoy, including the

d of two integers a and b can be expressed as

Along with the language we already established — namely that an integer d divides a,

For

r q so that

an integral linear combination of a and b.

A few comments on the divisibility and the division algorithm

or that d is a divisor of a — there are plenty of other equivalent expressions.

instance, if there exists an intege

(1)

then one can say that "d divides a," that " d is a divisor of a," that ''dq is a

factorization of a," or that "a is a multiple of d." All of these expressions capture the

equation above, and they should be pretty familiar vocabulary to all of you.

e the

same

It is also worth pointing out the division algorithm gives us a way to measur

success or failure of one integer dividing another. What we mean by this is the

following. In the case that , we have an equation which is satisfied. In

the case that , however, the definition of divisibility doesn't give us an equation

the

form

we can write down. The division algorithm, however, let's use write an equation of

(with ) regardless of the divisibility of d and a. In fact, the

remainder term tells us whether we're in the caseprecisely or the case .

Being able to w down such an equation winds up being critically important in many

circumstances, as you'll find in this week's assignment.

Finally, we provide an example of the division algorithm in action.

Example: The Division Algorithm

rite

Suppose you wanted to run the division algorithm on and . Playing

around with various multiples of 11, we see that is the smallest multiple of d

se q as 10, then we get the equation which is less than or equal to a. Hence if we choo

(2)

In this case, we see that the division algorithm gives us .

10

Page 11: Teorija Na Broevi

Greatest Common Divisors

For two integers a and b, it is often useful to know if there are any numbers d so that

and . For obvious reasons, such a nu

Certainly common divisors exist for any pair of i

mber is called a common divisor.

ntegers a and b, since we know that 1

always divides any integer. We also know that common divisors can't get too big since

diviso f a a

divisors can't be any larger than the number they are dividing; hence a common

r d o nd b must have and , so that . With all

as motivation, we have the following

this

Definition: The greatest common divisor of two integers a and b, written , is the

largest integer d so that and . More nerally, if ction of ge you have a colle

integers , then the greatest common divisor of the collection ,

written , is the largest integer d so that for every i.

Example: Non-trivial G

that

CD

Suppose we'd like to know the greatest common divisor of 12 and 15. We can see

the divisors of 12 are

the divisors of 15 are

The largest number which is a member of both of these sets — and hence the

and 9 — is therefore 3 e have shown (12,9) = greatest common divisor of 12 . So w

3.

Example: Trivial GCD

If we want to know the greatest common divisor of 21 and 10, then we write down

the r i divisors:

the divisors of 21 are

the divisors of 10 are .

Hence we know that (21, 10) = 1.

Example: GCD of a collection

Looking at the lists of divisors we've already written out, we can see that the greatest

1, so that (12, 15, 10) = 1. common divisor of 12, 15 and 10 is

11

Page 12: Teorija Na Broevi

Example: GCDs with 0

We finish by noting that for any . This follows since 0 has the

r divides it. Since property that every intege is the largest divisor of n, this means

that .

Of particular interest in number theory are in ers which do not share a common

diviso u

teg

r, and beca se of their importance they get their own special name.

Definition: Two integers a and b are said to be relatively prime if = 1; i.e., if a

and b share no common non-trivial divisors. A collection is relatively prime

. A collection if is said to be pairwise relatively prime if

whenever .

In the examples above, we see t 10 are relatively prime, and that the hat 21 and

collection is rel vely prime. Notice in this last example that the

collection is relatively prime even though each pair of integers from the collection is

a

pairwise re

Having met and played around with greatest common divisors a bit, we'll now

oy.

First, we'll see what we get when we remove the gcd of two integers.

ati

not relatively prime. (As a general rule of thumb, you'll care more about whether

collection is latively prime than whether it's relatively prime).

Properties of the GCD

introduce a few properties that they enj

Removing the GCD

Lemma: For any pair of integers a and b, we have .

Proof: and , there exist integers Since so that

(3)

Our goal, then, is to show that . For this, suppose that there were some

common divisor of both and . This would imply that there exist integers

satisfying

(4)

12

Page 13: Teorija Na Broevi

Putting this togethe ith the p us equation, we'd then have r w revio

(5)

Hence the integer would be a common divisor of a and b which is larger than

(a,b). This is a contradiction to the definition of greatest common divisor, and hence

e left to conclude that

(6)

we ar

You might be tempted to think that the integers a and are relatively prime; resist

the temptation! In general, it is not true that .

GCD as a linear combonation

foll

expressed as a linear combination of

the a and b.

Another surprisingly useful result to have around is the owing Proposition, which

says that the gcd of two integers a and b can be

Proposition: For any two integers a and b, we have

Proof: To prove this result, we'll define , and we'll

show that it is in fact the greatest common divisor. Toward this end, we'll start by

then we'll show that all other

common divisors divide d (and so all other divisors are no bigger than d).

rt by using the Division Algorithm t

showing that d is a common divisor of both a and b,

To show that d is a divisor of a, we'll sta o find

integers q and r with that satisfy . Using the fact that

for appropriately chosen integers m and n, this means we have

(7)

But since d is chosen as v ear combination ofthe minimum positi e integral lin a and b,

we therefore have , and so . Hence , and a similar proof shows that

. So d is a common divisor.

13

Page 14: Teorija Na Broevi

Now we show that any other common divisor k of a and b is also a divisor of d, from

which we conclude that ; this ensures that d is the greatest common divisor,

as claimed. To show that , we note that since and , then we have k

linea tion of In p

(8)

divides any integral r combina a and b. articular, we have

Corollary: Two integers e relatively prime if and only if 1 can be written as a and b ar

an integral linear combination of a and b.

Another interesting property which the gcd of two integers has is that all other

on divisors of a and b will divide (a,b). We actually proved this in the midst of

the proof of the last theorem, so we can write is as a

comm

Corollary: For any pair of integers a and b, a common divisor d has .

.

As a final corollary, we note that since the gcd of two numbers is their smallest

positive integral linear combination, any positive number smaller than their gcd

cannot be expressed as an integral linear combination

Corollary: If k is a positive integer which is smaller than , then there are no

integers x and y so that the equation holds.

One of the real benefits of using relatively prime integers is that they let you conclude

ua

Divisibility and Relatively Prime Integers

certain statements about divisibility which you might not us lly get to make. For

instance, if you are told that , you mi pted to ght be tem conclude that or

. In general, though, this is false (can you find a counterexample?). When you

gers, however, you can call

on a result such as this.

have some ''nice'' property involving relatively prime inte

Lemma: If and , then .

I won't prove this for you now, since this is one of your homework exercises.

14

Page 15: Teorija Na Broevi

Lecture 4 The Euclidean Algorithm;

Prime Numbers

divisors in class last time,

dn't come up with a very effective way of computing GCDs. We remedy this with

e Euclidean Algorithm, and we show how this algorithm can also be used to express

mbers a and b as an explicit linear combination of a and b.

oduced prime numbers and started proving some results about

u

aw GCDs when you were in high school. The kinds of GCDs you were after

then — between pairs of numbers which are relatively small and easily factored — are

care about in practice — namely

o large to easily factor. For this reason,

Summary

Although we introduced the concept of greatest common

we di

th

the GCD of two nu

Afterwards we intr

them.

The Euclidean Algorithm

Greatest Common Divisors might seem like a boring subject to you, since likely yo

already s

quite different from the kinds of GCDs people

between pairs of numbers which are much to

we need a method for computing GCDs effeciently. The idea for this method comes

from the remarkably simple

Lemma: Suppose that a and b are integers and that as per the Division

Algorithm. Then .

Proof: This is really not a hard proof. Suppose that d is a common divisor of a and b.

Then since , we have that d is a divisor of r as well (using our "divisibility

Likewise, if d is a common divisor of b and r, then since

of integral linear combinations" result).

we have that d is

mmon diviso

gst these common divisors are the

same.

also a divisor of a.

Hence all co rs of a and b are also common divisors of b and r, and vice

versa, proving that the greatest elements amon

We can apply this idea iteratively to give a computationally effective way to compute

GCDs.

Example: Computing GCDs with the Euclidean Algorithm

15

Page 16: Teorija Na Broevi

Suppose you're interested in computing (1921,493). Using the previous result, since

(1)

we know that this GCD is the same as (493,442). In fact, we can keep using this

result over and over again, provided we keep using the division algorithm every time

rithm are: we get a non-zero remainder. These applications of the division algo

(2)

Hence we have

(3)

Example: Expressing GCD as a linear combo

This same procedure can be used to write the GCD be en a and b as an integral

n of the two. In the previous computation, for instance, the second-

to-last division algorithm application gives

(4)

twe

linear combinatio

The previous application of the division algorithm, though, showed us that

, and hence we can substitute this into our expression for 17:

(5)

Using the equality and substituting again gives

(6)

Continuing this kind of back substitution gives

(7)

16

Page 17: Teorija Na Broevi

Prime Numbers

tars of number theory are the prime numbers. The s

A number is said to be prime if the only positive divisors of p are 1 and itself. A

number is said to be composite if it is not prime; i.e., n is composite if there

so that . exist

The reason

in the multiplicat

they are foundati

that prime numbers are so exciting is that, despite their foundational role

ive structure of the integers, they are very elusive. When I say that

onal in the multiplicative structure of the integers, I mean that any

factorization of an integer n involves prime numbers as the atomic pieces — in the

s built out of elements from the

periodic table. This is made precise by the Fundamental Theorem of Arithmetic, a

tart d

s a

ideas — as me co applications of primality — throughout the

remainder of the course.

same way that any physical substance we encounter i

topic we'll s iscussing tomorrow. And when I say elusive, I mean just that: the

damn thing re hard to pin down and understand. We'll talk more about both of

these well as so ol

For now, though, we'll take a step in the first direction: showing that prime numbers

are the building blocks of integers. For this, we begin with a nice lemma that says

that any number is divisible by at least 1 prime number.

Lemma: For any integer , there exists some prime number p which divides n.

Proof: We'll prove this result by contradiction: assuming the opposite of what we w

to prove, manipulating this assumption until it reaches a contradiction, and the

concluding that our assum

ant

n

ption must be false — and hence our desired conclusion is

true.

(8)

So suppose that not every integer n has a prime factor. This means that the set

is non-empty. As a non-empty set of positive integers, S must have a least element.

We'll call this least element N.

Now N is an element of S, and hence has no prime divisor. Since N is a divisor of itself

— , after all — this means in particular that N cannot be prime. Therefore N is

composite, meaning there exist integers so that N = ab. Being positive

integers less than N, both a and b must live outside of S, and hence each has a prime

17

Page 18: Teorija Na Broevi

and . But then and , so that factor: say , contrary to the

defining property of N.

we conclude that S must, indeed, be empty, and so

every integer greater than 1 has a prime factor.

Having reached a contradiction,

Thi t gives us a method for finding prime numbers using a sieve technique.

Before we get there, we need to first mak ng

s resul

e the followi

Observation: If is a composite number, then there exists a prime divisor p of n

such that .

Proof: If n is composite, then there exist integers a and b so that n = ab. Now one of

a or b must be less than , since otherwise th ir e product would be greater than n.

Without loss of generality, we can assume that . Now a has a prime factor p

from the previous lemma, and so . Since and , we further have

, giving the desired result.

A Sieve Example

The idea behind a sieve is to find prime numbers by eliminating multiples of known

Suppose, for instance, that you wanted to find all prime numbers less than 60. The

previous observation says that any composite number

prime numbers. The magic, though, is that one has to use relatively few primes to

sieve out larger ones.

must have a prime

factor which is smaller than . Hence any composite number smaller

le by one of the primes which is smaller than 8 — namely one

f we listed all the numbers between 2 and 60 and crossed out

2 3 4

than 60 must be divisib

of 2, 3, 5, or 7. Hence i

the multiples of the primes listed above, the remaining numbers would all have to be

prime. Let's try it out:

5 6 7 8 9 10

11 12 13 14 15 16 17 18 19 20

21 22 23 24 25 26 27 28 29 30

31 32 33 34 35 36 37 38 39 40

41 42 43 44 45 46 47 48 49 50

18

Page 19: Teorija Na Broevi

51 52 53 54 55 56 57 58 59 60

After sin t u les 2, , see that the primes less than 60

are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 21, 37, 41, 43, 47, 53, and 59.

In the same way that knowing the primes less than

cros g ou all m ltip of 3, 5 and 7, we

gave us a method for finding

r h 0, owing th t of ss than n gives us a way to

er h o im es an

the p imes less t an 6 kn e lis primes le

gen ate t e list f pr es l s th . W t s a great way to conclusively

generate prime numbers, the downside is that this technique takes a LONG times to

le t. ce a fe b m tic e for finding really big prime

numbers.

Having actually gone through and found a handful of small primes, we now begin to

ow many primes there are of a given magnitude?

do we know how "spread out" the prime numbers are? do they come in

ys far apart from each other?

is there a formula which allows us to quickly generate prime numbers?

ome of these questions are exceedingly difficult to investigate. We'll

cover a sampling in class tomorrow.

Today we spent the first half of the class exploring questions about prime numbers.

ong the way we proved that there are infinitely many prime numbers and that there

are arbitrarily large gaps between prime numbers. We also saw a formula which gives

a rough count for the number of integers up to a given number x, and we saw some

hile his i

imp men Hen it is n ef ctive ut i prac al m thod

Asking Questions About Primes

wonder what can be said about primes. Here are a few basic questions you might

want to know

how many primes are there? for instance, is the number of primes finite?

if the number of primes isn't finite, do we at least have a reasonable guess as

to h

clusters, or should we expect that they are alwa

These are all good questions, and some of them have nice, easy answers.

Alternatively, s

Lecture 5 Prime Numbers; The Fundamental Theorem of Arithmetic

Summary

Al

19

Page 20: Teorija Na Broevi

conjectures about other behaviors about prime numbers. In the last half of the cl

we started a proof of the Fundamental Theorem of Arithmetic.

ass

sking Questions About Primes

ne through and talked about the basics regarding prime numbers,

onder what can be said about primes. Here are a few basic

hey come in

clusters, or should we expect that they are always far apart from each other?

erate prime numbers?

for instance, are there more

primes behave under addition?

A

Having actually go

we now begin to w

questions you might want to know

how many primes are there? for instance, is the number of primes finite?

if the number of primes isn't finite, do we at least have a reasonable guess as

to how many primes there are of a given magnitude?

do we know how "spread out" the prime numbers are? do t

is there a formula which allows us to quickly gen

do prime numbers obey any special properties?

primes which leave remainder 1 after division by 4 than there are primes

which leave remainder 3 after division by 1?

what can you say about how the

These are all good questions, and some of them have nice, easy answers.

Alternatively, some of these questions are exceedingly difficult to investigate. We'll

cover a sampling now.

The Infinitude of Primes

The question on the number of primes has been around for a long time, and the

answer was known at least two thousand years ago. Here's the proof that Euclid gave

in his Elements.

Theorem: There are infinitely many primes.

Proof: Again, we'll proceed by contradiction: assuming there are finitely ma

massaging this condition into a contradiction, and then concluding that a finite

number of primes is imp

ny primes,

ossible.

e prime numbers, and call them . So suppose you have a list of all th

. Notice that for any Then we'll form the integer in our list of

primes, we cannot have

; if we did, then we'd also know that

(1)

20

Page 21: Teorija Na Broevi

But we know that N has to have at least 1 prime factor p. Since this prime number

isn't one of the primes in our list, we conclude that the list of primes we started

with was incomplete.

off

Gaps and Clusters in Primes

reasonable idea of how the primes are spaced out amongst the intege

Now that we know there are infinitely many primes, we might want to have a

rs. Displaying

l quirkiness, the answer to this question seems to be on both extremes:

imes have wide gaps to their next neighbor, while — conjecturally, at least —

others are as close as can be.

their typica

some pr

On the one extreme, we have a theorem which tells us that large gaps between

primes numbers are known to exist.

For any positive integer M, there is a string of at least M consecutive composite

integers.

Proof: The M integers between

(2)

are all composite, since the first is divisible by 2, the second by 3, etc.

suggests that there are also lots of primes

which are quite close to each other. The most famous result in this vein is

On the other hand, empirical evidence

The Twin Prime Conjecture: There are infinitely many primes p such that p+2 is also

prime.

For those who are interested, the record largest twin primes to date can be found at

argest Known Primes Page; as of this morning, the largest twin primes were

(3)

The L

two numbers which have something like 60,000 digits.

The Prime Number Theorem

the spreading out and bunching up between the prime numbers, one might

think that it would be hard to give an estimate for the number of primes of a given

With all

magnitude. However, one of the biggest results in number theory — and one which is

almost always proved using techniques from complex analysis (!) — tells us exactly

21

Page 22: Teorija Na Broevi

this information. It uses a function , which is defined as the number of primes

less than or equal to a given numbe . (So, for instance, we have r x since the

primes less than or equal to 11 are .

The Prime Number Theorem: as .

This says that for large values of x, the number of primes less than or equal to x is

about .

Primes of a particular form

Now that we know a little bit about primes, it is natural to ask: how can we go about

finding them? The answer to this question, sadly, is that there's not really a general

method for finding all primes aside from ''brute force'' techniques like our sieve

in finding pri is one of the hard problems which

helps keep our world afloat right now: encryption online is dependent on the fact that

oug it's hard to come up with an exhaustive list of all primes, there are some

. Although finding large primes

ematicians a hundred years or so

ago, today it is big business: the aforementioned internet security applications of

appen to take a particular form: they can be

expressed as

method. Indeed, the difficulty mes

it's really hard to factor large numbers.

Even th h

places where prime hunters go to search for big game

was a kind of pleasant amusement amongst math

primality require large primes to work. Hopefully we'll be able to talk about all this

more at the end of the term.

Mersenne Primes

The largest primes found these days all h

for a prime number p. These are the so-called Mersenne Primes.

There was a recent development (i.e., early last semester), when the Great Internet

Mersenne Prime Search (GIMPS) came across the new largest prime number. This

number is

and has around 13 million digits. If you want, you can use your computer to help

e your computer which finds the next largest prime!

numbers? Since primes are defined based upon a multiplicative property, one might

GIMPS out; maybe it will b

The Primes Under Addition

Finally, we consider the question: what happens when you add together prime

22

Page 23: Teorija Na Broevi

not expect that they really have a lot of interesting additive structure. It seems,

however, that they have a very rich additive structure. For instance, here's a long-

standing conjecture about how the primes behave under addition:

Goldbach's Conjecture: Every even integer at least 4 can be expressed as the sum of

two prime numbers.

Though plenty of smart people have been thinking about this problem for a couple of

en verified for "lots" of even numbers (can

someone post to the Wiki how many even integers have been verified to satisfy this

wn the

Fundamental Theorem of Arithmetic. This theorem is something which you all have

ase

hundred years, and although it has be

condition?), no one has yet been able to prove that it is true.

The Fundamental Theorem of Arithmetic

Having covered many of the basics, it's now time for us to knock do

seen many times before — whether explicitly or not — and is an incredibly useful tool

in number theory.

We need a preliminary lemma before we can knock down the Fundamental Theorem.

This preliminary result is known as Euclid's Lemma, and it is essentially a special c

of one of your homework problems for the week (44a).

. Euclid's Lemma: If p is a prime number and , then either or

Proof: Suppose that , and we'll argue that . For this, notice that forces

— the only divisors of p are 1 and itself, and we already know that p isn't

divisor of a. Applying 44a from your homework gives the desired result.

a

The Proof of the Fundamental Theorem

We're now ready to prove the Fundamental Theorem of Arithmetic. Recall that it says

The Fundamental Theorem of Arithmetic - Every positive integer at least 2 can be

uniquely expressed as a product of prime numbers.

We'll break our proof into two parts

Existence1. : that every can be written as for some prime

numbers

2. Uniqueness: there is only one such way to factor a given integer

23

Page 24: Teorija Na Broevi

We only had time in class to cover the first statement; we'll prove the second in class

on Monday.

Existence: Suppose that there were integers greater than 1 which couldn't be factored

into a product of primes. This would mean that there is a smallest such integer (by

l call this smallest element n. Now n can't be

prime since otherwise n is already an expression of itself as a product of primes.

the well-ordering principle), and we'l

Hence for some . Since both a and ller than n, this

means that they m s

b are sma

u t be elements which do have prime factorizations (since n was

Therefore selected as the smallest positive integer which didn't have this property).

and for appropriate primes . But then we have

(4)

a prime factorization of n. Since this contradicts the selection of n as the least

element without a prime factorization, we must conclude that every integer greate

than 1 can be factored as a product of primes.

undament Theorem

r

Lecture 6 The F al

and its Applications

Today we began by finishing off the proof of the fundamental theorem of arithmetic.

ter we completed the proof, we saw how the fundamental theorem could be used to

cilitate the computation of GCDs and LCMs, and we also used it to prove that there

got

Finishing off the FTA

e were in the midst of proving the Fundamental Theorem of

says

Summary

Af

fa

are infinitely many primes which leave remainder 3 after division by 4. Finally, we

a sneak peak at the fundamental concept in chapter 2: congruence of integers.

In class last time w

Arithmetic, which

The Fundamental Theorem of Arithmetic: Any integer can be uniquely

expressed as a product of prime numbers.

24

Page 25: Teorija Na Broevi

We had already shown that every integer has a factorization into primes, but we had

left to show that this factorization was unique. That's what we'll do now.

To show that any integer n has only o

factorizations of an integer n:

ne prime factorization, suppose we're given two

(1)

This expression just means that each of the are prime, and that the

corresponding exponents are positive.

We aim to show that the list of primes and are indeed the

same, and moreover that the corresponding exponents match up as well.

For this, we start by noting that for each , the term clearly divides

the first expression of n as a product of primes. For this reason we must also have

, and the supped up version of Euclid's Lemma says that for

some j. But since is prime, this means that in fact . Hence the list of primes

for the first factorization is a subset of the list of prim the second factorization.

e

es for

Running the same argument for a given prim in the second factorizatio

that the list of primes for the second factor

the first. Hence the list of primes are, in al. An entical as sets,

but — by virtue of our increasing ordering of the

n, we have

ization is a subset of the list of primes for

fact, identic d not just id

and — we must in fact have

and .

Now that the lists of primes are identical, we just need to show that . For this,

suppose that . Then we have

(2)

Now clearly divides the first expression (since ), whereas it cannot

divide the second expression (since doesn't sho up in the factorization). This is a

iction so

w

contrad , and we must have . A similar argument shows that is

impossible, and so we have .

GCDs, LCMs and FTA

To see that the Fundamental Theorem can be used to make our lives easier, we're

going to show how it relates to a concept already discussed (GCDs) as well as a close

25

Page 26: Teorija Na Broevi

cousin (LCMs or least common multiples). This se has yet to be mentio

in this class, so we give a definition

, cond term ned

Definition: For two positive integers a and b, the least common multiple of a and b —

written either or sometimes — is the smallest number m so that

and .

Example: Computing

In order to compute the least common multiple of 10 and 6, we should write down all

common multiples of these two numbers:

(3)

Notice that the first number common to both lists is 30, and so that means that 30 is

le of and 6. Notice that in this case the least common

multiple of a and b was *not* simply ab; there was a smaller common multiple than

the least common multip 10

the "obvious" common multiple.

Instead of writing out a list of common multiples, it would be nice if we had a uniform

o computer LCMs. In fact, there is a connection between GCDs and LCMs that

makes one easy to compute whenever you have the other. This is given by the

following

way t

. Theorem: For any integers a and b, one has

One can prove this result from the definition of GCDs and LCMs, but it because quite

cumbersome. Instead, one can prove it by taking advantage of the following result

that's borne from the Fundamental Theorem.

Theorem: For integers a and b with prime factorizations and

, one has

and

.

26

Page 27: Teorija Na Broevi

We won't prove this result in class, but we'll use it to prov relae the theorem ting the

GCD and LCM of two numbers above.

//Proof that // :

We'll assume that a and b have factorizations given by and

as in the theorem above. This then lets us substitute in the values of

and in the product :

(4)

Now we just notice that for any integers x and y we have

. Hence the product above becomes

es of a Particular form

We asked a while back how primes spread out amongst different classes of integers.

can be written as

(5)

Prim

For instance, we asked: how many primes are there which for

some integer k? We saw pretty t took this form.

We also asked: how many primes can be written in the form

quickly that there were no primes tha

for some integer

is time we argued that there was only 1 such prime (namely 2). This left primes

of the form

k? Th

or , and we asked: are there "more" primes of one form

than the other? We'll start to give an answer to this question today in class with a

roof of the following p

Theorem: There exist infinitely many primes p for which there exists with

.

In order to do this, we first note the following

Lemma: The product of two integers of the form and is another integer

of the form .

Proof: It isn't hard to see that

(6)

27

Page 28: Teorija Na Broevi

gives the desired result.Taking .

Now we're ready to prove our theorem above

Proof of Theorem: Suppose, to the contrary, that there are only finitely many such

primes. We'll list these primes out in order: , with the largest such

prime denoted . We claim that the integer contains a prime

divisor not on our list.

To see this, note first that N is an odd number, so its prime factorization contains o y

odd primes. If all these primes were of the form

nl

, then so too would N be of

(using induction H ce there exists at least one this form on our previous lemma). en

prime divisor p of N for which for some integer n.

We claim that p is not included in our list of primes. Suppose first that . By ou

result on divisibility of integral linear combina that

r

tions, this implies

. Hence Euclid's Lemma implies that either (which it

doesn't) or for some i (also impossible). Hence we're led to a contradiction, and

so we must have .

ve remSince we have a complete list of primes which ha ainder 3 after division by 4,

this means that for some . But then we have

— another clear contradiction. o conclude that for any of the We're left t in

our supposed complete list of primes of the form , and hence our list must

. have been incomplete.

Though an awfully nice w t re

ny pr

result, we can't adapt this technique to sho hat there a

infinitely ma imes of the form — we would need a result that says the

product of two prim hich toes w ok the form again takes that form, but this is

NOT true. Hence we have to be more clever want to prove such a result. Indeed,

if we

studying problems such as these makes us wonder how many primes there are of the

form or — of other . Though the proof

goes beyond the means

primes of that form

or plenty possible prime types

we have in this class, there is a big result which tells us about

Dirichlet's Theorem on Primes in an Arithmetic P grero ssion: For any integers a and b

with , the sequence

contains infinitely many prime numbers.

28

Page 29: Teorija Na Broevi

The proof of this result uses complex analysis to show that

(7)

diverges. Crazy!

The topics we've covered so far — basic ide

A Preview of Chapter 2: Congruence

as which are born from the concept of

ory as of a few hundred

years ago. Our next concept — the notion of modular congruence — was developed

uss and was a key result for moving forward in number theory. The basic idea

centers around the following

divisibility — cover most of the basic tools used in number the

by Ga

Definition: Two integers a and b are said to be congruence (or equivalent) module an

integer m — written — if .

We'll see that this definition provides a relation that has a lot of the properties of our

zes that this new

ultiplication) just

odular Arithmetic

ut

o addition and multiplication. We started to explore

can use these arithmetic properties of congruences to prove results about

tegers.

e key idea in this chapter centers around the following

"usual" equality. What is truly powerful, though, is when one reali

version of "equality" admits arithmetic operations (addition and m

like our usual notion of equality.

Lecture 7 M

Summary

Today in class we introduced the notion of modular congruence and saw that it can be

used to give an equivalence relation to the integers. Not only does this provide us

with a way to split the integers up into distinct subgroups (a so-called "partition"), b

it also behaves well with respect t

how we

in

Congruence

Th

29

Page 30: Teorija Na Broevi

Definition: Two integers a and b are said to be congruence (or equivalent) module an

integer m — written — if .

flexive: for any integer a and any modulus m, we have

One of the benefits of modular congruence is that it behaves an awful lot like the

regular "equals" you're used to playing with. In fact, modular congruence is an

equivalence relation, which means it has the following properties

1. Re .

2. Symmetric: for any integers a and b and any modulus m, if

then .

3. Transitive: for any integers a,b and c, and any modulus m, if

and , then .

Proof: To prove the reflexive property, note that just means that we

want to verify . We s hile back, though, that any integer m

divides 0, so this statement is valid.

aw a w

To prove symmetry, we need to show that implies . If

, though, the definition of modular congruence tells us that ,

so that . But then we have , and so

. By the definition of modular congruence, we therefore have

.

ansiti that Finally, for tr vity we are supposed to assume and

, and somehow conclude that . To prove this result, we

us that note that the first two congruence conditions tells and .

Our result on d tegral linear combinations, then, tells us that ivisibility of in

. Hence the definition of modular congruence tells us

that .

The benefit of t thi

tells us that congruence class partition the integers into distinct sets. For instance,

e modulus is ery integer fits into one of t

collections

(1)

showing that modular congruence is an equivalence relation is tha s

when th 3, we know that ev he three

30

Page 31: Teorija Na Broevi

We know this has to be true b r

emainder eithe 0 2 after trying to divide by 3.

ecause the division algorithm tells us that any numbe

has r r ,1 or

Example: Negative Numbers and Congruences

Suppose you want to know what the integer -2 is congruent to mod 3. The definition

tells us that is the same as saying is divisible by 3. Note that

choosing makes something which isn't divisible by 3, whereas

ing . Since leaves us with choos , we have

.

Notice, however, that the way we've written these subsets isn't unique. For instance,

since , the transitive property of congruence hows that s

(2)

With this observation in mind, one might be curious to know all the different ways of

writing representatives for the congruence classes of a given modulus. This leads to

the following

Definition: A ction of s called a complete residue system for modul colle integers i us m

if every in is congruent m from the cteger odulo m to exactly one element ollection.

Example: Complete residue systems for

The di m tells us that vision algorith is a complete residue system for .

But notice that so too are and . On the other hand, note that

is not a complete residue system, since it has a repeated congruence

cally, class; specifi . On the other hand, the set fails to be a

complete residue system because not every integer is congruence to either 1 or 2. In

particular, and .

The fact that is a complete residue system for comes from the

following more general result

Lemma: For any integer m, the set is a complete residue system

modulo m.

This complete residue system is so important that it gets its own name: it is called the

. least non-negative residue system for m

31

Page 32: Teorija Na Broevi

Congruence ithmetic

The reason

and Ar

that congruences are so important in number theory is that the notion of

congruence plays well with addition and multiplication. By this we mean

and For integers with , we have

and

This result is important because it tells us that when we're doing arithmetic

m. We'll see an example of this after we

Proof:

computations module m, we can do our computations by choosing any integers which

sit in the given congruence classes module

prove the theorem.

We're given that and , and these statements

translate into the divisibility statements and . By our result on

divisibility of integral linear combinations, we have that

(3)

This d tatem nt,ivisibility s e in turn, tells us that . To verify the

second statement, we'll choose a different integral linear combination:

(4)

and by the definition of congruence we have .

ion work modulo six

Example: Arithmetic Modulo 6

The following tables tells us how addition and multiplicat

+ 0 1 2 3 4 5

0 0 1 2 3 4 5

1 1 2 3 4 5 0

2 2 3 4 5 0 1

3 3 4 5 0 1 2

32

Page 33: Teorija Na Broevi

4 4 5 0 1 2 3

5 5 0 1 2 3 4

x 0 1 2 3 4 5

0 0 0 0 0 0 0

1 0 1 2 3 4 5

2 0 2 4 0 2 4

3 0 3 0 3 0 3

4 0 4 2 0 4 2

5 0 5 4 3 2 1

An important thing to notice about this table is that it gives us examples where

d .oes not imply For example, notice that we can find

a and b so that , and yet . Canceling coefficients is

e in ou p ab e used to, so you need to be wary when doing

modular arithmetic that you aren't carelessly "dividing" by constants. The following

m te us ac w t r tionship such a,b have to each other.

som th g y 're rob ly r ally

lem a lls ex tly ha ela

Lemma : is e ivalent toqu .

am le anceling" ef ients in modular equations

tic ha n e p ab e, anytime we have a and b such that

Ex p : "C co fic

No e t t i the xam le ov

, we also have . For instance, we could choose

and , in which case we'd have . Likewise if we have a and

//b/ such that , t that hen it follows ; for example, if we

choose and , then we get .

Though we didn't get to prove this lemma in class, I'll give a sketch of part of the

proof below.

Proof: We 'll only prove the direction, le direaving the other ction for the

enthusiastic student. Now if we're told that , then this translates to

the divisibility statement . Hence there is some integer e so that

33

Page 34: Teorija Na Broevi

. If we write , then we can divide each of m an

of integers

d c by d and

get an equation

(5)

Now since this is an equation of integers, we can cancel out the d on both sides, an

we're left with

d

the div

(6)

from which we have . We know that by an old result, and we

also know that this relative primality result together with our divisibility condition

implies that

(7)

from which we find as desired.

ple: A divisibility criterion for 11

People have been talking about divisibility criteria for integers on the forum, so I

thought we might talk about how one goes about proving such a result. We'll prove

Exam

the following

Divisibility Criterion: Suppose that a number n has digits , meaning that

. Then n is divisible by 11 if and only if the alternating sum of its

digits — — is divisible by 11.

Proof: To see that th l take the equis is true, we'l ation and consider

what it gives us modulo 11. On the left hand side we just get , but on the

right hand side we get

. Notice that . Now since "modding by 11"

plays nicely with addition and multiplication, this means that

.

Hence this me ans that our equation become

(8)

s

34

Page 35: Teorija Na Broevi

and only if In particular, if , meaning that n

gits is divisible is divisible by 11 if and only if the alternating sum of its di by 11.

Example: Computing

large powers of a given integer can be computed. As an exam

large powers (modularly)

One of the benefits of modular arithmetic is that it provides a context in which really

ple, we'll compute

. (This is more than the ms in the u number of ato niverse!). To do this,

we start by computing successive square powers of 10. To make this as efficient as

ble, I'll often use the trick of substituting a given integer with another small

integer which is equivalent modulo 13 (for instance, using the facts that

possi

and that . Witness:

(9)

Now when it comes to computing , we just notice that

(10)

Lecture 8 Linear Congruence Equations

Summary

Today we started by reviewing how one can go about "canceling" common factors in

congruence equations. Afterwards we introduced the notion of a linear congruence

an equation has solutions

(and, indeed, how many solutions exist).

equation, giving a theorem which told us exactly when such

35

Page 36: Teorija Na Broevi

Cancellation in Modular Equations

st class period we stated the following La

Proposition: is equivalent to .

This result will play a central role in today's lecture, so we'll start by giving a full

proof.

Proof: We'll use the notation to make our exposition easier to read.

Suppose first that . This means that , so that there exists an

integer e with . Multiplying this equation by c then gives .

Now notice that since we can rewrite the left hand side as , where each of

these terms are bona fide integers. Hence we have

(1)

Since the left hand side is a multiple of m, we conclude that .

'll prove the direction. Since we're told that Now we , this

translates to the divisibility statement . Hence there is some integer e so

that . We can divide each of m and c by d (since ) and get an

equation of integers

(2)

Now since this is an equation of integers, we can cancel out the d on both sides, and

left with the div

(3)

we're

from which we have . We know that by an old result, and we

sult togethe

implies that

also know that this relative primality re r with our divisibility condition

(4)

36

Page 37: Teorija Na Broevi

from which we find as desired.

Linear Congruences

Now that we've played around a bit with modular arithmetic, it's time that we take

one of our favorite problems in mathematics and give t a modular spin: solving

equations. We'll start off at the beginning, dealing with linear equations.

i

Definition: For integers a,b and m, the equation is called a linear

congruence.

The goal, of course, is to find all integers x which solve this equation. Given that the

equation is really a statement about modular congruence, though, you won't be

surprised to hear that we're actually most interes n knowing solutions to the

system modulo m; that is to say, we want to know which congruence classes modulo

uation.

e equations

.

ted i

m solve the given eq

Example: Some linear congruenc

From our multiplication table, we can read off solutions to some equations modulo 6

(5)

So we see that our linear congruences can have either no solutions, 1 solution, or

several solutions (where by "solutions" we mean more precisely "distinct solutions

modulo m"). The question, th

en, is how to distinguish when an equation does have a

solution from when it doesn't. And if it does have a solution, how can we produce all

solutions? How many solutions will there be?

Big Theorem on Linear Congruences: The congruence has integer

solutions if and only if . If is such a solution, then all other integral

, where solutions take the form . A complete list of the distinct

when solutions modulo m is given by .

37

Page 38: Teorija Na Broevi

Proof: For notational convenience, we'll write d for the gcd of a and m. Now we'll

proceed with the proof in steps: (1) show that solutions exist if and only if ; (2)

t

show that other solutions can be expressed in terms of one fixed solution; (3)

determine when two integer solutions are congruent modulo m. (Note: we didn't ge

to prove this last part in class today.)

Step 1: First, suppose that a solution exists to the equation . This

implies that , so that there exists an integer e with .

Rearranging, we therefore have

(6)

Now since d is the gcd of a and m we have and , and therefor divides

any integral linear combination of a and m. In particular,

e d

(7)

Hence if our congruence equation has a solution, then .

en Now we'll prove the converse, showing that a solution exists wh . We st

ere exists

(8)

art by

noting that th integers r and s such that

this follows because the gcd of two integers can be expressed as an integral

the fact that combination of the two integers. Now using , we find an integer e s

that

o

. Multiplying the displayed equation by e then gives

(9)

Taking this equation modulo m, we therefore have , and hence

is an integer solution to the equation .

Step 2: Now suppose we are given two solutions to the equation, and , and we

wish to show that . In order to do this, note that we have

(10)

38

Page 39: Teorija Na Broevi

This tells us that , and so it follows that —

we turn this divisibility statement into an equation, there ts some integer

or, if

exis k so

that . We'll divide this equation on both sides by d — a legal move

d is a common divisor of a and m — and we find that since . This

is equivalent to the divisibility condition . Notice, however, that

, and hence homework problem 44a tells us that . This is the

same as saying that , so that as desired.

Step 3: (Note: we didn't get to discuss this proof in class, but I'm including it in the

e we pick up tw

notes for people interested in seeing the full proof.) To find the distinct solutions

(modulo m), suppos o solutions and which are the same modulo

m. Since by the previous step, this means that we have

(11)

Getting rid of the that is common to both sides, we turn this divisibility condition

into an equation: . Hence we have

(12)

and after canceling th s of the e al move since m's on both side quation (a leg e this is

an equation in integers, not a congruence equation) we're left with —

. i.e., that

This tells us that two solutions and are distinct if and only if

. Hence the distinct solutions to are given as

when .

Example: Solving

Suppose you want to solve the equation . Notice that the gcd of 6

and 15 is 3, and that . Our big theorem tells us that this congruence equation

solutions. has no

Example: Solving

Let's put these ideas in practice to try to solve . To

decide wh en

start, we need to

ether this congru ce will have solutions or not. For this, we just notice that

39

Page 40: Teorija Na Broevi

, and that . Hen lutions, and we're expectin

be 2 distinct solutions modulo 14

h soluti

ce we know there are so g

that there should .

To find one suc on, we need to do two things:

xpress 2 as a linear combination of 4 and 4, and

2. we need to express 6 as a multiple of 2.

we k

e so:

1. we need to e

Toward the first goal, now that we can to use the Euclidean Algorithm. The

algorithm runs lik

(13)

and from this we see that

(14)

Now for the second goal, it isn't too hard to see that . Finding a solution,

ation by 3:

(15)

then means we should multiply our expression of 2 as a linear combin

Taking this equation modulo 14 leaves us with

(16)

and hence is one integer solution.

at we have one solution , we can find all solutions by taking Now th for

. Doing so shows that the distinct solutio lo 14 are given by ns modu

.

Notice that if we had been interested in least non-negative solutions, we would write

5 in place of -9 (since ) and 12 in place of -2 (since

).

40

Page 41: Teorija Na Broevi

Lecture 9 Multiplicative Inverses; the Chinese Remainder Theorem

Summary

talking about a spec ce equations,

namely those of the form

We started off today by ial class of linear congruen

. These led to multiplicative inverses, which

we saw were useful in solving certain congruence equations. We drove this point

me when we used multiplicative inverses to prove the Chinese Remainder Theorem,

tool that is used to solve simultaneous linear congruence equations.

ime we talked about solving linear congruence equations. Let's do another

ample of this kind of problem.

g the linear congruence

ho

a

Multiplicative Inverses

Last t

ex

Example: Solvin

Suppose we want to solve the equation . We first check to see if

solutions exist. In this case, we know that , and since , we

know there are solutions. In fact, we know that there is exactly 1 solution mod 67

compute it, we first need to write

. To

as a linear combination. We'll use the

Euclidean Algorithm. This gives

(1)

Now we can use these equations to express 1 n as a combinatio of 5 and 67:

(2)

Taking this equation modulo 67 shows that , and so 27 is the

multiplicative inverse of 5 modulo 6

7.

This example leads to the following

Definition: A solution to the linear congruence is called a

multiplicative inverse for a modulo m.

41

Page 42: Teorija Na Broevi

Example: The Inverse of 5 mod 67

The previous example can be translated to say "27 is the multiplicative inverse of 5

modulo 67."

Notice that we already have machinery that tells us when multiplicative inverses exist.

Theorem: An integer a has a multiplicative inverse modulo m if and only if

. When a and m are relatively prime, the multiplicative inverse of a mod m is unique

mod m.

Proof: Recall that has a solution if and only if . Of course

there aren't a lot of choices for what can be if this divisibility is going to hold;

in fact, is the only way this divisibility can hold. Hence must be

ultiplicative inverse mod m.

on solving linear congruences says that the

en by the gcd of a and m. We've already

a and m

relatively prime if a is going to have a m

When a solution does exist, our theorem

number of distinct solutions modulo m is giv

seen that a solution exists if and only if , and so in this case there is only

one solution modulo . m

Solving Congruences Using Inverses

Multiplicative inverses can be quite useful in solving other linear congruence

they allow one to solve a congruence by a simple multiplication.

s, since

Example: Solving

Suppose we wish to solve . We could proceed as e before —

finding a gcd, writing that gcd as a lin mbination, etc. Alternatively, we can use

the fa 've already computed the multiplicative inverse of 5 as 27. To take

this latter route, notice that we have

we hav

ear co

ct that we

(3)

(Notice: we're allowed to multiply by 27 des of the expression without

disturbing the solution s t b

on both si

e ecause , and you'll recall our theorem which

if and only if ). says that

Using the fact that by our previous example, this means that our

solution is .

42

Page 43: Teorija Na Broevi

The Chinese e Remaind r Theorem

tic on congruenc

Example: Simultaneous Congruence equations

Suppose you want to find an integer x which satisfies both of the congruen s

(4)

We've now defined arithme e classes mod m, and we've also managed

to solve linear equations mod m. Now we're going to try to solve simultaneous linear

congruences mod m.

ce

We don't have a really g this systematically right now, but you can

that we can

good way for doin

try out some small numbers to see if you can find a solution. For instance, we know

't have since this fails the second congruence; we also can't have

and , since this fails the first congruence. We can similarly rule out

but notice that does satisfy both of these equations. A little more

experimentation shows that works too, and the particularly diligent student

might also come across the solution .

This example shows us that we "experimentally" solve these simultaneous

ic (or efficient) way of computing

solutions. For this, we turn to

congruences, but they don't provide a very systemat

The Chinese Remainder Theorem: If are pairwise relatively prime

integers, then the congruence equations for each have a

unique solution modulo .

Proof: We'll break the proof into two pieces: first we'll construct a simultaneous

solution to the given congruences, and then we'll show this solution is unique in the

given modulus.

To start, we'll de for . fine , and for each we'll write

Now since the are pairwis ively prime, you showed in your homework (in th

course of #43(c) in chapter 1) that

e relat e

. Hence for every i, there exists an

integer which satisfies .

With the so constructed, we claim that

(5)

43

Page 44: Teorija Na Broevi

is a solution to all the congruences . To see this is true, fix an integer

i, and we'll show that . Notice that for every we have ,

is the product of all the moduli except for — in particular, since shows

the product which defines N_j$]]. Hence we have

up in

(6)

But now recall t t ha , and so the previous equation becomes

as desired.

Hence we've constructed a solution. To show that all solutions are equivalent modulo

, notice that if are two solutions to the congruence equations,

then we have for every i/. It follows that for

i, and so . By homework 43(c) in Chapter 1, since the every are

relatively prime we can conclude that .

Example: CRT in Action

se nc

(7)

Suppo that we're given the simultaneous congrue es

Our proof of the t we need to start by computing CRT says tha , which in

this case are given as , and . With

these numbers in hand, we now need to solve the congruence equations

for each i.

To solve , notice that . Hence we're rea

solve

lly trying to

. Now we could ing the Eusolve this equation by us clidean

Algorithm to express the gcd of 10 and 3 as a linear combination of the two, but since

can just use "guess and check" to find this inverse. For

this, notice that

the modulus is so small, we

, and that . Hence we have .

, we'll do a similar trick: since , we're

ng to solve

To solve

really tryi . But this makes it clear that we can take

.

44

Page 45: Teorija Na Broevi

Finally, we need to solve . Since , we're trying to

solve . Using "guess and check", we see that is the solution

we're after.

tion Now that we've computed all the appropriate terms, our desired solu modulo

is therefore

(8)

You can e d see what its tive residue is, but you don't

need t ant.

xpand that out an least non-nega

o if you don't w

The Chinese Remainder Theorem is a really powerful tool for solving simultaneous

congruences, but lls us how s where the given li are it only te to solve problem modu

pairwise relatively prime. There are plenty of "real life" scenarios in which the moduli

ystem of congrue in which case it'

rsion of the CRT

for your s nces won't be so nice, though, s handy to

know this stronger ve :

Strengthened Chinese Remainder Theorem: For arbitrary integers and

congruence equations , th s a simultaneo ere exist us solution if and

only if for every . When a solution exis s unique modulots, it i

the least common multiple of the .

Example: The Strengthened CRT

Suppose someone asks you to solve the simultaneous equations

We won't worry about proving this for now, but it is good to have in mind.

(9)

Since you know that and since , you know that this

simultaneous system has no solutions.

Example: The Strengthened CRT

Suppose someone asks you to solve the simultaneous equations

(10)

45

Page 46: Teorija Na Broevi

Note that since , there will be a solution to this equation (and the

solution will be unique modulo ). To find this solution, we note that the

first equation translates to the exi eger e so that stence of an int . This

means that , and we can plug this value of x into the second equation:

(11)

Of course this equation is equivalent to , which is just a linear

ble e. W the methodo veloped

w that

congruence in the varia e can use logy we've already de

to solve this equation, and doing so will sho are the solutions mod

15. Plugging these values back into our initial expr , we see that ession for x

46

. Notice that all these values of x are congruence mod , so they

all give the same solution to our equation (mod ).