MTH 346: The Chinese Remainder Theorem

Size: px
Start display at page:

Download "MTH 346: The Chinese Remainder Theorem"

Transcription

1 MTH 346: The Chinese Remainder Theorem March 3, Introduction In this lab we are studying the Chinese Remainder Theorem. We are going to study how to solve two congruences, find what conditions are needed to ensure a solution, and figure out general formulas to solve these congruences. 1.1 Notation and Definitions In this section, we will define some notation and definitions that will help prove our proofs. Divides: We say a divides b and write a b if there exists an integer c such that b = ac. For example 2 6 since 6 = 2 3 and 3 Z. One way to remember how to write this is that the smaller number goes first. For example, I would not write 6 2. Definition Prime: A prime number is a whole number greater than 1 which is divisible by only itself and 1. Definition of Greatest Common Divisor 1: This is denoted as gcd(a,b) and we say that d is the greatest common divisor of a and b, written d = gcd(a,b) if the following conditions are satisfied: 1. d a and d b. 2. If c a and c b, then c d. Lab 2 research question 3: Suppose that gcd(a, b)= 1 and that x = x 0 and y = y 0 is a solution to ax + by = 1. Then all solutions to this equations are given by x = x 0 + mb and y = y 0 ma, where m is any integer. 1

2 Lab 2 Research Question 5: Let a, b, and k be integers with a or b not equal to 0. Suppose that d = gcd(a, b), and x = x 0 and y = y 0 is a solution to ax + by = d. Then all solutions to the equation ax + by = kd, are given by x = kx 0 + m(b/d) and y = ky 0 m(a/d), where m is any integer. 2 The Chinese Remainder Theorem for Two Congruences Research Question 1 Complete the statement of the Chinese Remainder Theorem for two congruences. 2.1 Example Solve the following pairs of congruences. Suppose x 0 (mod 2) and x 1 (mod 3). We start with x 0 (mod 2) and is equivalent to 2 x. By the definition of divides y Z, such that 2y = x. Plug in x to x 1 (mod 3), 2y 1 (mod 3) 2y 4 (mod 3) y 2 (mod 3) 3 y 2, By the definition of divides, k Z, such that 3k = y 2.Solve for y and y = 3k + 2. Plug y in to 2y = x, therefore 2(3k + 2) = x Thus, we have found a solution. 2.2 Answer 6k + 4 = x 6k = x 4 6 x 4 x 4 (mod 6). Theorem: If m 1 and m 2 are positive integers such that m 1 and m 2 are relatively prime, then for any integers a 1 and a 2, the pair of x a 1 (mod m 1 ) and x a 2 (mod m 2 ) 2

3 has a unique solution x modulo m 1 m 2. Proof: Suppose x a 1 (mod m 1 ) and x a 2 mod m 2. Let x a 1 (mod m 1 ) m 1 x a 1 by the definition of congruences. By the definition of divides y Z, such that m 1 y = x a 1. We solve for x, m 1 y + a 1 = x. We substitute x in to our x a 2 (mod m 2 ) equation thus m 1 y + a 1 a 2 (mod m 2 ). We subtract a 1 and m 1 y a 2 a 1 (mod m 2 ). This is equivalent to m 2 a 2 a 1 m 1 y by the definition of congruences. By the definition of divides r Z, such that m 2 r = a 2 a 1 m 1 y. we add m 1 y to both sides and get m 2 r + m 1 y = a 2 a 1. This is similar to the form of rx + sy = t which has a solution by Lab 2 Research Question 3, for all a 2 a 1, if the gcd(m 1, m 2 )=1. Furthermore, by Lab 2 Research Question 5, y = ky 0 + m 2 l where l Z. We plug y into the equation m 1 y + a 1 = x, such that m 1 (ky 0 + m 2 l) + a 1 = x We distribute m 1 to (ky 0 + m 2 l) + a 1 = x such that m 1 ky 0 + m 1 m 2 l + a 1 = x. We (mod m 1 m 2 ) to both sides m 1 ky 0 + m 1 m 2 l + a 1 x (mod m 1 m 2 ) m 1 ky 0 + a 1 x (mod m 1 m 2 ). Thus, we have shown that when the gcd(m 1, m 2 ) a 2 a 1, then m 1 ky 0 + a 1 (mod m 1 m 2 ). x 3 A More General Theorem Research Question 2 For what values of a 1, a 2, m 1, and m 2 will the pair of congruences x a 1 (mod m 1 ) and x a 2 (mod m 2 ) have a solution modulo m 1 m 2? If there is a solution x 0 (mod m 1 m 2 ), find the form of all other solutions x (mod m 1 m 2 ) in terms of x Answer Theorem: The values of a 1, a 2, m 1, and m 2 need to satisfy the condition of gcd(m 1, m 2 ) a 2 a 1, so that the pair of congruences x a 1 (mod m 1 ) and x a 2 (mod m 2 ) have a solution modulo m 1 m 2. The form of all other solutions x (mod m 1 m 2 ) in terms of x 0 is m 1 ky 0 + (m 1 m 2 /d)l x (mod m 1 m 2 ) where x, y 0, m 1, m 2, d, l Z and d = gcd(m 1, m 2 ). Proof: Let x a 1 (mod m 1 ), x a 2 (mod m 2 ) and d a 2 a 1, where d = gcd(m 1, m 2 ). By the definition of congruences x a 1 (mod m 1 ) can be written iff m 1 x a 1. y Z 3

4 iff m 1 y = x a 1. Solve for x, x = m 1 y + a 1. Plug x = m 1 y + a 1 into x a 2 (mod m 2 ), thus m 1 y + a 1 a 2 (mod m 2 ). Subtract a 1 from both sides, iff m 1 y a 2 a 1 (mod m 2 ). By the definition of congruences, m 1 y a 2 a 1 (mod m 2 ) iff m 2 a 2 a 1 m 1 y. r Z iff m 2 r = a 2 a 1 m 1 y by the definition of divides. Add m 1 y to both sides, iff m 2 r + m 1 y = a 2 a 1. By lab 2 Research question 5, note that m 2 r + m 1 y = a 2 a 1 is in the form ax + by = c which tells us that it has a solution when d a 2 a 1. Therefore, y = ky 0 + (m 2 /d)l, l Z. Plug in y, so that Then we (modm 1 m 2 )to both sides so that, m 1 y + a 1 = x iff (ky 0 + (m 2 /d)l) = x a 1 iff m 1 ky 0 + (m 1 m 2 /d)l + m 1 a 1 = x. (m 1 ky 0 + (m 1 m 2 /d)l + m 1 a 1 )(modm 1 m 2 ) = x(modm 1 m 2 ) iff m 1 ky 0 + (m 1 m 2 /d)l + m 1 a 1 x (mod m 1 m 2 ). Thus, we have shown the form of all other solutions x (mod m 1 m 2 ) in terms of x 0. 4 Solving Lots of Congruences Research Question 3 Give a statement of the Chinese Remainder Theorem (as in Research Question 1) for n congruences. 4.1 Answer Theorem: If m 1, m 2, m 3,..., m k are positive integer such that they are pairwise relatively prime, then for any integers a 1, a 2, a 3,..., a k the pair of congruences x a 1 (mod m 1 ) x a 2 (mod m 2 ) x a 3 (mod m 3 ). x a k (mod m k ) has a unique solution x modulo M, where M = m 1 m 2 m 3... m k. Proof: Suppose m, a, x Z and m 1, m 2, m 3,..., m k are positive integer such that they are pairwise relatively prime so that for any integers a 1, a 2, a 3,..., a k the pair of congruences x a 1 (mod m 1 ) 4

5 x a 2 (mod m 2 ) x a 3 (mod m 3 ). x a k (mod m k ). By Research Question 1 if we take two pairs of congruences x a 1 (mod m 1 ) and x a 2 (mod m 2 ), and we know they are relatively prime then we have a unique solution so that, x b 1 (mod m 1 m 2 ). Then we do the same thing to the next congruence pairs with and get x b 1 (mod m 1 m 2 ) and x a 3 (modm 3 ) x b 2 (mod m 1 m 2 m 3 ), because they are relatively prime. We continue this until we get our unique solution, x b k 1 (mod m 1 m 2 m 3...m k ). Thus we have shown that if m 1, m 2, m 3,..., m k are pairwise relatively prime then the pair of congruences has a unique solution x modulo M, where M = m 1 m 2 m 3... m k. 5 Explicit Formulas Research Question 4 With the assumptions of Research Question 1, find formulas for c 1 and c 2 so that x = c 1 m 1 + c 2 m 2, is a solution to the pair of congruences in Research Question Answer Theorem: Assume Research Question 1 then c 1 and c 2 in the form x = a 2 m 1 m 1 is a solution to the pair of congruences in Research Question 1. 5

6 Proof: Consider x (mod m 1 ) and x (mod m 2 ). Since x = a 2 m 1 m 1 1 (mod m 2 )+a 1 m 2 m 1 2 (mod m 1 ) we can plug x in to x (mod m 1 ), We distribute (mod m 1 ), (a 2 m 1 m 1 2 ) (mod m 1 ). a 2 m 1 m 1 1 (mod m 2 ) (mod m 1 ) + a 1 m 2 m a 1 1 (mod m 1 ), since the first term has m 1 and we (mod m 1 ) we know that a 2 m 1 m 1 1 (mod m 2 ) (mod m 1 ) is 0. Also, the second term equals 1, because we multiplied by its inverse. Thus a 1 (mod m 1 ). We can also show this with the congruence x (mod m 2 ). Plug (a 2 m 1 m 1 1 (mod m 2 ) + a 1 m 2 m 1 2 ) (mod m 1 ) for x, We distribute (mod m 2 ), (a 2 m 1 m 1 ) (mod m 2 ). a 2 m 1 m 1 (mod m 2 ) a (mod m 2 ). Since the first term is being multiplied by its inverse it equals 1 and the second term is 0, because we (mod m 2 ). Thus a 2 (mod m 2 ). Therefore we have shown that x = a 2 m 1 m 1 is a solution to the pair of congruences x a 1 (mod m 1 ) and x a 2 (mod m 2 ). 6 System of Congruences Research Question 5 With the assumptions of Research Question 3, find a formula for x so that x will be a solution to the system of congruences x a i mod(m i ). 6

7 6.1 Answer Theorem: We assume Research Question 3.The formula x = k i=1 a i m i m 1 i (mod m i ) where M i = m 1,m 2,m 3,...,m k m i, k i,is a solution, x, to the system of congruences x a i (mod m i ). Proof: WLOG: Assume x a i (mod m i ) and let x = a 1 m 1 m 1 1 (modm 1 )+a 2 m 2 m 1 2 (modm 2 )+a 3 m 3 m 1 3 (modm 3 )+...+a k m k m 1 (modm k). We plug in this value of x for x a i (mod m i ), so that, (a 1 m 1 m 1 1 (modm 1 )+a 2 m 2 m 1 2 (modm 2 )+a 3 m 3 m 1 3 (modm 3 )+...+a k m k m 1 k (modm k)) a i (mod m i ) Note that m i m j i j and m j 0 (mod m i ), i j, such that a i (M i M 1 i (modm i )) a i 1 a i (modm i ). Therefore we have shown that this formula works and x will be a solution to the system of congruences x a i (mod m i ). k 7 Conclusion In this lab we have studied the Chinese Remainder Theorem and have come to some conditions. In order to have a unique solution for a pair of congruences then m 1 and m 2 need to be relatively prime. Also, if the gcd(m 1, m 2 ) a 2 a 1, then m 1 ky 0 + (m 1 m 2 /d)l + m 1 a 1 x (mod m 1 m 2 ) is the general form. We figured out a formula, x = a 2 m 1 m 1 which is a solution to a pair of congruences. For a system of congruences, they need to be pairwise relatively prime to have a unique solution and if this is so, then by this formula, x = k i=1 a i m i m 1 i (mod m i ) we can find a solution. After all this research we understand how to apply the Chinese Remainder Theorem and what conditions apply. 7

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

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635 COMP239: Mathematics for Computer Science II Prof. Chadi Assi assi@ciise.concordia.ca EV7.635 The Euclidean Algorithm The Euclidean Algorithm Finding the GCD of two numbers using prime factorization is

More information

4 Number Theory and Cryptography

4 Number Theory and Cryptography 4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.

More information

3 The fundamentals: Algorithms, the integers, and matrices

3 The fundamentals: Algorithms, the integers, and matrices 3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers

More information

M381 Number Theory 2004 Page 1

M381 Number Theory 2004 Page 1 M81 Number Theory 2004 Page 1 [[ Comments are written like this. Please send me (dave@wildd.freeserve.co.uk) details of any errors you find or suggestions for improvements. ]] Question 1 20 = 2 * 10 +

More information

The Chinese Remainder Theorem

The Chinese Remainder Theorem Sacred Heart University piazzan@mail.sacredheart.edu March 29, 2018 Divisibility Divisibility We say a divides b, denoted as a b, if there exists k Z such that ak = b. Example: Consider 2 6. Then k = 3

More information

Number Theory Proof Portfolio

Number Theory Proof Portfolio Number Theory Proof Portfolio Jordan Rock May 12, 2015 This portfolio is a collection of Number Theory proofs and problems done by Jordan Rock in the Spring of 2014. The problems are organized first by

More information

4 Powers of an Element; Cyclic Groups

4 Powers of an Element; Cyclic Groups 4 Powers of an Element; Cyclic Groups Notation When considering an abstract group (G, ), we will often simplify notation as follows x y will be expressed as xy (x y) z will be expressed as xyz x (y z)

More information

The Chinese Remainder Theorem

The Chinese Remainder Theorem Sacred Heart University DigitalCommons@SHU Academic Festival Apr 20th, 9:30 AM - 10:45 AM The Chinese Remainder Theorem Nancirose Piazza Follow this and additional works at: http://digitalcommons.sacredheart.edu/acadfest

More information

Homework #2 solutions Due: June 15, 2012

Homework #2 solutions Due: June 15, 2012 All of the following exercises are based on the material in the handout on integers found on the class website. 1. Find d = gcd(475, 385) and express it as a linear combination of 475 and 385. That is

More information

Notes on Systems of Linear Congruences

Notes on Systems of Linear Congruences MATH 324 Summer 2012 Elementary Number Theory Notes on Systems of Linear Congruences In this note we will discuss systems of linear congruences where the moduli are all different. Definition. Given the

More information

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

a the relation arb is defined if and only if = 2 k, k DISCRETE MATHEMATICS Past Paper Questions in Number Theory 1. Prove that 3k + 2 and 5k + 3, k are relatively prime. (Total 6 marks) 2. (a) Given that the integers m and n are such that 3 (m 2 + n 2 ),

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation

More information

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

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. Congruences Let n be a postive integer. The integers a and b are called congruent modulo n if they have the same

More information

Chapter 4 Finite Fields

Chapter 4 Finite Fields Chapter 4 Finite Fields Introduction will now introduce finite fields of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public Key concern operations on numbers what constitutes a number

More information

Numbers. Çetin Kaya Koç Winter / 18

Numbers. Çetin Kaya Koç   Winter / 18 Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 18 Number Systems and Sets We represent the set of integers as Z = {..., 3, 2, 1,0,1,2,3,...} We denote the set of positive integers modulo n as

More information

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer. CHAPTER 2 INTRODUCTION TO NUMBER THEORY ANSWERS TO QUESTIONS 2.1 A nonzero b is a divisor of a if a = mb for some m, where a, b, and m are integers. That is, b is a divisor of a if there is no remainder

More information

Discrete Mathematics with Applications MATH236

Discrete Mathematics with Applications MATH236 Discrete Mathematics with Applications MATH236 Dr. Hung P. Tong-Viet School of Mathematics, Statistics and Computer Science University of KwaZulu-Natal Pietermaritzburg Campus Semester 1, 2013 Tong-Viet

More information

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology. MATH 501 Discrete Mathematics Lecture 6: Number theory Prof. Dr. Slim Abdennadher, slim.abdennadher@guc.edu.eg German University Cairo, Department of Media Engineering and Technology 1 Number theory Number

More information

1 Overview and revision

1 Overview and revision MTH6128 Number Theory Notes 1 Spring 2018 1 Overview and revision In this section we will meet some of the concerns of Number Theory, and have a brief revision of some of the relevant material from Introduction

More information

Number Theory Math 420 Silverman Exam #1 February 27, 2018

Number Theory Math 420 Silverman Exam #1 February 27, 2018 Name: Number Theory Math 420 Silverman Exam #1 February 27, 2018 INSTRUCTIONS Read Carefully Time: 50 minutes There are 5 problems. Write your name neatly at the top of this page. Write your final answer

More information

Wednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).

Wednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory). Wednesday, February 21 Today we will begin Course Notes Chapter 5 (Number Theory). 1 Return to Chapter 5 In discussing Methods of Proof (Chapter 3, Section 2) we introduced the divisibility relation from

More information

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions MATH 11/CSCI 11, Discrete Structures I Winter 007 Toby Kenney Homework Sheet 5 Hints & Model Solutions Sheet 4 5 Define the repeat of a positive integer as the number obtained by writing it twice in a

More information

Chapter 3 Basic Number Theory

Chapter 3 Basic Number Theory Chapter 3 Basic Number Theory What is Number Theory? Well... What is Number Theory? Well... Number Theory The study of the natural numbers (Z + ), especially the relationship between different sorts of

More information

Ch 4.2 Divisibility Properties

Ch 4.2 Divisibility Properties Ch 4.2 Divisibility Properties - Prime numbers and composite numbers - Procedure for determining whether or not a positive integer is a prime - GCF: procedure for finding gcf (Euclidean Algorithm) - Definition:

More information

CHAPTER 3. Congruences. Congruence: definitions and properties

CHAPTER 3. Congruences. Congruence: definitions and properties CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write

More information

Basic Algorithms in Number Theory

Basic Algorithms in Number Theory Basic Algorithms in Number Theory Algorithmic Complexity... 1 Basic Algorithms in Number Theory Francesco Pappalardi #2 - Discrete Logs, Modular Square Roots, Polynomials, Hensel s Lemma & Chinese Remainder

More information

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen In this section you will apply the method of long division to divide a polynomial by a binomial. You will also learn to

More information

1. multiplication is commutative and associative;

1. multiplication is commutative and associative; Chapter 4 The Arithmetic of Z In this chapter, we start by introducing the concept of congruences; these are used in our proof (going back to Gauss 1 ) that every integer has a unique prime factorization.

More information

Today. Polynomials. Secret Sharing.

Today. Polynomials. Secret Sharing. Today. Polynomials. Secret Sharing. A secret! I have a secret! A number from 0 to 10. What is it? Any one of you knows nothing! Any two of you can figure it out! Example Applications: Nuclear launch: need

More information

Chapter 3: The Euclidean Algorithm and Diophantine. Math 138 Burger California State University, Fresno

Chapter 3: The Euclidean Algorithm and Diophantine. Math 138 Burger California State University, Fresno Chapter 3: The Euclidean Algorithm and Diophantine Equations Math 138 Burger California State University, Fresno Greatest Common Divisor d is the greatest common divisor of integers a and b if d is the

More information

Carmen s Core Concepts (Math 135)

Carmen s Core Concepts (Math 135) Carmen s Core Concepts (Math 135) Carmen Bruni University of Waterloo Week 8 1 The following are equivalent (TFAE) 2 Inverses 3 More on Multiplicative Inverses 4 Linear Congruence Theorem 2 [LCT2] 5 Fermat

More information

Number Theory Notes Spring 2011

Number Theory Notes Spring 2011 PRELIMINARIES The counting numbers or natural numbers are 1, 2, 3, 4, 5, 6.... The whole numbers are the counting numbers with zero 0, 1, 2, 3, 4, 5, 6.... The integers are the counting numbers and zero

More information

10 Problem 1. The following assertions may be true or false, depending on the choice of the integers a, b 0. a "

10 Problem 1. The following assertions may be true or false, depending on the choice of the integers a, b 0. a Math 4161 Dr. Franz Rothe December 9, 2013 13FALL\4161_fall13f.tex Name: Use the back pages for extra space Final 70 70 Problem 1. The following assertions may be true or false, depending on the choice

More information

4.4 Solving Congruences using Inverses

4.4 Solving Congruences using Inverses 4.4 Solving Congruences using Inverses Solving linear congruences is analogous to solving linear equations in calculus. Our first goal is to solve the linear congruence ax b pmod mq for x. Unfortunately

More information

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen In this section you will apply the method of long division to divide a polynomial by a binomial. You will also learn to

More information

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m Outline GCD and Euclid s Algorithm AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Modulo Arithmetic Modular Exponentiation Discrete Logarithms

More information

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Instructor: Dr. Kun Sun Outline GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation

More information

Discrete Structures Lecture Solving Congruences. mathematician of the eighteenth century). Also, the equation gggggg(aa, bb) =

Discrete Structures Lecture Solving Congruences. mathematician of the eighteenth century). Also, the equation gggggg(aa, bb) = First Introduction Our goal is to solve equations having the form aaaa bb (mmmmmm mm). However, first we must discuss the last part of the previous section titled gcds as Linear Combinations THEOREM 6

More information

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

3+4=2 5+6=3 7 4=4. a + b =(a + b) mod m Rings and fields The ring Z m -part2(z 5 and Z 8 examples) Suppose we are working in the ring Z 5, consisting of the set of congruence classes Z 5 := {[0] 5, [1] 5, [2] 5, [3] 5, [4] 5 } with the operations

More information

Modular Arithmetic Instructor: Marizza Bailey Name:

Modular Arithmetic Instructor: Marizza Bailey Name: Modular Arithmetic Instructor: Marizza Bailey Name: 1. Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find

More information

Lecture Notes. Advanced Discrete Structures COT S

Lecture Notes. Advanced Discrete Structures COT S Lecture Notes Advanced Discrete Structures COT 4115.001 S15 2015-01-13 Recap Divisibility Prime Number Theorem Euclid s Lemma Fundamental Theorem of Arithmetic Euclidean Algorithm Basic Notions - Section

More information

Definition For a set F, a polynomial over F with variable x is of the form

Definition For a set F, a polynomial over F with variable x is of the form *6. Polynomials Definition For a set F, a polynomial over F with variable x is of the form a n x n + a n 1 x n 1 + a n 2 x n 2 +... + a 1 x + a 0, where a n, a n 1,..., a 1, a 0 F. The a i, 0 i n are the

More information

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have Exercise 13. Consider positive integers a, b, and c. (a) Suppose gcd(a, b) = 1. (i) Show that if a divides the product bc, then a must divide c. I give two proofs here, to illustrate the different methods.

More information

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6 Math 131 notes Jason Riedy 6 October, 2008 Contents 1 Modular arithmetic 2 2 Divisibility rules 3 3 Greatest common divisor 4 4 Least common multiple 4 5 Euclidean GCD algorithm 5 6 Linear Diophantine

More information

CSC 474 Network Security. Outline. GCD and Euclid s Algorithm. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

CSC 474 Network Security. Outline. GCD and Euclid s Algorithm. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms Computer Science CSC 474 Network Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography CSC 474 Dr. Peng Ning 1 Outline GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation

More information

Chuck Garner, Ph.D. May 25, 2009 / Georgia ARML Practice

Chuck Garner, Ph.D. May 25, 2009 / Georgia ARML Practice Some Chuck, Ph.D. Department of Mathematics Rockdale Magnet School for Science Technology May 25, 2009 / Georgia ARML Practice Outline 1 2 3 4 Outline 1 2 3 4 Warm-Up Problem Problem Find all positive

More information

3.2 Solving linear congruences. v3

3.2 Solving linear congruences. v3 3.2 Solving linear congruences. v3 Solving equations of the form ax b (mod m), where x is an unknown integer. Example (i) Find an integer x for which 56x 1 mod 93. Solution We have already solved this

More information

Practice Number Theory Problems

Practice Number Theory Problems Massachusetts Institute of Technology Handout 9 6.857: Network and Computer Security March 21, 2013 Professor Ron Rivest Due: N/A Problem 3-1. GCD Practice Number Theory Problems (a) Compute gcd(85, 289)

More information

Mathematics of Cryptography

Mathematics of Cryptography Modulo arithmetic Fermat's Little Theorem If p is prime and 0 < a < p, then a p 1 = 1 mod p Ex: 3 (5 1) = 81 = 1 mod 5 36 (29 1) = 37711171281396032013366321198900157303750656 = 1 mod 29 (see http://gauss.ececs.uc.edu/courses/c472/java/fermat/fermat.html)

More information

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II CS 5319 Advanced Discrete Structure Lecture 9: Introduction to Number Theory II Divisibility Outline Greatest Common Divisor Fundamental Theorem of Arithmetic Modular Arithmetic Euler Phi Function RSA

More information

Wilson s Theorem and Fermat s Little Theorem

Wilson s Theorem and Fermat s Little Theorem Wilson s Theorem and Fermat s Little Theorem Wilson stheorem THEOREM 1 (Wilson s Theorem): (p 1)! 1 (mod p) if and only if p is prime. EXAMPLE: We have (2 1)!+1 = 2 (3 1)!+1 = 3 (4 1)!+1 = 7 (5 1)!+1 =

More information

Applied Cryptography and Computer Security CSE 664 Spring 2017

Applied Cryptography and Computer Security CSE 664 Spring 2017 Applied Cryptography and Computer Security Lecture 11: Introduction to Number Theory Department of Computer Science and Engineering University at Buffalo 1 Lecture Outline What we ve covered so far: symmetric

More information

Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY. Please indicate your reasoning and show all work on this exam paper.

Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY. Please indicate your reasoning and show all work on this exam paper. Name: Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY Please indicate your reasoning and show all work on this exam paper. Relax and good luck! Problem Points Score 1 20 20 2 20 20 3

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Define and use the congruence modulo m equivalence relation Perform computations using modular arithmetic

More information

Mathematical Foundations of Cryptography

Mathematical Foundations of Cryptography Mathematical Foundations of Cryptography Cryptography is based on mathematics In this chapter we study finite fields, the basis of the Advanced Encryption Standard (AES) and elliptical curve cryptography

More information

The Euclidean Algorithm and Multiplicative Inverses

The Euclidean Algorithm and Multiplicative Inverses 1 The Euclidean Algorithm and Multiplicative Inverses Lecture notes for Access 2009 The Euclidean Algorithm is a set of instructions for finding the greatest common divisor of any two positive integers.

More information

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = , Solution Sheet 2 1. (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = 3. 2. (i) gcd (97, 157) = 1 = 34 97 21 157, (ii) gcd (527, 697) = 17 = 4 527 3 697, (iii) gcd (2323, 1679) =

More information

Finite Fields. Mike Reiter

Finite Fields. Mike Reiter 1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements

More information

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

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) 1 Euclid s Algorithm Euclid s Algorithm for computing the greatest common divisor belongs to the oldest known computing procedures

More information

Lecture 7 Number Theory Euiseong Seo

Lecture 7 Number Theory Euiseong Seo Lecture 7 Number Theory Euiseong Seo (euiseong@skku.edu) 1 Number Theory God created the integers. All else is the work of man Leopold Kronecker Study of the property of the integers Specifically, integer

More information

Number Theory Alex X. Liu & Haipeng Dai

Number Theory Alex X. Liu & Haipeng Dai Number Theory Alex X. Liu & Haipeng Dai haipengdai@nju.edu.cn 313 CS Building Department of Computer Science and Technology Nanjing University How to compute gcd(x,y) Observation: gcd(x,y) = gcd(x-y, y)

More information

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic ECE 646 Lecture 5 Mathematical Background: Modular Arithmetic Motivation: Public-key ciphers RSA as a trap-door one-way function PUBLIC KEY message ciphertext M C = f(m) = M e mod N C M = f -1 (C) = C

More information

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory. CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,

More information

NOTES ON SIMPLE NUMBER THEORY

NOTES ON SIMPLE NUMBER THEORY NOTES ON SIMPLE NUMBER THEORY DAMIEN PITMAN 1. Definitions & Theorems Definition: We say d divides m iff d is positive integer and m is an integer and there is an integer q such that m = dq. In this case,

More information

CSC 474 Information Systems Security

CSC 474 Information Systems Security CSC Information Systems Security Topic. Basic Number Theory CSC Dr. Peng Ning Basic Number Theory We are talking about integers! Divisor We say that b divides a if a = mb for some m, denoted b a. b is

More information

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL NUMBER THEORY AND CODES Álvaro Pelayo WUSTL Talk Goal To develop codes of the sort can tell the world how to put messages in code (public key cryptography) only you can decode them Structure of Talk Part

More information

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, } Integers and Division 1 The Integers and Division This area of discrete mathematics belongs to the area of Number Theory. Some applications of the concepts in this section include generating pseudorandom

More information

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

This exam contains 5 pages (including this cover page) and 4 questions. The total number of points is 100. Grade Table MAT115A-21 Summer Session 2 2018 Practice Final Solutions Name: Time Limit: 1 Hour 40 Minutes Instructor: Nathaniel Gallup This exam contains 5 pages (including this cover page) and 4 questions. The total

More information

Integers and Division

Integers and Division Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random

More information

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

Outline. Number Theory and Modular Arithmetic. p-1. Definition: Modular equivalence a b [mod n] (a mod n) = (b mod n) n (a-b) Great Theoretical Ideas In CS Victor Adamchik CS - Lecture Carnegie Mellon University Outline Number Theory and Modular Arithmetic p- p Working modulo integer n Definitions of Z n, Z n Fundamental lemmas

More information

8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

More information

Elementary Properties of the Integers

Elementary Properties of the Integers Elementary Properties of the Integers 1 1. Basis Representation Theorem (Thm 1-3) 2. Euclid s Division Lemma (Thm 2-1) 3. Greatest Common Divisor 4. Properties of Prime Numbers 5. Fundamental Theorem of

More information

Part V. Chapter 19. Congruence of integers

Part V. Chapter 19. Congruence of integers Part V. Chapter 19. Congruence of integers Congruence modulo m Let m be a positive integer. Definition. Integers a and b are congruent modulo m if and only if a b is divisible by m. For example, 1. 277

More information

Mathematics for Cryptography

Mathematics for Cryptography Mathematics for Cryptography Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo Waterloo, Ontario, N2L 3G1, Canada March 15, 2016 1 Groups and Modular Arithmetic 1.1

More information

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

Math 312/ AMS 351 (Fall 17) Sample Questions for Final Math 312/ AMS 351 (Fall 17) Sample Questions for Final 1. Solve the system of equations 2x 1 mod 3 x 2 mod 7 x 7 mod 8 First note that the inverse of 2 is 2 mod 3. Thus, the first equation becomes (multiply

More information

MATH 3240Q Introduction to Number Theory Homework 4

MATH 3240Q Introduction to Number Theory Homework 4 If the Sun refused to shine I don t mind I don t mind If the mountains fell in the sea Let it be it ain t me Now if six turned out to be nine Oh I don t mind I don t mind Jimi Hendrix If Six Was Nine from

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn Problem 1: 4.4 # 2:x 3 + 8x 2 x 1 0 (mod 1331). a) x 3 + 8x 2 x 1 0 (mod 11). This does not break down, so trial and error gives: x = 0 : f(0)

More information

ECE596C: Handout #11

ECE596C: Handout #11 ECE596C: Handout #11 Public Key Cryptosystems Electrical and Computer Engineering, University of Arizona, Loukas Lazos Abstract In this lecture we introduce necessary mathematical background for studying

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively

More information

Chapter 9 Basic Number Theory for Public Key Cryptography. WANG YANG

Chapter 9 Basic Number Theory for Public Key Cryptography. WANG YANG Chapter 9 Basic Number Theory for Public Key Cryptography WANG YANG wyang@njnet.edu.cn Content GCD and Euclid s Algorithm Modular Arithmetic Modular Exponentiation Discrete Logarithms GCD and Euclid s

More information

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?

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? Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

More information

Congruences and Residue Class Rings

Congruences and Residue Class Rings Congruences and Residue Class Rings (Chapter 2 of J. A. Buchmann, Introduction to Cryptography, 2nd Ed., 2004) Shoichi Hirose Faculty of Engineering, University of Fukui S. Hirose (U. Fukui) Congruences

More information

CMPUT 403: Number Theory

CMPUT 403: Number Theory CMPUT 403: Number Theory Zachary Friggstad February 26, 2016 Outline Factoring Sieve Multiplicative Functions Greatest Common Divisors Applications Chinese Remainder Theorem Factoring Theorem (Fundamental

More information

Math 109 HW 9 Solutions

Math 109 HW 9 Solutions Math 109 HW 9 Solutions Problems IV 18. Solve the linear diophantine equation 6m + 10n + 15p = 1 Solution: Let y = 10n + 15p. Since (10, 15) is 5, we must have that y = 5x for some integer x, and (as we

More information

CS250: Discrete Math for Computer Science

CS250: Discrete Math for Computer Science CS250: Discrete Math for Computer Science L6: Euclid s Algorithm & Multiplicative Inverses Mod m Greatest Common Divisors, GCD If d a and d b then d is a common divisor of a and b. 1, 2, 3, and 6 are common

More information

Number Theory Solutions Packet

Number Theory Solutions Packet Number Theory Solutions Pacet 1 There exist two distinct positive integers, both of which are divisors of 10 10, with sum equal to 157 What are they? Solution Suppose 157 = x + y for x and y divisors of

More information

3.7 Non-linear Diophantine Equations

3.7 Non-linear Diophantine Equations 37 Non-linear Diophantine Equations As an example of the use of congruences we can use them to show when some Diophantine equations do not have integer solutions This is quite a negative application -

More information

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

MATH 420 FINAL EXAM J. Beachy, 5/7/97 MATH 420 FINAL EXAM J. Beachy, 5/7/97 1. (a) For positive integers a and b, define gcd(a, b). (b) Compute gcd(1776, 1492). (c) Show that if a, b, c are positive integers, then gcd(a, bc) = 1 if and only

More information

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time. 8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only

More information

Simultaneous Linear, and Non-linear Congruences

Simultaneous Linear, and Non-linear Congruences Simultaneous Linear, and Non-linear Congruences CIS002-2 Computational Alegrba and Number Theory David Goodwin david.goodwin@perisic.com 09:00, Friday 18 th November 2011 Outline 1 Polynomials 2 Linear

More information

ax b mod m. has a solution if and only if d b. In this case, there is one solution, call it x 0, to the equation and there are d solutions x m d

ax b mod m. has a solution if and only if d b. In this case, there is one solution, call it x 0, to the equation and there are d solutions x m d 10. Linear congruences In general we are going to be interested in the problem of solving polynomial equations modulo an integer m. Following Gauss, we can work in the ring Z m and find all solutions to

More information

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

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers ALGEBRA CHRISTIAN REMLING 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers by Z = {..., 2, 1, 0, 1,...}. Given a, b Z, we write a b if b = ac for some

More information

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?

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? Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

More information

Primes and Modular Arithmetic! CSCI 2824, Fall 2014!!

Primes and Modular Arithmetic! CSCI 2824, Fall 2014!! Primes and Modular Arithmetic! CSCI 2824, Fall 2014!!! Scheme version of the algorithm! for finding the GCD (define (gcd a b)! (if!(= b 0)!!!!a!!!!(gcd b (remainder a b))))!! gcd (812, 17) = gcd(17, 13)

More information

Introduction to Cryptography CS 355 Lecture 3

Introduction to Cryptography CS 355 Lecture 3 Introduction to Cryptography CS 355 Lecture 3 Elementary Number Theory (1) CS 355 Fall 2005/Lecture 3 1 Review of Last Lecture Ciphertext-only attack: Known-plaintext attack: Chosen-plaintext: Chosen-ciphertext:

More information

Intermediate Math Circles February 26, 2014 Diophantine Equations I

Intermediate Math Circles February 26, 2014 Diophantine Equations I Intermediate Math Circles February 26, 2014 Diophantine Equations I 1. An introduction to Diophantine equations A Diophantine equation is a polynomial equation that is intended to be solved over the integers.

More information

Lecture 7: Number Theory Steven Skiena. skiena

Lecture 7: Number Theory Steven Skiena.   skiena Lecture 7: Number Theory Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Number Theory and Divisibility G-d created

More information

MATH 145 Algebra, Solutions to Assignment 4

MATH 145 Algebra, Solutions to Assignment 4 MATH 145 Algebra, Solutions to Assignment 4 1: a) Find the inverse of 178 in Z 365. Solution: We find s and t so that 178s + 365t = 1, and then 178 1 = s. The Euclidean Algorithm gives 365 = 178 + 9 178

More information