CSE 311 Foundations of Computing I Lecture 14 Euclid’s Algorithm Mathematical Induction Autumn 2012 CSE 311 1.

Slides:



Advertisements
Similar presentations
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson.
Advertisements

The Integers and Division. Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest.
Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides.
22C:19 Discrete Structures Integers and Modular Arithmetic
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.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Elementary Number Theory and Methods of Proof. Basic Definitions An integer n is an even number if there exists an integer k such that n = 2k. An integer.
Announcements: Homework 1 returned. Comments from Kevin? Homework 1 returned. Comments from Kevin? Matlab: tutorial available at
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
CSE 321 Discrete Structures Winter 2008 Lecture 10 Number Theory: Primality.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
CS555Spring 2012/Topic 61 Cryptography CS 555 Topic 6: Number Theory Basics.
Divisibility October 8, Divisibility If a and b are integers and a  0, then the statement that a divides b means that there is an integer c such.
© 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.
COMP 170 L2 Page 1 L05: Inverses and GCDs l Objective: n When does have an inverse? n How to compute the inverse? n Need: Greatest common dividers (GCDs)
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.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
Cryptography Inverses and GCD Piotr Faliszewski. GCD(a,b) gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b) a = b*q + r Here: q =  a / b  r = a mod b (a –
Introduction to Cryptography
CompSci 102 Discrete Math for Computer Science
Greatest Common Divisor Jordi Cortadella Department of 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.
Section 2.2: Affine Ciphers; More Modular Arithmetic Shift ciphers use an additive key. To increase security, we can add a multiplicative parameter. –For.
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.
Scott CH Huang COM5336 Cryptography Lecture 11 Euclidean Domains & Division Algorithm Scott CH Huang COM 5336 Cryptography Lecture 10.
MA/CSSE 473 Day 06 Euclid's Algorithm. MA/CSSE 473 Day 06 Student Questions Odd Pie Fight Euclid's algorithm (if there is time) extended Euclid's algorithm.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
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
Tuesday’s lecture: Today’s lecture: One-way permutations (OWPs)
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.
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.
MA/CSSE 473 Day 07 Euclid's Algorithm. MA/CSSE 473 Day 07 Student Questions Review topics not covered in class Euclid's algorithm (if there is time) extended.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
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.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
MA/CSSE 473 Day 07 Extended Euclid's Algorithm Modular Division Fermat's little theorem intro.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Number-Theoretic Algorithms
MA/CSSE 473 Day 06 Euclid's Algorithm.
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Number Theory (Chapter 7)
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Copyright © Zeph Grunschlag,
Miniconference on the Mathematics of Computation
CSE 311 Foundations of Computing I
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.
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 14 Euclid’s Algorithm Mathematical Induction Autumn 2012 CSE 311 1

Announcements Reading assignments – Today: th Edition th Edition th Edition Homework 5 – Available now! Midterm: Friday, Nov 2 – Review sessions, Thursday Nov 1 3:30-4:30 pm, TBD, Anderson or Suciu 4:30-5:30 pm, TBD, Anderson or Suciu Autumn 2012CSE 311 2

Highlight from last lecture: Primality Autumn 2012CSE 3113 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. Every positive integer greater than 1 has a unique prime factorization

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

Computing the GCD Autumn 2012CSE 3115 Fact: If d | a and d | b then d | (a – b)

Euclid’s Algorithm GCD(x, y) = GCD(y, x mod y) Autumn 2012CSE 3116 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 311 7

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 311 9

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 Autumn 2012CSE 31111

Computing the 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

Solve 7x mod 26 = 1 Autumn 2012CSE 31113