Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.

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.
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
CSE115/ENGR160 Discrete Mathematics 03/13/12 Ming-Hsuan Yang UC Merced 1.
Number Theory and Cryptography
CSE115/ENGR160 Discrete Mathematics 03/15/11
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
1 Integers and Division CS/APMA 202 Rosen section 2.4 Aaron Bloomfield.
Division in the Integers Theorem 1. If n and m are integers and n>0, then m=qn+r for unique integers q and r with 0
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
The Integers and Division
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Integers Number Theory = Properties of Integers
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
© 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
9/2/2015Discrete Structures1 Let us get into… Number Theory.
CSE 504 Discrete Mathematics & Foundations of Computer Science
Mathematics of Cryptography Part I: Modular Arithmetic
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.
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
MATH 224 – Discrete Mathematics
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Copyright © Curt Hill Divisibility and Modular Arithmetic A Topic in Number Theory.
Chapter The Integers and Division Division
Copyright © Zeph Grunschlag, Basic Number Theory Zeph Grunschlag.
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.
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.
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.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
CS 210 Discrete Mathematics The Integers and Division (Section 3.4)
CSE15 Discrete Mathematics 03/20/17
CSE15 Discrete Mathematics 03/15/17
Integers and Division Section 3.4.
CMSC Discrete Structures
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
Applied Discrete Mathematics Week 4: Number Theory
Number Theory.
Foundations of Discrete Mathematics
Enough Mathematical Appetizers!
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
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.
Discrete Mathematics Chapter 4 Number Theory. Discrete Mathematics Chapter 4 Number Theory.
Module #9: Basic Number Theory
Presentation transcript:

Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving integers and their properties belongs to the branch of mathematics called number theory. Definition: 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. (Note that a is a factor of b) Remark: 1- We denote a divides b by a│b 2- We denote a doesn’t divide b by a ∕│b Example1: determine whether 3│7 and whether 3│12 answer: 3 does not divide 7 and 3│12 since 12 = (3)(4) Example2: let n and d be positive integers. How many positive integers not exceeding n are divisible by d? Answer: The positive integers divisible by d is of the form kd. So kd is not exceeding n. So. Therefore there are n/d positive integers not exceeding n that are divisible by d. 1Amal El Sayed

Theorem 1: Let a,b and c be integers. Then i)If a│b and a│c, then a│(b+c) ii)If a│b then a│bc for all integers c; iii)If a│b and b│c, then a│c Proof: 2Amal El Sayed

Corollary: 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: Since a│b → by theorem(1) ii a│mb Since a│c → by theorem (1) ii a│nc So by theorem (1) a│mb+nc Theorem 2: The Division Algorithm Let a be an integer and d a positive integer. Then there are unique q and r, with o ≤ r < d, such that a = dq + r. Example: let a = 17 d = 3 then 17 = (3)(5) + 2 Definition: In the theorem 2, d is called the divisor, a is called the dividend, q is called the quotient, and r is called the remainder. q = a div d, r = a mod d. Example3: what are q and r when 101 is divided by 11? Solution: 101 = 9(11)+2 q = 9, r =2 So 9 = 101 div 11 2 = 101 mod 11 3Amal El Sayed

Example4: what are the quotient and remainder when -11 is divided by 3? Answer: -11 = 3(-4) + 1 so -4= -11 div 3 1 = -11 mod 3 Note that r can’t be negative. 0 ≤ r < 3 Remark: the integer a is divisible by the integer d if and only if the remainder is zero. Modular Arithmetic: Definition3: If a and b are integers and m is a positive integer, then a is congruent to b modulo m if m divides a-b. We use notation a b (mod m) to indicate that a congruent to b modulo m. Theorem3: 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. Ex5: 1- determine whether 17 is congruent to 5 modulo 6 2- Determine whether 24 is congruent to 14 modulo 6 Solution: 17 – 5 = 12, 6│12 so 17 5 (mod 6) 24 – 14 = 10, 6∕│10 so 24 is not congruent to 14 (mod 6) 4Amal El Sayed

Theorem4: let m be a positive integer. The integers a and b are congruent modulo m iff there is an integer k such that a = b + km Proof: suppose a b mod (m) → m / a-b → a-b=km → a=b+km Conversely: suppose a = b + km k is an integer → a – b = km → m / a – b ( definition of divisibility) → a b ( mod m) Theorem5: let m be a positive integer. If a b (mod m) and c d (mod m), then a + c b + d (mod m) and ac bd (mod m). Proof: since a b (mod m) → m / a – b → a = b + m Since c d (mod m) → m / c- d → c = d + m a + c = (b + d) + m → (a + c) – (b + d) = m → m / (a + c) – (b + d) → a + c b + d mod (m) a. c = 5Amal El Sayed

Example6: 1- Show that 18 3 (mod 5), by using theorem 5: Solution: 18 = , 3 = mod (5) 11 1 mod (5) 18 = = 3 (mod 5) so 18 3 (mod 5) 2- Show that 77 2 (mod 5) by using theorem 5 77 = (7)(11) (2)(1) (mod 5) 77 2 (mod 5) Corollary 2: let m be a positive integer and let a and b be integers. Then (a + b) mod m = ((a mod m) + (b mod m)) mod m And ab mod m= (a mod m) (b mod m) (mod m) Application of Congruences Read example7. Hashing Functions Read example8 Remark on example8: 1- Pseudorandom Numbers: numbers generated by systematic methods are not truly random, they are called Pseudorandom Numbers. 6Amal El Sayed

2- we generate a sequence of pseudorandom numbers with for all n by using the congruence Cryptology: is the study of secret messages. Caesar encryption: is the process of making a message secret by shifting each letter forward. Eg. B sends to E, X sends to F Caesar’s encryption method can be represented by the function f that assigns to the nonnegative integer p, p ≤ 25, the integer f(p) is the set {0,1,……,25} with f(p) = (p+3) mod 26 note that in this process we replace each letter by an integer from 0 to 25, based on it’s position for example replace A by 0, K by 10 and so on. Example9: what is the secret message produced from the message “Meet you in the park” using the Caesar Cipher? Solution: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z )Replace the letters in the message with numbers M e e t y o u I n t h e p a r k Amal El Sayed

2) Replace each of these numbers by f(p)=(p+3)mod ) Translating this back to letters produces encrypted message P H H W B R X L Q W K H S D U N Decryption: the process of determining the original message from the encrypted message is call decryption Remark: instead of shifting each letter by 3, we can shift each letter by k so that f(p)=(p+k) mod26 (called shift cipher) Example: Decrypt the message using the Caesar Cipher: E O X H M H D Q V ( f(p)=p-3 ) B L U E J E A N S Do example10 page 208 8Amal El Sayed

Using f(p)=(p+3)(mod26) Decrypt the message G R Q R W S D V V “D O N O T P A S S” Encrypt the message “ how are you” H O W A R E Y O U K R Z D M H B R X 9Amal El Sayed

Section 3.5 Primes and Greatest Common Divisors A prime: is an integer greater than 1 that is divisible only by 1 and by itself. Definition: a positive integer p greater than 1 is called prime if the only positive factors of p are 1 and p. Remark: 1- A positive integer that is greater than 1 and is not prime called composite. 2- The integer n is composite iff there exists an integer a such that a│n and 1 < a < n. Examples of prime numbers: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89 and 97 Theorem1: the fundamental theorem of Arithmetic. Every positive integer greater than 1 Can be written uniquely as a prime or as the product of two or more primes where the Prime factors are written in order of non decreasing size. Example2: Find the prime factorization of 100,641,999, and Solution: 100 = = 2².5² 641 = 641 X 1 (prime) 10Amal El Sayed

999 = 3³ = 2 Theorem2: If n composite integer, then n has a prime divisor less than or equal to Example: Show that 101 is prime Solution: The only prime not exceeding √101 are 2,3,5 and 7. But √101 is not divisible by 2,3,5, or 7 it follows that 101 is prime. Example4: Find the prime factorization of Solution: start with 2 then 3 then 5. None of them divides 7007 Try 7, we get 7007 = 7² X 11 X 13 Theorem3: There are infinitely many primes Mersenne primes: The largest prime known has been an integer of special form 2 – 1 11Amal El Sayed

Example5: page 212 Theorem4: The prime number theorem. The ratio of the number of primes are not exceeding x and (x / lnx) approaches 1 as x grows without bound. Conjectures and open problems about primes. 1- Consider the polynomial f(n) = n² - n This polynomial has the property that f(n) is prime for all positive integers not exceeding 40. Eg: f(1) = 41 f(3) = 47 f(2) = 43 f(4) = 53 and so on. 2- Every odd integer n, n > 5 is the sum of 3 primes Every even integer n, n > 2 is the sum of 2 primes Eg: 4 = 2 + 2, 6 = 3 + 3, 8 = 5 + 3, 10 = and so on 3- There are infinitely many primes of the form n² + 1 where n is a positive integer. Eg: 5 = 2² + 1, 17 = 4² + 1, 37 = 6² + 1 and so on 4- The twin prime conjecture: Twin primes are primes that differ by 2 such as 3 and 5, 5 and 7, 11 and 13, 17 and 19. P + 2 where p is prime and p + 2 is prime or the product of two primes. 12Amal El Sayed

Greatest Common Divisors and Least Common Multiples Definition2: 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 denoted by gcd (a,b). Remark: One way to find the greatest common divisor of two integers is to find all the positive common divisors of both integers and then take the largest divisior. Example10 page 215 What is the greatest common divisor of 24 and 36 ? Solution: 24:1,2,3,4,6,8,12,24 (factors of 24) 36: 1,2,3,4,6,9,12,16,36 (factors of 36) g.c.d(24,36) = 12 Example11: Find g.c.d (17,22) Solution: 17: 1, 17 22: 1, 2,11,22 g.c.d (17, 22) = 1 Definition3: The integers a and b are relatively prime if their greatest common divisor is1. Example12: Since g.c.d (17,22) = 1 it follows that the integers 17 and 22 are relatively prime. Definition4: 13Amal El Sayed

Example13: Determine whether the following integers are pair wise relatively prime 1- 10, 17, , 19, and 24 Solution: 1- g.c.d(10,17)=1 g.c.d(17,21)=1 g.c.d(10,21)=1 We conclude that 10,17,21 are pair wise relatively prime. 2- g.c.d(10,19)=1 g.c.d(19,24)=1 g.c.d(10,24)=2>1 So 10,19 and 24 are not pair wise relatively prime. Remark: Another way to find the prime g.c.d if 2 integers is to use the prime factorizations of these integers suppose 14Amal El Sayed

Example14: find the g.c.d (120,500) (using method 2, prime factorization) → 120 = 2³.3.5 }→ g.c.d(120,500) = 2².5 = 20 → 500 = 2².5³ least common multiple Definition5: The least common multiple of the positive integers a and b is the smallest Positive integer that is divisible by both a and b it is denoted by Lcm(a,b) Remark: lcm(a,b) = Amal El Sayed

Example: What is the least common multiple of Answer: Theorem5: let a and b be positive integers then ab = gcd (a,b). Lcm (a,b) 16Amal El Sayed

Section 3.6: Integers and Algorithms Representations of Integers: Theorem(1): (The base b expansion of n). Let b be a positive integer greater than1. Then if n is a positive integer, it can be expressed uniquely in the form Where k is a non negative integer, are non negative integers less than b and Example: 965 = 9 X 10² + 6 X X 10˚ the base here is 10 Remark: (1) In theorem 1: The base b expansion of n is denoted by Example: (245) represents 2.8²+4.8+5=165 the base here is 8 (2) Choosing 2 as the base gives binary expansions of integers. (3) In binary notation each digit is either a0 or a1. So the binary expansions of an integer is just a bit string. Example1: What is the decimal expansion of the integer that has ( ) as its binary expansion? Solution: 17Amal El Sayed

Hexadecimal Expansions. Sixteen is another base used in computer science. The base 16 expansion of an integer is called its hexadecimal expansion Remark: The hexadecimal digits used are 0,1,2,…,9,A,B,C,D,E and F where the letters A through F represent the digits corresponding to the numbers 10 through 15 (in decimal notation) Example: What is the decimal expansion of the hexadecimal expansion of(2AE0B) ? Solution: Remark: Each hexadecimal digit can be represented using four bits for example Base Conversion: Constructing the base b expansion of an integer n 18Amal El Sayed

This process terminates when we obtain a quotient equal to zero Example3 page 220: Find the base 8, or octal, expansion of (12345) Solution: Divide by 8 → = Divide 1543 by 8 → 1543 = = = = Because the remainders are the digits of the base 8 expansion of 12345, it follows that Example4: Find the hexadecimal expansion of (177130) Solution: = = = = = Amal El Sayed

Example: Find the binary expansion of (241) Solution: 241 = = = = = = = = S0 20Amal El Sayed

Section 3.8: Matrices Definition1: A matrices is a rectangular array of numbers. A matrix with rows m and n column is called an mXn matrix. Remarks: 1- A matrix with the same number of rows as column is called square. 2- The matrices are equal if they have the same number of rows and the same number of columns and the corresponding entries in every position are equal. Example: The matrix is a 3X2 matrix The matrix is a square matrix (2X2 matrix) Definition: Addition of matrices Let be mXn matrices. The sum of A and B, denoted by A+B is the mXn matrix that has as its (i,j) the element. A+B= Remark: Addition of matrices is defined if the matrices are of same size Example: Add 21Amal El Sayed

Definition: multiplication of matrices Let A be an mXk matrix and B be a kXn matrix. The product of A and B, denoted by AB is the mXn matrix with its (i,j) the entry equal to the sum of the product of the corresponding elements from the i th row of A and the j th column of B. Remark: Multiplication of matrices is not commutative. Example: Find AB if it is defined A is 4X3 B is 3X2 so AB is defined and is 4X2 matrix. 22 Amal El Sayed

example: 23Amal El Sayed

Transpose of a matrix The transpose of the matrix is the matrix Definition: A square matrix A is called symmetric if A=A Example: The matrix is symmetric. Definition: Zero-one Matrix A matrix with entries that are either 0 or 1 is called a zero- one matrix 24Amal El Sayed

Read definition8 from the book page 252 Example: Find the join and meet of the zero matrices Solution: joint of A and B is The meet of A and B is Example: Find the Boolean product of A and B where 25Amal El Sayed

Solution: The Boolean product of A and B denoted by is Remark:1- let A be a square zero- one matrix then 2- note that Example: 26Amal El Sayed