Docsity

Chinese Remainder Theorem: Proof, Applications, and Examples, Essays (high school) of English Language

Toggle sidebar
bg1
The Chinese Remainder Theorem
Chinese Remainder Theorem: If m1, m2, .., mk are pairwise relatively
prime positive integers, and if a1, a2, .., ak are any integers, then the
simultaneous congruences
x ≡ a1 (mod m1), x ≡ a2 (mod m2), ..., x ≡ ak (mod mk)
have a solution, and the solution is unique modulo m, where
m = m1m2⋅⋅⋅ mk.
Proof that a solution exists: To keep the notation simpler, we will
assume k = 4. Note the proof is constructive, i.e., it shows us how to
actually construct a solution.
Our simultaneous congruences are
x ≡ a1
(mod
m
1
)
, x ≡ a2
(mod
m
2
)
, x ≡ a3
(mod
m
3
), x ≡ a4
(mod
m
4
)
.
Our goal is to find integers w1, w2, w3, w4 such that:
value
mod m1
value
mod m2
value
mod m3
value
mod m4
w1 1 0 0 0
w2 0 1 0 0
w3 0 0 1 0
w4 0 0 0 1
Once we have found w1, w2, w3, w4, it is easy to construct x:
x = a1w1 + a2w2 + a3w3 + a4w4.
Moreover, as long as the moduli (m1, m2, m3, m4) remain the same, we
can use the same w1, w2, w3, w4 with any a1, a2, a3, a4.
First define: z1 = m / m1 = m2m3m4
z2 = m / m2 = m1m3m4
z3 = m / m3 = m1m2m4
z4 = m / m4 = m1m2m3
Note that
i) z1 ≡ 0 (mod mj) for j = 2, 3, 4.
ii) gcd(z1,m1) = 1. (If a prime p dividing m1 also divides
z1= m2m3m4, then p divides m2, m3, or m4.)
and likewise for z2, z3, z4.
Next define: y1 ≡ z1–1 (mod m1)
y2 ≡ z2–1 (mod m2)
y3 ≡ z3–1 (mod m3)
y4 ≡ z4–1 (mod m4)
The inverses exist by (ii) above, and we can find them by Euclid’s
extended algorithm. Note that
iii) y1z1 ≡ 0 (mod mj) for j = 2, 3, 4. (Recall z1 ≡ 0 (mod mj) )
iv) y1z1 ≡ 1 (mod m1)
and likewise for y2z2, y3z3, y4z4.
Lastly define: w1 ≡ y1z1 (mod m)
w2 ≡ y2z2 (mod m)
w
3 ≡ y3z3 (mod m)
w
4 ≡ y4z4 (mod m)
Then w1, w2, w3, and w4 have the properties in the table on the
previous page.
pf2

Partial preview of the text

Download Chinese Remainder Theorem: Proof, Applications, and Examples and more Essays (high school) English Language in PDF only on Docsity!

The Chinese Remainder Theorem

Chinese Remainder Theorem:

If

m

1

m

2, ..,

m

k

are pairwise relatively

prime positive integers, and if

a

1,

a

2, ..,

a

k

are any integers, then the

simultaneous congruences

x

a

1

(mod

m

1

x

a

2

(mod

m

2

x

a

k

(mod

m

k

have a solution, and the solution is unique modulo

m

, where

m

m

1

m

2

m

k

Proof that a solution exists:

To keep the notation simpler, we will

assume

k

Note the proof is constructive, i.e., it shows us how to

Our simultaneous congruences areactually construct a solution.

x

a

1

(mod

m

1

x

a

2

(mod

m

2

x

a

3

(mod

m

3

x

a

4

(mod

m

4

Our goal is to find integers

w

1,

w

2,

w

3,

w

4

such that:

value

mod

m

1

value

mod

m

2

value

mod

m

3

value

mod

m

4

w 1 1 0 0 0 w 2 0 1 0 0 w 3 0 0 1 0 w 4 0 0 0 1

Once we have found

w

1,

w

2,

w

3,

w

4

, it is easy to construct

x

x

a

1

w

1

a

2

w

2

a

3

w

3

a

4

w

Moreover, as long as the moduli (

m

1

m

2,

m

3,

m

  1. remain the same, we

can use the same

w

1,

w

2

w

3

w

4

with any

a

1,

a

2,

a

3

a

4

First define:

z

1 = m / m 1 = m 2

m

3

m

4

z

2 = m / m 2 = m 1

m

3

m

4

z

3 = m / m 3 = m 1

m

2

m

4

z

4 = m / m 4 = m 1

m

2

m

3

Note that

i)

z

1

0 (mod

m

j

) for

j

ii)

gcd(

z

1

m

1

) = 1. (If a prime

p

dividing

m

1

also divides

z

1=

m

2

m

3

m

4, then

p

divides

m

2

m

3

, or

m

4.)

and likewise for

z

2,

z

3

z

Next define:

y

1

z

1

(mod

m

y

2

z

2

(mod

m

y

3

z

3

(mod

m

y

4

z

4

(mod

m

extended algorithm. Note thatThe inverses exist by (ii) above, and we can find them by Euclid’s

iii)

y

1

z

1

0 (mod

m

j

) for

j

(Recall

z

1

0 (mod

m

j

iv)

y

1

z

1

1 (mod

m

and likewise for

y

2

z

2,

y

3

z

3,

y

4

z

Lastly define:

w

1

y

1

z

1

(mod

m

w

2

y

2

z

2

(mod

m

w

3

y

3

z

3

(mod

m

w

4

y

4

z

4

(mod

m

Then

w

1

w

2

w

3

, and

w

4

have the properties in the table on the

previous page.

Example:

Solve the simultaneous congruences

x

(mod 11)

x

(mod 16)

x

(mod 21)

x

(mod 25)

Solution:

Since 11, 16, 21, and 25 are pairwise relatively prime, the

moduloChinese Remainder Theorem tells us that there is a unique solution

m

, where

m

We apply the technique of the Chinese Remainder Theorem with

k

m

1

m

2

= 16,

m

3

m

4

= 25,

a

1

a

2

a

3

a

4

= 19,

We computeto obtain the solution.

z 1 = m / m 1 = m 2

m

3 m

4

z 2 = m / m 2 = m 1

m

3 m

4

z 3 = m / m 3 = m 1

m

2 m

4

z 4 = m / m 4 = m 1

m

3 m

3

y

1

z 1

(mod

m

1 )

(mod 11)

(mod 11)

8 (mod 11)

y

2

z 2

(mod

m

2 )

(mod 16)

(mod 16)

15 (mod 16)

y

3

z 3

(mod

m

3 )

(mod 21)

(mod 21)

2 (mod 21)

y

4

z 4

(mod

m

4 )

(mod 25)

(mod 25)

6 (mod 25)

w

1

y

1 z

1

(mod

m

(mod 92400)

(mod 92400)

w

2

y

2 z

2

(mod

m

5775 (mod 92400)

86625 (mod 92400)

w

3

y

3 z

3

(mod

m

(mod 92400)

8800 (mod 92400)

w

4

y

4 z

4

(mod

m

(mod 92400)

22176 (mod 92400)

The solution, which is unique modulo 92400, is

x

a

1 w

1

a

2 w

2

a

3 w

3

a

4 w

4

(mod 92400)

(^) 22176 (mod 92400)

2029869 (mod 92400)

(mod 92400)

Example:

Find all solutions of

x

2

≡

1 (mod 144)

Solution:

4 3

2 , and gcd(16,9) = 1.

We can replace our congruence by two simultaneous congruences:

x

2

1 (mod 16)

and

x

2

1 (mod 9)

x

2

1 (mod 16) has 4 solutions:

x

1 or

7 (mod 16)

x

2

1 (mod 9)

has 2 solutions:

x

1 (mod 9)

There are 8 alternatives:

i)

x

(mod 16)

and

x

(mod 9)

ii)

x

(mod 16)

and

x

–1 (mod 9)

iii)

x

–1 (mod 16)

and

x

(mod 9)

iv)

x

–1 (mod 16)

and

x

–1 (mod 9)

v)

x

(mod 16)

and

x

(mod 9)

vi)

x

(mod 16)

and

x

–1 (mod 9)

vii)

x

–7 (mod 16)

and

x

(mod 9)

viii)

x

–7 (mod 16)

and

x

–1 (mod 9)

By the Chinese Remainder Theorem with

k

m

1

= 16 and

m

2

= 9, each

case above has a unique solution for

x

modulo 144.

We compute:

z

1

=

m

2

= 9,

z 2

=

m

1

= 16,

y

1

9 (mod 16),

y

2

≡

4 (mod 9),

w

1

≡

(^) 9 = 81 (mod 144),

w

2

64 (mod 144).

The 8 solutions are:

i)

x

(mod 144)

ii)

x

(mod 144)

iii)

x

(mod 144)

iv)

x

(mod 144)

v)

x

(mod 144)

vi

x

(mod 144)

vii)

x

(mod 144)

viii)

x

(mod 144)