Você está na página 1de 81

Outline

1 Basic Concepts
Sets, index sets, Cartesian product, Relations and Functions
The Integers and Division
Introduction
Integer Division
Modular Arithmetic

Applications of Congruences
Hushing Functions
Pseudo-random Numbers
Cryptology

Primes, Greatest common divisors and Least common multiples


Primes
Greatest common divisors and Least common multiples
Euclidean Algorithm

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 1 / 79


Basic Concepts Sets, index sets, Cartesian product, Relations and Functions

Sets, index sets, Cartesian product, Relations and

Functions

Revision Part One


Make a thorough revision on Sets, Index sets, Cartesian
product,Relations and Functions.
There will be questions supplied for tutorials about this section.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 2 / 79


Basic Concepts The Integers and Division

The Integers and Division

Revision Part Two


Make a thorough revision on the Well-ordering principle and the
Principle of Mathematical Induction.
Study the relationship between the Well-ordering principle and the
Principle of Mathematical Induction.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 3 / 79


Basic Concepts The Integers and Division

Introduction

Introduction
The part of mathematics involving the integers and their properties
belongs to the branch of mathematics called Number theory.
In this section, will develop the basic concepts of number theory used
throughout the computer science.
We will review some basic concepts of number theory including
Divisibility and Modular Arithmetic.
We will cover a bit on primes and introduce the algorithm of nding
the Greatest common divisor.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 4 / 79


Basic Concepts The Integers and Division

Integer Division

Integer Division
When one integer is divided by a second, nonzero integer, the
quotient may or may not be an integer.
Foe example 12=4 = 3 is an integer, while 11=4 = 2:75 is not integer.
These examples lead to the following de nition.

De nition (Divisibility)
If a and b are integers with a 6= 0, we say that a divides b if there is an
integer c such that b = ac . When a divides b, we say that a is a factor of
b and that b is a multiple of a. The notation ajb denotes a divides b . We

write a - b when a does not divide b.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 5 / 79


Basic Concepts The Integers and Division

Integer Division

Integer Division
We can express ajb using quanti ers, 9c [ac = b], where the universe
of discourse is the set of all integers.

Theorem (Divisibility Theorem)


Let a; b and c be integers. Then

a) j j
if a b and a c , then a j( b + c );
b) j j
if a b, then a bc for all integers c ;

c) j j j
if a b and b c , then a c .

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 6 / 79


Basic Concepts The Integers and Division

Integer Division

Proof
First, we give a direct proof of (a). We suppose that ajb and ajc .
Then from the de nition of divisibility, it follows that, 9s ; t 2 Z such
that b = as and c = at .
Hence, b + c = as + at = a(s + t ). Therefore, a divides b + c and
thus this establishes part (a) of the theorem.
The proof of the rest of the theorem are left as exercise.

Corollary
j
If a; b and c are integers such that a b and a c , then a mb j j + nc , whenever
m and n are integers.

The proof is left as exercise

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 7 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


An application of the Principle of Well-Ordering that we will use
often is the division algorithm.
When an integer is divided by a positive integer, there is a quotient
and a remainder, as the division algorithm shows.

Theorem (Division Algorithm)


Let a; b 2 Z with b 6= 0
. Then there exist unique integers q and r such

that a = bq + r , where 0  r < b jj

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 8 / 79


Basic Concepts The Integers and Division

The Division Algorithm

Proof
This is a perfect example of the existence-and-uniqueness type of
proof.
We must rst prove that the numbers q and r actually exist.
Then we must show that if q 0 and r 0 are two other such numbers,
then q = q 0 and r = r 0 .
The existence of q and r . Let
S = fa bk kj 2 Z; a bk  0g

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 9 / 79


Basic Concepts The Integers and Division

The Division Algorithm

Proof
If 0 2 S , then b divides a, and we can let q = a=b and r = 0.
If 0 6= S and b  1, we can use the Well-Ordering Principle and we
must rst show that S is nonempty.
If a > 0, then a b:0 2 S . If a < 0, then a b(2a) = a(1 2b) 2 S .
In either case, S 6= ;. By the Well-Ordering Principle, S must have a
smallest member, say r = a bq .
Therefore, a = bq + r ; r  0.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 10 / 79


Basic Concepts The Integers and Division

The Division Algorithm

Proof
We now show that r < b . Suppose that r > b . Then
a ( + 1) = a
b q bq b =r b > 0
In this case we would have a b(q + 1) in the set S .
But then a b(q + 1) < a bq , which would contradict the fact that
r = a bq is the smallest member of S .

So r  b. Since 0 2= S , r 6= b and so r < b.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 11 / 79


Basic Concepts The Integers and Division

The Division Algorithm

Proof
Uniqueness of and q r . Suppose there exists integers q; r ; q 0 and r 0
such that
a = bq + r ; 0  r < b jj and a = bq 0 + r 0 ; 0  r 0 < jbj
Then bq + r = bq 0 + r 0 . Assume that r 0  r . From the last equation
we have b(q q 0 ) = r 0 r .
Therefore, b must divide r 0 r and 0  r 0 r  r 0 < b.
This is only possible if r 0 r = 0. Hence, r 0 = r and q = q 0 .

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 12 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


The theorem (4) is not really an algorithm. Nevertheless, we use its
traditional name.

De nition
In the equality given in the division algorithm, b is called the divisor, a is
called the dividend, q is called the quotient and r is called the
remainder. This notation is used to express the quotient and remainder.
q = adivb; r mod b

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 13 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


Example 1: What are the quotient and remainder when 101 is
divided by 11?
Solution: We have 101 = 11  9 + 2. Hence, the quotient when 101
is divided by 11 is 9 = 101div11, and the remainder is 2 = 101mod11.
Example 2: What are the quotient and remainder when 11 is
divided by 3?

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 14 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


Example 1: What are the quotient and remainder when 101 is
divided by 11?
Solution: We have 101 = 11  9 + 2. Hence, the quotient when 101
is divided by 11 is 9 = 101div11, and the remainder is 2 = 101mod11.
Example 2: What are the quotient and remainder when 11 is
divided by 3?
Solution: We have 11 = 3  4 + 1. Hence, the quotient when
11 is divided by 3 is 4 = 11div3, and the remainder is
1 = 11mod3.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 14 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


Example 1: What are the quotient and remainder when 101 is
divided by 11?
Solution: We have 101 = 11  9 + 2. Hence, the quotient when 101
is divided by 11 is 9 = 101div11, and the remainder is 2 = 101mod11.
Example 2: What are the quotient and remainder when 11 is
divided by 3?
Solution: We have 11 = 3  4 + 1. Hence, the quotient when
11 is divided by 3 is 4 = 11div3, and the remainder is
1 = 11mod3.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 14 / 79


Basic Concepts The Integers and Division

The Division Algorithm

The Division Algorithm


Note that, the remainder cannot be negative. Consequently, the
remainder is not 2, even though 11 = 3( 3) 2, because, r = 2
does not satisfy 0  r < j3j.
Question 1: What are the quotient and remainder when 19 is divided
by 4?

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 15 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Modular Arithmetic
In some situations we care only about the remainder of an integer
when it is divided by some speci ed positive integer.
For instance, when we ask what time it will be (on a 24-hour clock)
50 hours from now, we care only about the remainder when 50 plus
the current hour is divided by 24.
Because we are often interested only in remainder, we have special
notation for them.
We have notation to indicate that two integers have the same
remainder when they are divided by the positive integer m

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 16 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

De nition
If a and b are integers and m is a positive integer, then a is congruent to
b modulo m if m divides a b. We use notation a  b (mod m) to
indicate that a is congruent to b modulo m. If a and b are not
congruent modulo m, then we write a 6 b (mod m).
Modular Arithmetic
The connection between the notations used when working with
remainders is made clear in theorem (7) below.

Theorem
Let a and b be integers, and let m be a positive integer.

Then a  b (mod m) if and only if a mod m = b mod m.


MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 17 / 79
Basic Concepts The Integers and Division

Modular Arithmetic

Proof
First we assume that  a (mod m) is true. Then by using the
b

division algorithm, positive integers r1 and r2 and the integers q1 and


q2 such that

a = mq1 + r1 ; and b = mq2 + r2


Then, since a  b (mod m), it follows that mj(a b), and
consequently, mj(r1 r2 .
But with 0  jr1 r2 j < m, we now nd that r1 = r2
Hence, if a  b (mod m) then a; b have the same remainder upon
division by m.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 18 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Proof
Conversely, we assume that a mod m = b mod m is true. Then let

= a mod m and r2 = b mod m.


r1

We assume that 9q1 ; q2 2 Z such that by division algorithm we have


a = mq1 + r1 ; and b = mq2 + r2
But with r1 = r2 then a b = (q1 q2 )m and hence a  b (mod m)
Example: Determine whether 17 is congruent to 5 modulo 6 and
whether 24 and 14 are congruent modulo 6.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 19 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Modular Arithmetic
The notion of congruences has played an important role in the
development of number theory.
The theorem below provides useful way to work with congruences.

Theorem
Let m be a positive integer. The integers a and b are congruent modulo m

if and only if there is an integer k such that a = b + km

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 20 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Proof
If a  b (mod m), then mj(a b). This means that there is an
integer k such that a b = km, so that a = b + km.
Conversely, if there is an integer k such that a = b + km, then
km = a b.

Hence, m divides a b, so that a  b (mod m).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 21 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Modular Arithmetic
The set of all integers congruent to an integer a modulo m is called
the congruence class of a modulo m.
The theorem below shows how congruences work with respect to
addition and multiplication.

Theorem
Let m be a positive integer. If a  b (mod m) and c  d (mod m), then
a +c  b + d (mod m); and; ac  bd (mod m)

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 22 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Proof
Because a  b (mod m) and c  d (mod m).
Then 9s ; t 2 Z such that a = b + sm and c = d + tm.
Hence
a + c = (b + d ) + (s + t )m =) a + c  b + d (mod m)
ac = (b + sm )(d + tm ) = bd + (bt + ds )m + stm
2

= bd + (bt + ds + stm)m =) ac  bd (mod m)

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 23 / 79


Basic Concepts The Integers and Division

Modular Arithmetic

Corollary
Let m be a positive integer, and let a and b be integers. Then

(a + b) (mod m) = ((a mod m) + (b mod m)) (mod m); and


ab (mod m) = ((a mod m)(b mod m)) (mod m)

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 24 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Applications of Congruences
Number theory has applications to a wide range of areas.
In this section we will get introduced to three applications of
congruences such as:
1 The use of congruence to assign memory locations to computer les.
2 The generation of pseudo-random numbers and
3 Cryptosystems based on modular arithmetic.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 25 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Hashing Functions
The central computer at an insurance company maintains records for
each of its customers.
How can memory locations be assigned so that customers records can
be retrieved quickly?
The solution to this problem is to use a suitably chosen Hashing
function.

Records are identi ed using a key, which uniquely identi es each


customer's records.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 26 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Hashing Functions
For instance, customer records are often identi ed using the social
security number of the customer as the key.
A hashing function h assigns memory locations h(k ) to the record
that has k as its key.
The widely applied hashing function is de ned hereunder:
( ) = k mod m
h k

where m is the number of available memory locations.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 27 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Hashing Functions
Hashing function should be easily evaluated so that les can be
quickly located.
The hashing function h(k ) = k mod m meets this requirement.
To nd h(k ), we need only compute the remainder when k is divided
by m.
Furthermore, the hashing function should be onto, so that all
memory locations are possible.
The function h(k ) = k mod m also satis es this property.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 28 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Hashing Functions
For example, when m = 111, the record of the customer with social
security number 064212848 is assigned to memory location 14,
because
h (064212848) = 064212848 mod 111 = 14

Similarly h(037149212) = 037149212 mod 111 = 65.


Thus, the records of the customer with social security 037149212 is
assigned to memory location 65.
Because, hashing function is not one-to-one(because there are more
possible keys than the memory locations), more than one le may be
assigned to a memory location.
When this happens, we say that a Collision occurs.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 29 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Hashing Functions
One way to resolve a collision is to assign the rst free location
following the occupied memory location assigned by hashing function.
For instance, consider a customer with social security number
107405723. We would like assign this to a memory location using
hashing function.
That is, h(107405723) = 107405723 mod 111 = 14.
But this location is already occupied(by the le of customer with SSN
064212848).
However, memory location 15, the rst location following memory
location 14 is free, so we assign it there.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 30 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers
Randomly chosen numbers are often needed for computer simulations.
Di erent methods have been devised for generating numbers that
have properties of randomly chosen numbers.
Numbers generated by systematic methods are not truly random, they
are called Pseudo-random numbers.
The most commonly used procedure for generating pseudo-random
numbers is the Linear Congruential method.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 31 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers
We choose four integers: The modulus m, multiplier a, increment c
and seed x0 , with 2  a < m; 0  c < m and 0  x0 < m.
We generate a sequence of pseudorandom numbers fxn g, with
0  xn < m for all n, by successively using the congruence.
xn+1 = (axn + c ) mod m

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 32 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers
Many computer experiments require the generation of pseudo-random
numbers between 0 and 1.
To generate such numbers, we divide numbers generated with a linear
congruential generator by the modulus; that is, we use the numbers
xn =m .

Below here is an example of the sequence of pseudo-random numbers


generated by choosing m = 9; a = 7; c = 4; and x0 = 3.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 33 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers

x1 = 7x0 + 4 mod 9 = 7  3 + 4 mod 9 = 25 mod 9 = 7


x2 = 7x1 + 4 mod 9 = 7  7 + 4 mod 9 = 53 mod 9 = 8
x3 = 7x2 + 4 mod 9 = 7  8 + 4 mod 9 = 60 mod 9 = 6
x4 = 7x3 + 4 mod 9 = 7  6 + 4 mod 9 = 46 mod 9 = 1
x5 = 7x4 + 4 mod 9 = 7  1 + 4 mod 9 = 11 mod 9 = 2
x6 = 7x5 + 4 mod 9 = 7  2 + 4 mod 9 = 18 mod 9 = 0

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 34 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers
Continuation from above
x7 = 7x6 + 4 mod 9 = 7  0 + 4 mod 9 = 4 mod 9 = 4
x8 = 7x7 + 4 mod 9 = 7  4 + 4 mod 9 = 32 mod 9 = 5
x9 = 7x8 + 4 mod 9 = 7  5 + 4 mod 9 = 39 mod 9 = 3
Because x9 = x0 and because each term depends only on the previous
term, this sequence is generated.
That is the Pseudo-random numbers generated are:
3; 7; 8; 6; 1; 2; 0; 4; 5; 3; 7; 8; 6; 1; 2; 0; 4; 5; 3; : : : .

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 35 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Pseudo-random Numbers
This sequence contains nine(9) di erent numbers before repeating.
Often, a Linear congruential generator with increment c = 0 is used.
Such a generator is called a Pure multiplicative generator.
For example, the pure multiplicative generator with modulus 2311 1
and multiplier 75 = 16; 807 is widely used.
With these values, it can be shown that 231 2 numbers are
generated before repetition.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 36 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Cryptology
Congruence have numerous applications to discrete mathematics and
computer science.
One of the most important application of congruences involves
Cryptology, which is the study of secret messages.
One of the earliest known uses of cryptology was by Julius Caesar.
He made messages secret by shifting each letter three letters forward
in the alphabet(sending the last three letters of the alphabet to the
rst three letters).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 37 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Cryptology
For instance, using this scheme, the letter B is send to E and the
letter X is send to A.
This is an example of Encryption, that is, the process of making a
message secret.
To express Caesar's encryption process mathematically, rst replace
each letter by an integer from 0 to 25 based on its position in the
alphabet.
For example replace A by 0, K by 10 and Z by 25.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 38 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Cryptology
Caesar's encryption method can be represented by the function f that
assigns to the nonnegative integer p; p  25, the integer
f (p ) 2 f0; : : : ; 25g with

f (p ) = (p + 3) mod 26
In the encrypted version of the message, the letter represented by p is
then replaced with the letter represented by (p + 3) mod 26

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 39 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Cryptology: Example
Example: What is the secret message produced from message
\MEET YOU IN THE PARK"using the Caesar cipher?
Solution: First replace the letters in the message with numbers. This
produces 12 4 4 19 24 14 20 8 13 19 7 4 15 0 17 10.
Now replace each of these numbers p by f (p ) = (p + 3) mod 26.
This gives 15 7 7 22 1 17 23 11 16 22 10 7 18 3 20 13.
Translating this back to letters produces the encrypted message
PHHW BRX LQ WKH SDUN.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 40 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Encryption
To recover the original message from a secret message encrypted by
Caesar cipher, the function f 1 , the inverse of f is used.
Note that the function f 1 sends an integer p from f0; : : : ; 25g to
f
1
(p ) = (p 3) mod 26.
In other words, to nd the original message, each letter is shifted
back three letters in the alphabet, with the rst three letters send to
the last three letters of the alphabet.
The process of determining the original message from the encrypted
message is called Decryption.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 41 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Encryption
There are various ways to generalize the Caesar cipher.
For example, instead of shifting each letter by 3, we can shift each
letter by an integer k , so that
f (p ) = (p + k ) mod 26
Such a cipher is called Shift cipher.
Note that decryption can be carried out using the function
f
1
(p ) = (p k ) mod 26

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 42 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Encryption
Obviously Caesar's method and shift cipher do not provide a high
level of security.
There are various ways to enhance security in this method.
One approach that slightly enhances the security is to use a function
of the form
f (p ) = (ap + b ) mod 26
where a and b are integers, chosen such that f is bijection.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 43 / 79


Basic Concepts Applications of Congruences

Applications of Congruences

Encryption
Such a mapping is called ane transformation.
This provides a number of possible encryption systems.
Example: Encrypt the message in the example above using the
function f (p ) = (7p + 3) mod 26.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 44 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
Every positive integer greater than 1 is divisible by at least two
integers.
Positive integers that have exactly two di erent positive integer
factors are called Primes.
De nition
A positive integer p greater than 1 is called prime if the only positive
factors of p are 1 and p . A positive integer that is greater than 1 and is
not prime is called Composite.
Remark: The integer n is composite if and only if there exists an
integer a such that ajn and 1 < a < n.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 45 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
The primes are the building blocks of positive integers, as the
Fundamental Theorem of Arithmetic below shows
Theorem (The Fundamental Theorem of Arithmetic)
Every positive integer greater than 1 can be written uniquely as a prime or

as the product of two or more primes where the prime factors are written

in order of nondecreasing size.

Primes
Question: Find the prime factorizations of 100, 641, 999 and 1024.
The following theorem below gives the procedures on how to show
that a given integer is a prime or not.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 46 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Theorem
p
If n is a composite integer, then n has a prime divisor less than or equal to

n.

Proof
Let n be a composite integer. Then by de nition of composite integer
there is a positive integer factor a with 1 < a < n such that n = ab
and b is a positive integer greater than 1.
Required to show
p p
that a  np_ bp n. Suppose that
p n ^b >
p n , then ab > n = n , which is contradiction.
p p
a > n:

Consequently, a  n _ b  n

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 47 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Proof
Because both
p a and b are divisors of n, then n has positive divisor not
exceeding n.
This divisor is either a prime or by the Fundamental Theorem of
Arithmetic, has a prime divisor less than itself.
p
In either case, n has a prime divisor less than or equal to n.
Question: Show that 101 is a prime integer.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 48 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
Let us now discuss the procedures for nding the prime factorization
of every integers under the question.
Consider the problem of nding the prime factorization of an integer
n.

Begin by dividing n by successive primes, starting with the least prime


2.
If n has a primep factor, then by the theorem above a prime factor p
not exceeding n will be found.
p
If no prime factor exceeding n is found then n is a prime integer.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 49 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
Otherwise, if a prime p is found continue by factoring n=p .
Note that n=p has no prime factors less than p.
Again, if n=p has no prime factor greater than or equal to p and not
exceeding its square root, then it is a prime.
Otherwise, if it has a prime factor q , continue by factoring n=(pq ).
This procedure is continued until the factorization has been reduced
to a prime.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 50 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
Question: Find the prime factorization of 7007.
Solution: First perform the division of 7007 by successive primes,
starting with the least prime 2.
However, none of the primes 2,3, and 5 divides 7007. But 7 does
divide 7007 with 7007=7 = 1001.
Next, divide 1001 by successive primes beginning with 7, and it is
immediately noted that 7 does divide 1007 and it is 1001=7 = 143.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 51 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Primes

Primes
The process continue by dividing 143 by successive primes starting
with 7.
But 7 - 143, however 11 does divide 143 and thus 143=11 = 13.
Since 13 is a prime then the process is complete and it follows that
the prime factorization of 7007 is 72  11  13.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 52 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Greatest common divisors

The gcd
The largest integer that divides both of two integers is called the
greatest common divisor of these integers.
De nition
Let a and b be integers not zero. The largest integer d such that d ja and
d jb is called the gcd of a and b . The greatest common divisor of a and b

is denoted by gcd(a; b).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 53 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Greatest common divisors

The gcd: Example


The gcd of two integers, not both zero, exists because the set of
common divisors of these integers is nite.
One way to nd the gcd of two integers is to nd all the positive
common divisors of both integers and then take the largest divisor.
Example 1: What is the gcd(24; 36)?
Solution: The positive common divisors of 24 and 36 are 1,2,3,4,6
and 12. Hence the gcd(24; 36) = 12

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 54 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Greatest common divisors

The gcd
Example 2: What is the gcd(17 22)? ;

Solution: The integers 17 and 22 have no positive common divisors


other than 1, so that gcd(17; 22) = 1
De nition
The integers a and b are relatively prime if their greatest common divisor
is 1.

De nition
The integers a1 ; a2 ; : : : ; an are pairwise relatively prime if gcd(ai ; aj ) = 1
whenever 1  i < j  n.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 55 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Greatest common divisors

Relatively prime: Example


Example 3:Determine whether the integers 10,17 and 21 are pairwise
relatively prime and whether the integers 10,19 and 24 are pairwise
relatively prime.
Solution: Because gcd(10; 17) = gcd (10; 21) = gcd(17; 21) = 1, we
conclude that 10,17 and 21 are pairwise relatively prime.
But, since gcd(10; 24) = 2 > 1, we see that 10,19, and 24 are not
pairwise relatively prime.
Another way to nd gcd of two integers is to use the prime
factorization of these integers.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 56 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Greatest common divisors

Prime factorization
Suppose that the prime factorization of the integers a and b, neither
equal to zero, are
a = p1a 1
;p
a2 an
2 ; : : : ; pn and b = p1b 1
;p
b2 bn
2 ; : : : ; pn

where each exponent is nonnegative integer, and where all primes


occurring in the prime factorization of either a and b are included in
both factorizations, with zero exponents if necessary.
Then gcd(a,b) is given by

(
gcd a; b ) = p1min(a b
1; 1)
:p
2
min(a b
2; 2)
: : : : :pn
min(an bn )
;

where the min(an ; bn ) represents the minimum of the two numbers an


and bn .
MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 57 / 79
Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Example
Example 4: Find the gcd(120 500). ;

Solution: From the prime factorization: 120 = 2 :3:5 and


3

500 = 2 :5 .2 3

Thus the
gcd(120; 500) = 2min(3 2) :3min(1 0) :5min(1 3) = 22 :30 :51 = 20
; ; ;

Prime factorization can also be used to nd the Least common


multiple of two integers.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 58 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The Least common multiple

The lcm

De nition
The least common multiple of the positive integers a and b is the smallest
positive integer that is divisible by both a and b. The least common
multiple of a and b is denoted by lcm(a; b).

Now suppose that the prime factorization of a and b are as before.


Then the least common multiple of a and b is given by

lcm(a; b) = p1max(a b
1; 1)
:p
2
max(a b
2; 2) max(an bn )
: : : : :pn
;

where max(an ; bn ) denotes the maximum of the two numbers an and


bn.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 59 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The gcd and lcm

Least common multiple


Example 5: What is the lcm(95256; 432)?
Solution: We have 95256 = 23; 35:72 and 432 = 24:33
So, lcm(95256; 432) = 190512
Theorem
Let a and b be positive integers. Then ab = gcd(a; b):lcm(a; b)

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 60 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Theorem
Let a and b be nonzero integers. Then there exist integers r and s such

that

(
gcd a; b ) = ar + bs
Furthermore, the greatest common divisor of a and b is unique.

Proof
Let
S = fam + bnjm; n 2 Z; am + bn > 0g
Clearly, the set S is nonempty; hence, by the Well-Ordering
Principle, S must have a smallest member, say d = ar + bs .

We claim that d = gcd(a; b).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 61 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Proof
Write a = dq + r 0 where 0  r 0 < d . If r 0 > 0 then
r
0=a dq

= a (ar + bs )q
= a arq bsq
= a(1 rq ) + b( sq )
which is in S .
But this would contradict the fact that d is the smallest member of S .
Hence r 0 = 0 and d divides a.
A similar argument shows that d divides b. Therefore, d is a common
divisor of a and b.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 62 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Proof
Suppose that d 0 is another common divisor of a and b and we want
to show that d 0 jd .
If we let a = d 0 h and b = d 0 k then
d = ar + bs = d 0 hr + d 0 ks = d 0 (hr + ks )
So d 0 must divide d and hence d must be the unique greatest
common divisor of a and b.

Theorem
Let a and b be nonzero integers. Then a and b are relatively prime if and

only if there exists integers r and s such that ar + bs = 1.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 63 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Proof
Let a and b be relatively prime. Then the gcd(a; b) = 1.
By the theorem above there exists r ; s 2 Z such that ar + bs = 1.
Conversely, suppose that ar + bs = 1 for some pair of integers r and
s , and let d = gcd(a; b ).

Then, d ja and d jb and so d j(ar + bs ) or d j1.


Since d is a positive integer and d j1, then d = 1. Thus, gcd(a; b) = 1
and so a and b are relatively prime.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 64 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

The greatest common divisor

Theorem
Let a; b; c 2 Z with a 6= 0 j
. If a bc and a and b are relatively prime, then

j
a c.

Proof
Since a and b are relatively prime, then 9r ; s 2 Z such that
ar + bs = 1.

Thus, c = acr + bcs . Since aja and by the hypothesis ajbc , then it is
obviously that aj(acr + bcs ) and hence ajc .

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 65 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
The method described earlier for computing the gcd of two integers,
using prime factorizations of these integers, is inecient.
The reason is that, it is time consuming to nd prime factorizations.
We are interested in a more ecient method of nding the gcd, called
the Euclidean Algorithm.
Before describing the Euclidean Algorithm, we would like rst to show
how it is used to nd gcd(91; 287).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 66 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
First, divide 287, the larger of the two integers, by 91, the smaller, to
obtain
287 = 91  3 + 14
Any divisor of 91 and 287 must also be a divisor of 287 91  3 = 14.
Also, any divisor of 91 and 14 must be a divisor of 287 = 91  3 + 14.
Hence, the gcd of 91 and 287 is the same as the gcd of 91 and 14.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 67 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
This means that the problem of nding the gcd(91; 287) has been
reduced to the problem of nding the gcd(91; 14).
Next, divide 91 by 14 to obtain 91 = 14  6 + 7.
With the same reasons, gcd(91; 14) = gcd(14; 7).
Continue by dividing 14 by 7, to obtain 14 = 7  2 + 0.
Because 7 divides 14, it follows that gcd(14; 7) = 7

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 68 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
Furthermore, because gcd(287; 91) = gcd(91; 14) = gcd(14; 7) = 7,
the original problem has been solved.
We now describe how the Euclidean algorithm works in generality.
We will use successive division to reduce the problem of nding the
greatest common divisor of two positive integers to the same problem
with smaller integers, until one of the integer is zero.
The Euclidean Algorithm is based on the following result about
greatest common divisors and the division algorithm.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 69 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Algorithm

Lemma
Let a = bq + r , where a; b; q and r are integers. Then

gcd(a; b ) = gcd(b; r ).

Proof: It is enough to show that the common divisors for a and b are
the same as the common divisors for b and r .
Now suppose that d ja and d jb. Then it follows that d j(a bq ),
which implies that d jr .
Hence, any common divisor of a and b is also a common divisor of b
and r .

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 70 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Algorithm
Likewise, suppose that d jb and d jr . Then d j(bq + r ), which implies
that d ja.
Hence, any common divisor of b and r is also a common divisor of a
and b.
Consequently gcd(a; b) = gcd(b; r ).

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 71 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Description of Euclidean Algorithm


Suppose that a and b are positive integers with a  b.
Let r0 = a and r1 = b. When we successively apply the division
algorithm, we obtain
r0 = r1 q1 + r2 ; 0  r2 < r1
r1 = r2 q2 + r 3; 0  r3 < r2
..
.
rn 2 = rn 1 qn 1 + rn ; 0  rn < rn 1

rn 1 = rn qn

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 72 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Description of Euclidean Algorithm


Eventually, a remainder of zero occurs in this sequence of successive
divisions, because the sequence of remainders
a = r0 > r1 > r2 > r3 > : : : > O cannot contain more than a terms.

Furthermore, it follows from the Lemma that


gcd(a; b) = gcd(r0 ; r1 ) = gcd(r1 ; r2 ) = : : : = gcd(rn 1 ; rn ) = gcd(rn ; o ) =
Hence, the greatest common divisor is the last nonzero remainder in
the sequence of divisions.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 73 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm: Example


Example 6: Find the gcd(414; 662) using the Euclidean algorithm.
Solution: The successive uses of the division algorithm give
662 = 414  1 + 248
414 = 248  1 + 166
248 = 166  1 + 82
166 = 82  2 + 2
82 = 2  41
Hence, gcd(414; 662) = 2, because, 2 is the last nonzero remainder.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 74 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm: Example


Example 6:Let us compute the greatest common divisor of 945 and
2415.
Solution: First observe that, the successive uses of the division
algorithm give
2415 = 945  2 + 525
945 = 525  1 + 420
525 = 420  1 + 105
420 = 105  4 + 0 :

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 75 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm: Example


Reversing our steps, 105 divides 420, 105 divides 525, 105 divides
945, and 105 divides 2415.
Hence, 105 divides both 945 and 2415.
If d were another common divisor of 945 and 2415, then d would also
have to divide 105. Therefore, gcd(945; 2415) = 105.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 76 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
If we work backward through the above sequence of equations, we
can also obtain numbers r and s such that 945r + 2415s = 105.
Observe that
105 = 525 + ( 1)  420 = 525 + ( 1)  [945 + ( 1)  525] = 2  525
So r = 5 and s = 2. Notice that r and s are not unique, since
r = 41 and s = 16 would also work.

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 77 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
To compute gcd(a; b) = d , we are using repeated divisions to obtain
a decreasing sequence of positive integers
r1 > r2 > : : : > rn =d
That is
= aq1 + r1 ;
b 0  r1 < a
a = r1 q2 + r2 ; 0  r2 < r1
.
r1 = r2 q3 + r3 0  r3 < r2 ..
rn 2 = rn 1 qn 1 + rn ; 0  rn < rn 1

rn 1 = rn qn

MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 78 / 79


Basic Concepts Primes, Greatest common divisors and Least common multiples

Euclidean Algorithm

Euclidean Algorithm
To nd r and s such that ar + bs = d , we begin with this last
equation and substitute results obtained from the previous equations:
d = rn
= rn 2 rn 1 qn

rn 2 [ 3 qn 1 rn 2 ]
qn rn

qn rn 3 + [1 + qn qn 1 ]rn 2

..
.
= ar + bs
The algorithm that we have just used to nd the greatest common
divisor d of two integers a and b and then write d as the linear
combination of a and b is known as the Euclidean Algorithm.
MBIGILI Lusungu Julius () MSS211: Abstract Algebra November 15, 2016 79 / 79

Você também pode gostar