Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Size: px
Start display at page:

Download "Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors"

Transcription

1 Math.3336: Discrete Mathematics Primes and Greatest Common Divisors Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston blerina Spring 2019 Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 1/26

2 Course Information/Office Hours Instructor: Dr. Blerina Xhabli Office hours: TuTh 10:30am 12:00pm (PGH 202) Tutor/Grader: An Vu Office hours: MonWed 2:30pm 4:00pm (Fleming #11) Class meets every TuTh 1:00 pm - 2:30 pm Course webpage: blerina/ The class webpage contains contact info, office hours, slides from lectures, and important announcements. Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 2/26

3 Assignments to work on Homework #5 due Thursday, 3/07, 11:59pm No credit unless turned in by 11:59pm on due date Late submissions not allowed, but lowest homework score dropped when calculating grades Homework will be submitted online in your CASA accounts. You can find the instructions on how to upload your homework in our class webpage. Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 3/26

4 Chapter 4 Number Theory and Cryptography Chapter 4 Overview Divisibility and Modular Arithmetic Section 4.1 Integer Representations and Algorithms Section 4.2 Primes and Greatest Common Divisors Section 4.3 Solving Congruences Section 4.4 Applications of Congruences Section 4.5* Cryptography Section 4.6 Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 4/26

5 A review on Divisibility and Congruence Modulo Given two integers a and b where a 0, we say a divides b if there is an integer c such that b = ac If a divides b, we write a b; otherwise, a b If a b, a is called a factor of b and b is called a multiple of a. Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 5/26

6 Properties of Divisibility Theorem 1: If a b and a c, then a (b + c) Theorem 2: If a b, then a bc for all integers c Theorem 3: If a b and b c, then a c Theorem 4: If a b and a c, then a (mb + nc) Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 6/26

7 The Division Theorem Division theorem: Let a be an integer, and d a positive integer. Then, there are unique integers q, r with 0 r < d such that a = dq + r Here, d is called divisor, and a is called dividend q is the quotient, and r is the remainder. We use the r = a mod d notation to express the remainder The notation q = a div d expresses the quotient Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 7/26

8 Congruence Modulo a and b are congruent modulo m, a b (mod m) if and only if m (a b) Theorem: a b (mod m) iff a mod m = b mod m If a b (mod m) and c d (mod m) and k Z, then a + c b + d (mod m) a c b d (mod m) ac bd (mod m) a + k b + k (mod m) ak bk (mod m) Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 8/26

9 Section 4.2 Integer Representations and Algorithms Section Summary Integer Representations Base b Expansions Binary Expansions Octal Expansions Hexadecimal Expansions Base Conversion Algorithm Algorithms for Integer Operations Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 9/26

10 Section 4.3 Prime Numbers A positive integer p that is greater than 1 and divisible only by 1 and itself is called a prime number. First few primes: 2, 3, 5, 7, 11,... A positive integer that is greater than 1 and that is not prime is called a composite number Example: 4, 6, 8, 9,... Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 10/26

11 Fundamental Theorem of Arithmetic Fundamental Thm: Every positive integer greater than 1 is either prime or can be written uniquely as a product of primes. This unique product of prime numbers for x is called the prime factorization of x Examples: 12 = = = Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 11/26

12 Determining Prime-ness In many applications, such as crypto, important to determine if a number is prime following thm is useful for this: Theorem: If n is composite, then it has a prime divisor less than or equal to n Proof: Since n is composite, it can be written as n = ab where a > 1 and b > 1. For contradiction, suppose neither a nor b are n, i.e., a > n, b > n Then, n = ab > n 2 = n, a contradiction. Hence, either a n, or b n, and by the Fundamental Thm, is either itself a prime or has a factor less than itself. Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 12/26

13 Consequence of This Theorem Theorem: If n is composite, then it has a prime divisor n Corollary: If n does not have a prime divisor n, then n is prime. Thus, to determine if n is prime, only need to check if it is divisible by primes n Example: Show that 101 is prime Since 101 < 11, only need to check if it is divisible by 2, 3, 5, 7. Since it is not divisible by any of these, we know it is prime. Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 13/26

14 Infinitely Many Primes Theorem: There are infinitely many prime numbers. Proof: (by contradiction) Suppose there are finitely many primes: p 1, p 2,..., p n Now consider the number Q = p 1 p 2... p n + 1. Q is either prime or composite Case 1: Q is prime. We get a contradiction, because we assumed only prime numbers are p 1,..., p n Case 2: Q is composite. In this case, Q can be written as product of primes. But Q is not divisible by any of p 1, p 2,..., p n Hence, by Fundamental Thm, not composite Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 14/26

15 Greatest Common Divisors Suppose a and b are integers, not both 0. Then, the largest integer d such that d a and d b is called greatest common divisor of a and b, written gcd(a,b). Example: gcd(24, 36) = 12 Example: gcd(2 3 5, 2 2 3) = 2 2 Example: gcd(14, 25) = 1 Two numbers whose gcd is 1 are called relatively prime. Example: 14 and 25 are relatively prime Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 15/26

16 Least Common Multiple The least common multiple of a and b, written lcm(a,b), is the smallest integer c such that a c and b c. Example: lcm(9, 12)= 36 Example: lcm( , )= Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 16/26

17 Theorem about LCM and GCD Theorem: Let a and b be positive integers. Then, ab = gcd(a, b) lcm(a, b) Proof: Let a = p i 1 1 p i pn in and b = p j 1 1 p j pn jn Then, ab = p i 1+j 1 1 p i 2+j p in +jn n gcd(a, b) = p min(i 1,j 1 ) 1 p min(i 2,j 2 ) 2... p lcm(a, b) = p max(i 1,j 1 ) 1 p max(i 2,j 2 ) 2... p min(in,jn ) n max(in,jn ) n Thus, we need to show i k + j k = min(i k, j k ) + max(i k, j k ) Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 17/26

18 Proof, cont. Show i k + j k = min(i k, j k ) + max(i k, j k ) Either (i) i k < j k or (ii) i k j k If (i), then min(i k, j k ) = i k and max(i k, j k ) = j k Thus, i k + j k = min(i k, j k ) + max(i k, j k ) If (ii), then min(i k, j k ) = j k and max(i k, j k ) = i k Hence min(i k, j k ) + max(i k, j k ) = i k + j k Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 18/26

19 Computing GCDs Simple algorithm to compute gcd of a, b: Factorize a as p i1 1 pi pin n Factorize b as p j1 1 pj pjn n gcd(a, b) = p min(i1,j1) 1 p min(i2,j2) 2... p min(in,jn ) n But this algorithm is not very practical because prime factorization is computationally expensive! Much more efficient algorithm to compute gcd, called the Euclidian algorithm Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 19/26

20 Insight Behind Euclid s Algorithm Theorem: Let a = bq + r. Then, gcd(a, b) = gcd(b, r) Proof: We ll show that a, b and b, r have the same common divisors implies they have the same gcd. Suppose d is a common divisor of a, b, i.e., d a and d b By theorem we proved earlier, this implies d a bq Since a bq = r, d r. Hence d is common divisor of b, r. Now, suppose d b and d r. Then, d bq + r Hence, d a and d is common divisor of a, b Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 20/26

21

22 Using this Theorem Theorem: Let a = bq + r. Then, gcd(a, b) = gcd(b, r) Theorem suggests following strategy to compute gcd(a, b): Compute r 1 = a mod b (gcd(a, b) = gcd(b, r 1 )) Compute r 2 = b mod r 1 (gcd(a, b) = gcd(r 1, r 2 )) Compute r 3 = r 1 mod r 2 (gcd(a, b) = gcd(r 2, r 3 )) Repeat until remainder becomes 0 (gcd(a, b) = gcd(r n, 0) = r n ) The last non-zero remainder is the gcd of a and b! Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 21/26

23 Euclidian Algorithm Find gcd of 72 and = 72 mod 20 8 = 20 mod 12 4 = 12 mod 8 0 = 8 mod 4 gcd is 4! Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 22/26

24 Euclidean Algorithm Example Find gcd of 662 and = 662 mod = 414 mod = 248 mod = 166 mod 82 0 = 82 mod 2 gcd is 2! Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 23/26

25

26 GCD as Linear Combination gcd(a, b) can be expressed as a linear combination of a and b Bezout s Theorem: If a and b are positive integers, then there exist integers s and t such that: gcd(a, b) = s a + t b. This is called the Bezout s identity, and s and t are the Bezout s coefficients. Furthermore, Euclidean algorithm gives us a way to compute these integers s and t Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 24/26

27 Example Express gcd(252, 198) as a linear combination of 252 and 198 First apply Euclid s algorithm (write a = bq + r at each step): = = = = gcd is 18 Now, using (3), write 18 as Using (2), write 18 as 54 1 ( ) Using (1), we have 54 = , thus: 18 = ( ) 1(198 3 ( )) Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 25/26

28 Example, cont. 18 = ( ) 1(198 3 ( )) Now, let s simplify this: 18 = Now, collect all 252 and 198 terms together: 18 = Trace steps of Euclid s algorithm backwards to derive s, t: gcd(a, b) = s a + t b This is known as the extended Euclidian algorithm Instructor: Dr. Blerina Xhabli, University of Houston Math.3336: Discrete Mathematics Primes and Greatest Common Divisors 26/26

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors Math.3336: Discrete Mathematics Primes and Greatest Common Divisors Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

More information

Math.3336: Discrete Mathematics. Advanced Counting Techniques

Math.3336: Discrete Mathematics. Advanced Counting Techniques Math.3336: Discrete Mathematics Advanced Counting Techniques Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

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

Math.3336: Discrete Mathematics. Mathematical Induction

Math.3336: Discrete Mathematics. Mathematical Induction Math.3336: Discrete Mathematics Mathematical Induction Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Math.3336: Discrete Mathematics. Cardinality of Sets

Math.3336: Discrete Mathematics. Cardinality of Sets Math.3336: Discrete Mathematics Cardinality of Sets Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Math.3336: Discrete Mathematics. Chapter 9 Relations

Math.3336: Discrete Mathematics. Chapter 9 Relations Math.3336: Discrete Mathematics Chapter 9 Relations Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Nov 13, 2014 Quiz announcement The second quiz will be held on Thursday,

More information

With Question/Answer Animations. Chapter 4

With Question/Answer Animations. Chapter 4 With Question/Answer Animations Chapter 4 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility

More information

Math.3336: Discrete Mathematics. Propositional Equivalences

Math.3336: Discrete Mathematics. Propositional Equivalences Math.3336: Discrete Mathematics Propositional Equivalences Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall

More information

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006 Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 1 / 1 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 2.4 2.6 of Rosen Introduction I When talking

More information

Math.3336: Discrete Mathematics. Combinatorics: Basics of Counting

Math.3336: Discrete Mathematics. Combinatorics: Basics of Counting Math.3336: Discrete Mathematics Combinatorics: Basics of Counting Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

More information

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm Review CS311H: Discrete Mathematics Number Theory Instructor: Işıl Dillig What does it mean for two ints a, b to be congruent mod m? What is the Division theorem? If a b and a c, does it mean b c? What

More information

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook) Proofs Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm Reading (Epp s textbook) 4.3 4.8 1 Divisibility The notation d n is read d divides n. Symbolically,

More information

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank University of Florida Dept. of Computer & Information Science & Engineering COT 3100 Applications of Discrete Structures Dr. Michael P. Frank Slides for a Course Based on the Text Discrete Mathematics

More information

CISC-102 Fall 2017 Week 6

CISC-102 Fall 2017 Week 6 Week 6 page 1! of! 15 CISC-102 Fall 2017 Week 6 We will see two different, yet similar, proofs that there are infinitely many prime numbers. One proof would surely suffice. However, seeing two different

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

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

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

4. Number Theory (Part 2)

4. Number Theory (Part 2) 4. Number Theory (Part 2) Terence Sim Mathematics is the queen of the sciences and number theory is the queen of mathematics. Reading Sections 4.8, 5.2 5.4 of Epp. Carl Friedrich Gauss, 1777 1855 4.3.

More information

Math.3336: Discrete Mathematics. Applications of Propositional Logic

Math.3336: Discrete Mathematics. Applications of Propositional Logic Math.3336: Discrete Mathematics Applications of Propositional Logic Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

More information

Math.3336: Discrete Mathematics. Proof Methods and Strategy

Math.3336: Discrete Mathematics. Proof Methods and Strategy Math.3336: Discrete Mathematics Proof Methods and Strategy Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall

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

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

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

2 Elementary number theory

2 Elementary number theory 2 Elementary number theory 2.1 Introduction Elementary number theory is concerned with properties of the integers. Hence we shall be interested in the following sets: The set if integers {... 2, 1,0,1,2,3,...},

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

Discrete Mathematics GCD, LCM, RSA Algorithm

Discrete Mathematics GCD, LCM, RSA Algorithm Discrete Mathematics GCD, LCM, RSA Algorithm Abdul Hameed http://informationtechnology.pk/pucit abdul.hameed@pucit.edu.pk Lecture 16 Greatest Common Divisor 2 Greatest common divisor The greatest common

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

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

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. INTEGERS PETER MAYR (MATH 2001, CU BOULDER) In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. 1. Divisibility Definition. Let a, b

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

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

CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD

CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD CSE 311: Foundations of Computing Lecture 12: Two s Complement, Primes, GCD n-bit Unsigned Integer Representation Represent integer as sum of powers of 2: If 2 where each {0,1} then representation is b

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

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

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

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

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

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013 Fall 2013 Student Responsibilities Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Proof Worksheets Attendance: Strongly Encouraged Overview 3.6 Integers and Algorithms 3.7

More information

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd() Student Responsibilities Week 8 Mat 2345 Week 8 Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Induction Proof Worksheets Attendance: Strongly Encouraged Fall 2013 Week

More information

Introduction Integers. Discrete Mathematics Andrei Bulatov

Introduction Integers. Discrete Mathematics Andrei Bulatov Introduction Integers Discrete Mathematics Andrei Bulatov Discrete Mathematics - Integers 9- Integers God made the integers; all else is the work of man Leopold Kroenecker Discrete Mathematics - Integers

More information

Number theory (Chapter 4)

Number theory (Chapter 4) EECS 203 Spring 2016 Lecture 10 Page 1 of 8 Number theory (Chapter 4) Review Questions: 1. Does 5 1? Does 1 5? 2. Does (129+63) mod 10 = (129 mod 10)+(63 mod 10)? 3. Does (129+63) mod 10 = ((129 mod 10)+(63

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

Introduction to Number Theory

Introduction to Number Theory Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility, greatest common divisors, least common multiples, and modular

More information

MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 361: NUMBER THEORY FOURTH LECTURE MATH 361: NUMBER THEORY FOURTH LECTURE 1. Introduction Everybody knows that three hours after 10:00, the time is 1:00. That is, everybody is familiar with modular arithmetic, the usual arithmetic of the

More information

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972) Intro to Math Reasoning Grinshpan EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972) We all know that every composite natural number is a product

More information

CS March 17, 2009

CS March 17, 2009 Discrete Mathematics CS 2610 March 17, 2009 Number Theory Elementary number theory, concerned with numbers, usually integers and their properties or rational numbers mainly divisibility among integers

More information

Chapter 5. Number Theory. 5.1 Base b representations

Chapter 5. Number Theory. 5.1 Base b representations Chapter 5 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,

More information

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.

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. Exercises Exercises 1. Determine whether each of these integers is prime. a) 21 b) 29 c) 71 d) 97 e) 111 f) 143 2. Determine whether each of these integers is prime. a) 19 b) 27 c) 93 d) 101 e) 107 f)

More information

Math.3336: Discrete Mathematics. Nested Quantifiers

Math.3336: Discrete Mathematics. Nested Quantifiers Math.3336: Discrete Mathematics Nested Quantifiers Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Number Theory and Cryptography

Number Theory and Cryptography . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Number Theory and

More information

Introduction to Number Theory. The study of the integers

Introduction to Number Theory. The study of the integers Introduction to Number Theory The study of the integers of Integers, The set of integers = {... 3, 2, 1, 0, 1, 2, 3,...}. In this lecture, if nothing is said about a variable, it is an integer. Def. We

More information

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal CSE 311 Lecture 13: Primes and GCD Emina Torlak and Kevin Zatloukal 1 Topics Modular arithmetic applications A quick wrap-up of Lecture 12. Primes Fundamental theorem of arithmetic, Euclid s theorem, factoring.

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

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications casting out 3s Theorem: A positive integer n is divisible by 3 if and only if the sum of its decimal digits is divisible

More information

Section Summary. Division Division Algorithm Modular Arithmetic

Section Summary. Division Division Algorithm Modular Arithmetic 1 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility and the primality of integers. Representations

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

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

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 12 CHAPTER 4 NUMBER THEORY PART1: Divisibility PART 2: Primes PART 1: DIVISIBILITY Basic Definitions Definition Given m,n Z, we say

More information

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases Lecture 2. The Euclidean Algorithm and Numbers in Other Bases At the end of Lecture 1, we gave formulas for the greatest common divisor GCD (a, b), and the least common multiple LCM (a, b) of two integers

More information

Lecture 3.1: Public Key Cryptography I

Lecture 3.1: Public Key Cryptography I Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena Today s Informative/Fun Bit Acoustic Emanations http://www.google.com/search?source=ig&hl=en&rlz=&q=keyboard+acoustic+em

More information

Math.3336: Discrete Mathematics. Nested Quantifiers/Rules of Inference

Math.3336: Discrete Mathematics. Nested Quantifiers/Rules of Inference Math.3336: Discrete Mathematics Nested Quantifiers/Rules of Inference Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

More information

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division Questions/Complaints About Homework? Here s the procedure for homework questions/complaints: 1. Read the solutions first. 2. Talk to the person who graded it (check initials) 3. If (1) and (2) don t work,

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

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

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

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24 Direct Proof MAT231 Transition to Higher Mathematics Fall 2014 MAT231 (Transition to Higher Math) Direct Proof Fall 2014 1 / 24 Outline 1 Overview of Proof 2 Theorems 3 Definitions 4 Direct Proof 5 Using

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

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

The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers: Divisibility Euclid s algorithm The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers: Divide the smaller number into the larger, and

More information

Number Theory and Divisibility

Number Theory and Divisibility Number Theory and Divisibility Recall the Natural Numbers: N = {1, 2, 3, 4, 5, 6, } Any Natural Number can be expressed as the product of two or more Natural Numbers: 2 x 12 = 24 3 x 8 = 24 6 x 4 = 24

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

Course: CS1050c (Fall '03) Homework2 Solutions Instructor: Prasad Tetali TAs: Kim, Woo Young: Deeparnab Chakrabarty:

Course: CS1050c (Fall '03) Homework2 Solutions Instructor: Prasad Tetali TAs: Kim, Woo Young: Deeparnab Chakrabarty: Course: CS1050c (Fall '03) Homework2 Solutions Instructor: Prasad Tetali TAs: Kim, Woo Young: wooyoung@cc.gatech.edu, Deeparn Chakrarty: deepc@cc.gatech.edu Section 3.7 Problem 10: Prove that 3p 2 is irrational

More information

W3203 Discrete Mathema1cs. Number Theory. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203

W3203 Discrete Mathema1cs. Number Theory. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203 W3203 Discrete Mathema1cs Number Theory Spring 2015 Instructor: Ilia Vovsha hcp://www.cs.columbia.edu/~vovsha/w3203 1 Outline Communica1on, encryp1on Number system Divisibility Prime numbers Greatest Common

More information

Senior Math Circles Cryptography and Number Theory Week 2

Senior Math Circles Cryptography and Number Theory Week 2 Senior Math Circles Cryptography and Number Theory Week 2 Dale Brydon Feb. 9, 2014 1 Divisibility and Inverses At the end of last time, we saw that not all numbers have inverses mod n, but some do. We

More information

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5) CSE 54 Discrete Mathematics & Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices Integers & Algorithms (Section 2.5) by Kenneth H. Rosen, Discrete Mathematics & its Applications,

More information

Remainders. We learned how to multiply and divide in elementary

Remainders. We learned how to multiply and divide in elementary Remainders We learned how to multiply and divide in elementary school. As adults we perform division mostly by pressing the key on a calculator. This key supplies the quotient. In numerical analysis and

More information

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications n-bit unsigned integer representation Represent integer x as sum of powers of 2: If x = n 1 i=0 b i 2 i where each b i

More information

Ma/CS 6a Class 2: Congruences

Ma/CS 6a Class 2: Congruences Ma/CS 6a Class 2: Congruences 1 + 1 5 (mod 3) By Adam Sheffer Reminder: Public Key Cryptography Idea. Use a public key which is used for encryption and a private key used for decryption. Alice encrypts

More information

Discrete Structures Lecture Primes and Greatest Common Divisor

Discrete Structures Lecture Primes and Greatest Common Divisor DEFINITION 1 EXAMPLE 1.1 EXAMPLE 1.2 An integer p greater than 1 is called prime if the only positive factors of p are 1 and p. A positive integer that is greater than 1 and is not prime is called composite.

More information

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

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,..., Chapter 1 Greatest common divisor 1.1 The division theorem In the beginning, there are the natural numbers 0, 1, 2, 3, 4,..., which constitute the set N. Addition and multiplication are binary operations

More information

Number Theory and Group Theoryfor Public-Key Cryptography

Number Theory and Group Theoryfor Public-Key Cryptography Number Theory and Group Theory for Public-Key Cryptography TDA352, DIT250 Wissam Aoudi Chalmers University of Technology November 21, 2017 Wissam Aoudi Number Theory and Group Theoryfor Public-Key Cryptography

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

Beautiful Mathematics

Beautiful Mathematics Beautiful Mathematics 1. Principle of Mathematical Induction The set of natural numbers is the set of positive integers {1, 2, 3,... } and is denoted by N. The Principle of Mathematical Induction is a

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

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

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

MATH 215 Final. M4. For all a, b in Z, a b = b a. MATH 215 Final We will assume the existence of a set Z, whose elements are called integers, along with a well-defined binary operation + on Z (called addition), a second well-defined binary operation on

More information

Module 1. Integers, Induction, and Recurrences

Module 1. Integers, Induction, and Recurrences Module 1. Integers, Induction, and Recurrences This module will look at The integers and the natural numbers. Division and divisors, greatest common divisors Methods of reasoning including proof by contradiction

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

Lecture 4: Number theory

Lecture 4: Number theory Lecture 4: Number theory Rajat Mittal IIT Kanpur In the next few classes we will talk about the basics of number theory. Number theory studies the properties of natural numbers and is considered one of

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

C-N Math 207 Discrete Math

C-N Math 207 Discrete Math C-N Math 207 - Massey, 1 / 70 C-N Math 207 Discrete Math Kenneth Massey September 16, 2011 Question C-N Math 207 - Massey, 2 / 70 Introduction What is the smallest positive number? Sets C-N Math 207 -

More information

C-N Math 207 Discrete Math

C-N Math 207 Discrete Math C-N Math 207 Discrete Math Kenneth Massey September 16, 2011 C-N Math 207 - Massey, 1 / 70 Question Introduction What is the smallest positive number? C-N Math 207 - Massey, 2 / 70 Sets Introduction 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

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya Resources: Kenneth Rosen,

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

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

More information

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.

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. 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. Thm: (Properties of Divisibility) 1 a b a bc 2 a b and b c a c 3

More information