CS 210 Discrete Mathematics The Integers and Division (Section 3.4)

Slides:



Advertisements
Similar presentations
CS 202 Epp section ?? Aaron Bloomfield
Advertisements

The Integers and Division. Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest.
CSE115/ENGR160 Discrete Mathematics 03/15/12
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
CSE 311 Foundations of Computing I Lecture 13 Number Theory Autumn 2012 CSE
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
February 19, 2015Applied Discrete Mathematics Week 4: Number Theory 1 The Growth of Functions Question: If f(x) is O(x 2 ), is it also O(x 3 )? Yes. x.
CSE115/ENGR160 Discrete Mathematics 03/13/12 Ming-Hsuan Yang UC Merced 1.
Number Theory and Cryptography
CSE115/ENGR160 Discrete Mathematics 03/15/11
1 Integers and Division CS/APMA 202 Rosen section 2.4 Aaron Bloomfield.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
The Integers and Division
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Number Theory and Cryptography
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 2): The Fundamentals: Algorithms, the.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
9/2/2015Discrete Structures1 Let us get into… Number Theory.
CSE 504 Discrete Mathematics & Foundations of Computer Science
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 3): The Fundamentals: Algorithms, the.
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
Discrete Mathematics CS 2610 March 17, Number Theory Elementary number theory, concerned with numbers, usually integers and their properties or.
The Integers & Division. a divides b if a is not zero there is a m such that a.m = b “a is a factor of b” “b is a multiple of a” a|b Division.
Chapter The Integers and Division Division
CompSci 102 Discrete Math for Computer Science
Number Theory 이재원 School of Information Technology Sungshin W. University.
Chapter 2 (Part 1): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 2.4)
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
Chapter 4 With Question/Answer Animations. Section 4.1.
Module #9 – Number Theory 1/5/ Algorithms, The Integers and Matrices.
Greatest Common Divisors & Least Common Multiples  Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is.
Unit 2 Modular Arithmetic and Cryptography IT Disicipline ITD1111 Discrete Mathematics & Statistics STDTLP 1 Unit 2 Modular Arithmetic and Cryptography.
Discrete Mathematics
Divisibility and Modular Arithmetic
AF2. Turn off your phones Primes, gcd, some examples, reading.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Module #9 – Number Theory 6/11/20161 Chapter 3 Algorithms, Integers and Matrices.
Chapter 4 With Question/Answer Animations 1. Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
CSE 311 Foundations of Computing I Lecture 12 Modular Arithmetic and Applications Autumn 2012 CSE
Discrete Mathematics Chapter 2 The Fundamentals : Algorithms, the Integers, and Matrices. 大葉大學 資訊工程系 黃鈴玲.
Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
CSE15 Discrete Mathematics 03/20/17
CSE15 Discrete Mathematics 03/15/17
Integers and Division Section 3.4.
CMSC Discrete Structures
Chapter 5: Number Theory
CSE 504 Discrete Mathematics & Foundations of Computer Science
Number Theory and Cryptography
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Applied Discrete Mathematics Week 3: Algorithms
Applied Discrete Mathematics Week 4: Number Theory
Number Theory.
Enough Mathematical Appetizers!
CSE 311 Foundations of Computing I
The Integers & Division
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Copyright © Zeph Grunschlag,
Divisibility and Modular Arithmetic
Applied Discrete Mathematics Week 10: Introduction to Counting
Number Theory.
Sets, Combinatorics, Probability, and Number Theory
Presentation transcript:

CS 210 Discrete Mathematics The Integers and Division (Section 3.4) Dr. Djamel Bouchaffra Chapter 3 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 3.4) © by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Introduction Review basics concepts of number theory Divisibility, greatest common divisors, modular arithmetic Computer arithmetic using binary expansions Application to computer arithmetic, cryptology, secret messages CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Division Definition 1: If a and b are integers with a  0, we say that a divides b if there is an integer c such that b = ac. When a divides b we say that a is a factor of b and that b is multiple of a. The notation a | b denotes that a divides b. We write a b when a does not divide b CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Example : 4 | 12 4 18 7, since 7 | 3 is not an integer. Example: Let n and d be positive integers. How many positive integers not exceeding n are divisible by d? Solution: They are of the form {dk}, where k is a positive integer. 0 < dk  n  0 < k  n/p  There are n/p positive integers not exceeding n that are divisible by d. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 1: Let a, b and c be integers. Then If a|b and a|c, then a | (b + c); If a|b, then a|bc c  Z; If a|b and b|c, then a|c Proof: Suppose a|b and a|c   s  Z,  t  Z such that: b = as and c = at. Therefore: b + c = as + at = a (s + t); which means that a | (b + c). This establishes part 1 of the theorem. Parts 2 and 3 are left to you! Q.E.D. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Corollary 1: if a, b and c are integers such that a|b and a|c, then a | mb +nc whenever m and n are integers. Proof: Part 2 of theorem 1 shows that: a | mb and a | nc whenever m and n are integers. Using part 1 of the theorem  a | mb + nc. Q.E.D. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Primes Definition 2: A positive 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. Example: 7 is prime, 9 is composite. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 2: The Fundamental Theorem of Arithmetic (FTA) Every positive integer greater than 1 can be written in a unique way as a prime or as the product of two or more primes where the prime factors are written in a nondecreasing size Example: 100 = 2.2.5.5 = 22.52 641 = 641 999 = 3.3.3.37 = 33.37 1024 = 2.2.2.2.2.2.2.2.2.2 = 210 Large numbers are used for secret messages in cryptology. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 3: If n is a composite integer, then n has a prime divisor less than or equal to n. Proof: if n is composite, n has a factor such that: 1 < a < n and b  Z such that: n = ab, where both a and b are positive integers greater than 1. Therefore a  n or b  n, since otherwise ab > n . n = n  n has positive divisor  n. This divisor is either prime or using the FTA, has a prime divisor. In either case, n has a prime divisor  n. Q.E.D. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Example: Prove that the integer 101 is prime. Solution: Using the contrapositive form of theorem 3, states that : “n has not a prime number divisor  n  n prime” The only primes not exceeding 101 are {2, 3, 5, 7}, since these numbers do not divide 101  101 is prime! Q.E.D. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 4: There are infinitely many primes. Proof: Let’s assume there are only finitely many primes p1, p2, …, pn. Let Q = p1p2 … pn + 1. Using FTA, Q is prime or Q can be written as the product of two or more primes. However, none of the primes pj divides Q, (since pj|Q  pj | (Q – p1p2 … pn) = 1  impossible since pj prime) if none of the primes pj divides Q  Q is prime. Q  Pj contradiction, because we assumed that we have listed all the primes. Q.E.D. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Remark: the largest prime known has been an integer of the form 2p –1, where p is also prime (Mersenne primes.) Example: 22 – 1 = 3, 23 –1 =7, 25 –1 =31 are Mersenne primes, whereas 211 – 1 = 2047 is not a Mersenne prime since 2047 = 23 . 89 Remark: the largest number known so far (year 2001) is 213,466,917 – 1 (over four million digits!!!) Visit GIMPS (Great Internet Mersenne Search) CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 5: The Prime Number Theorem The ratio of the number of primes not exceeding x and (x/lnx) approaches 1 as x grows without bound. (Conjectured by Legendre & Gauss) CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra The Division Algorithm Theorem 6: Let a be an integer and d a positive integer. Then !(q, r)  Z2; 0  r < d: a = dq +r. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Definition 3: d is called the divisor, a the dividend, q the quotient and r the remainder. q = a div d, r = a mod d. Example: 101 = 11.9 + 2 Quotient = 101 div 11 Remainder = 2 = 101 mod 11 CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Greatest Common Divisors & Least Common Multiples Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is called the greatest common divisor of a and b. It is denoted gcd (a, b). Example: gcd (24, 36) Div (24) = {1,2,3,4,6,8,12,24} Div (36) = {1,2,3,4,6,8,9,12,18,36} Com(24,36) = = {1,2,3,4,6,12} gcd(24,36) = 12 CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Definition 5: The integers a and b are relatively prime (rp) if gcd(a, b) =1. Example: 17 and 22 are rp since gcd(17,22) = 1. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Definition 7: The least common multiple (lcm) of the positive integers a and b is the smallest positive integer that is divisible by both a and b. where max(x,y) denotes the maximum of x and y. Example : What is the least common multiple of: 233572 and 2433? Solution: lcm(233572 ,2433) = 2 max(3,4). 3max(5,3). 7max(2,0) = 243572 CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Theorem 7: Let a and b be positive integers. Then ab = gcd(a,b).lcm(a.b). CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Modular Arithmetic Definition 8: Let (a, b)  Z2,, m  Z+ then a is a congruent to b modulo m if m divides a –b. Notation: a  b (mod m). Theorem 8 Let a and b be integers, and let m be a positive integer. Then a  b (mod m) if and only if a mod m = b mod m. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Example: 17  5 (mod 6) 24  14 (mod 6)? Since: 6|(17 – 5) = 12  17  5 (mod 6) 6 does not divide 10  24 is not congruent to 14 (mod 6) Theorem 9: Let m be a positive integer. The integers a and b are congruent modulo m if and only if k  Z; a = b + km CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Applications of Congruences Hashing Functions Pseudorandom Numbers Cryptology (Caesar Cepher) CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Hashing Functions Assignment of memory location to a student record h(k) = k mod m Example: h (064212848) = 064212848 mod 111 = 14 when m = 111 Key: social security # # of available memory location CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Pseudorandom Numbers Needed for computer simulation Linear congruential method : xn+1 = (axn + c) mod m Put them between 0 and 1 as: yn = xn/m CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Cryptology (Caesar Cepher) Encryption: Making messages secrets by shifting each letter three letters forward in the alphabet B  E X  A Mathematical expression: f(p) = (p + 3) mod 26 0  p  25 CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Example: What is the secret message produced from the message “Meet you in the park” Solution: Replace letters with numbers: meet = 12 4 4 19 you = 24 14 20 in = 8 1 3 the = 19 7 4 park = 15 0 17 10 Replace each of these numbers p by f(p) = (p + 3) mod 26 meet = 15 7 7 22 you = 1 17 23 in = 11 16 the = 22 10 7 park = 18 3 20 13 Translate back into letters: “PHHW BRX LQ WKH SDUN” CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)

CS 210 Discrete Mathematics Dr. Djamel Bouchaffra Decryption (Deciphering) f(p) = (p + k) mod 26 (shift cepher)  f -1(p) = (p – k) mod 26 Caesar’s method and shift cipher are very vulnerable and thus have low level of security (reason frequency of occurrence of letters in the message)  Replace letters with blocks of letters. CSE 504, Chapter 2 (Part 2): The Fundamentals: Algorithms, the Integers & Matrices Chapter 3 (part 2)