10
Chinese Remainder Theorem

Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Embed Size (px)

Citation preview

Page 1: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Chinese Remainder Theorem

Page 2: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

How many peopleWhat is x?

Divided into 4s: remainder 3x ≡ 3 (mod 4)

Divided into 5s: remainder 4x ≡ 4 (mod 5)

Chinese Remainder Theorem

Page 3: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Chinese Remainder Theorem

x ≡ a1 (mod m1)

x ≡ a2 (mod m2)

x ≡ ak (mod mk)

Theorem: If m1,m2,…,mk are relatively prime and

a1,a2,…,ak are integers, then

have a unique solution modulo m, where m = m1m2…mk.

(That is, there is a solution x with and all other solutions are congruent modulo m to this solution.)

mx 0

Page 4: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

(1) Compute m = m1 m2 … mn .

(2) Determine M1 = m/m1 ; M2= m/m2 ; … ; Mn= m/mn

(3) Find the inverse of M1 mod m1, M2 mod m2 , …, Mn

mod mn which are y1 , y2 ,…, yn ,

(4) Compute x = a1 M1 y1 + a2 M2 y2 +…+ an Mn yn

(5) Solve x ≡ y (mod m)

Steps of solution:

Page 5: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Example : Solve the system of congruences

x≡ 2 (mod 3), x≡ 3 (mod 5), x≡ 2 (mod 7)

Solution:

(1) m= 3 · 5 · 7=105(2) M1 = m/m1 =105/3=35, M2 = 21; M3 = 15(3) y1 = 2 is an inverse of 35 mod 3 because 35 ≡ 2 (mod 3)

y2 = 1 is an inverse of 21 mod 5 because 21 ≡ 1 (mod 5)

y3 = 1 is an inverse of 15 mod 7 because 15 ≡ 1 (mod 7) (4) x= a1 M1 y1 + a2 M2 y2 + a3 M3 y3 = 2 · 35 · 2 + 3 · 21 · 1 + 2 · 15 · 1=233(5) 233 ≡ 23 (mod 105)

Page 6: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

x≡ 2 (mod 3), x≡ 3 (mod 5), x≡ 2 (mod 7)

m 3 5 7 105

a 2 3 2

M 35 21 15

2.y1 1.y2 1.y3

y 2 1 1

2.35.2 3.21.1 2.15.1 233

233 ≡23) mod 105(

Page 7: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

We conclude that 23 is the smallest positive integer that:

23 mod 3 = 223 mod 5 = 323 mod 7 = 2

Page 8: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Find all the solution to the system of congruencesx≡ 2 (mod 3), x≡ 1 (mod 4), x≡ 3 (mod 5)

Page 9: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

x≡ 2 (mod 3), x≡ 1 (mod 4), x≡ 3 (mod 5)

m 3 4 5 60

a 2 1 3

M 20 15 12

2.y1 3.y2 2.y3

y 2 3 3

2.20.2 1.15.3 3.12.3 233

233≡ 53 (mod 60)

Page 10: Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder

Home Work

Find all the solution to the system of congruencesx≡ 1 (mod 2), x≡ 2 (mod 3), x≡ 3 (mod 5),x≡ 4 (mod 11)