Euclidean Algorithm for GCD

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

The Comparison Test Let 0 a k b k for all k.. Mika Seppälä The Comparison Test Comparison Theorem A Assume that 0 a k b k for all k. If the series converges,
THE WELL ORDERING PROPERTY Definition: Let B be a set of integers. An integer m is called a least element of B if m is an element of B, and for every x.
Richard Fateman CS 282 Lecture eea1 Extended Euclidean Algorithm Lecture eea.
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson.
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
Quotient-Remainder Theory, Div and Mod
CSC2110 Discrete Mathematics Tutorial 5 GCD and Modular Arithmetic
Chapter II. THE INTEGERS
11 -1 Chapter 11 Randomized Algorithms Randomized algorithms In a randomized algorithm (probabilistic algorithm), we make some random choices.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
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.
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.
CPSC 3730 Cryptography and Network Security
Continued Fractions, Euclidean Algorithm and Lehmer’s Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson TexPoint fonts used in EMF. Read the.
11 -1 Chapter 11 Randomized Algorithms Randomized Algorithms In a randomized algorithm (probabilistic algorithm), we make some random choices.
SYMMETRIC CRYPTOSYSTEMS Symmetric Cryptosystems 20/10/2015 | pag. 2.
Math 3121 Abstract Algebra I Lecture 9 Finish Section 10 Section 11.
MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number.
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.
Algorithms 1.Notion of an algorithm 2.Properties of an algorithm 3.The GCD algorithm 4.Correctness of the GCD algorithm 5.Termination of the GCD algorithm.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
Properties of the gcd Theorem: For any two integers a,b there exist integers x,y such that xa + yb = gcd(a,b). A proof will not be given at this point.
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 3 Algorithms.
Application: Algorithms Lecture 19 Section 3.8 Tue, Feb 20, 2007.
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.
Fuw-Yi Yang1 Textbook: Introduction to Cryptography 2nd ed. By J.A. Buchmann Chap 1 Integers Department of Computer Science and Information Engineering,
October 4, 2016Theory of Computation Lecture 9: A Universal Program I 1Minimalization Example 15: R(x, y) R(x, y) is the remainder when x is divided by.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Chapter 6 Differentiation.
Divisibility and Primes
MA/CSSE 473 Day 06 Euclid's Algorithm.
MA/CSSE 473 Day 06 Euclid's Algorithm.
CMSC Discrete Structures
CSE 311 Foundations of Computing I
GCD and Optimization Problem
Number Theory and Modular Arithmetic
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Applied Discrete Mathematics Week 4: Number Theory
Probability and Statistics for Computer Scientists Second Edition, By: Michael Baron Section 11.1: Least squares estimation CIS Computational.
Proving Properties of Recursive List Functions
Number Theory and Euclidean Algorithm
Topic 6: Number Theory Basics
Enough Mathematical Appetizers!
The sum of any two even integers is even.
The Extended Euclidean Algorithm (2/10)
Classical Ciphers – 2 CSCI284 Spring 2004 GWU
CS480/680: Intro to ML Lecture 01: Perceptron 9/11/18 Yao-Liang Yu.
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
Hash Functions Motivation Hash Functions: collision, pre-images SHA-1
Multiplying and Dividing Integers
Chapter 8 Limit and Continuity of Functions
Application: Algorithms
Application: Algorithms
CSCI284 Spring 2009 GWU Sections 5.1, 5.2.2, 5.3
Lectures prepared by: Elchanan Mossel Yelena Shvets
One Way Functions Motivation Complexity Theory Review, Motivation
Primitive Recursive Predicates
Applied Discrete Mathematics Week 10: Introduction to Counting
GCD CSCI 284/162 Spring 2009 GW.
Number Theory.
Cryptography Lecture 19.
THE WELL ORDERING PROPERTY
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.
Approximation of Functions
Presentation transcript:

Euclidean Algorithm for GCD CSCI 284/162 Spring 2007 GWU

Euclidean Algorithm considered first non-trivial algorithm Algorithm_gcd(m, a) /* m > a */ (X, Y) := (m, a) /* Initialize */ while (Y0) (X, Y) := (Y, X rem Y) return(X) Works because: gcd (X, Y) = gcd(Y, X rem Y) gcd(X, Y) = Y if Y|X Stops because: (X, Y) always decreasing and non-negative 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD Try gcd(17, 101) gcd(57, 93) 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Theorem: gcd(X, Y) = gcd(Y, X rem Y); X, Y0 Proof: Let X rem Y = r  r = X – qY for integer q Consider a factor g of X and Y g|X and g|Y X = q1g, Y = q2g, for some integers q1 and q2 r = g(q1 – qq2) g|Y and g|r 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Theorem: gcd(X, Y) = gcd(Y, X rem Y); X, Y0 Proof contd: Consider a factor h of Y and r h|Y and h|r Y = q3h, r = q4h for some integers q3 and q4 X = h(q4 + qq3) h|Y and h|X Note: all integers are factors of 0, see, for example, example 2.80 in Chapter 2, Handbook of Applied Cryptography, http://www.cacr.math.uwaterloo.ca/hac/about/chap2.pdf 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Theorem: gcd(X, Y) = gcd(Y, X rem Y) Proof contd. Hence all common factors of X and Y are common factors of Y and r and vice versa. Hence, in particular, the pair (X, Y) and the pair (Y, r) have the same gcd. 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Euclidean Algorithm: Correctness Proof Theorem: Algorithm_gcd (m, a) returns gcd(m, a) Proof: Let the ith update of (X, Y) be denoted (Xi Yi) Then (m, a) = (X0 Y0) and the algorithm returns XN if the algorithm performs N (a finite number) updates. 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Euclidean Algorithm: Correctness Proof contd. From previous theorem, gcd (X, Y) = gcd(Y, X rem Y)  gcd(m, a) = gcd(X0 Y0) = gcd(X1 Y1) = gcd(X2 Y2) = …. gcd(XN-1 YN-1) YN-1|XN-1 gcd(XN-1 YN-1) = YN-1 = XN = Algorithm_gcd (m, a) Hence gcd(m, a) = Algorithm_gcd (m, a) If N finite 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD

Euclidean Algorithm: Correctness Proof contd. a=Y0 > Y1 > Y2 > …. > YN-1 > YN = 0 As Y decreases by at least 1 each iteration N  a N is finite. 4/16/2019 CS284-162/Spring07/GWU/Vora/ Euuclidean Algorithm for GCD