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?

Similar documents
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. Congruences. Congruence: definitions and properties

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 = ,

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

3.2 Solving linear congruences. v3

Elementary Number Theory. Franz Luef

Part V. Chapter 19. Congruence of integers

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

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

Chapter 1 A Survey of Divisibility 14

1 Overview and revision

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

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

Chapter 3 Basic Number Theory

4. Congruence Classes

Lecture Notes. Advanced Discrete Structures COT S

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

M381 Number Theory 2004 Page 1

Homework #2 solutions Due: June 15, 2012

Modular Arithmetic Instructor: Marizza Bailey Name:

Practice Number Theory Problems

Commutative Rings and Fields

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

For your quiz in recitation this week, refer to these exercise generators:

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

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

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

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

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

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

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

MATH 215 Final. M4. For all a, b in Z, a b = b a.

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

Congruences. September 16, 2006

MATH 361: NUMBER THEORY FOURTH LECTURE

3.7 Non-linear Diophantine Equations

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

Number Theory Proof Portfolio

Elementary Number Theory Review. Franz Luef

Math From Scratch Lesson 20: The Chinese Remainder Theorem

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3

The Euclidean Algorithm and Multiplicative Inverses

Integers modulo N. Geoff Smith c 1998

THESIS. Presented in Partial Fulfillment of the Requirements for the Degree Master of Science in the Graduate School of The Ohio State University

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

MATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

Math Homework # 4

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

7.2 Applications of Euler s and Fermat s Theorem.

The Chinese Remainder Theorem

Elementary Properties of the Integers

Math 109 HW 9 Solutions

Number Theory. Introduction

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

1. multiplication is commutative and associative;

Ch 4.2 Divisibility Properties

Chapter 5: The Integers

5: The Integers (An introduction to Number Theory)

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

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

Mathematics of Cryptography Part I

8 Primes and Modular Arithmetic

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

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

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

Integers and Division

MATH Fundamental Concepts of Algebra

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

Solutions to Section 2.1 Homework Problems S. F. Ellermeyer

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

STEP Support Programme. Hints and Partial Solutions for Assignment 17

3 The fundamentals: Algorithms, the integers, and matrices

Chapter 5. Number Theory. 5.1 Base b representations

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

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

Number Theory Solutions Packet

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

Notes on Systems of Linear Congruences

Chapter 5. Modular arithmetic. 5.1 The modular ring

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

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers

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

Intermediate Math Circles February 26, 2014 Diophantine Equations I

7. Prime Numbers Part VI of PJE

Solving the general quadratic congruence. y 2 Δ (mod p),

Introduction to Cryptology. Lecture 19

With Question/Answer Animations. Chapter 4

Basic elements of number theory

Basic elements of number theory

SOLUTIONS Math 345 Homework 6 10/11/2017. Exercise 23. (a) Solve the following congruences: (i) x (mod 12) Answer. We have

Number Theory. Modular Arithmetic

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

NOTES ON SIMPLE NUMBER THEORY

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

CSE 20: Discrete Mathematics

The Chinese Remainder Theorem

Transcription:

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 inverse C Solving Linear Congruences In algebra we have linear equations in one unknown x given by Solving this equation gives x 3. 2x 7 A linear congruence in modular arithmetic is an equation of the form ax b mod n The solution to this linear congruence is the set of integers x which satisfy this: ax b mod n Why is the solution a set of integers rather than a unique integer? Recall ax b mod n integer k. means that ax b is a multiple of n or ax b kn for some Can we confine ourselves to a unique solution to the linear congruence ax b mod n? If two solutions x x and x x satisfy the linear congruence 0 ax b mod n and they are congruent modulo n, that is x x 0 mod n same solution and count them as one solution. For example let us consider the linear congruence We can trial a table of integers for x: 2 x mod 5 (*), then we say these are the x 0 2 3 4 5 6 7 8 9 2 x mod 5 0 2 4 3 0 2 4 3 Table Shows the junctions of 2x mod 5

Chapter 3: Theory of Modular Arithmetic 26 Therefore x 3 and x 8 satisfy However they are the same solution. Why? 2 x mod 5 Because 8 3 mod 5. We count this as one solution not two. [It is the same station in modulo 5 clock.] Since we are interested in solutions modulo 5 we only need to consider integers amongst the list; x 0,, 2, 3 and 4 [least non-negative residues modulo 5] Because all the other integers will be one of these in modulo 5 which is illustrated below: x 0,, 2, 3, 4 mod 5 these junctions. Figure 7 Modulo 5 clock covers all the stations. Any other integer will stop at one of A more systematic way of solving the above linear congruence is given next. Example 0 Determine the integers x of the following linear congruence: 2 x mod 5 By definition of congruence 2x mod 5 implies that 2x is a multiple of 5: 2x 5y where y is an integer Rearranging this we have 2x 5y which is a Diophantine equation and we solved these type of equations in chapter. Making x the subject of 2x 5y gives 5y x 2 Remember x must be an integer. So what values of y can we use?

Chapter 3: Theory of Modular Arithmetic 27 Only the odd integers because if we choose even then we get even plus which does not give a whole number after dividing by 2. Substituting y, 3, 5,,, 3, 5, x 3, 8, 3,, 2, 7, 2, 5y into x gives 2 respectively. We count all these solutions as one or the same solution because they are all congruent to each other modulo 5: 3 8 3 2 7 mod 5 See the above Fig. 7 and you will notice that all these numbers 3, 8, 3,, 2, 7 stop at the same junction, 3 mod 5. We normally write this as just one solution which is the least non-negative residue modulo 5: x 3 mod 5 We say the solution of 2x mod 5 is 3 mod 5 x. Example Solve the linear congruence: 2 x mod 6 The solution of this linear congruence 2x mod 6 x 0,, 2, 3, 4 and 5 must be in the list: Because we are working with modulo 6 in this case. Evaluating these we have x 0 2 3 4 5 2 x mod 6 0 2 4 0 2 4 Table 2 Junctions of 2x mod 6. [Note that the numbers 0, 2 and 4 are repeated]. By examining this table we find that there are no x values which satisfy 2 x mod 6. The set of integers 2x will not stop at junction modulo 6. This means that there is no solution to the given linear congruence 2x mod 6. (Try doing this by solving the Diophantine equation 2x 6y.) If we have x b mod n then we only have to consider values of

Chapter 3: Theory of Modular Arithmetic 28 In solving 2x mod 5 x 0,, 2, 3,, n. we tried values of x up to 9 (see Table at the beginning of this section), but we only need to try x 0,, 2, 3, 4. C2 Number of solutions of a Linear Congruence The above Example demonstrates that there are some linear congruences which have no solution. How do we know which congruences have a solution? The next proposition gives the criteria for a solution. Proposition (3.5). The linear congruence ax b mod n has a solution g b where g gcd a, n. Note that in Example 0 we had 2x mod 5. The the linear congruence 2x mod 5 has a solution. g gcd 2, 5 and so On the other hand in Example we had 2x mod 6 the g gcd 2, 6 2 and 2 does not divide so there are no solutions to this linear congruence. (For this example you would have noticed from the previous table that 2x mod 6 only stops at 0, 2 and 4 modulo 6 because these numbers are multiples of g gcd2, 6 2.) How do we prove this proposition (3.5)? By Proposition (.6) of chapter : ax by c has integer solutions g c where gcd, a b g Proof. We have ax b mod n Let g gcd a, n equation which means that there is an integer y such that ax b yn implies ax ny b. Then by Proposition (.6) we conclude that the Diophantine ax ny b has a solution g b which is our required result.

Chapter 3: Theory of Modular Arithmetic 29 Example 2 Which of the following linear congruences have solutions? (a) 7x 8 mod 4 (b) 2x 8 mod 6 (c) 5x 2 mod 9 (d) 36x 54 mod 90 (a) The greatest common divisor of 7 and 4, that is not divide 8 so by the above Proposition (3.5) the linear congruence 7 x 8 mod 4 (b) For 2x 8 mod 6 the congruence 2 x 8 mod 6 (c) For 5x 2 mod 9 we have linear congruence 5 x 2 mod 9 (d) The gcd36, 90 8 36 x 54 mod 90 has solutions. has no solution gcd 7, 4 7, but 7 does gcd 2, 6 6 but 6 8 so the given linear has no solution gcd 5, 9 3 and 3 divides 2 so the given has solutions (we are not asked to find them) and 8 divides 54 so the given linear congruence Next, we show that the congruence ax b mod n has exactly g gcd a, n incongruent solutions. What does incongruent mean? Not congruent. For example 6 x 2 mod 4 has solutions x mod 4 and x 3 mod 4 but 3 mod 4 [ 3 mod 4 is not congruent to We say x mod 4 and x 3 mod 4 linear congruence 6x 2 mod 4. These congruences x mod 4 and x 3 mod 4 are two different stops on the modulo 4 clock. Example 3 Solve the linear congruence 6x 3 mod 9. mod 4 ] are two incongruent solutions of the given

Chapter 3: Theory of Modular Arithmetic 30 We use the above Proposition (3.5) to test whether we have a solution: mod has a solution g b where g gcd a, n ax b n We first find the greatest common divisor of 6 and 9: g gcd 6, 9 3 Since 3 3 the given linear congruence 6x 3 mod 9. has exactly 3 solutions. In this case we are working with modulo 9 so we only need to consider x 0,, 2, 3, 4, 5, 6, 7 and 8 Evaluating these gives x 0 2 3 4 5 6 7 8 6 x mod 9 0 6 3 0 6 3 0 6 3 By using this table we see our solutions are The linear congruence 6x 3 mod 9 Table 4 Shows junctions of 6x mod 9 x 2, 5, 8 mod 9 has three incongruent solutions x 2, 5, 8 mod 9. By observing Table 4 in Example 3 we have that the congruences 6 x 0, 3, 6 mod 9 have solutions because all these numbers 0, 3, 6 are multiples of 3 which is the gcd of 6 and 9. The set of integers represented by 6x mod 9 0, 3, 6 on the modulo 9 clock. only stops at junctions However the following congruence equations 6x, 2, 4 and 5 mod 9 will have no solutions because g 3 does not divide into any of these numbers, 2, 4, 5, 7, 8. Proposition (3.6). The linear congruence ax b mod n Has exactly g incongruent solutions modulo n provided g b where g gcd a, n How do we prove this result?. We use Proposition (.7) of chapter which gives the solutions of the Diophantine equation:

Chapter 3: Theory of Modular Arithmetic 3 If x 0, y 0 are particular solutions of the Diophantine equation and g c where gcd a, b g by Proof. ax by c then all the other solutions of this equation are given b x x t 0 g a and y y t 0 g We do the proof in two parts. First we list the solutions and then we show there are exactly g incongruent solutions. The given congruence ax b mod n ax b kn implies that there is an integer k such that ax kn ax n k b which implies Let x 0 be a particular solution to this equation then by applying the above Proposition (.7) to ax n k b gives the other solutions as n x x t 0 g where t is an arbitrary integer and g gcd a, n Substituting t 0, t, t 2, and t g we have n n n n x x, x, x 2, x 3,, x 0 0 0 0 0 g g g g g (*) Need to show that each of these are not congruent modulo n. How? Use proof by contradiction. Suppose any two numbers in the list (*) are congruent modulo n: n n x t x t 0 2 0 mod n g g Where 0 t t g. By using Definition (3.): 2 g g On n n x t 0 2 x t 0 mod n a b mod n a b kn implies there is an integer k such that n n x t 0 2 x t k n 0 g g n t t 2 k n Simplifying and factorizing g t t k g implies t t k g 2 2 Cancelling n's

Chapter 3: Theory of Modular Arithmetic 32 We have t 2 t k g t g g (because k ) and earlier we had t 2 g. This is a contradiction because we have t 2 g and t 2 g. Hence none of the congruences in the above list (*) are congruent to each other modulo n. This means that the list of numbers: are incongruent modulo n. n n n n x x, x, x 2, x 3,, x 0 0 0 0 0 g g g g g n Any other solution x x t 0 g Why? is congruent to one of these in the list modulo n. We can show this by using the Division Algorithm on integers t and g. The Division Algorithm (.7) of chapter : Let a, b be given. Then there are unique integers q and r such that a bq r 0 r b Applying this on the above integers t and g means there are integers q and r such that: t gq r 0 r g ( ) n Substituting this t gq r into x x t 0 g gives n n x x 0 t x 0 gq r g g x nq r n 0 g n x 0 0 r Because g nq0 mod n n x r 0 mod n g From ( ) we have 0 r g which means r 0,, 2, 3,, g so this n x x t 0 g is in the above list (*) which is: n n n n x x, x, x 2, x 3,, x 0 0 0 0 0 g g g g g Hence we have exactly g incongruent solutions to ax b mod n.

Chapter 3: Theory of Modular Arithmetic 33 C3 Solving Linear Congruence Equations The list (*) produced in the proof of the above Proposition (3.6) is used to find the g solutions of ax b mod n. Hence the following integers: g g g g n n n n (3.7) x x, x, 2, 3,, 0 0 x x x 0 0 0 g mod n are the g solutions of ax b mod n provided g b where g gcd a, n These numbers can be written in compact form as: g (3.8) x n x t 0 mod n for t 0,, 2,, g We find a solution x 0 and then add multiples of n g. Example 4 Find all the solutions of the linear congruence equation: 7 x 35 mod 70 First we determine the greatest common divisor, gcd, of 7 and 70: gcd 7, 70 7 What next? We need to check that 7 divides into 35. Since 7 Why? Because by Proposition (3.6):. 35 we have 7 incongruent solutions. mod has exactly g solutions provided g b where g gcd a, n ax b n We can find the first solution by trial and error. Is there an obvious solution? Yes, it is x 5 mod 70 because 7 5 35. How do we find the other six solutions? Using the list of numbers given in (3.8): g (3.8) x n x t 0 mod n With x 5 0 mod 70, n 70 and g 7 0 with t 0,, 2,, 7 for t 0,, 2,, g we have to x 5 0 mod 70 n g 70 0. Adding multiples of 7, into this (3.8) gives

Chapter 3: Theory of Modular Arithmetic 34 x 5, 5 0, 5 2 0, 5 3 0,, 5 7 0 5, 5, 25, 35, 45, 55, 65 mod 70 Simplifying You can check that each of these is a solution by substituting these into 7 x 35 mod 70 Example 5 Find all the solutions of the linear congruence equation: First gcd7, 70 7 7 x 34 mod 70 but 7 does not divide into 34. What does this mean in relation to the solutions of 7x 34 mod 70? There are no solutions to 7x 34 mod 70. Example 6 Find all the incongruent solutions of the linear congruence: 5 x 34 mod 7 The greatest common divisor of 5 and 7 is, that is gcd5, 7 34. How many solutions do we have of the given linear congruence? and divides into One solution which means this linear congruence has a unique solution. How can we find this? We are given 5x 34 mod 7. We can simplify this to make the arithmetic easier; note that 34 6 mod 7 therefore 5x 34 6 mod 7. It is simpler to solve 5x 6 mod 7 rather than 5x 34 mod 7 Also note that 5 2 mod 7 and 6 mod 7 can solve the equivalent easier equation:. Using these results means that we 2x mod 7 2x mod 7 Multiplying by By observation we know x 4 mod 7 is a solution because 2 4 8 mod 4 Checking that this solution is correct:,

Chapter 3: Theory of Modular Arithmetic 35 54 20 6 34 mod 7 Therefore 5x 34 mod 7 has the unique solution 4 mod 7 x. To solve the linear equation 6x 5 0 It is easier to divide through by 3 and solve 2x 5 0. Can we divide through by a common factor for congruences? We need to be careful because we are dealing with integers. The next example demonstrates this. Example 7 Find all the incongruent solutions of the linear congruence: 6 x 5 mod 2 The gcd6, 2 3 and 3 5 so there are 3 incongruent solutions modulo 2. If you only have paper and pen then modulo 2 is too tedious to work with. Can we convert this to a smaller modulus and work with that? Yes. By Proposition (3.0) of the previous section: ac bc mod n implies a b mod n g where g gcd c, n This n g gives us a smaller modulus. We are given 6x 5 mod 2 gcd 6, 2 3 and. We can write the given linear congruence 6x 5 mod 2 32x 35 mod 7 3 The above Proposition (3.0) allows us to cancel the 3 s which in this case gives: 2 x 5 mod 7 By inspection we have the solution x 6 mod 7 From this x 6 mod 7 we have What are values of t? x 6 7t where t is an integer to this congruence. Since we only have 3 solutions so t 0, and 2. By substituting these values t 0, and 2 into x 6 7t we have as

Chapter 3: Theory of Modular Arithmetic 36 x 6, 3, 20 mod 2 These are the 3 incongruent solutions modulo 2. You can check these by substituting them into the given linear congruence 6x 5 mod 2. Generally it is easier to divide through by the gcd a, n to find possible solutions of ax b mod n to work with. because then we are dealing with a smaller modulus which is simpler C4 Unique s How many solutions does the general linear congruence have if gcd a, n? ax b mod n Just one, a unique solution because g is the number of solutions of ax b mod n provided g divides b. We can write this as a general result. Corollary (3.9). If gcd a, n then the linear congruence ax b mod n has a unique solution modulo n. Proof. Applying Proposition (3.6) with g : ax b mod n has exactly g solutions provided g b where g gcd a, n We are given g gcd a, n and b so we have a unique solution to ax b mod n. Example 8 Solve the linear congruence: 6 x mod 3

Chapter 3: Theory of Modular Arithmetic 37 Since gcd6, 3 6 x mod 3 so we have a unique solution modulo 3. The congruence means that 3k 6x 3k implies x where k is an integer 6 35 We choose k so that x is an integer. Let k 5 then x. Hence 6 In ordinary algebra when we have 6x x mod 3 x. This x 6 6 is the inverse 6 of 6. Similarly, the unique solution of the above linear congruence 6x mod 3 x mod 3 We call this x mod 3 the (multiplicative) inverse of 6 modulo 3. C5 Multiplicative Inverse is Definition (3.20). If ax mod n then the unique solution of this congruence is called the multiplicative inverse of a modulo n and is denoted by a mod n In Example 0 we had 2x mod 5 x 3 mod 5 Therefore we write this in compact notation as 2 3 mod 5. In the exercises we will show that a mod n has an inverse a and n are relatively prime. Example 9 Determine the inverse of 3 mod 4. To find the inverse means we need to solve 3x mod 4. The gcd3, 4 we have a unique solution. By inspection x 5 mod 4 Because 3 5 5 mod 4 Inverse of 3 modulo 4 is 5 modulo 4 or in notation form 3 5 mod 4.. so

Chapter 3: Theory of Modular Arithmetic 38 Example 20 Determine the inverse of 3 modulo 5. In this case we need to solve 3x mod 5. Note that the not divide into so there are no solutions to this congruence 3x mod 5. Therefore 3 modulo 5 has no inverse. gcd 3, 5 3 but 3 does It is critical that a mod n has an inverse if and only if a and n are relatively prime. This implies that only the relative prime integers to n have inverses. Which integers have inverses modulo 0?, 3, 7 and 9 The integers 2, 4, 5, 6, 8 and 0 will not have inverses modulo 0 because they are not relatively prime with 0. SUMMARY (3.5) ax b mod n has solutions g b where g gcd a, n. The multiplicative inverse of a modulo n is the unique solution x mod n of ax mod n and is denoted by a mod n.