Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number...

32
Outline Divisibility Greatest common divisor Euclidean algorithm Extended Euclidean algorithm Introduction to Number Theory I Introduction to Number Theory I

Transcript of Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number...

Page 1: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Introduction to Number Theory I

Introduction to Number Theory I

Page 2: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Divisibility

Greatest common divisor

Euclidean algorithm

Extended Euclidean algorithm

Introduction to Number Theory I

Page 3: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionLet a and b be integers. We say that a 6= 0 divides b if there is aninteger k such that a · k = b. The notation for this is a|b.

Example

7|63 because 7 · 9 = 63.

Note that every number divides zero since a · 0 = 0 for everyinteger a.

Introduction to Number Theory I

Page 4: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaFor integers a, b, c, the following hold:

I If a|b, then a|b · c for all c.

I If a|b and b|c, then a|c.

I If a|b and a|c, then a|(sb + tc) for all s and t.

I If a|b and b|a, then a = ±b.

I For all c 6= 0, a|b if and only if ca|cb.

Proof: Exercise.

Introduction to Number Theory I

Page 5: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaFor integers a, b, c, the following hold:

I If a|b, then a|b · c for all c.

I If a|b and b|c, then a|c.

I If a|b and a|c, then a|(sb + tc) for all s and t.

I If a|b and b|a, then a = ±b.

I For all c 6= 0, a|b if and only if ca|cb.

Proof: Exercise.

Introduction to Number Theory I

Page 6: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaFor integers a, b, c, the following hold:

I If a|b, then a|b · c for all c.

I If a|b and b|c, then a|c.

I If a|b and a|c, then a|(sb + tc) for all s and t.

I If a|b and b|a, then a = ±b.

I For all c 6= 0, a|b if and only if ca|cb.

Proof: Exercise.

Introduction to Number Theory I

Page 7: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaFor integers a, b, c, the following hold:

I If a|b, then a|b · c for all c.

I If a|b and b|c, then a|c.

I If a|b and a|c, then a|(sb + tc) for all s and t.

I If a|b and b|a, then a = ±b.

I For all c 6= 0, a|b if and only if ca|cb.

Proof: Exercise.

Introduction to Number Theory I

Page 8: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaFor integers a, b, c, the following hold:

I If a|b, then a|b · c for all c.

I If a|b and b|c, then a|c.

I If a|b and a|c, then a|(sb + tc) for all s and t.

I If a|b and b|a, then a = ±b.

I For all c 6= 0, a|b if and only if ca|cb.

Proof: Exercise.

Introduction to Number Theory I

Page 9: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionA number p > 1 with no positive divisors other than itself and 1 iscalled a prime number.

Non-prime numbers bigger than 1 are called composite numbers.

The Prime Number theorem:

For each positive integer n there are approximately n/ ln n primenumbers up to n.

Euclid’s theorem:

If p is a prime number and p divides a · b, then p divides a or pdivides b.

Introduction to Number Theory I

Page 10: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionA number p > 1 with no positive divisors other than itself and 1 iscalled a prime number.

Non-prime numbers bigger than 1 are called composite numbers.

The Prime Number theorem:

For each positive integer n there are approximately n/ ln n primenumbers up to n.

Euclid’s theorem:

If p is a prime number and p divides a · b, then p divides a or pdivides b.

Introduction to Number Theory I

Page 11: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

The Fundamental Theorem of Arithmetic:

Every positive integer n can be written in a unique way in the form

n = pe11 · pe2

2 · pe33 ....pek

k

where p1 ≤ p2 ≤ p3 ≤ ... ≤ pk are primes and e1, e2, e3, ..., ek arepositive integers.

Introduction to Number Theory I

Page 12: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

The Fundamental Theorem of Arithmetic:

Every positive integer n can be written in a unique way in the form

n = pe11 · pe2

2 · pe33 ....pek

k

where p1 ≤ p2 ≤ p3 ≤ ... ≤ pk are primes and e1, e2, e3, ..., ek arepositive integers.

Introduction to Number Theory I

Page 13: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

The Fundamental Theorem of Arithmetic:

Every positive integer n can be written in a unique way in the form

n = pe11 · pe2

2 · pe33 ....pek

k

where p1 ≤ p2 ≤ p3 ≤ ... ≤ pk are primes and e1, e2, e3, ..., ek arepositive integers.

Introduction to Number Theory I

Page 14: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionA positive integer d is called greatest common divisor of a andb if d divides both a and b and any divisor of a and b is also adivisor of d . It is denoted gcd(a, b).

DefinitionIf gcd(a, b) = 1, then we say that a and b are relatively prime.

Dirichlet’s theorem:

Let a, b ∈ N be relatively prime. Then there exist infinitely manyprimes of the form a · n + b for n ∈ N.

Example

gcd(1539, 7380) = 32 since 1539 = 34 · 19 and 7380 = 22 · 32 · 5 · 41

Introduction to Number Theory I

Page 15: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionA positive integer d is called greatest common divisor of a andb if d divides both a and b and any divisor of a and b is also adivisor of d . It is denoted gcd(a, b).

DefinitionIf gcd(a, b) = 1, then we say that a and b are relatively prime.

Dirichlet’s theorem:

Let a, b ∈ N be relatively prime. Then there exist infinitely manyprimes of the form a · n + b for n ∈ N.

Example

gcd(1539, 7380) = 32 since 1539 = 34 · 19 and 7380 = 22 · 32 · 5 · 41

Introduction to Number Theory I

Page 16: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

DefinitionA positive integer d is called greatest common divisor of a andb if d divides both a and b and any divisor of a and b is also adivisor of d . It is denoted gcd(a, b).

DefinitionIf gcd(a, b) = 1, then we say that a and b are relatively prime.

Dirichlet’s theorem:

Let a, b ∈ N be relatively prime. Then there exist infinitely manyprimes of the form a · n + b for n ∈ N.

Example

gcd(1539, 7380) = 32 since 1539 = 34 · 19 and 7380 = 22 · 32 · 5 · 41

Introduction to Number Theory I

Page 17: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaIf a = q · b + r then gcd(a, b) = gcd(b, r).

Theorem (Euclid, 300 B.C.)

Given integers a and b with b > 0, there exist unique integers qand r satisfying

a = q · b + r , 0 ≤ r < b

The integers q and r are called, respectively, the quotient andremainder in the division of a and b.

Introduction to Number Theory I

Page 18: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaIf a = q · b + r then gcd(a, b) = gcd(b, r).

Theorem (Euclid, 300 B.C.)

Given integers a and b with b > 0, there exist unique integers qand r satisfying

a = q · b + r , 0 ≤ r < b

The integers q and r are called, respectively, the quotient andremainder in the division of a and b.

Introduction to Number Theory I

Page 19: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example

gcd(1147, 899) =

gcd(899, 248︸︷︷︸1147=1·899+248

)

= gcd(248, 155︸︷︷︸899=3·248+155

)

= gcd(155, 93︸︷︷︸248=1·155+93

)

Introduction to Number Theory I

Page 20: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example

gcd(1147, 899) = gcd(899, 248︸︷︷︸1147=1·899+248

)

=

gcd(248, 155︸︷︷︸899=3·248+155

)

= gcd(155, 93︸︷︷︸248=1·155+93

)

Introduction to Number Theory I

Page 21: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example

gcd(1147, 899) = gcd(899, 248︸︷︷︸1147=1·899+248

)

= gcd(248, 155︸︷︷︸899=3·248+155

)

=

gcd(155, 93︸︷︷︸248=1·155+93

)

Introduction to Number Theory I

Page 22: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example

gcd(1147, 899) = gcd(899, 248︸︷︷︸1147=1·899+248

)

= gcd(248, 155︸︷︷︸899=3·248+155

)

= gcd(155, 93︸︷︷︸248=1·155+93

)

Introduction to Number Theory I

Page 23: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example (Cont.)

= gcd(93, 62︸︷︷︸155=1·93+62

)

=

gcd(62, 31︸︷︷︸93=1·62+31

)

= gcd(31, 0︸︷︷︸62=2·31+0

)

= gcd(31, 0)

= 31.

Introduction to Number Theory I

Page 24: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example (Cont.)

= gcd(93, 62︸︷︷︸155=1·93+62

)

= gcd(62, 31︸︷︷︸93=1·62+31

)

=

gcd(31, 0︸︷︷︸62=2·31+0

)

= gcd(31, 0)

= 31.

Introduction to Number Theory I

Page 25: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example (Cont.)

= gcd(93, 62︸︷︷︸155=1·93+62

)

= gcd(62, 31︸︷︷︸93=1·62+31

)

= gcd(31, 0︸︷︷︸62=2·31+0

)

=

gcd(31, 0)

= 31.

Introduction to Number Theory I

Page 26: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example (Cont.)

= gcd(93, 62︸︷︷︸155=1·93+62

)

= gcd(62, 31︸︷︷︸93=1·62+31

)

= gcd(31, 0︸︷︷︸62=2·31+0

)

= gcd(31, 0)

= 31.

Introduction to Number Theory I

Page 27: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

TheoremLet a and b be positive integers with a ≥ b. The followingalgorithm computes gcd(a, b) in a finite number of steps.

1. Let r0 = a and r1 = b.

2. Set i=1.

3. Divide ri−1 by ri to get a quotient qi and remainder ri+1,

ri−1 = ri · qi + ri+1 with 0 ≤ ri+1 < ri

4. If the remainder ri+1 = 0, then ri = gcd(a, b) and thealgorithm terminates.

5. Otherwise, ri+1 > 0, so set i = i + 1 and go to Step 3.

The division step is executed in at most 2log2(b) + 1 times.

Introduction to Number Theory I

Page 28: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

TheoremLet a and b be positive integers with a ≥ b. The followingalgorithm computes gcd(a, b) in a finite number of steps.

1. Let r0 = a and r1 = b.

2. Set i=1.

3. Divide ri−1 by ri to get a quotient qi and remainder ri+1,

ri−1 = ri · qi + ri+1 with 0 ≤ ri+1 < ri

4. If the remainder ri+1 = 0, then ri = gcd(a, b) and thealgorithm terminates.

5. Otherwise, ri+1 > 0, so set i = i + 1 and go to Step 3.

The division step is executed in at most 2log2(b) + 1 times.

Introduction to Number Theory I

Page 29: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

TheoremLet a and b be positive integers with a ≥ b. The followingalgorithm computes gcd(a, b) in a finite number of steps.

1. Let r0 = a and r1 = b.

2. Set i=1.

3. Divide ri−1 by ri to get a quotient qi and remainder ri+1,

ri−1 = ri · qi + ri+1 with 0 ≤ ri+1 < ri

4. If the remainder ri+1 = 0, then ri = gcd(a, b) and thealgorithm terminates.

5. Otherwise, ri+1 > 0, so set i = i + 1 and go to Step 3.

The division step is executed in at most 2log2(b) + 1 times.

Introduction to Number Theory I

Page 30: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

LemmaThe following statements about the greatest common divisor hold:

I Every common divisor of a and b divides gcd(a, b).

I gcd(k · a, k · b) = k · gcd(a, b) for all k > 0.

I If gcd(a, b) = 1 and gcd(a, c) = 1,then gcd(a, b · c) = 1.

I If a|bc and gcd(a, b) = 1, then a|c.

Proof: Exercise.

Introduction to Number Theory I

Page 31: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

TheoremGiven integers a and b not both of which are zero, there existintegers x and y such that gcd(a, b) = a · x + b · y.

TheoremLet a and b be integers with at least one of them different fromzero. The integers a and b are relatively prime if and only if1 = a · x + b · y for some x , y ∈ Z.

Introduction to Number Theory I

Page 32: Introduction to Number Theory I - Boise State University · 2011-08-29 · Introduction to Number Theory I. Outline Divisibility Greatest common divisor Euclidean algorithm Extended

OutlineDivisibility

Greatest common divisorEuclidean algorithm

Extended Euclidean algorithm

Example

gcd(12378, 3054) = 4 = 3186 · 12378 + (−12913) · 3054

TheoremLet a and b be positive integers. Then the equationax + by = gcd(a, b) always has a solution in integers x and y. If(x0, y0) is one solution, then every solution has the formx = x0 + b·k

gcd(a,b) and y = y0 − a·kgcd(a,b) for some k ∈ Z.

Proof: Exercise.

Introduction to Number Theory I