CSE 311 Foundations of Computing I Lecture 13 Number Theory Autumn 2012 CSE 311 1.

Slides:



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

CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
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
Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
22C:19 Discrete Structures Integers and Modular Arithmetic
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.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
CSE115/ENGR160 Discrete Mathematics 03/15/11
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
1 Integers and Division CS/APMA 202 Rosen section 2.4 Aaron Bloomfield.
CSE 321 Discrete Structures Winter 2008 Lecture 10 Number Theory: Primality.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
Integers Number Theory = Properties of Integers
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 2): The Fundamentals: Algorithms, the.
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.
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.
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CompSci 102 Discrete Math for Computer Science
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Chapter 2 (Part 1): The Fundamentals: Algorithms, the Integers & Matrices The Integers and Division (Section 2.4)
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
CSE 311 Foundations of Computing I Lecture 14 Euclid’s Algorithm Mathematical Induction Autumn 2012 CSE
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Foundations of Computing I CSE 311 Fall Review: Division Theorem Let a be an integer and d a positive integer. Then there are unique integers q.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
CSE 311: Foundations of Computing Fall 2013 Lecture 11: Modular arithmetic and applications.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
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.
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
CSE 311 Foundations of Computing I Lecture 11 Modular Exponentiation and Primes Autumn 2011 CSE 3111.
MA/CSSE 473 Day 07 Extended Euclid's Algorithm Modular Division Fermat's little theorem intro.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Number-Theoretic Algorithms
CS 210 Discrete Mathematics The Integers and Division (Section 3.4)
CSE15 Discrete Mathematics 03/20/17
CS 2210:0001Discrete Structures Modular Arithmetic and Cryptography
Numerical Algorithms x x-1 Numerical Algorithms
CSE 311 Foundations of Computing I
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Number Theory (Chapter 7)
Number Theory.
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Number Theory.
Useful GCD Fact If a and b are positive integers, then gcd(a,b) = gcd(b, a mod b) Proof: By definition of mod, a = qb+ (a mod b) for.
From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers.
Sets, Combinatorics, Probability, and Number Theory
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 13 Number Theory Autumn 2012 CSE 311 1

Announcements Reading assignments – Today : 7 th Edition: 4.3 (the rest of the chapter is interesting!) 6 th Edition: 3.5, th Edition: 2.5, 2.6 up to p. 191 – Wednesday 7 th Edition: 5.1, th Edition: 4.1, th Edition: 3.3, 3.4 Autumn 2012CSE 3112

Fast modular exponentiation Autumn 2012CSE 3113

Fast exponentiation algorithm Compute mod Compute mod Autumn 2012CSE 3114

Fast exponentiation algorithm What if the exponent is not a power of two? = The fast exponentiation algorithm computes a n mod m in time O(log n) Autumn 2012CSE 3115

Basic applications of mod Hashing Pseudo random number generation Simple cipher Autumn 2012CSE 3116

Hashing Map values from a large domain, 0…M-1 in a much smaller domain, 0…N-1 Index lookup Test for equality Hash(x) = x mod p Often want the hash function to depend on all of the bits of the data – Collision management Autumn 2012CSE 3117

Pseudo random number generation Linear Congruential method Autumn 2012CSE 3118 x n+1 = (a x n + c) mod m

Simple cipher Caesar cipher, A = 1, B = 2,... – HELLO WORLD Shift cipher – f(p) = (p + k) mod 26 – f -1 (p) = (p – k) mod 26 f(p) = (ap + b) mod 26 Autumn 2012CSE 3119

Primality 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. Autumn 2012CSE 31110

Fundamental Theorem of Arithmetic Autumn 2012CSE Every positive integer greater than 1 has a unique prime factorization 48 = = ,523 = 45, ,950 = ,234,567,890 = ,607 3,803

Factorization If n is composite, it has a factor of size at most sqrt(n) Autumn 2012CSE 31112

Euclid’s theorem Proof: By contradiction Suppose there are a finite number of primes: p 1, p 2,..., p n Autumn 2012CSE There are an infinite number of primes.

Distribution of Primes If you pick a random number n in the range [x, 2x], what is the chance that n is prime? Autumn 2012CSE

Famous Algorithmic Problems Primality Testing: – Given an integer n, determine if n is prime Factoring – Given an integer n, determine the prime factorization of n Autumn 2012CSE

Factoring Factor the following 232 digit number [RSA768]: Autumn 2012CSE

Autumn 2012CSE

Greatest Common Divisor GCD(a, b): Largest integer d such that d|a and d|b – GCD(100, 125) = – GCD(17, 49) = – GCD(11, 66) = – GCD(180, 252) = Autumn 2012CSE

GCD, LCM and Factoring Autumn 2012CSE a = = 46,200 b = = 204,750 GCD(a, b) = 2 min(3,1) 3 min(1,2) 5 min(2,3) 7 min(1,1) 11 min(1,0) 13 min(0,1) LCM(a, b) = 2 max(3,1) 3 max(1,2) 5 max(2,3) 7 max(1,1) 11 max(1,0) 13 max(0,1)

Theorem Autumn 2012CSE Let a and b be positive integers. Then a b = gcd(a, b) lcm(a, b)

Euclid’s Algorithm GCD(x, y) = GCD(y, x mod y) Autumn 2012CSE int GCD(int a, int b){ /* a >= b, b > 0 */ int tmp; int x = a; int y = b; while (y > 0){ tmp = x % y; x = y; y = tmp; } return x; } Example: GCD(660, 126)

Extended Euclid’s Algorithm If GCD(x, y) = g, there exist integers s, t, such sx + ty = g; The values x, y in Euclid’s algorithm are linear sums of a, b. – A little book keeping can be used to keep track of the constants Autumn 2012CSE

Bézout’s Theorem Autumn 2012CSE If a and b are positive integers, then there exist integers s and t such that gcd(a,b) = sa + tb.

Simple cipher Caesar cipher, a → b, b → c,... – HELLOWORLD → IFMMPXPSME Shift cipher – f(x) = (x + k) mod 26 – f -1 (x) = (x – k) mod 26 f(x) = (ax + b) mod 26 – How good is the cipher f(x) = (2x + 1) mod 26 Autumn 2012CSE

Multiplicative Cipher: f(x) = ax mod m For a multiplicative cipher to be invertible: f(x) = ax mod m : {0, m-1} → {0, m-1} must be one to one and onto Autumn 2012CSE Lemma: If there is an integer b such that ab mod m = 1, then the function f(x) = ax mod m is one to one and onto.

Multiplicative Inverse mod m Suppose GCD(a, m) = 1 By Bézoit’s Theorem, there exist integers s and t such that sa + tm = 1. s is the multiplicative inverse of a: 1 = (sa + tm) mod m = sa mod m Autumn 2012CSE