Module 1. Integers, Induction, and Recurrences

Similar documents
Ch 4.2 Divisibility Properties

Chapter 5. Number Theory. 5.1 Base b representations

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

MATH 215 Final. M4. For all a, b in Z, a b = b a.

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

4 Powers of an Element; Cyclic Groups

1 Overview and revision

Lecture 4: Number theory

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

Basic elements of number theory

Basic elements of number theory

CSE 1400 Applied Discrete Mathematics Proofs

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

3 The fundamentals: Algorithms, the integers, and matrices

1. multiplication is commutative and associative;

Well-Ordering Principle. Axiom: Every nonempty subset of Z + has a least element. That is, if S Z + and S, then S has a smallest element.

CISC-102 Fall 2017 Week 6

CHAPTER 4: EXPLORING Z

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

Senior Math Circles Cryptography and Number Theory Week 2

Writing Assignment 2 Student Sample Questions

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

Definition For a set F, a polynomial over F with variable x is of the form

Homework #2 solutions Due: June 15, 2012

4 Number Theory and Cryptography

We want to show P (n) is true for all integers

NOTES ON SIMPLE NUMBER THEORY

4. Number Theory (Part 2)

12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.

5: The Integers (An introduction to Number Theory)

Number Theory Notes Spring 2011

Intermediate Math Circles February 26, 2014 Diophantine Equations I

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

The Euclidean Algorithm and Multiplicative Inverses

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Notes on Systems of Linear Congruences

Remainders. We learned how to multiply and divide in elementary

NOTES ON INTEGERS. 1. Integers

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

Basic Algebra. Final Version, August, 2006 For Publication by Birkhäuser Boston Along with a Companion Volume Advanced Algebra In the Series

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.

Elementary Properties of the Integers

a = qb + r where 0 r < b. Proof. We first prove this result under the additional assumption that b > 0 is a natural number. Let

2 Elementary number theory

MATH FINAL EXAM REVIEW HINTS

Complete Induction and the Well- Ordering Principle

Applied Cryptography and Computer Security CSE 664 Spring 2017

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic

Number Theory and Graph Theory

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Chapter 2. Divisibility. 2.1 Common Divisors

Ma/CS 6a Class 2: Congruences

Properties of the Integers

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

Chapter 1 A Survey of Divisibility 14

CPSC 467: Cryptography and Computer Security

Finite Fields. Mike Reiter

The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Chapter 1 : The language of mathematics.

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

With Question/Answer Animations. Chapter 4

Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition. Todd Cochrane

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

CS250: Discrete Math for Computer Science

Chapter 5: The Integers

The Chinese Remainder Theorem

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

Modular Arithmetic Instructor: Marizza Bailey Name:

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

CHAPTER 8: EXPLORING R

Number Theory Proof Portfolio

Beautiful Mathematics

Some Facts from Number Theory

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

a the relation arb is defined if and only if = 2 k, k

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

CMPUT 403: Number Theory

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b.

MATH10040 Chapter 1: Integers and divisibility

Math Circles - Lesson 2 Linear Diophantine Equations cont.

Deepening Mathematics Instruction for Secondary Teachers: Algebraic Structures

0 Sets and Induction. Sets

C-N Math 207 Discrete Math

C-N Math 207 Discrete Math

Numbers, Groups and Cryptography. Gordan Savin

Transcription:

Module 1. Integers, Induction, and Recurrences This module will look at The integers and the natural numbers. Division and divisors, greatest common divisors Methods of reasoning including proof by contradiction and proof by induction. Thesolutiontocertainrecursivelydefined sequences Sincediscretemathdealswith discrete entities, we can count them and so the counting numbers play an important role. Reading: Gossett Ch 3.1, 3.2, 3.3, 3.4 (optional), 3.6. Typeset October 13, 2005 1

Integers and Natural Numbers Recall: The integers Z = {0, 1, 1, 2, 2,...} and the natural numbers N = {0, 1, 2,...} These are important sets. We will study them for their own sake and use them as a source of examples of general proof techniques that apply throughout math. Axiom: The well ordering principle (WOP). Inany nonempty set of natural numbers, there is a unique smallest member. Typeset October 13, 2005 2

Starting point. Besides the WOP, we ll assume that the basic facts of addition, subtraction, multiplication, and comparison are all understood for the integers and the natural numbers. For example, I ll use the inference for natural numbers a b<c b a<c without stopping to justify it. Aside:Itwouldbepossibletostartinsteadwith just 0 and function succ and prec as undefined terms and a small number of axioms (called the Peano postulates) about them and define addition, subtraction, multiplication, and comparison in terms of these undefined terms. (The functions turn out to be such that succ(a) =a+1 and prec(b) =b 1.) However, such an exercise would take a while and not add much to your practical understanding of the integers. Therefore we next look at division of integers. Typeset October 13, 2005 3

Division Lemma: The Euclidean lemma For any a, b N, with b 6= 0, there exists a pair of natural numbers (q, r) such that a = qb + r and r<b. Aside: We can express this theorem more concisely as a, b N, [b 6= 0 q, r N, (a = qb + r r<b)] Proof Let a and b be any natural numbers at all Suppose that b 6= 0. We need to show that there exist natural numbers q and r that satisfy the constraints a = qb + r and r<b Consider the set S, {s N q N,s= a qb} S is not empty because, by choosing q =0,wecan see that a S. Since S is not empty, there is (by the WOP) a smallest member. Call it r 0. Typeset October 13, 2005 4

Let q 0 be such that r 0 = a q 0 b (such a q 0 must exist since r 0 S) From the definition of q 0 (adding q 0 b to both sides) we have a = q 0 b + r 0 Proof that r 0 <b. Suppose (falsely, it will turn out) r 0 b Let r 1 = r 0 b. Noter 1 N since r 0 b. Note also r 1 <r 0 since b>0. Let q 1 = q 0 +1 r 1 = r 0 b = a q 0 b b = a (q 0 b + b) = a (q 0 +1)b = a q 1 b So r 1 S. But this contradicts that r 0 is the smallest member of the set. Thus, in fact, r 0 <b (q 0,r 0 ) is a pair that satisfies the constraints. Typeset October 13, 2005 5

Aside on reasoning techniques used This single proof illustrates several important proof techniques. Direct proof of for all To prove that all members of a set V have some property P : x V,P(x) Pick a name x for an arbitrary member of the set, then show that P (x) is true. We wrote: Suppose that a, b are any natural numbers at all. The rest of the proof shows that b 6= 0 q, r N, (a = qb + r r<b) Direct proof of implication To prove an implication P Q: Suppose that P is true, show that Q is also true. We wrote: Typeset October 13, 2005 6

Suppose that b 6= 0. The rest of the proof shows q, r N, (a = qb + r r<b) Likewise, to show P Q: Suppose that P is true and show that Q must then be true. This is because P Q P Q. Constructive proof of existence To show that x V,P(x): Findanexamplex 0 V and then show that P (x 0 ) is true. We constructed numbers r 0 and q 0 and then showed that a = q 0 b + r 0 r 0 <b Proof of a conjunction To show P Q: ProveP and then prove Q. (Actually, when proving Q we may assume P, since it has already been proved, or, to put it another way, because P Q P (P Q).) To prove a = q 0 b + r 0 r 0 <bwe first proved a = q 0 b + r 0 and then proved r 0 <b. Typeset October 13, 2005 7

Proof by contradiction To show P : Assume P and then prove something that is false. We wanted to show r 0 <b,soweassumedthatr 0 b and then showed that this implied that r 0 is not the smallest member of S, when in fact, by definition, it is. Suppose (falsely, it will turn out) r 0 b This part of the proof shows a contradiction. Thus, in fact, r 0 <b Justifying existence If you introduce a name for an object that has certain properties, then you must be able to justify that such an object actually exists. In the example, we justified the existence of a the smallest member of S by appealing to the WOP and we justified the existence of a q 0 such that r 0 = a q 0 b by the fact that r 0 S and by defining property of the set S. Typeset October 13, 2005 8

Back to division We can extend the above lemma in two ways. First we extend it from the natural numbers to the integers. Second, we show that the pair is unique. Notn: The absolute value of an integer b is the natural number b such that b = b b = b. Theorem: The Euclidean Division Algorithm [Note this is not really an algorithm, It is an existence theorem.] For any a, b Z with b 6= 0, there exists a unique pair of integers (q, r) such that a = qb + r and 0 r< b Proof of existence. Let a and b be any members of Z with b 6= 0. Case: a, b N Our Euclidean lemma already proves the existence of (q, r) Case a N and b N Let (q 1,r 1 ) be such that bq 1 + r 1 = a and 0 r 1 < b. (Suchapairmustexistbythe Euclidean lemma) Let q 0 = q 1 and r 0 = r 1 Typeset October 13, 2005 9

The pair (q 0,r 0 ) satisfies the constraints a = q 0 b + r 0 and 0 r 0 < b Case a N and b N Let (q 1,r 1 ) be such that bq 1 +r 1 = a and 0 r 1 <b. (Such a pair must exist by the Euclidean lemma) Case r 1 > 0 a = bq 1 r 1 = b(q 1 +1 1) r 1 = b(q 1 +1)+b r 1 Let q 0 = (q 1 +1)and r 0 = b r 1 Note that since 0 <r 1 <bwe have 0 <r 0 <b The pair (q 0,r 0 ) satisfies the constraints a = q 0 b + r 0 and 0 r 0 < b Case r 1 =0 a = bq 1 Let q 0 = q 1 and r 0 =0 The pair (q 0,r 0 ) satisfies the constraints a = q 0 b + r 0 and 0 r 0 < b Case a N and b N Let (q 1,r 1 ) be such that bq 1 + r 1 = a and Typeset October 13, 2005 10

0 r 1 < b. (Suchapairmustexistbythe Euclidean lemma) Case r 1 > 0 a = bq 1 r 1 = b(q 1 +1 1) r 1 = b(q 1 +1) b r 1 = b(q 1 +1)+( b r 1 ) Let q 0 =(q 1 +1)and r 0 =( b r 1 ). Note that since 0 <r 1 < b we have 0 <r 0 < b The pair (q 0,r 0 ) satisfies the constraints a = q 0 b + r 0 and 0 r 0 < b Case r 1 =0 a = bq 1 Let q 0 = q 1 and r 0 =0 The pair (q 0,r 0 ) satisfies the constraints a = q 0 b + r 0 and 0 r 0 < b By the way, Gossett presents a much more elegant existence proof by generalizing the construction we used Typeset October 13, 2005 11

to prove the lemma. For this reason he does not need and does not present the lemma. Aside This proof illustrates two more useful proof techniques Proof by cases. We want to prove P. First assume A 0 and prove P under that assumption. Then assume A 1 and prove P under that assumption. As long as A 0 A 1 is clearly true, then we have proved P. The idea extends to any number of cases. Using previously proved theorems and lemmata In the above proof we appealed a number of times to the lemmaprovedearlier. It makes sense to decompose complicated arguments into a number of theorems, just as one would decompose a complex algorithm into a number of subroutines. Typeset October 13, 2005 12

Back to the Euclidean Algorithm The Euclidean Algorithm asserts also that the pair (q, r) is unique. Proof of uniqueness. Let a and b be any integers such that b 6= 0 Suppose that (q 1,r 1 ) and (q 2,r 2 ) are two (possibly equal) pairs that such that 0 r 1,r 2 < b, a = q 1 b + r 1,and a = q 2 b + r 2 Then q 1 b + r 1 = q 2 b + r 2 So b(q 1 q 2 )=r 2 r 1.So b q 1 q 2 = r 2 r 1 Since 0 r 1,r 2 < b we know r 2 r 1 < b From the last two lines: b q 1 q 2 < b Cancelling the b we get q 1 q 2 < 1 Hence (as q 0 and q 1 are both integers) q 1 = q 2 And since b(q 1 q 2 )=r 2 r 1 this means r 1 = r 2 Typeset October 13, 2005 13

Aside on the proof technique This proof illustrates a common method of proving uniqueness (nonduplication) To show that no more than 1 thing has property P : Let x and y be any two things. Assume P (x) and P (y). Show x = y under these assumptions. Underlying this proof technique is the following fact about sets ( x, y S, x 6= y) S > 1 or equivalently (negating both sides & using De Morgan) ( x, y S, x = y) S 1 which might be worth a moment s thought. Back to division again If (q, r) satisfy the conditions set out we call q the quotient of a divided by b and we call r the remainder of a divided by b. Typeset October 13, 2005 14

Notation div We write a div b to mean the quotient, when a is divided by b. mod We write a mod b to mean the remainder when a is divided by b. Thus, when b 6= 0, b(a div b) +a mod b = a and 0 a mod b< b Examples 9div3=3 while 9mod3=0 10 div 3 = 3 while 10 mod 3 = 1 11 div 3 = 3 while 11 mod 3 = 2 9div3= 3 while 9mod3=0 10 div 3 = 4 while 10 mod 3 = 2 11 div 3 = 4 while 11 mod 3 = 1 10 div 3 = 3 while 10 mod 3 =1 10 div 3 =4 while 10 mod 3 =2 If x is a real number then floor bxc is the largest integer not larger than x Typeset October 13, 2005 15

ceiling dxe is the smallest integer not smaller than x Note that a div b = a b,ifb>0 a div b = a b, ifb<0 a div b = a b iff a mod b =0 a mod b = a b(a div b) Typeset October 13, 2005 16

Divisibility Divisibility: Fora, b Z, wesaythatb a ( b divides a ) iff there exists an integer q such that a = bq. When b 6= 0,thisistosayamod b =0or that a div b = a b True or false? 6 12, 6 6, 6 0, 6 6 all true 6 11 false 0 0 true Theorem: If a b and a c then a b + c a k b, foranyk Z. a b c Theorem: For all a, b, c N Reflexivity: a a Antisymmetry: If a b and b a then a = b Transitivity: If a b and b c then a c. This is to say divisibility is a partial order on the naturals. Typeset October 13, 2005 17

(For the integers, divisibility is reflexive and transitive, but not antisymmetric. Why?) Divisors. We say that the divisors of an integer a is the set of integers b such that b a. Congruence. If integers a, b, andm are such that m (a b) then we say that a and b are congruent mod. m. Thus for each integer m there is a different binary relation of congruence. Notn. We write a b (mod m) to mean that a and b are congruent mod m. Aside: Note that the use of the symbol mod here is quite different from our earlier use of mod as a binary operator. Here we are using mod in a parenthetical remark that indicates which relation of congruence we are dealing with at the moment. Theorem. If a b (mod m) and c d (mod m) then a + c b + d (mod m) ka kb (mod m) ac bd (mod m) Typeset October 13, 2005 18

Proof Assume a b (mod m) and c d (mod m) Since a b (mod m) we know m (a b) Andthusthereisanintegerq 0 such that q 0 m =(a b). Similarly, there is an integer q 1 such that q 1 m =(c d). Part 0: WTP a + c b + d (mod m) Consider (a + c) (b + d) (a + c) (b + d) =(a b)+(c d) = q 0 m + q 1 m =(q 0 + q 1 )m Since (a + c) (b + d) =(q 0 + q 1 )m, a + c b + d (mod m) Part 1: WTP ka kb (mod m) Consider ka kb ka kb = k(a b) kq 0 m Since ka kb = kq 0 m, ka kb (mod m) Typeset October 13, 2005 19

Part 2 WTP ac bd (mod m) We know a = q 0 m + b and d = c q 1 m Consider ac bd ac bd =(q 0 m + b)c b(c q 1 m) = q 0 mc + bc bc + q 1 mb =(q 0 c + q 1 b)m So ac bd (mod m) Theorem. For all a, b, c, m Z and m 6= 0 Reflexivity: a a (mod m) Symmetry: a b (mod m) iff b a (mod m) Transitivity: If a b (mod m) and b c (mod m) then a c (mod m). This is to say that congruence mod m is an equivalence relation. GCD: The greatest common divisor of two integers (not both 0) is the largest integer that divides both. I.e. gcd(a, b) a and gcd(a, b) b and for all c if c a and c b then c gcd(a, b). Typeset October 13, 2005 20

E.g. gcd(12, 8) is what? gcd(9, 3) is what? gcd(0, 20) is what? gcd(10, 21) is what? If gcd(a, b) =1, what does that say about a and b? Theorem gcd(0,b)=b, ifb is a positive integer gcd(a, b) =gcd(b, a), ifeithera 6= 0or b 6= 0 If b 6= 0, then gcd(a, b) =gcd(amod b, b) Proof of last part Let r = a mod b and q = a div b. Thena = qb + r. Let g 0 =gcd(a, b) and g 1 =gcd(r, b) Since g 1 r and g 1 b, wehaveg 1 qb + r, and thus g 1 a Also g 1 b and so g 1 is a divisor of both a and b. Thus g 1 g 0 (by definition of GCD) Since g 0 b we have g 0 qb. Since g 0 a and g 0 qb we have g 0 a qb and thus Typeset October 13, 2005 21

g 0 r. Since g 0 divides both r and b we have g 0 g1 (by the definition of GCD) Since g 1 g 0 and g 0 g 1 we have g 0 = g 1. Using this theorem we can see that the following algorithm computes the gcd(a, B) for natural A and B where A 6= 0or B 6= 0 { // Euclidean algorithm for GCD in C/Java notation. int a = A, b = B ; // Loop invariant: gcd(a,b) == gcd(a,b) // && (a!=0 b!=0) while( b!= 0 ) { int r = a % b ; a=b; b=r;} gcd=a;} Aside: What is a loop invariant? A loop invariant is a statement about the state of the program that is true just before the evaluation of a Typeset October 13, 2005 22

loop s guard expression (in this case b 6= 0is the guard expression). In our example, the invariant is trivially true at the start of the first iteration because a and b are initialized to A and B respectively. In our example, the invariant is true at the end of each iteration because it was true at the start of the iteration. To see this, let a and b be the values of a and b at the start of an iteration and let a 0 and b 0 be the values of a and b at the end of the iteration: a 0 = b and b 0 = a mod b We have gcd(a, B) =gcd(a, b) Assuming the invariant holds at start =gcd(b, a mod b) Latest theorem =gcd(a 0,b 0 ) From the loop body Fromtheloopguardwehaveb 6= 0so a 0 6=0. Thus gcd(a, B) =gcd(a 0,b 0 ) (b 0 6=0 a 0 6=0) When the loop is exited, the invariant gcd(a, B) = gcd(a, b) will be true and so will b =0.Thus,whenthe loop is exited, gcd(a, B) =a. Typeset October 13, 2005 23