The Chinese Remainder Theorem

Similar documents
Solutions for the Practice Questions

Wilson s Theorem and Fermat s Theorem

Math 255 Spring 2017 Solving x 2 a (mod n)

Practice Midterm 2 Solutions

University of British Columbia. Math 312, Midterm, 6th of June 2017

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

Constructions of Coverings of the Integers: Exploring an Erdős Problem

6. Find an inverse of a modulo m for each of these pairs of relatively prime integers using the method

SOLUTIONS FOR PROBLEM SET 4

Modular Arithmetic. claserken. July 2016

1.6 Congruence Modulo m

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 24 February 2012

The congruence relation has many similarities to equality. The following theorem says that congruence, like equality, is an equivalence relation.

ALGEBRA: Chapter I: QUESTION BANK

Applications of Fermat s Little Theorem and Congruences

Modular Arithmetic. Kieran Cooney - February 18, 2016

Assignment 2. Due: Monday Oct. 15, :59pm

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 4 October 2013

Math 127: Equivalence Relations

Discrete Math Class 4 ( )

b) Find all positive integers smaller than 200 which leave remainder 1, 3, 4 upon division by 3, 5, 7 respectively.

Sheet 1: Introduction to prime numbers.

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

Permutation Groups. Every permutation can be written as a product of disjoint cycles. This factorization is unique up to the order of the factors.

Number Theory/Cryptography (part 1 of CSC 282)

Modular Arithmetic: refresher.

Fermat s little theorem. RSA.

Math 412: Number Theory Lecture 6: congruence system and

MAT Modular arithmetic and number theory. Modular arithmetic

ON SPLITTING UP PILES OF STONES

Number Theory. Konkreetne Matemaatika

Quadratic Residues. Legendre symbols provide a computational tool for determining whether a quadratic congruence has a solution. = a (p 1)/2 (mod p).

Collection of rules, techniques and theorems for solving polynomial congruences 11 April 2012 at 22:02

MATH 324 Elementary Number Theory Solutions to Practice Problems for Final Examination Monday August 8, 2005

Carmen s Core Concepts (Math 135)

Lecture 8. Outline. 1. Modular Arithmetic. Clock Math!!! 2. Inverses for Modular Arithmetic: Greatest Common Divisor. 3. Euclid s GCD Algorithm

ON MODULI FOR WHICH THE FIBONACCI SEQUENCE CONTAINS A COMPLETE SYSTEM OF RESIDUES S. A. BURR Belt Telephone Laboratories, Inc., Whippany, New Jersey

Primitive Roots. Chapter Orders and Primitive Roots

LECTURE 7: POLYNOMIAL CONGRUENCES TO PRIME POWER MODULI

#A3 INTEGERS 17 (2017) A NEW CONSTRAINT ON PERFECT CUBOIDS. Thomas A. Plick

Data security (Cryptography) exercise book

12. Let Rm = {0,1,2,..., m 1} be a complete residue system modulo ra. Let a be an integer. When is a Rm = {0,1 a, 2 a,...

p 1 MAX(a,b) + MIN(a,b) = a+b n m means that m is a an integer multiple of n. Greatest Common Divisor: We say that n divides m.

ON THE EQUATION a x x (mod b) Jam Germain

Degree project NUMBER OF PERIODIC POINTS OF CONGRUENTIAL MONOMIAL DYNAMICAL SYSTEMS

PT. Primarity Tests Given an natural number n, we want to determine if n is a prime number.

Distribution of Primes

An elementary study of Goldbach Conjecture

NUMBER THEORY AMIN WITNO

Number-Theoretic Algorithms

An interesting class of problems of a computational nature ask for the standard residue of a power of a number, e.g.,

Goldbach Conjecture (7 th june 1742)

Numbers (8A) Young Won Lim 5/24/17

Numbers (8A) Young Won Lim 6/21/17

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

Numbers (8A) Young Won Lim 5/22/17

LECTURE 3: CONGRUENCES. 1. Basic properties of congruences We begin by introducing some definitions and elementary properties.

CHAPTER 2. Modular Arithmetic

MATH 135 Algebra, Solutions to Assignment 7

Calculators will not be permitted on the exam. The numbers on the exam will be suitable for calculating by hand.

by Michael Filaseta University of South Carolina

MODULAR ARITHMETIC II: CONGRUENCES AND DIVISION

Public Key Encryption

Public Key Cryptography Great Ideas in Theoretical Computer Science Saarland University, Summer 2014

LUCAS-SIERPIŃSKI AND LUCAS-RIESEL NUMBERS

6.2 Modular Arithmetic

NIM Games: Handout 1

Final exam. Question Points Score. Total: 150

Launchpad Maths. Arithmetic II

Solutions for the 2nd Practice Midterm

SYMMETRIES OF FIBONACCI POINTS, MOD m

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

Exam 1 7 = = 49 2 ( ) = = 7 ( ) =

A REMARK ON A PAPER OF LUCA AND WALSH 1. Zhao-Jun Li Department of Mathematics, Anhui Normal University, Wuhu, China. Min Tang 2.

1111: Linear Algebra I

PRIMES IN SHIFTED SUMS OF LUCAS SEQUENCES. Lenny Jones Department of Mathematics, Shippensburg University, Shippensburg, Pennsylvania

Number Theory and Public Key Cryptography Kathryn Sommers

SMT 2013 Advanced Topics Test Solutions February 2, 2013

Solutions to Exam 1. Problem 1. a) State Fermat s Little Theorem and Euler s Theorem. b) Let m, n be relatively prime positive integers.

Permutation Groups. Definition and Notation

Discrete Mathematics & Mathematical Reasoning Multiplicative Inverses and Some Cryptography

Solutions for the Practice Final

Algorithmic Number Theory and Cryptography (CS 303)

Linear Congruences. The solutions to a linear congruence ax b (mod m) are all integers x that satisfy the congruence.

Congruence properties of the binary partition function

MST125. Essential mathematics 2. Number theory

Introduction to Modular Arithmetic

Mark Kozek. December 7, 2010

CMath 55 PROFESSOR KENNETH A. RIBET. Final Examination May 11, :30AM 2:30PM, 100 Lewis Hall

The Sign of a Permutation Matt Baker

Zhanjiang , People s Republic of China

Modular arithmetic Math 2320

How to Become a Mathemagician: Mental Calculations and Math Magic

Lecture 32. Handout or Document Camera or Class Exercise. Which of the following is equal to [53] [5] 1 in Z 7? (Do not use a calculator.

Power = 36² mod 99 Power = 9 5 a 5 = 0 x = 81 Power = 9² mod 99 Power = 81 6 a 6 = 1 x = 81 x 81 mod 99 x = 27 7 a 7 = 1 x = 27 x 27 mod 99 x = 36

SESAME Modular Arithmetic. MurphyKate Montee. March 2018 IN,Z, We think numbers should satisfy certain rules, which we call axioms:

Transcription:

The Chinese Remainder Theorem 8-3-2014 The Chinese Remainder Theorem gives solutions to systems of congruences with relatively prime moduli The solution to a system of congruences with relatively prime moduli may be produced using a formula by computing modular inverses, or using an iterative procedure involving successive substitution The Chinese Remainder Theorem says that certain systems of simultaneous congruences with different moduli have solutions The idea embodied in the theorem was apparently known to Chinese mathematicians a long time ago hence the name I ll begin by collecting some useful lemmas Lemma 1 Let m and a 1,, a n be positive integers If m is relatively prime to each of a 1,, a n, then it is relatively prime to their product a 1 a n Proof If (m,a 1 a n ) 1, then there is a prime p which divides both m and a 1 a n Now p a 1 a n, so p must divide a i for some i But p divides both m and a i, so (m,a i ) 1 This contradiction implies that (m,a 1 a n ) = 1 Example 6 is relatively prime to 25, to 7, and to 11 25 7 11 = 1925, and (6,1925) = 1: a q 1925-6 320 5 1 1 5 I showed earlier that the greatest common divisor (a,b) of a and b is greatest in the sense that it is divisible by any common divisor of a and b The next result is the analogous statement for least common multiples Lemma 2 Let m and a 1,, a n be positive integers If m is a multiple of each of a 1,, a n, then m is a multiple of [a 1,,a n ] Proof By the Division Algorithm, there are unique numbers q and r such that m = q [a 1,,a n ]+r, where 0 r < [a 1,,a n ] Now a i divides both m and [a 1,,a n ], so a i divides r Since this is true for all i, r is a common multiple of the a i smaller than the least common multiple [a 1,,a n ] This is only possible if r = 0 Then m = q [a 1,,a n ], ie m is a multiple of [a 1,,a n ] Example 88 is a multiple of 4 and 22 The least common multiple of 4 and 22 is 44, and 88 is also a multiple of 44 1

Lemma 3 Let a 1,, a n be positive integers If a 1,, a n are pairwise relatively prime (that is, (a i,a j ) = 1 for i j), then [a 1,,a n ] = a 1 a n Proof Induct on n The statement is trivially true for n = 1, so I ll start with n = 2 The statement for n = 2 follows from the equation xy = [x,y](x,y): [a 1,a 2 ] = a 1a 2 (a 1,a 2 ) = a 1a 2 = a 1 a 2 1 Now assume n > 2, and assume the result is true for n I will prove that it holds for n+1 Claim: [[a 1,,a n ],a n+1 ] = [a 1,,a n,a n+1 ] (Some people take this as an iterative definition of [a 1,,a n,a n+1 ]) [a 1,,a n,a n+1 ] is a multiple of each of a 1,, a n, so by Lemma 2 it s a multiple of [a 1,,a n ] It s also a multiple of a n+1, so On the other hand, for i = 1,,n, Therefore, Obviously, [[a 1,,a n ],a n+1 ] [a1,,a n,a n+1 ] a i [a1,,a n ] and [a 1,,a n ] [[a1,,a n ],a n+1 ] a i [[a 1,,a n ],a n+1 ] a n+1 [[a 1,,a n ],a n+1 ] Thus, [[a 1,,a n ],a n+1 ]isacommonmultipleofallthea i s Since[a 1,,a n,a n+1 ]istheleastcommon multiple, Lemma 2 implies that [a 1,,a n,a n+1 ] [[a 1,,a n ],a n+1 ] Since I have two positive numbers which divide one another, they re equal: [[a 1,,a n ],a n+1 ] = [a 1,,a n,a n+1 ] This proves the claim Returning to the proof of the induction step, I have [a 1,,a n,a n+1 ] = [[a 1,,a n ],a n+1 ] = [a 1 a n,a n+1 ] = a 1 a n a n+1 The second equality follows by the induction hypothesis (the statement for n) The third equality follows from Lemma 1 and the result for n = 2 Example 6, 25, and7arerelativelyprime(inpairs) Theleastcommonmultiple is[6,25,7] = 1050 = 6 25 7 Theorem (The Chinese Remainder Theorem) Suppose m 1,, m n are pairwise relatively prime (that is, (m i,m j ) = 1 for i j) Then the following system of congruences has a unique solution mod m 1 m 2 m n : x = a 1 (mod m 1 ) x = a 2 (mod m 2 ) x = a n (mod m n ) 2

Notation For example, x 1 x 2 x i x n means x 1 x 2 x i x n omitting x i x 1 x 2 x 4 x 6 means x 1 x 2 x 3 x 5 x 6 This is a convenient (and standard) notation for omitting a single variable term in a product of things Proof Define p k = m 1 m k m n That is, p k is the product of the m s with m k omitted By Lemma 1, (p k,m k ) = 1 Hence, there are numbers s k, t k such that s k p k +t k m k = 1 In terms of congruences, Now let s k p k = 1 (mod m k ) x = a 1 p 1 s 1 +a 2 s 2 p 2 + +a n p n s n If j k, then m k p j, so mod m k all the terms but the k-th term are 0 mod m k : x = a k p k s k = a k 1 = a k (mod m k ) This proves that x is a solution to the system of congruences (and incidentally, gives a formula for x) Now suppose that x and y are two solutions to the system of congruences x = a 1 (mod m 1 ) and y = a 1 (mod m 1 ) x = a 2 (mod m 2 ) and y = a 2 (mod m 2 ) x = a n (mod m n ) and y = a n (mod m n ) Then x = a k = y (mod m k ) so x y = 0 (mod m k ) or m k x y Thus, x y is a multiple of all the m s, so [m 1,,m n ] x y But the m s are pairwise relatively prime, so by Lemma 3, m 1 m n x y, or x = y (mod m 1 m n ) That is, the solution to the congruences is unique mod m 1 m n Example Solve x = 2 (mod 4) x = 7 (mod 9) (4,9) = 1, so there is a unique solution mod 36 Following the construction of x in the proof, p 1 = 9, 9 1 = 1 (mod 4), so s 1 = 1 p 2 = 4, 4 7 = 1 (mod 9), so s 2 = 7 3

Solution: x = a 1 p 1 s 1 +a 2 p 2 s 2 = 18+196 = 214 = 34 (mod 36) Example Solve x = 3 (mod 4) x = 1 (mod 5) x = 2 (mod 3) The moduli are pairwise relatively prime, so there is a unique solution mod 60 This time, I ll solve the system using an iterative method But x = 1 (mod 5), so x = 3 (mod 4), so x = 3+4s 3+4s = 1 (mod 5), 4s = 3 (mod 5), 4 4s = 4 3 (mod 5), s = 2 (mod 5), s = 2+5t Hence, x = 3+4s = 3+4(2+5t) = 11+20t Finally, x = 2 (mod 3), so 11+20t = 2 (mod 3), 20t = 9 = 0 (mod 3), 2t = 0 (mod 3), 2 2t = 2 2 (mod 3), t = 0 (mod 3) Hence, t = 3u Now put everything back: x = 11+20t = 11+20(3u) = 11+60u, or x = 11 (mod 60) Example Calvin Butterball keeps pet meerkats in his backyard If he divides them into 5 equal groups, 4 are left over If he divides them into 8 equal groups, 6 are left over If he divides them into 9 equal groups, 8 are left over What is the smallest number of meerkats that Calvin could have? Let x be the number of meerkats Then x = 4 (mod 5) x = 6 (mod 8) x = 8 (mod 9) From x = 4 (mod 5), I get x = 4+5a Plugging this into the second congruence, I get 4+5a = 6 (mod 8) 5a = 2 (mod 8) 5 5a = 5 2 (mod 8) 25a = 10 (mod 8) a = 2 (mod 8) Hence, a = 2+8b Plugging this into x = 4+5a gives x = 4+5(2+8b) = 14+40b 4

Plugging this into the third congruence, I get 14+40b = 8 (mod 9) 40b = 6 (mod 9) 4b = 3 (mod 9) 7 4b = 7 3 (mod 9) 28b = 21 (mod 9) b = 3 (mod 9) Hence, b = 3+9c Plugging this into x = 14+40b gives x = 14+40(3+9c) = 134+360c The smallest positive value of x is obtained by setting c = 0, which gives x = 134 You can sometimes solve a system even if the moduli aren t relatively prime; the criteria are similar to those for solving system of linear Diophantine equations I ll state the result, but omit the proof Theorem Consider the system x = a 1 (mod m 1 ) x = a 2 (mod m 2 ) (a) If (m 1,m 2 ) a 1 a 2, there are no solutions (b) If (m 1,m 2 ) a 1 a 2, there is a unique solution mod [m 1,m 2 ] Note that if (m 1,m 2 ) = 1, case (b) automatically holds, and [m 1,m 2 ] = m 1 m 2 ie I get the Chinese Remainder Theorem for n = 2 Example Solve x = 5 (mod 12) x = 11 (mod 18) Since (12,18) = 6 11 5, there is a unique solution mod [12,18] = 36 I ll use the iterative method to find the solution x = 5 (mod 12), so x = 5+12s Since x = 11 (mod 18), 5+12s = 11 (mod 18), 12s = 6 (mod 18) Now I use my rule for dividing congruences: 6 divides both 12 and 6, and (6,18) = 6, so I can divide through by 6: 2s = 1 (mod 3) Multiply by 2, and convert the congruence to an equation: Plug back in: s = 2 (mod 3), s = 2+3t x = 5+12s = 5+12(2+3t) = 29+36t, x = 29 (mod 36) c 2014 by Bruce Ikenaga 5