CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.

Slides:



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

Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Basic Number Theory.
WS Algorithmentheorie 03 – Randomized Algorithms (Primality Testing) Prof. Dr. Th. Ottmann.
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.
Recursion Michael Ernst CSE 190p University of Washington To seal: moisten flap, fold over, and seal.
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.
3 Gallon Jug5 Gallon Jug Greatest Common Divisor Lecture 8: Sep 30.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Proofs, Recursion, and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 7 Tuesday, 11/6/01 Number-Theoretic Algorithms Chapter.
Great Theoretical Ideas in Computer Science for Some.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
Mathematics of Cryptography Part I: Modular Arithmetic
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
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown Chapter 4 – Finite Fields.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 4 (Part 3): Mathematical Reasoning, Induction.
Greatest Common Divisor
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
YSLInformation Security -- Public-Key Cryptography1 Prime and Relatively Prime Numbers Divisors: We say that b  0 divides a if a = mb for some m, where.
Greatest Common Divisor Jordi Cortadella Department of Computer Science.
Prime Factorization SWBAT find the prime factorization of a composite number.
Fall 2002CS 395: Computer Security1 Chapters 4 and 8: The Mathematics Required for Public Key Cryptography In case you’re beginning to worry that this.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
CS/ECE Advanced Network Security Dr. Attila Altay Yavuz
More on Efficiency Issues. Greatest Common Divisor given two numbers n and m find their greatest common divisor possible approach –find the common primes.
UNIT-I INTRODUCTION ANALYSIS AND DESIGN OF ALGORITHMS CHAPTER 1:
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
COMPSCI 102 Introduction to Discrete Mathematics.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
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.
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.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
AF2. Turn off your phones Primes, gcd, some examples, reading.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
Discrete Mathematics
CSCI 125 & 161 Lecture 12 Martin van Bommel. Prime Numbers Prime number is one whose only divisors are the number 1 and itself Therefore, number is prime.
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.
AF2. Turn off your phones Primes, gcd, some examples, reading.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Number-Theoretic Algorithms
Recursion CSE 2320 – Algorithms and Data Structures
Chapter 4 (Part 3): Mathematical Reasoning, Induction & Recursion
Advanced Algorithms Analysis and Design
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Great Theoretical Ideas in Computer Science
Greatest Common Divisor
CSE 311 Foundations of Computing I
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
GCD and Optimization Problem
Number Theory and Modular Arithmetic
Computer Science 101 While Statement.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Number Theory (Chapter 7)
MATH 15A – Discrete Mathematics
Prime and Relatively Prime Numbers
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
CSE 321 Discrete Structures
Topic Past Papers –Proofs
Computer Security: Art and Science, 2nd Edition
Presentation transcript:

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

Today’s Topics: 1. GCD 2. Euclid’s algorithm 3. Extended Euclid’s algorithm 2

1. GCD The poor man version of prime factorization 3

GCD  Greatest common divisor  Given two positive integers a,b, their GCD is the largest integer n such that n|a and n|b 4

GCD  What is GCD(20,30)? A. 5 B. 10 C. 20 D. 30 E. Other 5

GCD  What is GCD( , )? 6

GCD  How can we compute GCD(a,b)?  Simple way: (i) Compute prime factorization of a,b (ii) Take common primes and prime powers  Example: if a= and b= then GCD(a,b)=  However, we believe that computing the prime factorization of large numbers is hard…  Euclid’s algorithm provides a much faster way 7

2. Euclid’s algorithm Fast GCD 8

Euclid’s algorithm

(a,b) (b,a mod b)

Euclid’s algorithm

a b Example run: a=20, b=30

Euclid’s algorithm  The same basic questions 1. Does it always terminate? 2. Does it return the correct answer? 3. How fast is it?

Euclid’s algorithm: termination

The value of a keeps decreasing, which proves termination

Euclid’s algorithm: correctness g=gcd(a,b)

Euclid’s algorithm: correctness

g=gcd(a,b) Proved!

Euclid’s algorithm: speed How many iterations?

Euclid’s algorithm: speed

3. Extended Euclid’s algorithm Using algorithms to do math! 28

Extended Euclid’s algorithm