Number Theory and Techniques of Proof

Slides:



Advertisements
Similar presentations
Methods of Proof. Methods of Proof The Vicky Pollard Proof Technique Prove that when n is even n2 is even. Assume n is 0, then n2 is 0, and that is.
Advertisements

Lecture 3 – February 17, 2003.
Discrete Mathematics Lecture 3
With examples from Number Theory
Cryptography and Network Security
Copyright © Cengage Learning. All rights reserved.
Ch. 10: What is a number?. MAIN DEFINITION OF THE COURSE: A symmetry of an object (in the plane or space) means a rigid motion (of the plane or space)
Section 4.1: Primes, Factorization, and the Euclidean Algorithm Practice HW (not to hand in) From Barr Text p. 160 # 6, 7, 8, 11, 12, 13.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
5.1 Number Theory. The study of numbers and their properties. The numbers we use to count are called the Natural Numbers or Counting Numbers.
Copyright © Cengage Learning. All rights reserved.
CMSC 250 Discrete Structures Number Theory. 20 June 2007Number Theory2 Exactly one car in the plant has color H( a ) := “ a has color”  x  Cars –H(
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
The Integers and Division
Slide 5-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Methods of Proof & Proof Strategies
Introduction to Proofs
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
MATH 224 – Discrete Mathematics
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Computational Number Theory - traditional number theory Prime Numbers Factors Counting Factors D- functions.
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
1 CMSC 250 Chapter 3, Number Theory. 2 CMSC 250 Introductory number theory l A good proof should have: –a statement of what is to be proven –"Proof:"
Section 1.7. Definitions A theorem is a statement that can be shown to be true using: definitions other theorems axioms (statements which are given as.
Methods of Proof Lecture 4: Sep 20 (chapter 3 of the book, except 3.5 and 3.8)
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.
Slide Copyright © 2009 Pearson Education, Inc. Slide Copyright © 2009 Pearson Education, Inc. Chapter 1 Number Theory and the Real Number System.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Chapter 1 Logic and Proof.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
MA/CSSE 473 Day 07 Extended Euclid's Algorithm Modular Division
The Foundations: Logic and Proofs
Indirect Argument: Contradiction and Contraposition
Direct Proof and Counterexample IV: Division into Cases and the Quotient-Remainder Theorem For each of the following values of n and d, find integers q.
Chapter 3 The Real Numbers.
B504/I538: Introduction to Cryptography
MA/CSSE 473 Day 06 Euclid's Algorithm.
CSE15 Discrete Mathematics 02/08/17
Indirect Argument: Two Classical Theorems
Proof methods We will discuss ten proof methods: Direct proofs
Advanced Algorithms Analysis and Design
MA/CSSE 473 Day 08 Randomized Primality Testing Carmichael Numbers
Methods of Proof CS 202 Epp, chapter 3.
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Gray Code Can you find an ordering of all the n-bit strings in such a way that two consecutive n-bit strings differed by only one bit? This is called the.
Applied Discrete Mathematics Week 4: Number Theory
Number Theory (Chapter 7)
The Foundations: Logic and Proofs
Proving Existentials A proof of a statement of the form x P(x) is called an existence proof. If the proof demonstrates how to actually find or construct.
Lecture 20 Guest lecturer: Neal Gupta
CS 220: Discrete Structures and their Applications
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept 24, 25.
Copyright © Cengage Learning. All rights reserved.
Copyright © Zeph Grunschlag,
Application: Algorithms
Copyright © Cengage Learning. All rights reserved.
Foundations of Discrete Mathematics
Number Theory.
Cryptography Lecture 16.
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.
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept, 2019.
Presentation transcript:

Number Theory and Techniques of Proof

Basic definitions:Parity An integer n is called even if, and only if, there exists an integer k such that n = 2*k. An integer n is called odd if, and only if, it is not even. Corollary: An integer n is called odd if, and only if, there exists an integer k such that n = 2*k + 1 The property of an integer as being either odd or even is known as its parity.

Arguing the positive: Universal Statements Let’s consider the following statement: “The sum of an odd and an even integer is odd.”

Arguing the positive: Universal Statements Let’s consider the following statement: “The sum of an odd and an even integer is odd.” Do you believe this statement? Yes No

Arguing the positive: Universal Statements Let’s consider the following statement: “The sum of an odd and an even integer is odd.” Do you believe this statement? If you believe it, you have to try to prove that it’s true (argue the positive/affirmative) Yes No

Proof, take 1 Claim to be proven true (we argue its affirmative): “The sum of an odd and an even integer is odd.” Proof: Let 𝑛 1 be any odd integer. Then, ∃𝑘∈ℤ 𝑛 1 =2⋅𝑘+1 (1) Let 𝑛 2 be any even integer. Then, 𝑛 2 =2⋅𝑘 (2) By (1) and (2), we have that 𝑛 1 + 𝑛 2 = 2⋅𝑘+1 +2⋅𝑘= 2𝑘+2𝑘 +1=2⋅ 2𝑘 +1 (3). We set 2𝑘=𝑟. Clearly, 𝑟∈ℤ. (4) Substituting (4) into (3) yields: 𝑛 1 + 𝑛 2 =2⋅𝑟 + 1, which means that 𝑛 1 + 𝑛 2 is odd. End of proof.

Proof, take 1 Claim to be proven true (we argue its affirmative): “The sum of an odd and an even integer is odd.” Proof: Let 𝑛 1 be any odd integer. Then, ∃𝑘∈ℤ 𝑛 1 =2⋅𝒌+1 (1) Let 𝑛 2 be any even integer. Then, 𝑛 2 =2⋅𝒌 (2) By (1) and (2), we have that 𝑛 1 + 𝑛 2 = 2⋅𝑘+1 +2⋅𝑘= 2𝑘+2𝑘 +1=2⋅ 2𝑘 +1 (3). We set 2𝑘=𝑟. Clearly, 𝑟∈ℤ. (4) Substituting (4) into (3) yields: 𝑛 1 + 𝑛 2 =2⋅𝑟 + 1, which means that 𝑛 1 + 𝑛 2 is odd. End of proof. What does this proof actually prove? WHOOPS!

Proof, take 1 Claim to be proven true (we argue its affirmative): “The sum of an odd and an even integer is odd.” Proof: Let 𝑛 1 be any odd integer. Then, ∃𝑘∈ℤ 𝑛 1 =2⋅𝒌+1 (1) Let 𝑛 2 be any even integer. Then, 𝑛 2 =2⋅𝒌 (2) By (1) and (2), we have that 𝑛 1 + 𝑛 2 = 2⋅𝑘+1 +2⋅𝑘= 2𝑘+2𝑘 +1=2⋅ 2𝑘 +1 (3). We set 2𝑘=𝑟. Clearly, 𝑟∈ℤ. (4) Substituting (4) into (3) yields: 𝑛 1 + 𝑛 2 =2⋅𝑟 + 1, which means that 𝑛 1 + 𝑛 2 is odd. End of proof. What does this proof actually prove? It proves that two consecutive integers sum to an odd number! WHOOPS!

Proof, take 2 Claim to be proven true (we argue its affirmative): “The sum of an odd and an even integer is odd.” Proof: Let 𝑛 1 be any odd integer. Then, ∃ 𝑘 1 ∈ℤ 𝑛 1 =2⋅ 𝑘 1 +1 (1) Let 𝑛 2 be any even integer. Then, ∃ 𝑘 2 ∈ℤ [ 𝑛 2 =2⋅ 𝑘 2 ] (2) By (1) and (2), we have that 𝑛 1 + 𝑛 2 = 2⋅ 𝑘 1 +1 +2⋅ 𝑘 2 =2⋅ 𝑘 1 + 𝑘 2 +1 (3). We set 𝑘 1 + 𝑘 2 =𝑘. Clearly, 𝑘 is an integer. (4) Substituting (4) into (3) yields: 𝑛 1 + 𝑛 2 =2⋅𝑘 + 1, which means that 𝑛 1 + 𝑛 2 is odd. End of proof.

Statements of claims / theorems Mathematical claims and theorems can be stated in various different ways! “The sum of an odd and an even integer is odd.” “Any two integers of opposite parity sum to an odd number” “Every pair of integers of opposite parity sums to an odd number” ∀ 𝑛 1 ∈ ℤ 2𝑘+1 [ ∀ 𝑛 2 ∈ ℤ 2𝑘 𝑛 1 + 𝑛 2 ∈ 𝑍 2𝑘+1 ]

Statements of claims / theorems Mathematical claims and theorems can be stated in various different ways! “The sum of an odd and an even integer is odd.” “Any two integers of opposite parity sum to an odd number” Other ideas? “Every pair of integers of opposite parity sums to an odd number” ∀ 𝑛 1 ∈ ℤ 2𝑘+1 [ ∀ 𝑛 2 ∈ ℤ 2𝑘 𝑛 1 + 𝑛 2 ∈ 𝑍 2𝑘+1 ]

Your turn, class! Let’s split into teams and prove the following claims true: The square of an odd integer is also odd. If 𝑎 is an integer, then 𝑎 2 +𝑎 is even.

Arguing the affirmative of existential statements Two methods: Constructive Non-Constructive In “constructive” proofs we either explicitly show or construct an element of the domain that answers our query. In non-constructive proofs (very rare in this class) we prove that it is a logical necessity for such an element to exist! But we neither explicitly, nor implicitly, show or construct such an element!

Our first constructive proof Claim: There exists a natural number that you cannot write as a sum of three squares of natural numbers.

Constructive proofs in Number Theory (and one non-constructive one)

Our first constructive proof Claim: There exists a natural number that you cannot write as a sum of three squares of natural numbers. Examples of numbers you can write as a sum of three squares: 0= 0 2 + 0 2 + 0 2 1= 1 2 + 0 2 + 0 2 2= 1 2 + 1 2 + 0 2 Try to find a number that cannot be written as such.

Proof The natural number 7 cannot be written as the sum of three squares. This we can prove by case analysis: Can’t use 3, since 3 2 =9>7 Can’t use 2 more than once, since 2 2 + 2 2 =8>7 So, we can use 2, one or zero times. If we use 2 once, we have 7= 2 2 + 𝑎 2 + 𝑏 2 ≤ 2 2 + 1 2 + 1 2 =6<7 If we use 2 zero times, the maximum value is 1 2 + 1 2 + 1 2 =3<7

Your turn, class! Let’s split in teams and prove the following theorems: There exists an integer 𝑛 that can be written in two ways as a sum of two prime numbers. There is a perfect square that can be written as a sum of two other perfect squares. Suppose 𝑟, 𝑠∈ℤ. Then, (∃𝑘∈ℤ)[ 22𝑟 + 18𝑠 = 2𝑘] There exists an integer 𝑛 that can be written in two ways as a sum of two cubed integers. (Hard) 1729: Ramanujan, Hardy,

Your turn, class! How is the 3rd proof different from the others? Let’s split in teams and prove the following theorems: There exists an integer 𝑛 that can be written in two ways as a sum of two prime numbers. There is a perfect square that can be written as a sum of two other perfect squares. Suppose 𝑟, 𝑠∈ℤ. Then,(∃𝑘∈ℤ)[ 22𝑟 + 18𝑠 = 2𝑘] There exists an integer 𝑛 that can be written in two ways as a sum of two cubed integers. (Hard) (4) is the Ramanujan problem How is the 3rd proof different from the others?

Our first (and last?) non-constructive proof Theorem: There exists a pair of irrational numbers 𝑎 and 𝑏 such that 𝑎 𝑏 is a rational number. Proof: Let 𝑎 = 𝑏 = 2 . Since 2 is irrational, 𝑎 and 𝑏 are both irrational. Is 𝑎 𝑏 = ( 2 ) 2 rational? Two cases: If 2 2 is rational, then we have proven the result. Done. If 2 2 is irrational, then we will name it 𝑐. Then, observe that 𝑐 2 is rational, since 𝑐 2 = 2 2 2 = 2 2 =2∈ℚ. Since both 𝑐 and 2 are irrationals, but 𝑐 2 is rational, we are done. Take it as a given (for now) that root of 2 is irrational.

Divisibility Let 𝑛∈ℤ and d∈ ℤ ≠0 . Then, we say or denote any one of the following: d divides n n is divided by d d | n d is a divisor (or factor) of n n is a multiple of d 𝑛≡0 (𝑚𝑜𝑑 𝑑) if, and only if, ∃𝑘∈ℤ [𝑛=𝑑⋅𝑘] We sometimes call k the quotient of the division of n by d. If d does not divide n, we denote that by 𝑑 ∤ 𝑦 (note the small strikethrough)

Pop Quizzes 3 | 6 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 N 5 | 0 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 N 5 | 0 Y 0 | 5 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 N 5 | 0 Y 0 | 5 N ∀𝑝∈𝐏, 2∤𝑝 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 N 5 | 0 Y 0 | 5 N ∼∃𝑛∈ ℕ 𝑜𝑑𝑑 :𝑛 | 0 Yes No

Pop Quizzes 3 | 6 Y 6 | 3 N 10 | 10 Y -10 ∤ 10 N 5 | 0 Y 0 | 5 N ∼∃𝑛∈ ℕ 𝑜𝑑𝑑 :𝑛 | 0 N (any non-zero integer divides 0) Yes No

Universal claims with divisibility Let’s all try to prove the affirmative of this claim: ∀𝑎, 𝑏, 𝑐∈ℤ [((𝑎≠0)∧ 𝑎 𝑏)∧(𝑎 𝑐 )⇒𝑎 | 𝑏+𝑐 ]

Universal claims with divisibility Let’s all try to prove the affirmative of this claim: ∀𝑎, 𝑏, 𝑐∈ℤ 𝑎≠0 ∧ 𝑎 𝑏 ∧ 𝑎 𝑐 ⇒𝑎 𝑏+𝑐 Proof: 𝑎 |𝑏⇒ ∃ 𝑟 1 ∈ℤ 𝑏=𝑎⋅ 𝑟 1 𝑎 |𝑐⇒ ∃ 𝑟 2 ∈ℤ 𝑐=𝑎⋅ 𝑟 2 From (1) and (2), we have that 𝑏+𝑐=𝑎⋅ 𝑟 1 +𝑎⋅ 𝑟 2 =𝑎⋅( 𝑟 1 + 𝑟 2 ) So 𝑎 |(𝑏+𝑐). Done.

Proof by contradiction Sometimes, proving a fact directly is tough. In such cases, we can attempt an indirect proof The most common type of indirect proof is proof by contradiction Briefly: We want to prove a fact 𝑎, so we assume ∼𝑎 and hope that we reach a contradiction (a falsehood). Example: We will prove that if a prime number divides an integer 𝒂, it cannot possible divide 𝒂+𝟏.

Proofs by contradiction in Number Theory

First proof by contradiction Claim: Let 𝑝∈𝐏, 𝑎∈ℕ. Then, if 𝑝 |𝑎, then 𝑝∤ 𝑎+1 .

First proof by contradiction Claim: Let 𝑝∈𝐏, 𝑎∈ℕ. Then, if 𝑝 |𝑎, then 𝑝∤ 𝑎+1 . Proof: Assume that 𝑝 |(𝑎+1). Then, this means that ∃ 𝑟 1 ∈ℤ 𝑎+1=𝑝⋅ 𝑟 1 (I) We already know that 𝑝 |𝑎⇒(∃ 𝑟 2 ∈ℤ)[𝑎=𝑝⋅ 𝑟 2 ] (II) Substituting (II) into (I) yields: 𝑝⋅ 𝑟 2 +1=𝑝⋅ 𝑟 1 ⇒𝑝 𝑟 1 − 𝑟 2 =1⇒𝑝 |1 which is a contradiction. Therefore, 𝑝∤ 𝑎+1 .

Infinitude of primes Assume that the primes are finite. Then, we can list them in ascending order: 𝑝 1 , 𝑝 2 ,…, 𝑝 𝑛

Infinitude of primes Assume that the primes are finite. Then, we can list them in ascending order: 𝑝 1 , 𝑝 2 ,…, 𝑝 𝑛 Let’s create the number 𝑁= 𝑝 1 ⋅ 𝑝 2 ⋅…⋅ 𝑝 𝑛 +1

Infinitude of primes 𝑁= 𝑝 1 ⋅ 𝑝 2 ⋅…⋅ 𝑝 𝑛 +1 Clearly, 𝑁 is bigger than any 𝑝 𝑖 . We have two cases: N is prime. Contradiction, since 𝑁 is bigger than any prime. N is composite. This means that N has at least one factor 𝑓. Let’s take the smallest factor of N, and call it 𝑓 𝑚𝑖𝑛 . Then, this number is prime (why?) Since 𝑓 𝑚𝑖𝑛 is prime, it divides 𝑝 1 ⋅ 𝑝 2 ⋅…⋅ 𝑝 𝑛 . By the previous theorem, this means that it cannot possibly divide 𝑝 1 ⋅ 𝑝 2 ⋅…⋅ 𝑝 𝑛 +1=𝑁. Contradiction, since we assumed that 𝑓 𝑚𝑖𝑛 is a factor of N. Therefore, the primes are not finite.

Modular Arithmetic

Modular Arithmetic We say that 𝑎≡𝑏 𝑚𝑜𝑑 𝑚 (read “a is congruent to b mod m”) means that 𝑚 |(𝑎−𝑏). Examples: 100≡2 𝑚𝑜𝑑 7 91≡0 𝑚𝑜𝑑 13 6≡2 𝑚𝑜𝑑 4 Convention: 0≤𝑏≤𝑚−1 THINK: Take large number 𝑎, divide by 𝑚, remainder is 𝑏 Terminology: “Reducing 𝑎 𝑚𝑜𝑑 𝑚”

≡ vs ≡ In Logic, 𝜑 1 ≡ 𝜑 2 mean that 𝜑 1 and 𝜑 2 have the same truth table (are logically equivalent) In Number Theory, 𝑎≡𝑏 (𝑚𝑜𝑑 𝑚), read “a is congruent to b mod m”) means 𝑚 | 𝑎 −𝑏 !

≡ vs ≡ In Logic, 𝜑 1 ≡ 𝜑 2 mean that 𝜑 1 and 𝜑 2 have the same truth table (are logically equivalent) In Number Theory, 𝑎≡𝑏 (𝑚𝑜𝑑 𝑚), read “a is congruent to b mod m”) means 𝑚 | 𝑎 −𝑏 ! THESE TWO ARE VERY DIFFERENT!!!! THEY HAVE NOTHING TO DO WITH EACH OTHER!

Properties of equivalence If 𝑎 1 ≡ 𝑏 1 (𝑚𝑜𝑑 𝑚) and 𝑎 2 ≡ 𝑏 2 (𝑚𝑜𝑑 𝑚), then: 𝑎 1 + 𝑎 2 ≡ 𝑏 1 + 𝑏 2 (𝑚𝑜𝑑 𝑚)

Properties of equivalence If 𝑎 1 ≡ 𝑏 1 (𝑚𝑜𝑑 𝑚) and 𝑎 2 ≡ 𝑏 2 (𝑚𝑜𝑑 𝑚), then: 𝑎 1 + 𝑎 2 ≡ 𝑏 1 + 𝑏 2 𝑚𝑜𝑑 𝑚 Proof: 𝑎 1 ≡ 𝑏 1 𝑚𝑜𝑑 𝑚 ⇒𝑚|( 𝑎 1 − 𝑏 1 ) ∃ 𝑟 1 ∈ℤ [ 𝑎 1 − 𝑏 1 =𝑚⋅ 𝑟 1 ] (I) Similarly, ∃ 𝑟 2 ∈ℤ [ 𝑎 2 − 𝑏 2 =𝑚⋅ 𝑟 2 ] (II) Therefore, by (I) and (II) we have: 𝑎 1 − 𝑏 1 + 𝑎 2 − 𝑏 2 =𝑚⋅ 𝑟 1 +𝑚⋅ 𝑟 2 ⇒ 𝑎 1 + 𝑎 2 − 𝑏 1 + 𝑏 2 =𝑚⋅ 𝑟 1 + 𝑟 2 ⇒ 𝑎 1 + 𝑎 2 ≡ 𝑏 1 + 𝑏 2 (𝑚𝑜𝑑 𝑚)

Properties of equivalence If 𝑎 1 ≡ 𝑏 1 (𝑚𝑜𝑑 𝑚) and 𝑎 2 ≡ 𝑏 2 𝑚𝑜𝑑 𝑚 , then 𝑎 1 ⋅ 𝑎 2 ≡ 𝑏 1 ⋅ 𝑏 2 𝑚𝑜𝑑 𝑚

Properties of equivalence If 𝑎 1 ≡ 𝑏 1 (𝑚𝑜𝑑 𝑚) and 𝑎 2 ≡ 𝑏 2 𝑚𝑜𝑑 𝑚 , then 𝑎 1 ⋅ 𝑎 2 ≡ 𝑏 1 ⋅ 𝑏 2 𝑚𝑜𝑑 𝑚 Proof: For you to figure out. Might be in: Homework Quiz Midterm 1 Midterm 2 Final Any combination of the above How many possibilities are there?

First proof revisited Recall that we proved that the sum of an even and an odd integer is odd. Note that: If 𝑎 is even (so 2 divides it), then 𝑎≡0 𝑚𝑜𝑑 2 If 𝑎 is odd, then 𝑎≡1 𝑚𝑜𝑑 2 So now we can re-do the proof with modular arithmetic!

Proof with modular arithmetic Claim: Any two integers of opposite parity sum to an odd number. Proof: Since 𝑎 1 , 𝑎 2 are opposite parity, without loss of generality, assume that 𝑎 1 ≡0 𝑚𝑜𝑑 2 and 𝑎 2 ≡1 (𝑚𝑜𝑑 2) Using the properties of modular arithmetic, we obtain: 𝑎 1 + 𝑎 2 ≡ 0+1 𝑚𝑜𝑑 2 ≡1 (𝑚𝑜𝑑 2) Done.

More proofs Similarly, you can show that ∀𝑎∈ℕ [𝑎 2 +𝑎≡0 ( 𝑚𝑜𝑑 2)]

More proofs Similarly, you can show that ∀𝑎∈ℕ [𝑎 2 +𝑎≡0 ( 𝑚𝑜𝑑 2)] Proof: ≡ is ≡(𝑚𝑜𝑑 2) throughout to save space. We have two cases: 𝑎≡0. Then, 𝑎 2 +𝑎≡ 0 2 +0≡0. Done. 𝑎≡1. Then, 𝑎 2 +𝑎≡ 1 2 +1≡0. Done.

Advantages of this notation Theorem (clumsy): If 𝑥 is such that when you divide x by 4 you get a remainder of 2, and 𝑦 is such that when you divide y by 4 you get a remainder of 3, then when you divide 𝑥 ⋅𝑦 by 4 you get a remainder of 2.

Advantages of this notation Theorem (clumsy): If 𝑥 is such that when you divide x by 4 you get a remainder of 2, and 𝑦 is such that when you divide y by 4 you get a remainder of 3, then when you divide 𝑥 ⋅𝑦 by 4 you get a remainder of 2. THIS SOUNDS AWFUL!

Advantages of this notation Theorem (clumsy): If 𝑥 is such that when you divide x by 4 you get a remainder of 2, and 𝑦 is such that when you divide y by 4 you get a remainder of 3, then when you divide 𝑥 ⋅𝑦 by 4 you get a remainder of 2. THIS SOUNDS AWFUL! Theorem (elegant): If 𝑥≡2 ( 𝑚𝑜𝑑 4) and 𝑦≡3 ( 𝑚𝑜𝑑 4), then 𝑥⋅𝑦≡2 (𝑚𝑜𝑑 4).

Advantages of this notation Theorem (clumsy): If 𝑥 is such that when you divide x by 4 you get a remainder of 2, and 𝑦 is such that when you divide y by 4 you get a remainder of 3, then when you divide 𝑥 ⋅𝑦 by 4 you get a remainder of 2. THIS SOUNDS AWFUL! Theorem (elegant): If 𝑥≡2 ( 𝑚𝑜𝑑 4) and 𝑦≡3 ( 𝑚𝑜𝑑 4), then 𝑥⋅𝑦≡2 (𝑚𝑜𝑑 4). Proof: All ≡ are mod 4. Then: 𝑥⋅𝑦≡2⋅3≡6 ≡2 (𝑚𝑜𝑑 4)

Proofs by contrapositive in Number Theory

Proof by contraposition Applicable to all kinds of statements of type: ∀𝑥∈𝐷 [𝑃 𝑥 ⇒𝑄 𝑥 ]

Proof by contraposition Applicable to all kinds of statements of type: ∀𝑥∈𝐷 [𝑃 𝑥 ⇒𝑄 𝑥 ] Sometimes, proving the implication in this way is hard. On the other hand, proving its contrapositive might be easier: ∀𝑥∈𝑆 [ ∼𝑄 𝑥 ⇒∼𝑃 𝑥 ]

Examples ∀𝑛∈ℤ 𝑛 2 ≡0 𝑚𝑜𝑑 2 ⇒𝑛≡0 𝑚𝑜𝑑 2 ∀𝑛∈ℤ 𝑛 2 ≡0 𝑚𝑜𝑑 2 ⇒𝑛≡0 𝑚𝑜𝑑 2 Proving this directly is somewhat hard On the other hand, the contrapositive is child’s (or 250 student’s) play: ∀𝑛∈ℤ, [ 𝑛≢0 (𝑚𝑜𝑑 2)⇒ 𝑛 2 ≢0 (𝑚𝑜𝑑 2)]

Examples ∀𝑛∈ℤ [ 𝑛 2 ≡0 ( 𝑚𝑜𝑑 2)⇒𝑛≡0 ( 𝑚𝑜𝑑 2)] Proving this directly is somewhat hard On the other hand, the contrapositive is child’s (or 250 student’s) play: ∀𝑛∈ℤ, [ 𝑛≢0 (𝑚𝑜𝑑 2)⇒ 𝑛 2 ≢0 (𝑚𝑜𝑑 2) Proof: Since 𝑛≢0 (𝑚𝑜𝑑 2), we have that 𝑛≡1 𝑚𝑜𝑑 2 . So, 𝑛 2 ≡ 1 2 ≡1 (𝑚𝑜𝑑 2)

Another example If 𝑛 2 ≡0 (𝑚𝑜𝑑 5), then 𝑛≡0 (𝑚𝑜𝑑 5)

Another example If 𝑛 2 ≡0 (𝑚𝑜𝑑 5), then 𝑛≡0 (𝑚𝑜𝑑 5) Proof (contrapositive): 𝑛≢0 (𝑚𝑜𝑑 5)⇒ 𝑛 2 ≢0 (𝑚𝑜𝑑 5) Cases (all ≡ are mod 5): 𝑛≡1 ⇒ 𝑛 2 ≡1≢ 0 𝑛≡2⇒ 𝑛 2 ≡4≢0 𝑛≡3⇒ 𝑛 2 ≡9≡4≢0 𝑛≡4⇒ 𝑛 2 ≡16≡1≢0 Done.

A historical proof by contradiction

Proof that 2 is irrational Let’s assume BY WAY OF CONTRADICTION that 2 is rational. So 2 = 𝑎 𝑏 , 𝑎,𝑏∈ℤ, 𝑏≠0 and 𝑎,𝑏 do not have common factors. So 𝑎= 2 ⋅𝑏⇒ 𝑎 2 =2 𝑏 2 so 𝑎 2 ≡0 𝑚𝑜𝑑 2 (1) By the previous theorem, this means that 𝑎≡0 (𝑚𝑜𝑑 2) So 𝑎=2𝑘 for some integer 𝑘. (2) Substituting (2) into (1) yields: 2𝑘 2 =2 𝑏 2 ⇒ 𝑏 2 =2 𝑘 2 ⇒ 𝑏 2 ≡0 𝑚𝑜𝑑 2 ⇒𝑏≡0(𝑚𝑜𝑑 2) So both 𝑎 and 𝑏 are both even, have common factor of 2. Contradiction.

Proof that 5 is irrational Let’s assume BY WAY OF CONTRADICTION that 5 is rational. So 5 = 𝑎 𝑏 , 𝑎,𝑏∈ℤ, 𝑏≠0 and 𝑎,𝑏 do not have common factors. So 𝑎= 5 ⋅𝑏⇒ 𝑎 2 =5 𝑏 2 so 𝑎 2 ≡0 𝑚𝑜𝑑 5 (1) By the previous theorem, this means that 𝑎≡0 (𝑚𝑜𝑑 5) So 𝑎=5𝑘 for some integer 𝑘. (2) Substituting (2) into (1) yields: 5𝑘 2 =5 𝑏 2 ⇒ 𝑏 2 =5 𝑘 2 ⇒ 𝑏 2 ≡0 𝑚𝑜𝑑 5 ⇒𝑏≡0 (𝑚𝑜𝑑 5) So both 𝑎 and 𝑏 are both even, have common factor of 5. Contradiction.

Proof that 4 is irrational (???) Why can we not use this machinery to prove that 4 is irrational (which is wrong anyway)?

Using the Unique Factorization Theorem

Unique Factorization: examples 91= 7 1 × 13 1 There is no other way to factor 91 into a product of primes. 18= 2 1 × 3 2 Once again, no other way to factor 18 into a product of primes. 7= 7 1 Since 7 is prime, there is trivially no other way to factor it into primes. 1000= 2 3 × 5 3 1027: prime or not?

Unique Factorization: examples 91= 7 1 × 13 1 There is no other way to factor 91 into a product of primes. 18= 2 1 × 3 2 Once again, no other way to factor 18 into a product of primes. 7= 7 1 Since 7 is prime, there is trivially no other way to factor it into primes. 1000= 2 3 × 5 3 1027: prime or not? Nope! 1027=13 × 79 1049= 1049 1 (1049 is prime)

Statement of Theorem Every number 𝑛∈ ℕ ≥2 can be uniquely factored into a product of prime numbers 𝑝 1 , 𝑝 2 , …, 𝑝 𝑛 like so: 𝑛= 𝑝 1 𝑒 1 ⋅ 𝑝 2 𝑒 2 ⋅…⋅ 𝑝 𝑘 𝑒 𝑘 , 𝑒 𝑖 ∈ ℕ ≥1 Proving existence is easy (Jason) Proving uniqueness is hard (Bill)

What is “uniqueness”? By “uniqueness” we mean that the product is unique up to reordering of the factors 𝑝 𝑖 𝑒 𝑖 . Examples: 30= 3 1 × 10 1 = 10 1 × 3 1 88= 2 3 × 11 1 = 11 1 × 2 3 1026= 2 1 × 3 3 × 19 1 = 2 1 × 19 1 × 3 3 = 19 1 × 2 1 × 3 3 = 3 3 × 19 1 × 2 1

Proof of 2 ∉ℚ with PFT Proof (once again by contradiction): Assume that 2 ∈ℚ, so ∃𝑎∈ℤ, 𝑏∈ ℤ ≠0 [ 2 = 𝑎 𝑏 ]

Proof of 2 ∉ℚ with PFT Proof (once again by contradiction): Assume that 2 ∈ℚ, so ∃𝑎∈ℤ, 𝑏∈ ℤ ≠0 [ 2 = 𝑎 𝑏 ] Let 𝑘 1 ∈ℕ be the largest integer such that 𝑎= 2 𝑘 1 ⋅𝐴 (By UPFT) Similarly, let 𝑘 2 ∈ℕ be the largest integer such that 𝑏= 2 𝑘 2 ⋅𝐵 (By UPFT)

Proof of 2 ∉ℚ with UFT Since 2 = 𝑎 𝑏 , 𝑎 2 =2 𝑏 2 Proof (once again by contradiction): Assume that 2 ∈ℚ, so ∃𝑎∈ℤ, 𝑏∈ ℤ ≠0 [ 2 = 𝑎 𝑏 ] Since 2 = 𝑎 𝑏 , 𝑎 2 =2 𝑏 2

Proof of 2 ∉ℚ with UFT Since 2 = 𝑎 𝑏 , 𝑎 2 =2 𝑏 2 Let 𝑘 1 ∈ℕ be the largest integer such that 𝑎= 2 𝑘 1 ⋅𝐴⇒ 𝑎 2 = 2 2 𝑘 1 ⋅ 𝐴 2 Let 𝑘 2 ∈ℕ be the largest integer such that 𝑏= 2 𝑘 2 ⋅𝐵⇒ 𝑏 2 = 2 2 𝑘 2 ⋅ 𝐵 2 Since 𝑘 1 , 𝑘 2 are largest ints, 𝐴 and 𝐵 are odd, so 𝐴 2 , 𝐵 2 odd (we proved this) 𝑎 2 =2 𝑏 2 ⇒ 𝟐 𝟐 𝒌 𝟏 ⋅ 𝑨 𝟐 =𝟐⋅ 𝟐 𝟐 𝒌 𝟐 ⋅ 𝑩 𝟐 = 𝟐 𝟐 𝒌 𝟐 +𝟏 ⋅ 𝑩 𝟐 Even number of 2s on left side, odd number of 2s on right Contradiction.

Proof of 5 ∉ℚ with UFT 𝒂 𝟐 =𝟓 𝒃 𝟐 ⇒ 𝟓 𝟐 𝒌 𝟏 ⋅ 𝑨 𝟐 = 𝟓 𝟐 𝒌 𝟐 +𝟏 ⋅ 𝑩 𝟐 Proof (by contradiction) Assume that 5 ∈ℚ⇒ ∃𝑎∈ℤ, 𝑏∈ ℤ ≠0 5 = 𝑎 𝑏 ⇒(∃𝑎∈ℤ, 𝑏∈ ℤ ≠0 )[ 𝑎 2 =5 𝑏 2 ] Let 𝑘 1 , 𝑘 2 ∈ℤ be the largest integers such that 𝑎= 5 𝑘 1 ⋅𝐴, 𝑏= 5 𝑘 2 ⋅𝐵. Clearly, 𝐴,𝐵 ≢0 (𝑚𝑜𝑑 5), so 𝐴 2 , 𝐵 2 ≢0 (𝑚𝑜𝑑 5) (make sure you’re convinced) 𝒂 𝟐 =𝟓 𝒃 𝟐 ⇒ 𝟓 𝟐 𝒌 𝟏 ⋅ 𝑨 𝟐 = 𝟓 𝟐 𝒌 𝟐 +𝟏 ⋅ 𝑩 𝟐 Even number of 5s on the left, odd on the right. Contradiction.

Proof that 4 ∉ℚ (???) with UFT Why can we not use this machinery to prove that 4 is irrational (which is wrong anyway)?

Speed of Computations in Number Theory

Basic assumptions 𝑎+𝑏 and 𝑎⋅𝑏 have unit cost This is not true if 𝑎,𝑏 are too large Jason: Do you mean >64 bits or something? Bill: Nobody cares, just say “large”.

First problem How fast can we compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 𝑛, 𝑚∈ℕ ? Obviously, we can compute 𝑎 𝑛 = 𝑎×𝑎×⋯×𝑎 and mod that large number by 𝑚. 𝑛 𝑡𝑖𝑚𝑒𝑠

First problem How fast can we compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 𝑛, 𝑚∈ℕ ? Obviously, we can compute 𝑎 𝑛 = 𝑎 × 𝑎 ×⋯ ×𝑎 and mod that large number by 𝑚. Is this algorithm ? 𝑛 𝑡𝑖𝑚𝑒𝑠 Good Bad Ugly

First problem How fast can we compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 𝑛, 𝑚∈ℕ ? Obviously, we can compute 𝑎 𝑛 = 𝑎 × 𝑎 ×⋯×𝑎 and mod that large number by 𝑚. Is this algorithm ? 𝑛 𝑡𝑖𝑚𝑒𝑠 Because: Jason: Numbers can get above 32 bits, and that’s a storage and computation problem. Bill: Numbers get “too freaking large”. Good Bad Ugly

First problem, second approach We could start computing 𝑎 × 𝑎 × … × 𝑎 until the product becomes larger than 𝑚, reduce and repeat until we’re done.

First problem, second approach We could start computing 𝑎 × 𝑎⋯ × 𝑎 until the product becomes larger than 𝑚, reduce and repeat until we’re done. Is this better? Yes No Something Else

First problem, second approach We could start computing 𝑎 × 𝑎 ×⋯× 𝑎 until the product becomes larger than 𝑚, reduce and repeat until we’re done. Is this better? Yes No Something Else We no longer produce huge numbers! However, we still need 𝑛 multiplications.

First problem How fast can we compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 𝑛, 𝑚∈ℕ ? We always need 𝑛 steps We can do it in roughly 𝑛 steps We can do it in roughly log𝑛 steps Something Else

First problem How fast can we compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 𝑛, 𝑚∈ℕ ? We always need 𝑛 steps We can do it in roughly 𝑛 steps We can do it in roughly log𝑛 steps Something Else

Example Computing 3 64 𝑚𝑜𝑑 99 in log 2 64 =6 steps. All ≡ are ≡ (mod 99). 3 1 ≡3 3 2 ≡9 3 2 2 ≡ 3 2 2 ≡ 9 2 ≡81 3 2 3 ≡ 3 2 2 2 ≡ 81 2 ≡27 3 2 4 ≡ 3 2 3 2 ≡ 27 2 ≡36 3 2 5 ≡ 3 2 4 2 ≡ 36 2 ≡9 3 2 6 ≡ 9 2 ≡81

Example Computing 3 64 𝑚𝑜𝑑 99 in log 2 64 =6 steps. All ≡ are ≡ (mod 99). 3 2 1 ≡9 3 2 2 ≡ 3 2 2 ≡ 9 2 ≡81 3 2 3 ≡ 3 2 2 2 ≡ 81 2 ≡27 3 2 4 ≡ 3 2 3 2 ≡ 27 2 ≡36 3 2 5 ≡ 3 2 4 2 ≡ 36 2 ≡9 3 2 6 ≡ 9 2 ≡81 Aha! 3 64 =3 2 6 ≡81

Good news, bad news Good news: By using repeated squaring, can compute 𝑎 2 ℓ 𝑚𝑜𝑑 𝑚 quickly (roughly ℓ= log 2 2 ℓ steps) Bad news: What if our exponent is not a power of 2?

Example Computing 3 27 𝑚𝑜𝑑 99 with the same method All ≡ are ≡ (mod 99). 3 1 ≡3 3 2 ≡9 3 2 2 ≡ 3 2 2 ≡ 9 2 ≡81 3 2 3 ≡ 3 2 2 2 ≡ 81 2 ≡27 3 2 4 ≡ 3 2 3 2 ≡ 27 2 ≡36 3 27 = 3 16 × 3 8 × 3 2 × 3 1 ≡36 × 27 × 9 × 3

Example (contd.) To avoid large numbers, reduce product as you go: 3 27 = 3 16 × 3 8 × 3 2 × 3 1 ≡36 × 27 × 9 × 3≡ 36 × 27 × 9 × 3 ≡81 × 27≡9

Algorithm to compute 𝑎 𝑛 𝑚𝑜𝑑 𝑚 in log𝑛 steps Step 1: Write 𝑛= 2 𝑞 1 + 2 𝑞 2 +…+ 2 𝑞 𝑟 , 𝑞 1 < 𝑞 2 <…< 𝑞 𝑟 Step 2: Note that 𝑎 𝑛 = 𝑎 2 𝑞 1 + 2 𝑞 2 +…+ 2 𝑞 𝑟 = 𝑎 2 𝑞 1 ×…× 𝑎 2 𝑞 𝑟 Step 3: Use repeated squaring to compute: 𝑎 2 0 , 𝑎 2 1 , 𝑎 2 2 , …, 𝑎 𝑞 𝑟 𝑚𝑜𝑑 𝑚 using 𝑎 2 𝑖+1 ≡ 𝑎 2 𝑖 2 𝑚𝑜𝑑 𝑚 Step 4: Compute 𝑎 2 𝑞 1 ×…× 𝑎 2 𝑞 𝑟 mod m reducing when necessary to avoid large numbers

The key step The key step is Step #3: Use repeated squaring to compute: 𝑎 2 0 , 𝑎 2 1 , 𝑎 2 2 , …, 𝑎 2 𝑞 𝑟 𝑚𝑜𝑑 𝑚 using 𝑎 2 𝑖+1 ≡ 𝑎 2 𝑖 2 𝑚𝑜𝑑 𝑚 When computing 𝑎 2 𝑖+1 mod m, already have computed 𝑎 2 𝑖 2 𝑚𝑜𝑑 𝑚 Note that all numbers are below 𝑚 because we reduce mod m every step of the way So 𝑎 2 𝑖 2 is unit cost and anything mod m is also unit cost!

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏 What is the GCD of… 10 and 15?

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏 What is the GCD of… 10 and 15? 5 12 and 90?

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏 What is the GCD of… 10 and 15? 5 12 and 90? 6 20 and 29?

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏 What is the GCD of… 10 and 15? 5 12 and 90? 6 20 and 29? 1 (20 and 29 are called co-prime or relatively prime) 153 and 181

Second problem: Greatest Common Divisor (GCD) If 𝑎, 𝑏∈ ℕ ≠0 , then the GCD of 𝑎, 𝑏 is the largest non-zero integer 𝑛 such that 𝑛 |𝑎 and 𝑛 | 𝑏 What is the GCD of… 10 and 15? 5 12 and 90? 6 20 and 29? 1 (20 and 29 are called co-prime or relatively prime) 153 and 181 17

Euclid’s GCD algorithm Recall: If 𝑎≡0 (𝑚𝑜𝑑 𝑚) and 𝑏≡0 𝑚𝑜𝑑 𝑚 , then 𝑎 −𝑏≡ 0 𝑚𝑜𝑑 𝑚 The GCD algorithm finds the greatest common divisor by executing this recursion (assume a > b): 𝐺𝐶𝐷 𝑎, 𝑏 =𝐺𝐶𝐷 𝑎, 𝑏 −𝑎 Until its arguments are the same.

Greatest Common Divisor (GCD) Recall: If 𝑎≡0 (𝑚𝑜𝑑 𝑚) and 𝑏≡0 𝑚𝑜𝑑 𝑚 , then 𝑎 −𝑏≡ 0 𝑚𝑜𝑑 𝑚 The GCD algorithm finds the greatest common divisor by executing this recursion (assume a > b): 𝐺𝐶𝐷 𝑎, 𝑏 =𝐺𝐶𝐷 𝑎, 𝑏 −𝑎 Until its arguments are the same. Question: If we implement this in a programming language, it can only be done recursively Yes (why) No (Why) Something Else (What)

Greatest Common Divisor (GCD) Recall: If 𝑎≡0 (𝑚𝑜𝑑 𝑚) and 𝑏≡0 𝑚𝑜𝑑 𝑚 , then 𝑎 −𝑏≡ 0 𝑚𝑜𝑑 𝑚 The GCD algorithm finds the greatest common divisor by executing this recursion: 𝐺𝐶𝐷 𝑎, 𝑏 =𝐺𝐶𝐷 𝑎, 𝑏 −𝑎 Until its arguments are the same. Question: If we implement this in a programming language, it can only be done recursively Tail recursion left = a; right = b; while(left != right){ if(left > right) left = left – right; else right = right - left; } print "GCD is: " left; // Or right Yes (why) No (Why) Something Else (What)

GCD example GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)=

GCD example GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= Given integers 𝑎, 𝑏 with 𝑎>𝑏 (without loss of generality), approximately how many steps does this algorithm take? a steps b steps a-b steps Something Else

GCD example GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= Given integers 𝑎, 𝑏 with 𝑎>𝑏 (without loss of generality), approximately how many steps does this algorithm take? a steps b steps Roughly 𝑎 𝑏 a-b steps Something Else

Can we do better? GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= Yes No Something Else GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= GCD(18, 82 – 18 = GCD(18, 64) = GCD(18, 64 – 18) = GCD(18, 46) = GCD(18, 46 – 18) = GCD(18, 28) = GCD(18, 28 – 18) = GCD(18, 10) = GCD(18 - 10, 10) = GCD(8, 10)= GCD(8, 10 - 8)= GCD(8, 2) = GCD(8 - 2, 2) = GCD(6, 2) = GCD(6 - 2, 2) = GCD(4, 2) = GCD(4- 2, 2) = GCD(2, 2) = 2

Can we do better? GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= Yes No Something Else GCD(18, 100) = GCD(18, 100 – 18) = GCD(18, 82)= GCD(18, 82 – 18 = GCD(18, 64) = GCD(18, 64 – 18) = GCD(18, 46) = GCD(18, 46 – 18) = GCD(18, 28) = GCD(18, 28 – 18) = GCD(18, 10) = GCD(18 - 10, 10) = GCD(8, 10)= GCD(8, 10 - 8)= GCD(8, 2) = GCD(8 - 2, 2) = GCD(6, 2) = GCD(6 - 2, 2) = GCD(4, 2) = GCD(4- 2, 2) = GCD(2, 2) = 2 GCD(18, 100 – 5 x 18) GCD(18, 100) = GCD(18, 100 – 5 x 18) = GCD(18, 10) = GCD(18 – 10, 10) = GCD(8, 10) = GCD(8, 10 - 8) = GCD(8, 2) = GCD(8 – 3 x 2, 2) = GCD(2, 2) = 2 GCD(8 – 3 x 2, 2) From 10 to 4 steps!

How fast is this new algorithm? Given non-zero integers 𝑎, 𝑏 with 𝑎 > 𝑏, roughly how many steps does this new algorithm take to compute GCD(a, b)? 𝑎 𝑏 2 𝑎 loga Something Else

How fast is this new algorithm? Given non-zero integers 𝑎, 𝑏 with 𝑎 > 𝑏, roughly how many steps does this new algorithm take to compute GCD(a, b)? In fact, it takes log 𝜙 𝑎 , where 𝜙= 1+ 5 2 is the golden ratio. Proof by Gabriel Lamé in 1844, considered to be the first ever result in Algorithmic Complexity theory. 𝑎 𝑏 2 𝑎 loga Something Else