CHINESE REMAINDER THEOREM

Download Report

Transcript CHINESE REMAINDER THEOREM

CHINESE REMAINDER THEOREM
GET HYPE
Joe Malone & Chris Cain
Bobby’s Pencils
• Let’s pretend that Bobby has a certain number of pencils
in his backpack. If Bobby were to pull out pencils in
groups of 4, he would eventually end up with 1 pencil in
his backpack. Similarly, if Bobby were to pull out pencils
in groups of 5, he would end up with 2 pencils left in his
backpack. Finally, we know that if Bobby pulls out
pencils in groups of 7, he would end up with up 4 pencils
left. How many pencils does Bobby have in his
backpack?
Chinese Remainder Theorem
• Developed in the 3rd century by Chinese
Mathematician Sun Tzu.
▫ Not the Art of War guy.
The Theorem
Suppose n1, n2, …, nk are positive integers which are pairwise coprime.
Then, for any given set of integers a1,a2, …, ak, there exists an integer x
solving the system of simultaneous congruences.
What does (mod n) mean?
• X == a (mod n)
• If we were to divide X by our mod, which in this
case was n, then the remainder of that quotient
will be a
• X == 3 (mod 7)
• In this case, X could be any integer that when
divided by 7 will leave a remainder of 3.
Pairwise Coprime?
• 2 integers are pairwise coprime when their
greatest common factor is 1.
• Example: {10, 9, 7} are pairwise coprime
because they share 0 common factors with each
other except for 1.
• Pairwise coprimes do NOT have to be prime.
▫ (10 was coprime and part of the last example)
The Proof
• Let s and t be positive integers with gcd(s, t) = 1
▫ S and t are therefore coprime
• Prove that there exists an integer w such that
sw == 1 (mod t)
The Proof
• For each k, let Mi = m/mk
▫ Where m = m1m2m3…mk (product of mods)
• Prove that the greatest common denominator of
Mi & mi = 1.
▫ Or, that Mi and mi are coprime
The Proof
• Prove that there is an integer xi such that
Mixi == 1(mod mi) AND
•
aiMixi == ai(mod mi)
The Proof
• Let x == a1M1x1 + a2M2x2 + … + anMnxn
• Prove that x == ai (mod mi)
How to we apply this?
•
•
X == 4 (mod 5)
X == 2 (mod 7)
Another Example:
•
•
•
X == 3 (mod 5)
X == 4 (mod 7)
X == 2 (mod 3)
Problems to try:
•
•
X == 4 (mod 7)
X == 2 (mod 11)
Bobby’s Pencils
•
•
•
X == 1 (mod 4)
X == 2 (mod 5)
X == 4 (mod 7)
The End