LINEAR CONGRUENCES AND LINEAR DIOPHANTINE EQUATIONS

Similar documents
MATH 145 Algebra, Solutions to Assignment 4

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

Chapter 2. Divisibility. 2.1 Common Divisors

Notes on Systems of Linear Congruences

Number Theory Proof Portfolio

5: The Integers (An introduction to Number Theory)

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?

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

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

Math 109 HW 9 Solutions

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

Chapter 5: The Integers

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

4 Powers of an Element; Cyclic Groups

NOTES ON SIMPLE NUMBER THEORY

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?

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

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

CHAPTER 3. Congruences. Congruence: definitions and properties

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

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

Wilson s Theorem and Fermat s Little Theorem

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

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

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

Divisibility. Chapter Divisors and Residues

Intermediate Math Circles February 26, 2014 Diophantine Equations I

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

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

Lecture Notes. Advanced Discrete Structures COT S

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

Homework #2 solutions Due: June 15, 2012

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

LEGENDRE S THEOREM, LEGRANGE S DESCENT

MATH 361: NUMBER THEORY FOURTH LECTURE

1 Overview and revision

3.2 Solving linear congruences. v3

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

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

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

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

Math From Scratch Lesson 20: The Chinese Remainder Theorem

Modular Arithmetic Instructor: Marizza Bailey Name:

Number Theory Solutions Packet

1. multiplication is commutative and associative;

The Chinese Remainder Theorem

A Readable Introduction to Real Mathematics

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

Rings and modular arithmetic

Chapter 3 Basic Number Theory

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

Elementary Properties of the Integers

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

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

Simultaneous Linear, and Non-linear Congruences

Discrete Mathematics with Applications MATH236

MATH10040 Chapter 1: Integers and divisibility

CHAPTER 4: EXPLORING Z

Section 19 Integral domains

The Euclidean Algorithm and Diophantine Equations

Part V. Chapter 19. Congruence of integers

ELEMENTS OF NUMBER THEORY

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

4.4 Solving Congruences using Inverses

Mathematics of Cryptography Part I

Discrete Math, Second Problem Set (June 24)

3.7 Non-linear Diophantine Equations

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

4 Number Theory and Cryptography

The Chinese Remainder Theorem

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b.

PROBLEM SET 1 SOLUTIONS 1287 = , 403 = , 78 = 13 6.

Math Circles - Lesson 2 Linear Diophantine Equations cont.

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

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

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

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

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

Deepening Mathematics Instruction for Secondary Teachers: Algebraic Structures

Carmen s Core Concepts (Math 135)

Integers and Division

MTH 346: The Chinese Remainder Theorem

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

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

An Introduction to Mathematical Thinking: Algebra and Number Systems. William J. Gilbert and Scott A. Vanstone, Prentice Hall, 2005

Chapter 5. Modular arithmetic. 5.1 The modular ring

Number Theory. Henry Liu, 6 July 2007

Math 4400/6400 Homework #8 solutions. 1. Let P be an odd integer (not necessarily prime). Show that modulo 2,

is square-free. Suppose it were not and had a square factor x 2 p r 1. This is a contradiction, as the only possible primes dividing p r 1

3 The fundamentals: Algorithms, the integers, and matrices

Introduction to Sets and Logic (MATH 1190)

The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:

Number Theory and Group Theoryfor Public-Key Cryptography

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

Try the assignment f(1) = 2; f(2) = 1; f(3) = 4; f(4) = 3;.

44.(ii) In this case we have that (12, 38) = 2 which does not divide 5 and so there are no solutions.

8 Primes and Modular Arithmetic

MATH 3240Q Introduction to Number Theory Homework 4

Kevin James. MTHSC 412 Section 3.4 Cyclic Groups

Transcription:

LINEAR CONGRUENCES AND LINEAR DIOPHANTINE EQUATIONS MATH 422, CSUSM. SPRING 2009. AITKEN This document discusses methods and results related to solving linear congruences and linear Diophantine equations. 1. Linear Congruences: Simple Case In what follows assume m is a positive integer. Here x is an unknown, and a, c and m are fixed. In this section we will consider the case where a and m are coprime (the simple case ). Theorem 1. If gcd(a, m) = 1 then the equation ax c has the unique solution x a 1 c modulo m. Proof. Existence: It is easy to see that x = a 1 c does work: substitute and simplify. Recall that a 1 exists since gcd(a, m) = 1. Uniqueness: Suppose that x 1 is any solution. Then ax 1 c modulo m. Multiply both sides by a 1 and simplify. Thus x 1 a 1 c modulo m. This shows that x 1 x 0. Exercise 1. Solve 7x 11 mod 9 by finding an inverse for 7. Exercise 2. Solve 3x + 3 x + 5 mod 11. Exercise 3. Use the Euclidean algorithm to find the inverse to 297 modulo 349. Use this to solve 297x 3 modulo 349. y Remark. We only have uniqueness modulo m. There are actually an infinite number of solutions in Z given by the formula x = a 1 c + km where k Z. Another method is to use the cancellation law. With this method you do not have to actually compute a 1, you just need to know it exists. In this method you try to rewrite the right hand side c as a multiple of a. Theorem 2. If gcd(a, m) = 1 then the equation has the same solutions as ax ab x b Proof. This is a consequence of the following theorem where d = a. Date: March 2, 2009. 1

Theorem 3. If gcd(d, m) = 1, and if d divides a and c, then has the same solutions as ax c (a/d)x (c/d). Proof. Suppose that x 0 solves the first congruence. Multiply both sides by d 1 (which exists since it is prime to m): Rewrite a as d(a/d) and c as c(c/d). d 1 ax d 1 c d 1 d(a/d)x d 1 d(c/d). Now simply. This shows that x 0 satisfies the second congruence. Conversely, suppose that x 0 solves the second congruences. Multiple both sides of the congruence (with x = x 0 ) by d and simplify. This shows that x 0 satisfies the first congruence. Remark. Observe that the modulus does not change in this case. Exercise 4. Solve 6x 18 mod 31 without finding the inverse of 6. Solve 5x 4 mod 21 without finding the inverse of 5. 2. Linear Congruences: Nonsimple Case Now we consider the case where a is not relatively prime to m. Here we must reduce the modulus. First we consider a result that describes how to reduce the modulus. Theorem 4. Suppose d divides a, c, m. Then has the same solutions as ax c (a/d)x (c/d) mod (m/d). Proof. Suppose that x 0 solves the first congruence. ax c. Then m (ax 0 c). So ax 0 c = ml for some l Z. Dividing by d gives us that (a/d)x 0 (c/d) = (m/d)l. In other words, m/d divides (a/d)x 0 (c/d). Thus x 0 solves the second congruence. Conversely, if x 0 solves the second congruence, then m/d divides (a/d)x 0 (c/d). So (a/d)x 0 (c/d) = (m/d)l for some l Z. Multiply by d. So ax 0 c = ml. Thus m (ax 0 c). Hence x 0 solves the first congruence. Just because the two congruences above have the same solutions, does not mean that they have the same number of solutions relative to their respective moduli. This is described in the following: 2

Theorem 5. Suppose d divides a, c, m. Then every solution of (a/d)x (c/d) corresponds to d distinct solutions (modulo m) of ax c. mod (m/d) In particular, the second congruence has d times the number of solutions as the first congruence. Proof. Let x 0 be a solution to the first equation. We can assume that x 0 is chosen so that 0 x 0 < m/d. This is a solution modulo m/d and really corresponds to an infinite number of solutions x = x 0 + k(m/d) where k Z. Observe that 0 x 0 + k(m/d) < m if and only if k is in the range 0, 1,..., d 1. Thus x = x 0 + k(m/d) describes d distinct solutions. Exercise 5. Use the above to find all six solutions to 12x 24 mod 30. Now we can prove the main theorem: Theorem 6. Consider the congruence ax c and let g = gcd(a, m). If g c then this congruence has no solutions. If g c then it has exactly g solutions modulo m. Remark. Observe that when g = 1 we recover the uniqueness result of the previous section. Proof. First consider the case where g c, and suppose a solution x = x 0 exists. Then m divides ax 0 c. Thus ax 0 c = ml for some l Z. This means c = ax 0 ml. Since g divides the right hand side, it must divide c, a contradiction. Now suppose g c. By Theorem 4 we need to solve (a/g)x (c/g) mod (m/g) By the following lemma, a/g and m/g are relatively prime. Thus there is exactly one solution modulo m/g. By Theorem 5 there are g 1 solutions to the original congruence modulo m. Exercise 6. Use Bezout s identity to prove the following: Lemma 7. Let g = gcd(a, b) where b 0. Then a/g and b/g are relatively prime. Exercise 7. How many solutions does 34x+1 18 mod 85 have? How many solutions does 34x + 1 20 mod 170 have? 3. Linear Diophantine Equations: two variables Thus far we have been considering congruences (using ). Now we will consider true equations (using =) where we look only for integer solutions. Such equations are called Diophantine equations in honor of the Greek mathematician Diophantus. Diophantine equations are much harder than equations where we allow real solutions. Fortunately, the linear case is not too bad. Since one variable linear equations are very easy, we start with two variables: ax + by = c where we assume a, b, c Z with a and b nonzero. 3

To solve this, first solve the congruence ax c mod b. If there are any solutions, there will be an infinite number of them given by the formula x 0 + kb/g where g = gcd(a, b). Now use the equation to solve for y. This method is justified by the following theorem and corollary. Theorem 8. Let a, b, c Z with a and b nonzero. If (x 0, y 0 ) is a solution to ax + by = c then x 0 is a solution to the associated congruence ax c where m = b. Conversely, if x 0 is a solution to the above congruence, then there is a y 0 such that (x 0, y 0 ) is a solution to the above Diophantine equation. Proof. For the first claim, observe that b divides (ax 0 c). Thus m divides (ax 0 c). For the second claim. Since x 0 solve the congruence, m (ax 0 c). Thus ax 0 c is a multiple of b. Hence ax 0 c = y 0 b for some y 0 Z. Thus (x 0, y 0 ) solves the Diophantine equation. Corollary 9. Let a, b, c Z with a and b nonzero. Let g = gcd(a, b). Then ax + by = c has integer solutions if and only if g c. If it has a solution (x 0, y 0 ) then the general solution is of the form x = x 0 + (a/g)k, y = y 0 (b/g)k One consequence of the above corollary is that if you find one solution, one can find the general solution. Proof of corollary. By the above theorem, the equation has a solution if and only if the congruence ax c mod b has a solution. By Theorem 6 this occurs if and only if g c. Now suppose that (x 0, y 0 ) is a solution (so g c). The possible values of x are given by the congruence ax c mod b which can be rewritten as the congruence (a/g)x (c/g) mod b /g. This has a unique solution x 0 modulo b /g. So the general solution is of the form x = x 0 + k b /g where k Z. We can remove the absolute value sign, and obtain the same set of possible x. For any x = x 0 + kb/g, the corresponding y is given by solving This yields a(x 0 + kb/g) + by = c. y = (c ax 0 )/b k(a/g) = y 0 k(a/g). Exercise 8. Find the general solution of equation 6x + 8y = 100. Often we want only positive solutions to ax+by = c. In this case, take the general solution x = x 0 + (a/g)k, y = y 0 (b/g)k and set x 0 and y 0. Now solve for k. This will give the range of possible k. Now for each integer value of k, you get a positive solution. 4

Exercise 9. Find the solutions of equation 6x + 8y = 100 such that x and y are natural numbers. 3.1. Another method. The Euclidean algorithm provides another method for finding a solution to the equation ax + by = c. Technically the Euclidean algorithm gives a solution to ax + by = g where g = gcd(a, b) (by finding a linear combination). However, once a solution is found giving g a linear combination, a solution yielding c as a linear combination is simply obtained by multiplying the equation by c/g. Recall that g must divide c for solutions to exist, so c/g will be an integer in any situation where solutions exist. Once one solution is found, the general solution is given by the formula of Corollary 9. Exercise 10. Solve 297x + 349y = 3 using the Euclidean algorithm. Then find the general solution. 4. Linear Diophantine Equations: Three Variables Now consider the Diophantine equation ax + by + cz = d where a, b, c, d Z with a, b, c nonzero. If there is a solution, then any common divisor of a, b, c will also divide d. Thus the greatest common divisor divides d. We will see that this is also a sufficient condition: the equation has a solution if and only if the greatest common divisor of a, b, c divides d. From now on suppose that the greatest common divisor of a, b, c divides d. First we solve ax + by = g where g is the greatest common divisor of a and b. Suppose (x 0, y 0 ) is such a solution. Next solve gw + cz = d. This has a solution since the greatest common divisor of g and c divides a, b, c, and by assumption must divide d as well. Let (w 0, Z 0 ) be such a solution. Observe that d = gw 0 + cz 0 = (ax 0 + by 0 )w 0 + cz 0 = a(x 0 w 0 ) + b(y 0 w 0 ) + cz 0 Thus we get a solution to the original equation. This discussion establishes the following Theorem 10. Let a, b, c, d Z with a, b, c nonzero. The Diophantine equation ax + by + cz = d has a solution if and only if d is a multiple of the greatest common divisor of a, b, c. The above method and theorem extends to four or more variables. Exercise 11. Find a solution to 6x + 15y + 10z = 2. 5. Additional Problems Exercise 12. Find the smallest postive rational number that can be written in the form x/30 + y/36 where x, y are integers. Exercise 13. Suppose you have a piece of paper with 31 parallel horizontal lines colored blue dividing the paper into 32 strips of equal height. Assume that there are also 21 parallel horizontal lines colored red dividing the paper into 22 strips of equal height. Suppose the piece of paper is 10 inches high. What is the shortest distance between two lines? 5

Exercise 14. Find all positive solution to 15x + 7y = 210. Exercise 15. Find all positive solution to 221x + 91y = 1053. Exercise 16. Find all integral solution to (6x + 15y)(8x + 7y) = 129. Exercise 17. A farmer buys 120 head of livestock from $8000. Horses cost 100 dollars, cows 60 dollars, and sheep 30 dollars. The farmer buys at least one of each type. What is the least number of sheep the farmer could have bought? Exercise 18. A child has $4.55 in change consisting of dimes and quarters. How many possibilities are there? Prof. Wayne Aitken, Cal. State, San Marcos, CA 92096, USA E-mail address: waitken@csusm.edu 6