Вы находитесь на странице: 1из 45

Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Chapter 4 - Solving Linear Congruences,


Chinese Remainder Theorem, and Euler’s Φ
Function

March 3, 2007

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

1 Solving Linear Congruences

2 Chinese Remainder Theorem

3 Moduli are not Relatively Prime

4 Properties of Euler’s φ Function

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Lemma 4.1

Lemma 4.1
Given relatively prime integers a and m, there exists an integer
b, unique modulo m, such that

a × b ≡ 1 (mod m).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Lemma 4.1

Lemma 4.1
Given relatively prime integers a and m, there exists an integer
b, unique modulo m, such that

a × b ≡ 1 (mod m).

Definition
If a × b ≡ 1 (mod m), then we say that b is the inverse of a
modulo m.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.1

Proof of Lemma 4.1


By the Euclidean algorithm (Algorithm 1.8) we can find integers
b and c such that
a × b + m × c = 1.
This means that a × b is congruent to 1 modulo m.
Let e be any other integer satisfying

a × e ≡ 1 (mod m).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.1 - Cont.

Proof of Lemma 4.1 - Cont.


Then,

e ≡ e × (a × b) (mod m)
≡ (a × e) × b (mod m)
≡ b (mod m)

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

1 Solving Linear Congruences

2 Chinese Remainder Theorem

3 Moduli are not Relatively Prime

4 Properties of Euler’s φ Function

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Chinese Remainder Theorem

We need to prove that if p and q are distinct primes, then

φ(p × q) = (p − 1) × (q − 1).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Chinese Remainder Theorem

We need to prove that if p and q are distinct primes, then

φ(p × q) = (p − 1) × (q − 1).

We will prove more. The starting point is an algorithm that


appeared in the first century A.D. simultaneously in China,
in the writings of Sun-Tsu, and in Judea, in a book by
Nichomachus of Gerasa.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Chinese Remainder Theorem

Theorem 4.4
Let m1 , m2 , . . . , mr be positive integers that are pairwise
relatively prime (i.e., no two share a common factor larger than
one). Let a1 , a2 , . . . , ar be arbitrary integers. Then there exists
an integer a such that

a ≡ a1 (mod m1 )
≡ a2 (mod m2 )
..
.
≡ ar (mod mr ).

Furthermore, a is unique modulo M = m1 × m2 × · · · mr .

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Theorem 4.4

Proof of Theorem 4.4


We will actually find an algorithm for constructing a. For each i
from 1 up to r , define Mi by

Mi = (M/mi )φ(mi ) .

Since M/mi is relatively prime to mi and divisible by mj for


every j not equal to i, we have that

Mi ≡ 1 (mod mi )
Mj ≡ 0 (mod mi )

for every j not equal to i.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Theorem 4.4 - Cont.


Proof of Theorem 4.4 - Cont.
Define a by

a = a1 × M1 + a2 × M2 + · · · + ar × Mr .

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Theorem 4.4 - Cont.


Proof of Theorem 4.4 - Cont.
Define a by

a = a1 × M1 + a2 × M2 + · · · + ar × Mr .

To see that a is unique modulo M, let b be any other integer


satisfying the r congruences. Then for each mi , a and b are
congruent modulo mi . In other words, mi divides b − a. Since
this is true for every i, M divides b − a which means that

a≡b (mod M).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Theorem 4.4 - Cont.


Proof of Theorem 4.4 - Cont.
Define a by

a = a1 × M1 + a2 × M2 + · · · + ar × Mr .

To see that a is unique modulo M, let b be any other integer


satisfying the r congruences. Then for each mi , a and b are
congruent modulo mi . In other words, mi divides b − a. Since
this is true for every i, M divides b − a which means that

a≡b (mod M).

Of course, one need only compute the values of Mi modulo


M, which keeps the computations a little more reasonable.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

1 Solving Linear Congruences

2 Chinese Remainder Theorem

3 Moduli are not Relatively Prime

4 Properties of Euler’s φ Function

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Question

What if two or more of the moduli are divisible by the same


prime? The Chinese Remainder Theorem does not work in
this case.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Question

What if two or more of the moduli are divisible by the same


prime? The Chinese Remainder Theorem does not work in
this case.
We first observe that if we have a congruence with a
modulus which is divisible by more than one prime, then
we can split our single congruence into several
congruences as long as the new moduli are relatively
prime and their product is the original modulus.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example

Example

x ≡ 3 (mod 45)

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example

Example

x ≡ 3 (mod 45)
is equivalent to

x ≡3 (mod 5) and x ≡ 3 (mod 9).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example

Example

x ≡ 3 (mod 45)
is equivalent to

x ≡3 (mod 5) and x ≡ 3 (mod 9).

The equivalence is a consequence of the Chinese Remainder


Theorem.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Procedure and Example

Procedure
Let us assume that in our system of congruences we have two
moduli say m1 and m2 that are both divisible by the same prime
p.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Procedure and Example

Procedure
Let us assume that in our system of congruences we have two
moduli say m1 and m2 that are both divisible by the same prime
p. We split each of our congruences into two congruences as
explained above where one of the new moduli is the highest
power of p dividing m1 or m2 , respectively.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Procedure and Example

Procedure
Let us assume that in our system of congruences we have two
moduli say m1 and m2 that are both divisible by the same prime
p. We split each of our congruences into two congruences as
explained above where one of the new moduli is the highest
power of p dividing m1 or m2 , respectively.

Example
As an example, the two congruences

x ≡ 3 (mod 45)
x ≡ 7 (mod 756)

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example - Cont.

Example - Cont.
are split into four congruences:

x ≡ 3 (mod 9)
x ≡ 7 (mod 27)
x ≡ 3 (mod 5)
x ≡ 7 (mod 28).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example - Cont.

Example - Cont.
are split into four congruences:

x ≡ 3 (mod 9)
x ≡ 7 (mod 27)
x ≡ 3 (mod 5)
x ≡ 7 (mod 28).

We now have two congruences that both involve powers of p.


One of two things has to happen:

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Two Things

Two Things
1. The congruences are contradictory and so there are no
solutions. This is the case with the example given above. If
x ≡ 3 (mod 9), then x ≡ 3, 12, or 21 (mod 27). or

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Two Things

Two Things
1. The congruences are contradictory and so there are no
solutions. This is the case with the example given above. If
x ≡ 3 (mod 9), then x ≡ 3, 12, or 21 (mod 27). or 2. Both of
the congruences for powers of p are implied by the congruence
with the higher power. This means we can get rid of one of our
equations, leaving us with three congruences with relatively
prime moduli for which we can use the Chinese Remainder
Theorem.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example

Example
Consider the system of congruences,

x ≡ 7 (mod 200)
x ≡ 82 (mod 375).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example

Example
Consider the system of congruences,

x ≡ 7 (mod 200)
x ≡ 82 (mod 375).

This splits into four congruences:

x ≡ 7 (mod 25)
x ≡ 82 (mod 125)
x ≡ 7 (mod 8)
x ≡ 82 (mod 3).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example - Cont.

Example - Cont.
The congruence modulo 25 is a special case of the congruence
modulo 125, so we really have three congruences to relatively
prime moduli:

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example - Cont.

Example - Cont.
The congruence modulo 25 is a special case of the congruence
modulo 125, so we really have three congruences to relatively
prime moduli:

x ≡ 82 (mod 125)
x ≡ 7 (mod 8)
x ≡ 82 ≡ 1 (mod 3),

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Example - Cont.

Example - Cont.
The congruence modulo 25 is a special case of the congruence
modulo 125, so we really have three congruences to relatively
prime moduli:

x ≡ 82 (mod 125)
x ≡ 7 (mod 8)
x ≡ 82 ≡ 1 (mod 3),

which has as a solution

x ≡ 1207 (mod 3000).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

1 Solving Linear Congruences

2 Chinese Remainder Theorem

3 Moduli are not Relatively Prime

4 Properties of Euler’s φ Function

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Lemma 4.6

Lemma 4.6
If gcd(m, n) = 1, then

φ(m × n) = φ(m) × φ(n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Lemma 4.6

Lemma 4.6
If gcd(m, n) = 1, then

φ(m × n) = φ(m) × φ(n).

Proof
Let a be a positive integer less than and relatively prime to
m × n. In other words, a is one of the integers counted by
φ(m × n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Lemma 4.6

Lemma 4.6
If gcd(m, n) = 1, then

φ(m × n) = φ(m) × φ(n).

Proof
Let a be a positive integer less than and relatively prime to
m × n. In other words, a is one of the integers counted by
φ(m × n). We consider the correspondence

a → (a mod m, a mod n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


The integer a is relatively prime to m and relatively prime to n,
so a mod m and a mod n are relatively prime to m and n,
respectively.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


The integer a is relatively prime to m and relatively prime to n,
so a mod m and a mod n are relatively prime to m and n,
respectively. This means that each integer counted by φ(m × n)
corresponds to a pair of integers, the first counted by φ(m) and
the second counted by φ(n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


By the second part of Theorem 4.4, distinct integers counted by
φ(m × n) correspond to distinct pairs. Therefore, φ(m × n) is at
most the number of such pairs:

φ(m × n) ≤ φ(m) × φ(n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


By the second part of Theorem 4.4, distinct integers counted by
φ(m × n) correspond to distinct pairs. Therefore, φ(m × n) is at
most the number of such pairs:

φ(m × n) ≤ φ(m) × φ(n).

In the other direction, we take a pair of integers, one counted by


φ(m) and the other counted by φ(n). Since m and n are
relatively prime, we can use the first part of Theorem 4.4 to
construct a unique positive integer a less than and relatively
prime to m × n.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


By the Chinese Remainder Theorem

(b, c) → a ≡ b (mod m) and c (mod n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


By the Chinese Remainder Theorem

(b, c) → a ≡ b (mod m) and c (mod n).

So the number of such pairs is at most φ(m × n):

φ(m × n) ≥ φ(m) × φ(n).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Proof of Lemma 4.6 - Cont.

Proof of Lemma 4.6 - Cont.


By the Chinese Remainder Theorem

(b, c) → a ≡ b (mod m) and c (mod n).

So the number of such pairs is at most φ(m × n):

φ(m × n) ≥ φ(m) × φ(n).

In Exercise 4.17 you are asked to prove that if p is a prime,


then
φ(pa ) = pa−1 × (p − 1).

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Theorem 4.7

With this equality and Lemma 4.6, we can calculate φ(n)


for n that we can factor.

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function
Solving Linear Congruences Chinese Remainder Theorem Moduli are not Relatively Prime Properties of Euler’s φ Functio

Theorem 4.7

With this equality and Lemma 4.6, we can calculate φ(n)


for n that we can factor.

Theorem 4.7
Let
n = p1a1 × p2a2 × · · · × prar
be the unique factorization of n. Then
     
1 1 1
φ(n) = n × 1 − × 1− × ··· × 1 − .
p1 p2 pr

Chapter 4 - Solving Linear Congruences, Chinese Remainder Theorem, and Euler’s Φ Function

Вам также может понравиться