Lecture Notes. Advanced Discrete Structures COT S

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

CHAPTER 3. Congruences. Congruence: definitions and properties

3.2 Solving linear congruences. v3

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

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?

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

Elementary Number Theory. Franz Luef

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

NOTES ON SIMPLE NUMBER THEORY

Part V. Chapter 19. Congruence of integers

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

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?

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

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Math 109 HW 9 Solutions

MATH 361: NUMBER THEORY FOURTH LECTURE

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

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

Ma/CS 6a Class 2: Congruences

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

Elementary Number Theory Review. Franz Luef

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

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

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?

Congruence of Integers

1 Overview and revision

Chapter 5. Number Theory. 5.1 Base b representations

Homework #2 solutions Due: June 15, 2012

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

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

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

Chapter 2. Divisibility. 2.1 Common Divisors

Modular Arithmetic Instructor: Marizza Bailey Name:

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

CPSC 467b: Cryptography and Computer Security

The Euclidean Algorithm and Multiplicative Inverses

Simultaneous Linear, and Non-linear Congruences

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

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

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

M381 Number Theory 2004 Page 1

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

3 The fundamentals: Algorithms, the integers, and matrices

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

Solutions to Section 2.1 Homework Problems S. F. Ellermeyer

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

5: The Integers (An introduction to Number Theory)

Objective Type Questions

Elementary Properties of the Integers

Ma/CS 6a Class 2: Congruences

4 Powers of an Element; Cyclic Groups

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

Intermediate Math Circles February 26, 2014 Diophantine Equations I

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

Math 110 HW 3 solutions

4 Number Theory and Cryptography

Introduction to Cryptology. Lecture 19

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

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

1. multiplication is commutative and associative;

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

Chapter 4 Finite Fields

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

Elementary Number Theory MARUCO. Summer, 2018

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

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

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

Hilbert s problems, Gödel, and the limits of computation

MTH 346: The Chinese Remainder Theorem

Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing

Deepening Mathematics Instruction for Secondary Teachers: Algebraic Structures

Basic Algorithms in Number Theory

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

Chapter 3 Basic Number Theory

Chapter 5: The Integers

Integers and Division

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

Chapter 5. Modular arithmetic. 5.1 The modular ring

A Guide to Arithmetic

Chapter 14: Divisibility and factorization

Basic Algorithms in Number Theory

The Chinese Remainder Theorem

Homework 3, solutions

12x + 18y = 30? ax + by = m

Elliptic curves: Theory and Applications. Day 3: Counting points.

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

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

Part IA Numbers and Sets

Wilson s Theorem and Fermat s Little Theorem

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

Introduction to Number Theory

8 Primes and Modular Arithmetic

CMPUT 403: Number Theory

Lecture 7.4: Divisibility and factorization

PROBLEMS ON CONGRUENCES AND DIVISIBILITY

7.2 Applications of Euler s and Fermat s Theorem.

Congruences. September 16, 2006

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

Number theory lectures

Transcription:

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 3.2 SOLVING ax + by = d

Definition A Diophantine equation is a polynomial equation (in two or more unknowns) such that only the integer solutions are searched or studied. Examples: 3 x + 3y = 2 No integer solutions 2 x 2 + 5y 2 = 1 No integer solutions 3x + 5y = 2 x = 4 + 5k y = 2 3k, k Z

Definition A set of integers is computably enumerable if there is an algorithm such that: For each integer input n, if n S, then the algorithm eventually halts; otherwise it runs forever. Example: S: there is a run of exactly n 6 s in the decimal expansion of τ = 2π = 6. 283185307179586476925286766559 S = {1,2,?, }

Hilbert s 10 th Problem (1900) Is there a general algorithm for solving all types of Diophantine equations? Answer (Matiyasevich-Robinson-Davis-Putnam, 1977): No, every computably enumerable set is Diophantine. Corresponding to any given consistent axiomatization of number theory, one can explicitly construct a Diophantine equation which has no solutions, but this fact cannot be proved within the given axiomatization.

Linear Diophantine Equations Theorem: Let a, b Z with d = gcd(a, b). The equation ax + by = c has no integral solutions if d c. If d c, then there are infinitely many integral solutions. Moreover, if X = x and Y = y is a particular solution of the equation, then all solutions are given by: X = x + b d k, Y = y + a d k where k Z.

Linear Diophantine Equations Consider: ax + by = c and d = gcd(a, b) If d c but c d, solve instead: a Now, gcd a d, b d = c d. d X + b d Y = c d

Solving ax + by = gcd(a, b) 1. Extended Euclidean Algorithm Form the following sequence: x 0 = 0, x 1 = 1, x j = q j 1 x j 1 + x j 2, y 0 = 1, y 1 = 0, y j = q j 1 y j 1 + y j 2, Then a x n + b y n = gcd(a, b)

Recall from last Lecture Use the Euclidean algorithm to find gcd(600, 252): 600 = 2 252 + 96 q 1 = 2 252 = 2 96 + 60 q 2 = 2 96 = 1 60 + 36 q 3 = 1 60 = 1 36 + 24 q 4 = 1 36 = 1 24 + 12 q 5 = 2 24 = 2 12 + 0 q 6 = 2 gcd(600, 252) = 12

Solving Linear Diophantine Equations Example: 252 x + 600 y = gcd 252,600 = 12 q 1 = 2, q 2 = 2, q 3 = 1, q 4 = 1, q 5 = 1, q 6 = 2 x 0 = 0, x 1 = 1, y 0 = 1, y 1 = 0, x j = q j 1 x j 1 + x j 2 y j = q j 1 y j 1 + y j 2 x 2 = 2 x 1 + x 0 = 2, y 2 = 2 y 1 + y 0 = 1, x 3 = 2 x 2 + x 1 = 5, y 3 = 2 y 2 + y 1 = 2, x 4 = 1 x 3 + x 2 = 7, y 4 = 1 y 3 + y 2 = 3, x 5 = 1 x 4 + x 3 = 12, y 5 = 1 y 4 + y 3 = 5, x 6 = 1 x 5 + x 4 = 19, y 6 = 1 y 5 + y 4 = 8, 252 19 + 600 8 = 12 = gcd(252,600)

Solving Linear Diophantine Equations Recursive Form: x 0 = 0, x 1 = 1, x j = q j 1 x j 1 + x j 2, y 0 = 1, y 1 = 0, y j = q j 1 y j 1 + y j 2, Matrix Form: 0 1 x j 2 y j 2 1 q j 1 x j 1 y j 1 = x j 1 y j 1 x j 2 q j 1 x j 1 y j 2 q j 1 y j 1 = x j 1 y j 1 x j y j

Solving Linear Diophantine Equations 0 1 1 2 0 1 1 2 0 1 1 1 0 1 1 1 0 1 1 1 = 5 8 12 19

Two was to solve ax + by = gcd(a, b) Reverse Euclidean Algorithm (Substitution) 600 = 2 252 + 96 12 = 8 600 2 252 3 252 = 8 600 19 252 252 = 2 96 + 60 12 = 2 96 3 252 2 96 = 8 96 3 252 96 = 1 60 + 36 12 = 2 96 1 60 1 60 = 2 96 3 60 60 = 1 36 + 24 12 = 36 1 60 1 36 = 2 36 1 60 36 = 1 24 + 12 12 = 36 1 24 24 = 2 12 + 0

Basic Notions - Section 3.3 CONGRUENCES

Definition Let a, b, n Z with n 0. We say that a b mod n (read: a is congruent to b mod n) if n a b, i.e., there exists a k Z such that a b = k n or a = b + k n.

Examples 2 9 mod 11 2 9 = 11 = 1 11 123 3 (mod 10) 123 3 = 120 = 12 10 21 21 (mod 10) 21 21 = 0 = 0 10 21 0 (mod 21) 21 0 = 21 = 1 21

Proposition Let a, n Z with n 0. a 0 (mod n) if and only if n a. Proof. ( ) Suppose a 0 (mod n), i.e., there exists a k Z such that a 0 = k n. By definition, n a. ( ) Likewise, if n a there exists a k Z such that a 0 = k n which means a 0 (mod n). a a (mod n). Proof. Note that a a = 0 = 0 n, thus a a (mod n).

Proposition Let a, b, n Z with n 0. a b (mod n) if and only if b a (mod n). Proof. ( ) Suppose a b (mod n), i.e., there exists a k Z such that a b = k n. Multiply both sides by 1 to get: b a = a b = k n = k n which means b a (mod n). ( ) Proof is similar; interchange a and b.

Proposition Let a, b, c, n Z with n 0. If a b (mod n) and b c (mod n), then a c mod n. Proof. By definition, a = b + k 1 n and b = c + k 2 n for some integers k 1, k 2 Z. Thus, a = b + k 1 n = c + k 2 n + k 1 n = c + k 2 + k 1 n which means a c (mod n).

Proposition Let a, b, c, d, n Z with n 0, and suppose a b (mod n) and c d (mod n). Then Proof. a + c b + d mod n. We have that a = b + n k 1 and c = d + n k 2 for some k 1, k 2 Z. Thus, a + c = b + n k 1 + d + n k 2 = b + d + n (k 1 + k 2 ), i.e., a + c b + d (mod n).

Proposition Let a, b, c, d, n Z with n 0, and suppose a b (mod n) and c d (mod n). Then Proof. a c b d mod n. We have that a = b + n k 1 and c = d + n k 2 for some k 1, k 2 Z. Thus, a c = b + n k 1 d + n k 2 = b d + n d k 1 + b k 2 + n k 1 k 2, i.e., a c b d (mod n).

Proposition Let a, b, c, d, n Z with n 0, and suppose a b (mod n) and c d (mod n). Then Proof. a c b d mod n. We have that a = b + n k 1 and c = d + n k 2 for some k 1, k 2 Z. Thus, a c = b + n k 1 d + n k 2 = b d + n d k 1 + b k 2 + n k 1 k 2, i.e., a c b d (mod n).

Examples We can do algebra modulo n: x + 7 3 (mod 11) x + 7 + 7 3 + ( 7) (mod 11) x 7 (mod 11) Remember, this means that, x = 18, x = 7, x = 4, x = 15, are all solutions.

Basic Notions - Section 3.3.1 DIVISION

Subtraction and Division Subtraction: Addition of negative numbers 7 4 = 7 + ( 4) Division: Multiplication of fractions Negative numbers: Negative powers: 3 4 = 3 1 4 = 3 4 1 4 is the number k which solves 4 + k = 0 4 1 is the number k which solves 4 k = 1

Proposition Let a, b, c, n Z with n 0 and gcd a, n = 1. If ab ac (mod n), then b c (mod n). Proof. Recall that gcd a, n = 1 implies that there exist x, y Z such that a x + n y = 1 b c a x + n y = (b c) or a b a c x + b y c y n = b c. Since n ab ac and n by cy n, n b c also. Thus, b c (mod n).

Example Solve: 2x + 5 9 (mod 11) 2x + 5 + 5 9 + ( 5) (mod 11) 2x 4 (mod 11) x 2 (mod 11) since gcd(2,11) = 1.

Example Solve: 2x + 5 8 (mod 11) 2x + 5 + 5 8 + ( 5) (mod 11) 2x 3 (mod 11) 2 1 2x 2 1 3 (mod 11) since gcd(2,11) = 1. But what does 2 1 (mod 11) mean?

2 1 (mod 11) Want to find a k Z with the following property: this would mean k 2 1 mod 11, 2k 1 = 11j for some j Z. Rewritten, we are looking for j, k Z such that 2k + 11j = 1. Using the extended Euclidean algorithm: k = 6, j = 1 Check: 6 2 = 12 1 (mod 11)

Example Solve: 2x + 5 8 (mod 11) 2x + 5 + 5 8 + ( 5) (mod 11) 2x 3 (mod 11) 2 1 2x 2 1 3 (mod 11) x 6 3 = 18 7 (mod 11)

Proposition Suppose gcd(a, n) = 1. Let s, t Z s.t. as + nt = 1. Then a s 1 mod n. [The integer s is said to be the multiplicative inverse of a modulo n and written a 1.] Proof. Since a s 1 = n t, a s 1 (mod n). What can happen when gcd a, n 1? 3k 1 (mod 6)

Example However, 15 x 21 (mod 39) 3 5 x 3 7 mod 39 5 x 7 (mod 39) Here we re looking for 5 1 (mod 39). Find j, k such that 39j + 5k = 1 by the extended Euclidean algorithm: j = 1, k = 8 works, so x 8 7 = 56 17 (mod 39) Other solutions: x 4 (mod 39) and x 30 (mod 39).

Solving ax c (mod n) If gcd a, n = 1: 1. Use the extended Euclidean algorithm to find s, t Z such that a s + n t = 1. 2. The solution is x s c (mod n). If gcd(a, n) > 1: 1. If d does not divide b, there is no solution. 2. Assume d b. Consider the new congruence a/d x b/d mod n/d and obtain the new solution x = x 0. 3. Solutions to original congruence are: x 0, x 0 + n d, x 0 + 2 n d,, x 0 + d 1 n d (mod n)

Non-linear Equations An important congruence: x 2 a mod n. Example Check: x 2 1 mod 5 0 2 = 0 0 (mod 5) 1 2 = 1 1 (mod 5) 2 2 = 4 4 (mod 5) 3 2 = 9 4 (mod 5) 4 2 = 16 1 (mod 5) Solutions: x ±1 (mod 5)

Non-linear Equations Example Check: x 2 1 mod 15 1 2 = 1 1 (mod 15) 8 2 = 64 4 (mod 15) 2 2 = 4 4 (mod 15) 9 2 = 81 6 (mod 15) 3 2 = 9 9 (mod 15) 10 2 = 100 10 (mod 15) 4 2 = 16 1 (mod 15) 11 2 = 121 1 (mod 15) 5 2 = 25 10 (mod 15) 12 2 = 144 9 (mod 15) 6 2 = 36 6 (mod 15) 13 2 = 169 4 (mod 15) 7 2 = 49 4 (mod 15) 14 2 = 196 1 (mod 15) Solutions: x ±1, ±4 (mod 5)

Basic Notions - Section 3.3.2 WORKING WITH FRACTIONS

Don t Use multiplicative inverse notation: a 1 Always check that the integer a 1 actually exists, i.e., gcd a, n = 1.