introduction to number theory iii - boise state universityliljanab/isas/course_materials/... ·...

28
Outline Congruences Solving congruences a · X = b mod n Chinese Remainder Theorem Fermat’s Little Theorem and Euler’s Theorem Introduction to Number Theory III Introduction to Number Theory III

Upload: others

Post on 11-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Introduction to Number Theory III

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Congruences

Solving congruences a · X = b mod n

Chinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Definition1 Let n > 0 be an integer. We say that integers a and b arecongruent modulo n if n divides their difference.We write a ≡ b mod n. The number n is called the modulusand b is called the remainder.

DefinitionLet a, b ∈ Zn and n be a positive integer. We say a is amultiplicative inverse of b modulo n if a · b = 1 mod n.

TheoremSuppose gcd(a, n) = 1. Let u and v be integers such thata · u + n · v = 1. Then a · u ≡ 1 mod n, u is the multiplicativeinverse inverse for a modulo n.

1Carl F. Gauss, Disquisitiones Arithmeticae, 1801.Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

TheoremThe equation a · X = b mod n has a solution if gcd(a, n) dividesb.

TheoremIf a and n are integers and d = gcd(a, n), then gcd(a/d , n/d) = 1.

Proof: Exercise.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

TheoremLet a, b and n are integers with n ≥ 1 and let d = gcd(a, n).

1. If d does not divide b, then a ·X = b mod n does not have asolution.

2. If d divides b then a · X = b mod n has exactly dincongruent solutions. To find the solutions, first find asolution (x0, y0) to the linear equation

a · X + n · Y = d

Then the set of solutions is given by

x ≡ x0 + k · n/d mod n for k = 0, 1, 2, ..., d − 1.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 1: d = gcd(a, n) = 1.

1. Use the Extended Euclidean Algorithm to find u and v suchthat a · u + n · v = 1.

2. The solution is X ≡ b · u mod n.

Example

Solve 11111 · X ≡ 4 mod 12345.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 1: d = gcd(a, n) = 1.

1. Use the Extended Euclidean Algorithm to find u and v suchthat a · u + n · v = 1.

2. The solution is X ≡ b · u mod n.

Example

Solve 11111 · X ≡ 4 mod 12345.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 1: d = gcd(a, n) = 1.

1. Use the Extended Euclidean Algorithm to find u and v suchthat a · u + n · v = 1.

2. The solution is X ≡ b · u mod n.

Example

Solve 11111 · X ≡ 4 mod 12345.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 1: d = gcd(a, n) = 1.

1. Use the Extended Euclidean Algorithm to find u and v suchthat a · u + n · v = 1.

2. The solution is X ≡ b · u mod n.

Example

Solve 11111 · X ≡ 4 mod 12345.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Case 2: d = gcd(a, n) > 1

1. Compute d = gcd(a, n). If d does not divide b, there is nosolution.

2. Assume d |b. Consider the congruence(a/d) · X = (b/d) mod (n/d). Solve this equation as inCase 1 to obtain a solution x0.

3. The solutions of the original congruence a ·X = b mod n are

x0, x0 + (n/d), x0 + 2(n/d), ..., x0 + (d − 1)(n/d) mod n

Example

Solve 12 · x ≡ 21 mod 39.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Chinese Remainder Theorem

Let n1, n2, ..., nk be natural

numbers such that for i , j distinct indices one has gcd(ni , nj) = 1.Then the system of linear congruences

x = b1 mod n1

x = b2 mod n2

x = b3 mod n3

· · ·x = bk mod nk

has a solution which is unique modulo N = n1 · n2 · ... · nk .

The solution is

x = b1 · N1 · x1 + b2 · N2 · x2 + ... + bk · Nk · xk mod N

where Ni = N/ni and xi = 1Ni

mod ni .

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Chinese Remainder Theorem Let n1, n2, ..., nk be natural

numbers such that for i , j distinct indices one has gcd(ni , nj) = 1.Then the system of linear congruences

x = b1 mod n1

x = b2 mod n2

x = b3 mod n3

· · ·x = bk mod nk

has a solution which is unique modulo N = n1 · n2 · ... · nk .

The solution is

x = b1 · N1 · x1 + b2 · N2 · x2 + ... + bk · Nk · xk mod N

where Ni = N/ni and xi = 1Ni

mod ni .

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Chinese Remainder Theorem Let n1, n2, ..., nk be natural

numbers such that for i , j distinct indices one has gcd(ni , nj) = 1.Then the system of linear congruences

x = b1 mod n1

x = b2 mod n2

x = b3 mod n3

· · ·x = bk mod nk

has a solution which is unique modulo N = n1 · n2 · ... · nk .

The solution is

x = b1 · N1 · x1 + b2 · N2 · x2 + ... + bk · Nk · xk mod N

where Ni = N/ni and

xi = 1Ni

mod ni .

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Chinese Remainder Theorem Let n1, n2, ..., nk be natural

numbers such that for i , j distinct indices one has gcd(ni , nj) = 1.Then the system of linear congruences

x = b1 mod n1

x = b2 mod n2

x = b3 mod n3

· · ·x = bk mod nk

has a solution which is unique modulo N = n1 · n2 · ... · nk .

The solution is

x = b1 · N1 · x1 + b2 · N2 · x2 + ... + bk · Nk · xk mod N

where Ni = N/ni and xi = 1Ni

mod ni .

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Fermat’s Little Theorem: Let p be a prime which does not

divide the integer a, then ap−1 = 1 mod p.

Proof: See the lecture notes.

Remark: Usually, if 2n−1 ≡ 1 mod n, the number n is prime.This gives us a way to search for prime numbers.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Fermat’s Little Theorem: Let p be a prime which does not

divide the integer a, then ap−1 = 1 mod p.

Proof: See the lecture notes.

Remark: Usually, if 2n−1 ≡ 1 mod n, the number n is prime.

This gives us a way to search for prime numbers.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Fermat’s Little Theorem: Let p be a prime which does not

divide the integer a, then ap−1 = 1 mod p.

Proof: See the lecture notes.

Remark: Usually, if 2n−1 ≡ 1 mod n, the number n is prime.This gives us a way to search for prime numbers.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

DefinitionFor n ≥ 1, let φ(n) denote the number of positive integers notexceeding n that are relatively prime to n.

The function φ(n) is called the Euler’s φ-function or totientfunction.

TheoremIf p is a prime and k > 0, then

φ(pk) = pk − pk−1 = pk(1− 1/p).

Proof: See the lecture notes.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

DefinitionFor n ≥ 1, let φ(n) denote the number of positive integers notexceeding n that are relatively prime to n.

The function φ(n) is called the Euler’s φ-function or totientfunction.

TheoremIf p is a prime and k > 0, then

φ(pk) = pk − pk−1 = pk(1− 1/p).

Proof: See the lecture notes.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

DefinitionFor n ≥ 1, let φ(n) denote the number of positive integers notexceeding n that are relatively prime to n.

The function φ(n) is called the Euler’s φ-function or totientfunction.

TheoremIf p is a prime and k > 0, then

φ(pk) = pk − pk−1 = pk(1− 1/p).

Proof: See the lecture notes.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

TheoremIf the integer n > 1 has the prime factorizationn = p1

k1p2k2p3

k3 ...prkr , then

φ(n) = (pk11 − pk1−1

1 )(pk22 − pk2−1

2 )...(pkrr − pkr−1

r ) =n(1− 1/p1)(1− 1/p2)....(1− 1/pr )

Proof: See the lecture notes.

Euler’s Theorem:If gcd(a, n) = 1 then aφ(n) ≡ 1 mod n.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

TheoremIf the integer n > 1 has the prime factorizationn = p1

k1p2k2p3

k3 ...prkr , then

φ(n) = (pk11 − pk1−1

1 )(pk22 − pk2−1

2 )...(pkrr − pkr−1

r ) =n(1− 1/p1)(1− 1/p2)....(1− 1/pr )

Proof: See the lecture notes.

Euler’s Theorem:If gcd(a, n) = 1 then aφ(n) ≡ 1 mod n.

Introduction to Number Theory III

OutlineCongruences

Solving congruences a · X = b mod nChinese Remainder Theorem

Fermat’s Little Theorem and Euler’s Theorem

Basic Principle

Let n, x , y , a be integers with ≥ 1 and gcd(a, n) = 1. Ifx ≡ y mod φ(n), then ax ≡ ay mod n.

Proof:Write x = φ(n) · k + y . Then

ax ≡ ay+φ(n)·k = ay (aφ(n))k ≡ ay · 1k ≡ ay mod n.

Introduction to Number Theory III