The Chinese Remainder Theorem

Similar documents
Tomáš Madaras Congruence classes

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

Applied Cryptography and Computer Security CSE 664 Spring 2018

3 The fundamentals: Algorithms, the integers, and matrices

Elementary Number Theory. Franz Luef

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

Math From Scratch Lesson 20: The Chinese Remainder Theorem

Section 18 Rings and fields

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Math 312/ AMS 351 (Fall 17) Sample Questions for Final

Simultaneous Linear, and Non-linear Congruences

Algebra. Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example.

INTRODUCTION TO THE GROUP THEORY

4 Number Theory and Cryptography

3+4=2 5+6=3 7 4=4. a + b =(a + b) mod m

Outline. Number Theory and Modular Arithmetic. p-1. Definition: Modular equivalence a b [mod n] (a mod n) = (b mod n) n (a-b)

ALGEBRA I (LECTURE NOTES 2017/2018) LECTURE 9 - CYCLIC GROUPS AND EULER S FUNCTION

5 Group theory. 5.1 Binary operations

Math 2070BC Term 2 Weeks 1 13 Lecture Notes

M381 Number Theory 2004 Page 1

Mathematics for Cryptography

Extending The Natural Numbers. Whole Numbers. Integer Number Set. History of Zero

Algebraic Structures Exam File Fall 2013 Exam #1

Math 31 Take-home Midterm Solutions

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

Basic elements of number theory

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:

Basic elements of number theory

Notes on Systems of Linear Congruences

MATH 25 CLASS 21 NOTES, NOV Contents. 2. Subgroups 2 3. Isomorphisms 4

1 Overview and revision

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

2. Two binary operations (addition, denoted + and multiplication, denoted

Discrete Mathematics with Applications MATH236

The Chinese Remainder Theorem

MTH 346: The Chinese Remainder Theorem

Groups in Cryptography. Çetin Kaya Koç Winter / 13

Chapter 5. Modular arithmetic. 5.1 The modular ring

Congruences and Residue Class Rings

4 Powers of an Element; Cyclic Groups

Rings of Residues. S. F. Ellermeyer. September 18, ; [1] m

Elementary Number Theory MARUCO. Summer, 2018

Lecture 4.1: Homomorphisms and isomorphisms

CONSTRUCTING MULTIPLICATIVE GROUPS MODULO N WITH IDENTITY DIFFERENT FROM ONE

Relations. Binary Relation. Let A and B be sets. A (binary) relation from A to B is a subset of A B. Notation. Let R A B be a relation from A to B.

Rings and modular arithmetic

a the relation arb is defined if and only if = 2 k, k

128. The integers 1 to 1000 are written in order around a circle. Starting at 1, every fifteenth number is marked (that is, 1, 16, 31, etc.).

Modular Arithmetic Instructor: Marizza Bailey Name:

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS

Computer Architecture 10. Residue Number Systems

Summary Slides for MATH 342 June 25, 2018

A Readable Introduction to Real Mathematics

12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.

The number of ways to choose r elements (without replacement) from an n-element set is. = r r!(n r)!.

Rings and Fields Theorems

Discrete Logarithms. Let s begin by recalling the definitions and a theorem. Let m be a given modulus. Then the finite set

This is an auxiliary note; its goal is to prove a form of the Chinese Remainder Theorem that will be used in [2].

Wilson s Theorem and Fermat s Little Theorem

CHAPTER 3. Congruences. Congruence: definitions and properties

1. Prove that the number cannot be represented as a 2 +3b 2 for any integers a and b. (Hint: Consider the remainder mod 3).

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

This exam contains 5 pages (including this cover page) and 4 questions. The total number of points is 100. Grade Table

Mathematical Foundations of Public-Key Cryptography

Elementary Number Theory Review. Franz Luef

Chapter 5. Number Theory. 5.1 Base b representations

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

Part V. Chapter 19. Congruence of integers

Definition List Modern Algebra, Fall 2011 Anders O.F. Hendrickson

Linear Diophantine Equations

Group, Rings, and Fields Rahul Pandharipande. I. Sets Let S be a set. The Cartesian product S S is the set of ordered pairs of elements of S,

The Chinese Remainder Theorem

Commutative Rings and Fields

ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS

Carmen s Core Concepts (Math 135)

* 8 Groups, with Appendix containing Rings and Fields.

CMPUT 403: Number Theory

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

MATH 420 FINAL EXAM J. Beachy, 5/7/97

Algebraic structures I

Section 0. Sets and Relations

0 Sets and Induction. Sets

ECEN 5022 Cryptography

Congruences. September 16, 2006

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

RINGS: SUMMARY OF MATERIAL

Euler s, Fermat s and Wilson s Theorems

Mathematics of Cryptography

GROUPS. Chapter-1 EXAMPLES 1.1. INTRODUCTION 1.2. BINARY OPERATION

Primes in arithmetic progressions

Math 547, Exam 1 Information.

a b (mod m) : m b a with a,b,c,d real and ad bc 0 forms a group, again under the composition as operation.

Part IV. Rings and Fields

B Sc MATHEMATICS ABSTRACT ALGEBRA

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

LECTURE NOTES IN CRYPTOGRAPHY

Transcription:

Chapter 4 The Chinese Remainder Theorem The Monkey-Sailor-Coconut Problem Three sailors pick up a number of coconuts, place them in a pile and retire for the night. During the night, the first sailor wanting to make sure that he gets his fair share gets up and takes 1/3 of the pile. The number of coconuts in the pile is not divisible by 3, there is 1 left over and he gives that coconut to the monkey. A little later, the second sailor gets up to do the same thing. He too finds that in order to take 1/3 of the pile, he needs to give one coconut to the monkey. Even later still, the third sailor gets up and does the same thing, giving 1 coconut to the monkey. In the morning the sailors gather to divide the remaining pile of coconuts evenly among the three of them. None would dare say anything about the size of the pile for fear of incriminating himself, and the monkey isn t talking, since he got 3 coconuts last night. When they divide the pile into 3 equal piles they find that they need to give the monkey 1 more coconut. What is the smallest number of coconuts with which they could have started and how many did each sailor get? We know the monkey got 4. [Note: n = 2 is, in some respects, the optimal solution but it has it physical drawbacks especially if there is any interaction between the -2 anti-coconuts and coconuts. The implications for the future of the Universe are colossal. This is actually a problem that has been passed down through many different cultures. It appears in Chinese manuscripts and Indian manuscripts in forms that are very much like the above problem. It appears in Chinese literature as early as the first century A.D. Sun-Tsu asked: Find a number which leaves the remainders 2,3,2 when divided by 3,5,7 respectively. In order to solve this problem we need to recall quite a bit of mathematics. A binary relation on a set R is an equivalence relation if it satisfies the following conditions. a) Reflexive: a a for all a R. b) Symmetric: If a, b R and a b, then b a. c) Transitive: If a, b, c R and if a b and b c, then a c. When we have an equivalence relation, we can divide the set R into equivalence classes [a] = {b R b a}. We are interested in the integers, Z and the equivalence relation a n b if n (a b), or if a and b have the same remainder when divided by n. The set of congruence classes modulo n is denoted by Z n. Let s recall a few definitions from algebra. 19

20 CHAPTER 4. THE CHINESE REMAINDER THEOREM 4.1 Groups, rings and fields Recall the following definitions. Definition 1 A non-empty set G together with an operation, (G, ), is a group if the following holds: 1. a, b, c G : a (b c) = (a b) c 2. e G such that a G, a e = e a = a 3. a G A G such that a A = A a = e. A group (G, ) is called commutative or Abelian if a b = b a for all a, b G. Example 4.1.1 (Z, +) is an Abelian group. Definition 2 A set R together with operations + and is a ring (R, +, ) if the following holds: 1. (R, +) is a commutative group. 2. a, b, c R a (b c) = (a b) c. 3. I R such that a R, a I = I a = a. 4. a, b, c R : a (a + b) = a b + a c and (a + b) c = a c + b c. A ring (R, +, ) is a commutative if a, b G, a b = b a. Example 4.1.2 (Z, +, ) is a ring. Definition 3 The characteristic of a ring R is 0 if ni e for any positive integer n. Otherwise the characteristic is the smallest integer m such that mi = e. Here e and I are the neutral elements of the operations + and, respectively. Example 4.1.3 Rational numbers form the ring (Q, +, ). Let M 2,2 (Q) be the set of 2 2 matrices with rational coefficients. Let + denote the addition of matrices and the multiplication. Then (M 2,2 (Q), +, ) is a ring that is not commutative. This ring has characteristic 0. Definition 4 Let R and S be rings. A map ϕ : R S is a ring homomorphism if ϕ(e R ) = e S, ϕ(i R ) = I S, ϕ(a + b) = ϕ(a) + ϕ(b) and ϕ(a b) = ϕ(a) ϕ(b) for all a, b R. Example 4.1.4 Consider integers modulo 4, Z 4 with the usual addition and multiplication. It is clear that (Z 4, +, ) is a commutative ring. Since 1 + 1 + 1 + 1 = 0 in Z 4, Z 4 has characteristic at most 4. The characteristic is actually exactly 4, as can be easily seen. The projection Z Z 4, which takes a number n to its reminder under the division by 4, is a ring homomorphism.

4.2. LINEAR CONGRUENCES 21 Definition 5 A field F = (F, +, ) is a ring for which 0 1 and whose every non zero element has a multiplicative inverse. Observe that (F, +, ) is a field if and only if both (F, +) and (F, ) are groups. Which of the following are fields: Z 3 Z 4 Z Q R Theorem 1 (Z n, +, ) is a ring. (Z n, +, ) is a field if and only if n is prime. Note that this distinction is important. When can we cancel, i.e., when does ca = cb mod n imply that a = b mod n? Theorem 2 If ca = cb mod n, then a = b mod (n/d), where d = gcd(c, n). Corollary 1 If ca = cb mod n and gcd(c, n) = 1, then a = b mod n. Corollary 2 If ca = cb mod p, p a prime, and p does not divide c, then a = b mod p. 4.2 Linear Congruences An equation of the form ax = b( mod n) is called a linear congruence. We will want to solve this equation for x. Theorem 3 The linear congruence ax = b( mod n) has a solution if and only if d b, where d = gcd(a, n). If d does not divide b, then there are d mutually incongruent solutions modulo n. by If d does not divide b and if x 0 is a solution, then the d incongruent solutions are given x 0, x 0 + n/d, x 0 + 2(n/d),..., x 0 + (d 1)(n/d). Corollary 3 If gcd(a, n) = 1, then the linear congruence ax = b( mod n) has a unique solution modulo n.

22 CHAPTER 4. THE CHINESE REMAINDER THEOREM 4.3 Chinese remainder theorem Let m and n be relatively prime positive integers. Consider the system of congruences Equivalently one may write x a ( mod m) (4.1) x b ( mod n) (4.2) irem(x, m) = a (4.3) irem(x, n) = b (4.4) To solve these equations, observe first that both Z m and Z n are rings and also the product Z m Z n is a ring. It is a finite ring having mn elements. Consider the mapping π : Z Z m Z n, s (irem(s, m), irem(s, n)). This mapping is a homomorphism of rings. Clearly π(s) = (0, 0) if and only if s is divisible by mn. It follows that π induces a one-to-one ring homomorphism Z mn Z m Z n, s (irem(s, m), irem(s, n)). Since Z mn and Z m Z n both have mn elements, the above ring homomorphism must be onto. This means the the above equations have a solution for any a and b. This is the Chinese remainder theorem. Theorem 4 Let m and n be relatively prime positive integers. The system x a ( mod m) (4.5) x b ( mod n) (4.6) has integer solutions for any integers a and b. Moreover the solution is unique up to a multiple of mn (i.e. as an element of Z mn the solution is unique). In fact, the general Chinese Remainder Theorem holds for more than two equations: Theorem 5 Let n 1, n 2,..., n r be positive integers so that gcd(n i, n j ) = 1 for i j. Then the system of linear congruences x a 1 ( mod n 1 ) (4.7) x a 2 ( mod n 2 ) (4.8). (4.9) x a r ( mod n r ) (4.10) has a simultaneous solution, which is unique modulo n 1 n 2... n r.

4.3. CHINESE REMAINDER THEOREM 23 The solution is given by taking N k = (n 1 n 2... n r )/n k for k = 1, 2,... r. Since gcd(n k, n k ) = 1 there is a solution, x k, to N k x 1 mod n k. Then the solution is given by x = r a k N k x k. i=k The problem posed by Sun-Tsu is x 2( mod 3) (4.11) x 3( mod 5) (4.12) x 2( mod 7) (4.13) Then N 1 = 35, N 2 = 21, and N 3 = 15. We have to solve the congruences 35x 1 mod 3, 21x 1 mod 5, and 15x 1 mod 7. These solutions are x 1 = 2, x 2 = 1, and x 3 = 1. Thus, x 2 35 2 + 3 21 1 + 2 15 1( mod 105) or x 233 23 mod 105.