MATH 135 Course Note

342
Reading, Discovering and Writing Proofs Version 0.2.6 c Steven Furino August 29, 2012

description

Waterloo Math 135 Course Note

Transcript of MATH 135 Course Note

Page 1: MATH 135 Course Note

Reading, Discovering and Writing Proofs

Version 0.2.6

c© Steven Furino

August 29, 2012

Page 2: MATH 135 Course Note

Contents

I Introduction 11

1 In the beginning 121.1 What Makes a Mathematician a Mathematician? . . . . . . . . . . . . . . . 121.2 How The Course Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.3 Why do we reason formally? . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.4 Reading and Lecture Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . 16

1.4.1 Lecture Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.4.2 Reading Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Our First Proof 182.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.2 The Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.3 Implications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.4 Our First Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3 Discovering Proofs 263.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.2 Discovering a Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.3 Reading A Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.4 The Division Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

II Foundations 33

4 Truth Tables 344.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.2 Truth Tables as Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.3 Truth Tables to Evaluate Logical Expressions . . . . . . . . . . . . . . . . . 364.4 Contrapositive and Converse . . . . . . . . . . . . . . . . . . . . . . . . . . 394.5 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.6 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

5 Introduction to Sets 415.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415.2 Describing a Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415.3 Set Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.3.1 Venn Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.4 Comparing Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

5.4.1 Sets of Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.4.2 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

2

Page 3: MATH 135 Course Note

Section 0.0 CONTENTS 3

5.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

6 More on Sets 506.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506.2 Showing Two Sets Are Equal . . . . . . . . . . . . . . . . . . . . . . . . . . 506.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

III Proof Techniques 53

7 Quantifiers 547.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547.2 Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547.3 The Object Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577.4 The Construct Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587.5 The Select Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617.6 Sets and Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627.7 A Non-Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

8 Nested Quantifiers 658.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658.2 Onto (Surjective) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

8.2.1 Definition of Function . . . . . . . . . . . . . . . . . . . . . . . . . . 658.2.2 Definition of Onto (Surjective) . . . . . . . . . . . . . . . . . . . . . 668.2.3 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688.2.4 Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698.2.5 A Difficult Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

8.3 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728.3.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728.3.2 Reading A Limit Proof . . . . . . . . . . . . . . . . . . . . . . . . . 738.3.3 Discovering a Limit Proof . . . . . . . . . . . . . . . . . . . . . . . . 758.3.4 A Harder Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

9 Practice, Practice, Practice: Quantifiers and Sets 809.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

10 Simple Induction 8410.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8410.2 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

10.2.1 Summation Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 8410.2.2 Product Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8610.2.3 Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

10.3 Introduction to Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8710.4 Principle of Mathematical Induction . . . . . . . . . . . . . . . . . . . . . . 87

10.4.1 Why Does Induction Work? . . . . . . . . . . . . . . . . . . . . . . . 8810.4.2 Two Examples of Simple Induction . . . . . . . . . . . . . . . . . . . 8810.4.3 A Different Starting Point . . . . . . . . . . . . . . . . . . . . . . . . 90

10.5 An Interesting Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9210.6 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

Page 4: MATH 135 Course Note

4 Chapter 0 CONTENTS

11 Strong Induction 9611.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9611.2 Strong Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9611.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

12 Binomial Theorem 10212.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10212.2 Binomial Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10212.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10612.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

13 Negation 10713.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10713.2 Negating Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10713.3 Negating Statements with Quantifiers . . . . . . . . . . . . . . . . . . . . . 109

13.3.1 Counterexamples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11013.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

14 Contradiction 11314.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11314.2 How To Use Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

14.2.1 When To Use Contradiction . . . . . . . . . . . . . . . . . . . . . . . 11414.2.2 Reading a Proof by Contradiction . . . . . . . . . . . . . . . . . . . 11414.2.3 Discovering and Writing a Proof by Contradiction . . . . . . . . . . 115

15 Contrapositive 11815.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11815.2 The Contrapositive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

15.2.1 When To Use The Contrapositive . . . . . . . . . . . . . . . . . . . . 11815.3 Reading a Proof That Uses the Contrapositive . . . . . . . . . . . . . . . . 118

15.3.1 Discovering and Writing a Proof Using The Contrapositive . . . . . 120

16 Uniqueness 12216.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12216.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12216.3 Showing X = Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12316.4 Finding a Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12416.5 The Division Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

17 Elimination 12817.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12817.2 When to Use the Elimination Method . . . . . . . . . . . . . . . . . . . . . 12817.3 How to Use the Elimination Method . . . . . . . . . . . . . . . . . . . . . . 12817.4 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12917.5 Writing and Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

IV Securing Internet Commerce 132

18 The Greatest Common Divisor 13318.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13318.2 Greatest Common Divisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Page 5: MATH 135 Course Note

Section 0.0 CONTENTS 5

18.3 Certificate of Correctess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13718.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13918.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

19 The Extended Euclidean Algorithm 14119.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14119.2 The Extended Euclidean Algorithm (EEA) . . . . . . . . . . . . . . . . . . 14119.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

20 Properties Of GCDs 14620.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14620.2 Some Useful Propositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14620.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

21 Linear Diophantine Equations:One Solution 15321.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15321.2 Linear Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 153

21.2.1 Finding One Solution to ax+ by = c . . . . . . . . . . . . . . . . . . 154

22 Linear Diophantine Equations:All Solutions 15822.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15822.2 Finding All Solutions to ax+ by = c . . . . . . . . . . . . . . . . . . . . . . 15822.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16222.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

23 Congruence 16523.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16523.2 Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

23.2.1 Definition of Congruences . . . . . . . . . . . . . . . . . . . . . . . . 16523.3 Elementary Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16623.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

24 Congruence and Remainders 17124.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17124.2 Congruence and Remainders . . . . . . . . . . . . . . . . . . . . . . . . . . . 17124.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17524.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

25 Modular Arithmetic 17625.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17625.2 Modular Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

25.2.1 [0] ∈ Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17825.2.2 [1] ∈ Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17825.2.3 Identities and Inverses in Zm . . . . . . . . . . . . . . . . . . . . . . 17925.2.4 Subtraction in Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18025.2.5 Division in Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

25.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

26 Fermat’s Little Theorem 18126.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

Page 6: MATH 135 Course Note

6 Chapter 0 CONTENTS

26.2 Fermat’s Little Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18126.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18626.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

27 Linear Congruences 18727.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18727.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18727.3 Extending Equivalencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19027.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19027.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

28 Chinese Remainder Theorem 19328.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19328.2 An Old Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19328.3 Chinese Remainder Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 19428.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19728.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

29 Practice, Practice, Practice: Congruences 19929.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19929.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19929.3 Preparing for RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

30 The RSA Scheme 20630.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20630.2 Private Key Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

30.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20630.2.2 Substitution Cipher . . . . . . . . . . . . . . . . . . . . . . . . . . . 20730.2.3 Looking for Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 20930.2.4 Vigenere Ciphers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

30.3 Why Public Key Cryptography? . . . . . . . . . . . . . . . . . . . . . . . . 21230.4 Implementing RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

30.4.1 Setting up RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21330.4.2 Sending a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21330.4.3 Receiving a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 21330.4.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

30.5 Does M = R? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21530.6 How Secure Is RSA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

V Bijections and Counting 218

31 Injections and Bijections 21931.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21931.2 One-to-one (Injective) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

31.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21931.2.2 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22031.2.3 Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22131.2.4 A Difficult Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

31.3 Bijections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22331.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

Page 7: MATH 135 Course Note

Section 0.0 CONTENTS 7

32 Counting 22532.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22532.2 African Shepherds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22532.3 What Does It Mean To Count? . . . . . . . . . . . . . . . . . . . . . . . . . 22632.4 Showing That A Bijection Exists . . . . . . . . . . . . . . . . . . . . . . . . 22632.5 Finite Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

33 Cardinality of Infinite Sets 23233.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23233.2 Infinite Sets Are Weird . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23233.3 Infinite Sets are Even Weirder Than You Thought . . . . . . . . . . . . . . 23433.4 Not All Infinite Sets Have The Same Cardinality . . . . . . . . . . . . . . . 235

34 Practice, Practice, Practice: Bijections and Cardinality 23734.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23734.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

VI Complex Numbers and Euler’s Formula 239

35 Complex Numbers 24035.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24035.2 Different Equations Require Different Number Systems . . . . . . . . . . . . 24035.3 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24135.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

36 Properties Of Complex Numbers 24636.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24636.2 Conjugate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24636.3 Modulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24836.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24936.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

37 Graphical Representations of Complex Numbers 25137.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25137.2 The Complex Plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

37.2.1 Cartesian Coordinates (x, y) . . . . . . . . . . . . . . . . . . . . . . . 25137.2.2 Modulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

37.3 Polar Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25237.4 Converting Between Representations . . . . . . . . . . . . . . . . . . . . . . 253

38 De Moivre’s Theorem 25638.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25638.2 De Moivre’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25638.3 Complex Exponentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25838.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25938.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

39 Roots of Complex Numbers 26039.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26039.2 Complex n-th Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26039.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

Page 8: MATH 135 Course Note

8 Chapter 0 CONTENTS

40 Practice, Practice, Practice:Complex Numbers 26440.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26440.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

VII Factoring Polynomials 266

41 An Introduction to Polynomials 26741.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26741.2 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26741.3 Operations on Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . 268

42 Factoring Polynomials 27242.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27242.2 Polynomial Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

43 Practice, Practice, Practice:Polynomials 27743.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27743.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

44 Practice, Practice, Practice: Course Review 28044.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28044.2 Suggestions On How To Start A Proof . . . . . . . . . . . . . . . . . . . . . 28144.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

VIII Finding the Shortest Path 284

45 The Shortest Path Problem 28545.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28545.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28545.3 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28745.4 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28845.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

46 Paths, Walks, Cycles and Trees 28946.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28946.2 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28946.3 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

47 Trees 29547.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29547.2 Properties of Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

48 Dijkstra’s Algorithm 29948.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29948.2 Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29948.3 Certificate of Optimality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304

Page 9: MATH 135 Course Note

Section 0.0 CONTENTS 9

49 Certificate of Optimality - Path 30649.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30649.2 Certificate of Optimality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30649.3 Weighted Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30749.4 Certificate of Optimality - Tree . . . . . . . . . . . . . . . . . . . . . . . . . 312

IX An Introduction to Fermat’s Last Theorem 314

50 Introduction to Primes 31550.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31550.2 Introduction to Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31550.3 Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31650.4 Fundamental Theorem of Arithmetic . . . . . . . . . . . . . . . . . . . . . . 31750.5 Finding a Prime Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31950.6 Working With Prime Factorizations . . . . . . . . . . . . . . . . . . . . . . 32150.7 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32250.8 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

51 Introduction to Fermat’s Last Theorem 32451.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32451.2 History of Fermat’s Last Theorem . . . . . . . . . . . . . . . . . . . . . . . 32451.3 Pythagorean Triples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

52 Characterization of Pythagorean Triples 33052.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33052.2 Pythagorean Triples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

53 Fermat’s Theorem for n = 4 33353.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33353.2 n = 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33353.3 Reducing the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33553.4 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336

54 Problems Related to FLT 33754.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33754.2 x4 − y4 = z2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33754.3 Pythagorean Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

55 Practice, Practice, Practice:Primes and Non-Linear Diophantine Equations 34055.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34055.2 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

56 Appendix 342

Page 10: MATH 135 Course Note

Preface

These notes are the script for the online lectures of MATH 135 at the University of Waterlooin Fall 2012. The script has been supplemented by worked examples and exercises.

These notes are very much a work in progress. Please send any corrections or suggestionsto Steven Furino at [email protected]

10

Page 11: MATH 135 Course Note

Part I

Introduction

11

Page 12: MATH 135 Course Note

Chapter 1

In the beginning

1.1 What Makes a Mathematician a Mathematician?

Welcome to MATH 135!

Let me begin with a question. What makes a mathematician a mathematician?

Many people would answer that someone who works with numbers is a mathematician.But bookkeepers for small businesses work with numbers and we don’t normally consider abookkeeper as a mathematician. Others might think of geometry and answer that someonewho works with shapes is a mathematician. But architects work with shapes and we don’tnormally consider architects as mathematicians. Still others might answer that people whouse formulas are mathematicians. But engineers work with formulas and we don’t normallyconsider engineers as mathematicians. A more insightful answer would be that people whofind patterns and provide descriptions and evidence for those patterns are mathematicians.But scientists search for and document patterns and we don’t normally consider scientistsas mathematicians.

The answer is proof - a rigorous, formal argument that establishes the truth of a statement.This has been the defining characteristic of mathematics since ancient Greece.

This course is about reading, writing and discovering proofs. If you have never done thisbefore, do not worry. The course will provide you with techniques that will help, and wewill practice those techniques in the context of some very interesting algebra.

1.2 How The Course Works

He who seeks for methods without having a definite problem in mind seeks forthe most part in vain.

David Hilbert

Let me describe how the course works.

Throughout the course, we will work on four problems all of which illustrate the need forproof. The first problem resolves a very important practical commercial problem. Thesecond problem concerns an astonishing result about one the simplest things we do, count.The third problem results in a new number system and yields a surprising and beautiful

12

Page 13: MATH 135 Course Note

Section 1.2 How The Course Works 13

formula. The fourth problem relies on a profound theorem proved by Carl Friedrich Gauss,the greatest mathematician of the modern age. Here are the four problems.

How do we secure internet commerce? Have you ever bought a song or movie overiTunes? Have you ever done your banking over the web? How do you make surethat your credit card number and personal information are not intercepted by badguys? Number theory allows us to enable secure web transactions. And that theoryis backed by proof.

What does it mean to count? You probably learned to count before you went to school.But how do you count to infinity? And is there only one infinity?

Why does eiπ + 1 = 0 ? e is a very unusual number that arises in calculus. i is a veryunusual number because it has the property that i2 = −1. π is a very unusualnumber even if it is common. It is the unique ratio of the circumference of a circleto its diameter. Why should that ratio be unique? One is the basis of the naturalnumbers, hence the integers, hence the rationals. Zero is a difficult number and wasonly accepted into the mathematics of western Europe because of the influence ofHindu and Islamic scholars. Why should all of these numbers be connected in sosimple and elegant a form?

How do we factor polynomials? You have factored integers into a product of primenumbers. There is also a need in mathematics to factor polynomials, expressions likeax4 + bx3 + cx2 + dx+ e into the polynomial equivalent of prime numbers.

The course notes contain two other problems if you would like to see the power of proofdisplayed in very different contexts.

How do we find the shortest path from one point to another? How does a telecom-munications company route your cell phone call? How does Google find the quickestroute on Google maps? How does a courier company route your package? All of thesetasks are completed using a shortest path algorithm. And how do we know we havefound the shortest path? Proof.

How many positive integer solutions are there to xn + yn = zn where n is an inte-ger greater than or equal to three? This is one of the most famous problems in thehistory of mathematics and it took over 350 years to solve. It was first conjecturedby the French mathematician Pierre de Fermat in 1637 and was only solved in 1995by Andrew Wiles.

To work with these problems we will need to learn about congruences, modular arithmetic,complex numbers and polynomials. And to work with these topics, we must learn somefoundational mathematics such as logical expressions and sets, and, most importantly, wemust learn how to recognize and use proof techniques.

Page 14: MATH 135 Course Note

14 Chapter 1 In the beginning

1.3 Why do we reason formally?

But why do we reason so formally at all? Many people believe that humans already knowenough mathematics so “Why bother with proofs?” There are quite a few reasons.

To prevent silliness. In solving quadratic equations with non-real roots, some of you willhave encountered the number i which has the special property that i2 = −1. Butthen,

−1 = i2 = i× i =√−1√−1 =

√−1×−1 =

√1 = 1

Clearly, something is amiss.

To understand better. How would most of us answer the question “What’s a real num-ber?” We would probably say that any number written as a decimal expansion is areal number and any two different expansions represent different numbers. But thenwhat about this?

Let x = 0.9 = 0.999 . . . .

Multiplying by 10 and subtracting gives

10x = 9.9− x = 0.9

9x = 9

which implies x = 1, not x = 0.9.

Or suppose we wanted to evaluate the infinite sum

1− 1 + 1− 1 + 1− 1 + 1− 1 + . . .

If we pair up the first two terms we get zero and every successive pair of terms alsogives us 0 so the sum is zero.︷ ︸︸ ︷

1− 1 +︷ ︸︸ ︷1− 1 +

︷ ︸︸ ︷1− 1 +

︷ ︸︸ ︷1− 1 + . . .

On the other hand, if we pair up the second and third term we get 0 and all successivepairs of terms give 0 so the sum is 1.

1︷ ︸︸ ︷−1 + 1

︷ ︸︸ ︷−1 + 1

︷ ︸︸ ︷−1 + 1

︷ ︸︸ ︷−1 + 1 + . . .

Or suppose we wanted to resolve Zeno’s paradox. Zeno was a famous ancient Greekphilosopher who posed the following problem. Suppose the Greek hero Achilles wasgoing to race against a tortoise and suppose, in recognition of the slowness of thetortoise, that the tortoise gets a 100m head start. By the time Achilles has run halfthe distance between he and the tortoise, the tortoise has moved ahead. And nowagain, by the time Achilles has run half the remaining distance between he and thetortoise, the tortoise has moved ahead. No matter how fast Achilles runs, the tortoisewill always be ahead! You might object that your eyes see Achilles pass the tortoise,but what is logically wrong with Zeno’s argument?

Page 15: MATH 135 Course Note

Section 1.3 Why do we reason formally? 15

To make better commercial decisions. Building pipelines is expensive. And lots ofpipelines will be built in the next few decades. Pipelines will ship oil, natural gas,water and sewage. Finding the shortest route given physical constraints (mountains,rivers, lakes, cities), environmental constraints (protection of the water table, no accessthrough national or state parks), and supply chain constraints (access to concrete andsteel) is very important. How do pipeline builders prove that the route they havechosen for the pipeline is the shortest possible route given the constraints?

To discover solutions. Formal reasoning provides a set of tools that allow us to thinkrationally and carefully about problems in mathematics, computing, engineering, sci-ence, economics and any discipline in which we create models.

Poor reasoning can be very expensive. Inaccurate application of financial models ledto losses of hundreds of billions of dollars during the financial crisis of 2008.

To experience joy. Mathematics can be beautiful, just as poetry can be beautiful. Butto hear the poetry of mathematics, one must first understand the language.

Page 16: MATH 135 Course Note

16 Chapter 1 In the beginning

1.4 Reading and Lecture Schedule

1.4.1 Lecture Schedule

This is a proposed lecture schedule.

Lec. Ch. Topic

1 1 In The Beginning

2 2 Our First Proof

3 3 Discovering Proofs

4 7 Quantifiers

5 8 Nested Quantifiers

6 9 Practice, Practice, Practice: Quantifiers and Sets

7 10 Simple Induction

8 11 Strong Induction

9 12 Binomial Theorem

10 18 Greatest Common Divisor

11 19 Extended Euclidean Algorithm

12 20 Properties of the GCD

13 21 Linear Diophantine Equations 1

14 22 Linear Diophantine Equations 2

15 23 Congruence

16 24 Congruence and Remainders

17 25 Modular Arithmetic

18 26 Fermat’s Little Theorem

19 27 Linear Congruences

20 28 Chinese Remainder Theorem

21 29 Practice, Practice, Practice: Congruences

22 30 RSA

23 31 Injections and Bijections

24 32 Counting

25 33 Cardinality of Infinite Sets

26 34 Practice, Practice, Practice: Bijections and Cardinality

27 35 Introduction to Complex Numbers

28 36 Properties of Complex Numbers

29 37 Graphical Representations of Complex Numbers

30 38 DeMoivre’s Theorem

31 39 Roots of Complex Numbers

32 40 Practice, Practice, Practice: Complex Numbers

33 41 An Introduction to Polynomials

34 42 Factoring Polynomials

35 43 Practice, Practice, Practice: Polynomials

36 44 Practice, Practice, Practice: Course Review

Page 17: MATH 135 Course Note

Section 1.4 Reading and Lecture Schedule 17

1.4.2 Reading Schedule

Since one of the goals of this course is to help you become comfortable reading mathematics,there are several short chapters for you to read. After you have completed the reading, anonline assignment will help you consolidate what you know.

Ch. Topic Before Lecture

4. Truth Tables 3. Discovering Proofs

5. Introduction to Sets 3. Discovering Proofs

13. Negation 6. PPP: Quantifiers and Sets

14. Contradiction 10. Greatest Common Divisor

15. Contrapositive 10. Greatest Common Divisor

16. Uniqueness 11. Extended Euclidean Algorithm

17. Elimination 12. Properties of the GCD

30. Private Key Cryptography (§30.2) 22. The RSA Scheme

Page 18: MATH 135 Course Note

Chapter 2

Our First Proof

2.1 Objectives

The technique objectives are:

1. Define statement, hypothesis, conclusion and implication.

2. Learn how to structure the analysis of a proof.

3. Carry out the analysis of a proof.

The content objectives are:

1. Define divisibility.

2. State and prove the Transitivity of Divisibility.

2.2 The Language

Mathematics is the language of mathematicians, and a proof is a method of com-municating a mathematical truth to another person who speaks the “language”.(Solow, How to Read and Do Proofs)

Mathematics is an unusual language. It is extraordinarily precise. When a proof is fullyand correctly presented, there is no ambiguity and no doubt about its correctness.

However, understanding a proof requires understanding the language. This course will helpyou with the basic grammar of the language of mathematics and is applicable to all proofs.Just as in learning any new language, you will need lots of practice to become fluent.

18

Page 19: MATH 135 Course Note

Section 2.2 The Language 19

One of the goals of this course is to learn proof techniques. Our broad objectives for thisgoal are simple.

1. Explain and categorize proof techniques that can be used in any proof. This coursewill teach not only how a technique works, but when it is most likely to be used andwhy it works.

2. Learn how to read a proof. This will require you to identify the techniques of the firstobjective.

3. Discover your own proofs. Knowledge of technique is essential but inadequate. Or,as we would say in the language of mathematics, technique is “necessary but notsufficient”. Discovering your own proof requires not only technique but also under-standing, creativity, intuition and experience. This course will help with the techniqueand experience. Understanding, creativity, and intuition come with time. Talent helpsof course.

4. Write your own proofs. Having discovered a proof, you must distill your discoveryinto mathematical prose that is targeted at a specific audience.

Hopefully, in the previous lecture, I convinced you of why we need to prove things. Nowwhat is it that mathematicians prove? Mathematicians prove statements.

Definition 2.2.1

Statement

A statement is a sentence which is either true or false.

Example 1 Here are some examples of statements.

1. 2 + 2 = 4. (A true statement.)

2. 2 + 2 = 5. (A false statement.)

3. x2 − 1 = 0 has two distinct real roots. (A true statement.)

4. There exists an angle θ such that sin(θ) > 1. (A false statement.)

Example 2 Now consider the following sentences.

1. x > 0.

2. 4ABC is congruent to 4PQR.

These are statements only if we have an appropriate value for x in the first sentence andappropriate instances of 4ABC and 4PQR in the second sentence. For example, if x isthe number 5, then the sentence “5 > 0” is a statement since the sentence is true. If x isthe number −5, then the sentence “−5 > 0” is also a statement since the sentence is false.The key point is that a statement is a sentence which must be true or false. If x is theEnglish word algebra, then the sentence “algebra > 0” is not a statement since the sentenceis neither true nor false. Sentences like the two above are called open sentences.

Page 20: MATH 135 Course Note

20 Chapter 2 Our First Proof

Definition 2.2.2

Open Sentence

An open sentence is a sentence that

• contains one or more variables, where

• each variable has values that come from a designated set called the domain of thevariable, and

• where the sentence is either true or false whenever values from the respective domainsof the variables are substituted for the variables.

For example, if the domain of x is the set of real numbers, then for any real number chosenand substituted for x, the sentence “x > 0” is a statement.

In this course, we will treat all open sentences as statements under the assumption that thevalues of the variables always come from a suitable domain.

2.3 Implications

Definition 2.3.1

Implication

The most common type of statement we will prove is an implication. Implications havethe form

If A is true , then B is true

where A and B are themselves statements. An implication is more commonly read as

If A, then B

orA implies B

and is written symbolically asA⇒ B

Definition 2.3.2

CompoundStatement

An implication is a compound statement, that is, it is made up of more than one state-ment.

In the statement “A implies B”, A is a statement which may be true or false. B is astatement which may be true or false. “A implies B” is also a statement which may be trueor false.

Definition 2.3.3

Hypothesis,Conclusion

The statement A is called the hypothesis. The statement B is called the conclusion.

Page 21: MATH 135 Course Note

Section 2.4 Our First Proof 21

REMARK

To prove the implication “A implies B”, you assume that A is true and you use thisassumption to show that B is true. Statement A is what you start with. Statement B iswhere you must end up.

To use the implication “A implies B”, you must first establish that A is true. After youhave established that A is true, then you can invoke B.

It is crucial that you are able to identify

1. the hypothesis

2. the conclusion

3. whether you are using or proving an implication

Here are some examples of implications.

Example 3 If x is a positive real number, then log10 x > 0.

Hypothesis: x is a positive real number.

Conclusion: log10 x > 0.

Example 4 Let f(x) = x sin(x). Then f(x) = x for some real number x with 0 ≤ x ≤ 2π.

Hypothesis: f(x) = x sin(x).

Conclusion: f(x) = x for some real number x with 0 ≤ x ≤ 2π.

Example 5 In plane geometry, ∠ABC = ∠XY Z whenever 4ABC is similar to 4XY Z.

Hypothesis: All figures are in the plane. 4ABC ∼ 4XY Z.

Conclusion: ∠ABC = ∠XY Z.

2.4 Our First Proof

Let us read our first proof. We begin with a definition.

Definition 2.4.1

Divisibility

An integer m divides an integer n, and we write m | n, if there exists an integer k so thatn = km.

Page 22: MATH 135 Course Note

22 Chapter 2 Our First Proof

Example 6

• 3 | 6 since we can find an integer k, 2 in this case, so that 6 = k × 3.

• 5 - 6 since no integer k exists so that 6 = k × 5.

• For all integers a, a | 0 since 0 = 0× a. This is true for a = 0 as well.

• For all non-zero integers a, 0 - a since there is no integer k so that k × 0 = a.

Some comments about definitions are in order. If mathematics is thought of as a language,then definitions are the vocabulary and our prior mathematical knowledge indicates ourexperience and versatility with the language.

Mathematics and the English language both share the use of definitions as extremely prac-tical abbreviations. Instead of saying “a domesticated carnivorous mammal known scien-tifically as Canis familiaris” we would say “dog.” Instead of writing down “there exists aninteger k so that n = km”, we write “m | n.”

However, mathematics differs greatly from English in precision and emotional content.Mathematical definitions do not allow ambiguity or sentiment.

Definition 2.4.2

Proposition

A proposition is a true statement that has been proved by a valid argument.

REMARK

You will encounter several variations on the word proposition. A theorem is a particularlysignificant proposition. A lemma is a subsidiary proposition, or more informally, a “helper”proposition, that is used in the proof of a theorem. A corollary is a proposition that followsalmost immediately from a theorem.

There are particular statements that may look like propositions but are more foundational.An axiom is a statement that is assumed to be true. No proof is given. From axioms wederive propositions and theorems. Obviously, choosing axioms has to be done very carefully.

Consider the following proposition.

Proposition 1 (Transitivity of Divisibility (TD))

Let a, b and c be integers. If a | b and b | c, then a | c.

When one first encounters a proposition, it often helps to work through some examples tounderstand the proof.

Page 23: MATH 135 Course Note

Section 2.4 Our First Proof 23

Example 7 Suppose a = 3, b = 6 and c = 42. Since 3 | 6 (a | b) and 6 | 42 (b | c), Transitivity ofDivisibility allows us to conclude that 3 | 42 (a | c).

Now you might immediately know that 3 | 42. The strength of this proposition is that itworks for any integers a, b, c that satisfy the condition “a | b and b | c”, not just for theparticular integers of our example.

Now take a minute to read the following proof of Transitivity of Divisibility.

Proof: Since a | b, there exists an integer r so that ra = b. Since b | c, there exists aninteger s so that sb = c. Substituting ra for b in the previous equation, we get (sr)a = c.Since sr is an integer, a | c.

Though this is a simple proof, other proofs can be difficult to read because of the habitsof writing for professional audiences. Many proofs share the following properties which canbe frustrating for students.

1. Proofs are economical. That is, a proof includes what is needed to verify the truth ofa proposition but nothing more.

2. Proofs do not usually identify the hypothesis and the conclusion.

3. Proofs sometimes omit or combine steps.

4. Proofs do not always explicitly justify steps.

5. Proofs do not reflect the process by which the proof was discovered.

The reader of the proof must be conscious of the hypothesis and conclusion, fill in theomitted parts and justify each step.

REMARK

When you are reading a proof of an implication, do the following.

1. Explicitly identify the hypothesis and the conclusion. If the hypothesis contains nostatements write “No explicit hypothesis”. At the end of the proof, you should beable to identify where each part of the hypothesis has been used.

2. Explicitly identify the core proof technique. When reading a proof, the reader usuallyworks forward from the hypothesis until the conclusion is reached. Specific techniqueswill be covered later in the course.

3. Record any preliminary material needed, usually definitions or propositions that havealready been proved. Judgement is needed here about how much to include.

4. Justify each step with reference to the definitions, previously proved propositions ortechniques used.

5. Add missing steps where necessary and justify these steps with reference to the defi-nitions, previously proved propositions or techniques used.

Page 24: MATH 135 Course Note

24 Chapter 2 Our First Proof

Let’s analyze the proof of the Transitivity of Divisibility in detail because it will give ussome sense of how to analyze proofs in general. First, observe that “If a | b and b | c, thena | c.” is an open sentence, and that the domains for the variables a, b and c are specifiedin the first sentence, “Let a, b and c be integers.”

Professional mathematicians do all of these things implicitly but for the first part of thiscourse, we will do these things explicitly.

We will do a line by line analysis, so to make our work easier, we will write each sentenceon a separate line.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Since a | b, there exists an integer r so that ra = b.

2. Since b | c, there exists an integer s so that sb = c.

3. Substituting ra for b in the previous equation, we get (sr)a = c.

4. Since sr is an integer, a | c.

Let’s analyze the proof. What we do now will seem like overkill but it serves two purposes.It gives practice at justifying every line of a proof, and it gives us a structure that wecan use for other proofs. Lastly, recall that the author is proving an implication. Theauthor assumes that the hypothesis is true, and uses the hypothesis to demonstrate thatthe conclusion is true. Here goes.

Analysis of Proof We begin by explicitly identifying the hypothesis and the conclusion.

Hypothesis: a, b and c are integers. a | b and b | c.Conclusion: a | c.Core Proof Technique: Work forwards from the hypothesis.

Preliminary Material: The definition of divides. An integer m divides an integern, and we write m | n, if there exists an integer k so that n = km.

Sentence 1 Since a | b, there exists an integer r so that ra = b.

In this sentence, the author of the proof uses the hypothesis a | b and the definitionof divides.

Sentence 2 Since b | c, there exists an integer s so that sb = c.

In this sentence, the author uses the hypothesis b | c and the definition of divides.

Sentence 3 Substituting ra for b in the previous equation, we get (sr)a = c.

Here, the author works forward using arithmetic. The actual work is:

sb = c and ra = b implies s(ra) = c which implies (sr)a = c.

Page 25: MATH 135 Course Note

Section 2.4 Our First Proof 25

Sentence 4 Since sr is an integer, a | c.Lastly, the author uses the definition of divides. In this case, the m, k and n of thedefinition apply to the a, sr and c of the proof. It is important to note that sr is aninteger, otherwise the definition of divides does not apply.

At the end of each proof, you should be able to identify where each part of the hypothesiswas used. It is obvious where a | b and b | c were used. The hypothesis “a, b and c areintegers” was needed to allow the author to use the definition of divides.

This completes the analysis of our first proof. Between the readings, lectures, quizzes,assignments and tests, you will work your way through roughly one hundred proofs.

Page 26: MATH 135 Course Note

Chapter 3

Discovering Proofs

3.1 Objectives

The technique objectives are:

1. Discover a proof using the Direct Proof technique.

2. Write a proof.

3. Read a proof.

The content objectives are:

1. Prove the Divisibility of Integer Combinations.

2. Prove the Bounds By Divisibility.

3. State the Division Algorithm.

3.2 Discovering a Proof

Discovering a proof of a statement is generally hard. There is no recipe for this, but thereare some tips that may be useful, and as we go on through the course, you will learn specifictechniques. Consider the following proposition.

Proposition 1 (Divisibility of Integer Combinations (DIC))

If a, b and c are integers where a | b and a | c, and x and y are any integers, then a | (bx+cy).

As with our first proposition, let’s begin with a numeric example.

26

Page 27: MATH 135 Course Note

Section 3.2 Discovering a Proof 27

Example 1 Suppose a = 3, b = 6 and c = 27. Then, for any integers x and y, 3 | (6x+ 27y). That is, 3divides any integer combination of 6 and 27. You might say, “That’s obvious. Just take acommon factor of 3 from 6x+ 27y.” That is

6x+ 27y = 3(2x+ 9y)

That observation is very suggestive of the proof of the Divisibility of Integer Combinations.

The very first thing to do when proving a statement is to explicitly identify the hypothesisand the conclusion. Let’s do that for the Divisibility of Integer Combinations.

Hypothesis: a, b, c ∈ Z, a | b and a | c. x, y ∈ Z

Conclusion: a | (bx+ cy)

Since we are proving a statement, not using a statement, we assume that the hypothesisis true, and then demonstrate that the conclusion is true. This straightforward approachis called Direct Proof. However, in actually discovering a proof we do not need to workonly forwards from hypothesis. We can work backwards from the conclusion and meetsomewhere in the middle. When writing the proof we must ensure that we begin with thehypothesis and end with the conclusion.

Whether working forwards or backwards, I find it best to proceed by asking questions.When working backwards, I ask

What mathematical fact would allow me to deduce the conclusion?

For example, in the proposition under consideration I would ask

What mathematical fact would allow me to deduce that a | (bx+ cy)?

The answer tells me what to look for or gives me another statement I can work backwardsfrom. In this case the answer would be

If there exists an integer k so that bx+ cy = ak, then a | (bx+ cy).

Note that the answer makes use of the definition of divides. Let’s record this statement aspart of a proof in progress.

Proof in Progress

1. To be completed.

2. Since there exists an integer k so that bx+ cy = ka, then a | (bx+ cy).

Now I could ask the question

How can I find such a k?

Page 28: MATH 135 Course Note

28 Chapter 3 Discovering Proofs

The answer is not obvious so let’s turn to working forwards from the hypothesis. In thiscase my standard two questions are

Have I seen something like this before?What mathematical fact can I deduce from what I already know?

I have seen a | b in an hypothesis before. Twice actually, once in the proof of the Transitivityof Divisibility and once in the prior example. Just as was done in the proof of the Transitivityof Divisibility, I can use a | b and the definition of divisibility to assert that

There exists an integer r such that b = ra.

and I’ll add this to the proof in progress.

Proof in Progress

1. Since a | b, there exists an integer r such that b = ra.

2. To be completed.

3. Since there exists an integer k so that bx+ cy = ka, then a | (bx+ cy).

I also know that a | c so I can use the definition of divisibility again to assert that

There exists an integer s such that c = sa.

and I will add this to the proof in progress as well.

Proof in Progress

1. Since a | b, there exists an integer r such that b = ra.

2. Since a | c, there exists an integer s such that c = sa.

3. To be completed.

4. Since there exists an integer k so that bx+ cy = ka, then a | (bx+ cy).

Hmmm, what now? Let’s look again at the last sentence. There is a bx + cy in the lastsentence and an algebraic expression for b and c in the first two sentences. Substitutinggives

bx+ cy = (ra)x+ (sa)y

and factoring out the a gives

bx+ cy = (ra)x+ (sa)y = a(rx+ sy)

Does this look familiar? We factored in our numeric example and we are factoring here.If we let k = rx+ sy then, because multiplying integers gives integers and adding integersgives integers, k is an integer. Hence, there exists an integer k so that bx+ cy = ak. Thatis, a | (bx+ cy).

We are done. Almost. We have discovered a proof but this is rough work. We must nowwrite a formal proof. Just like any other writing, the amount of detail needed in expressingyour thoughts depends upon the audience. A proof of a statement targeted at an audienceof professional specialists in algebra will not look the same as a proof targeted at a highschool audience. When you approach a proof, you should first make a judgement about theaudience. Write for your peers. That is, write your proof so that you could hand it to aclassmate and expect that they would understand the proof.

Page 29: MATH 135 Course Note

Section 3.3 Reading A Proof 29

Proof: Since a | b, there exists an integer r such that b = ra. Since a | c, there exists aninteger s such that c = sa. Let x and y be any integers. Now bx + cy = (ra)x + (sa)y =a(rx + sy). Since rx + sy is an integer, it follows from the definition of divisibility thata | (bx+ cy).

Note that this proof does not reflect the discovery process, and it is a Direct Proof. Itbegins with the hypothesis and ends with the conclusion.

Before we leave this proposition, let’s consider the significance of the hypothesis “x and yare integers”. Suppose, as in our numeric example, a = 3, b = 6 and c = 27. If we choosex = 3/2 and y = 1/4, ax + by = 45/4 which is not even an integer! This simple exampleemphasizes the importance of the hypothesis.

Exercise 1 Prove the following statement. Let a, b, c and d be integers. If a | c and b | d, then ab | cd.

3.3 Reading A Proof

Here is another proposition and proof.

Proposition 2 (Bounds By Divisibility (BBD))

Let a and b be integers. If a | b and b 6= 0 then |a| ≤ |b|.

Proof: Since a | b, there exists an integer q so that b = qa. Since b 6= 0, q 6= 0. But ifq 6= 0, |q| ≥ 1. Hence, |b| = |qa| = |q||a| ≥ |a|.

Let’s analyze this proof. First, we will rewrite the proof line by line.

Proof: (For reference purposes, each sentence of the proof is written on a separate line.)

1. Since a | b, there exists an integer q so that b = qa.

2. Since b 6= 0, q 6= 0.

3. But if q 6= 0, |q| ≥ 1.

4. Hence, |b| = |qa| = |q||a| ≥ |a|.

Now the analysis.

Page 30: MATH 135 Course Note

30 Chapter 3 Discovering Proofs

Analysis of Proof As usual, we begin by explicitly identifying the hypothesis and theconclusion.

Hypothesis: a and b are integers. a | b and b 6= 0.

Conclusion: |a| ≤ |b|.Core Proof Technique: Direct Proof.

Preliminary Material: The definition of divides.

Now we justify every sentence in the proof.

Sentence 1 Since a | b, there exists an integer q so that b = qa.

In this sentence, the author of the proof uses the hypothesis a | b and the definitionof divides.

Sentence 2 Since b 6= 0, q 6= 0.

If q were zero, then b = qa would imply that b is zero. Since b is not zero, q cannotbe zero.

Sentence 3 But if q 6= 0, |q| ≥ 1.

Since q is an integer from Sentence 1, and q is not zero from Sentence 2, q ≥ 1 orq ≤ −1. In either case, |q| ≥ 1.

Sentence 4 Hence, |b| = |qa| = |q||a| ≥ |a|.Sentence 1 tells us that b = qa. Taking the absolute value of both sides gives |b| = |qa|and using the properties of absolute values we get |qa| = |q||a|. From Sentence 3,|q| ≥ 1 so |q||a| ≥ |a|.

3.4 The Division Algorithm

As you have known since grade school, not all integers are divided evenly by other integers.There is usually a remainder. We record this as the Division Algorithm.

Proposition 3 (Division Algorithm (DA))

If a and b are integers, and b > 0, then there exist unique integers q and r such that

a = qb+ r where 0 ≤ r < b.

We will not prove this statement now. You will see a proof of the uniqueness part later on.Let’s see some examples before a few remarks.

Page 31: MATH 135 Course Note

Section 3.5 Practice 31

Example 2 (Division Algorithm)

a = q × b+ r

20 = 2× 7 + 6

21 = 3× 7 + 0

−20 = −3× 7 + 1

REMARK

• The integer q is called the quotient.

• The integer r is called the remainder.

• The integer r is always strictly less than b.

• The integer r is always positive or zero.

• Observe that b | a if and only if the remainder is 0.

• Though the proposition is commonly known as the Division Algorithm, it is not reallyan algorithm since it doesn’t provide a finite sequence of steps that will construct qand r.

It turns out that the Division Algorithm is remarkably useful. To see how, we must firstdefine the greatest common divisor, which we do soon.

3.5 Practice

1. Prove the following statement. Let a, b, c ∈ Z. If ac | bc and c 6= 0, then a | b.

2. Prove the following statement. Let x be an integer. If 2 | (x2 − 1), then 4 | (x2 − 1).

3. Consider the following statement: If a | 30 then a | 60.

(a) The following “proof” of the statement is incorrect. Describe what is wrong withthe proof.

Proof: Let a be a divisor of 60. Since a can only contain the prime factors 2, 3,and 5, and since all of these integers are factors of 30 as well, a | 30.

(b) Prove the statement.

Page 32: MATH 135 Course Note

32 Chapter 3 Discovering Proofs

4. Consider the following statement:

Suppose a is an integer. If 32 - ((a2 + 3)(a2 + 7)), then a is even.

In trying to prove or disprove this statement, each of parts (a), (b) and (c) containsa flaw. Determine the main flaw in each argument.

(a) Suppose a is even. Then a2 is even, so both a2 + 3 and a2 + 7 are odd. Since 32is even, 32 - ((a2 + 3)(a2 + 7)).

(b) Let a = 1. Then 32|((a2+3)(a2+7)), but a is not even. This is a counterexampleto the statement.

(c) Suppose 32 - ((a2+3)(a2+7)). Since 2|32, 2 - ((a2+3)(a2+7)). This means that(a2 + 3)(a2 + 7) must be odd, so both a2 + 3 and a2 + 7 must be odd. Therefore,a2 is even, and hence a is even.

(d) Prove the statement.

Page 33: MATH 135 Course Note

Part II

Foundations

33

Page 34: MATH 135 Course Note

Chapter 4

Truth Tables

4.1 Objectives

The technique objectives are:

1. Define not, and, or, implies and if and only if using truth tables.

2. Evaluate logical expressions using truth tables.

3. Use truth tables to establish the equivalence of logical expressions and particularlythe equivalence of the contrapositive and the non-equivalence of the converse.

4.2 Truth Tables as Definitions

Throughout this course we work with statements.

Definition 4.2.1

Statement

A statement is a sentence which is either true or false.

Definition 4.2.2

Compound,Component

All of the statements we need to prove will be compound statements, that is, statementscomposed of several individual statements called component statements.

For example, the compound statement

If a | b and b | c, then a | c.

contains three component statements

a | b,b | c, anda | c

Suppose we let X be the statement a | b and Y be the statement b | c and Z be thestatement a | c. Then our original statement

34

Page 35: MATH 135 Course Note

Section 4.2 Truth Tables as Definitions 35

If a | b and b | c, then a | c.

becomes

X and Y imply Z.

If we knew the truth values of X, Y and Z, then we would be able to determine the truthvalue of the compound statement “X and Y imply Z”. And that is where truth tables comein. Truth tables contain all possible values of the component statements and determine thetruth value of the compound statement.

Truth tables can be used to define the truth value of a statement or evaluate the truthvalue of a statement. For logical operations like not, and, or, implies and if and only if,truth tables are used to define the truth value of the compound statement.

Definition 4.2.3

NOT

The simplest definition is that of NOT A, written ¬A.

A ¬AT F

F T

In prose, if the statement A is true, then the statement “NOT A” is false. If the statementA is false, then the statement “NOT A” is true.

Two very important and common logical connectives are AND and OR. Note that these donot always coincide with our use of the words and and or in the English language!

Definition 4.2.4

AND

The definition of A AND B, written A ∧B, is

A B A ∧BT T T

T F F

F T F

F F F

Definition 4.2.5

OR

The definition of A OR B, written A ∨B, is

A B A ∨BT T T

T F T

F T T

F F F

This is an opportune moment to highlight the difference between mathematical languageand the English language. If you are visiting a friend and your friend offers you “coffee or

Page 36: MATH 135 Course Note

36 Chapter 4 Truth Tables

tea”, you interpret that to mean that you may have coffee or tea but not both. However,the logical A ∨B results in a true statement when A is true, B is true or both are true. Inmathematics, or is inclusive.

Definition 4.2.6

Implies

The definition of A implies B, written A⇒ B, often seems strange.

A B A⇒ B

T T T

T F F

F T T

F F T

The first two rows in the table make sense. The last two make less sense. How can a falsehypothesis result in a true statement? The basic idea is that if one is allowed to assume anhypothesis which is false, any conclusion can be derived.

We will shortly see that implies is closely related to if and only if.

Definition 4.2.7

If and Only If

The definition of A if and only if B, written A ⇐⇒ B or A iff B, is

A B A ⇐⇒ B

T T T

T F F

F T F

F F T

4.3 Truth Tables to Evaluate Logical Expressions

We can construct truth tables for compound statements by evaluating parts of the compoundstatement separately and then evaluating the larger statement. Consider the following truthtable which shows the truth values of ¬(A∨B) for all possible combinations of truth values ofthe component statements A and B. (Brackets serve the same purpose in logical expressionsas they do in arithmetic. They specify the order of operation. In logic the order is: brackets,¬, ∧, ∨, ⇒, ⇐⇒ , ≡ with evaluation from left to right.)

Example 1 Construct a truth table for ¬(A ∨B).

A B A ∨B ¬(A ∨B)

T T T F

T F T F

F T T F

F F F T

Page 37: MATH 135 Course Note

Section 4.3 Truth Tables to Evaluate Logical Expressions 37

In the first row of the table A and B are true, so using the definition of or, the statementA ∨ B is true. Since the negation of a true statement is false, ¬(A ∨ B) is false, whichappears in the last column of the first row. Take a minute to convince yourself that each ofthe remaining rows is correct.

Here is another example.

Example 2 Construct a truth table for A⇒ (B ∨ C).

A B C B ∨ C A⇒ (B ∨ C)

T T T T T

T T F T T

T F T T T

T F F F F

F T T T T

F T F T T

F F T T T

F F F F T

Exercise 1

1. If A,B,C are statements, and A and B are true, and C is false, what is the truthvalue of

(a) A ∧ (B ∨ C)?

(b) A ∧ (¬B ∨ C)?

(c) A ∧ ¬(B ∨ C)?

(d) (A ∧B)⇒ C?

2. Construct a truth table for (A ∧ ¬B)⇒ C.

Definition 4.3.1

Logicallyequivalent

Two compound statements are logically equivalent if they have the same truth values forall combinations of their component statements. We write S1 ≡ S2 to mean S1 is logicallyequivalent to S2.

REMARK

Equivalent statements are enormously useful in proofs. Suppose you wish to prove S1 butare having difficulty. If there is a simpler statement S2 and S1 ≡ S2, then you can prove S2instead. In proving S2, you will have proved S1 as well.

Page 38: MATH 135 Course Note

38 Chapter 4 Truth Tables

Example 3 Construct a single truth table for ¬(A∨B) and (¬A)∧(¬B). Are these statements logicallyequivalent?

A B A ∨B ¬(A ∨B) ¬A ¬B (¬A) ∧ (¬B)

T T T F F F F

T F T F F T F

F T T F T F F

F F F T T T T

Since the columns representing ¬(A ∨B) and (¬A) ∧ (¬B) are identical,we can conclude that ¬(A ∨B) ≡ (¬A) ∧ (¬B).

The preceding example and your assignments demonstrate DeMorgan’s Laws.

Proposition 1 (De Morgan’s Law’s (DML))

If A and B are statements, then

1. ¬(A ∨B) ≡ (¬A) ∧ (¬B)

2. ¬(A ∧B) ≡ (¬A) ∨ (¬B)

REMARK

The next example shows the equivalence of A ⇐⇒ B and (A ⇒ B) ∧ (B ⇒ A). This isparticularly important for proofs. Because A ⇐⇒ B is equivalent to (A⇒ B)∧ (B ⇒ A),to prove a statement of the form A ⇐⇒ B, we could prove

1. A⇒ B and

2. B ⇒ A.

Example 4 Show that A ⇐⇒ B is logically equivalent to (A⇒ B) ∧ (B ⇒ A).

A B A ⇐⇒ B A⇒ B B ⇒ A (A⇒ B) ∧ (B ⇒ A)

T T T T T T

T F F F T F

F T F T F F

F F T T T T

Since the columns representing A ⇐⇒ B and (A⇒ B) ∧ (B ⇒ A) are identical,we can conclude that A ⇐⇒ B ≡ (A⇒ B) ∧ (B ⇒ A).

Page 39: MATH 135 Course Note

Section 4.5 Contrapositive and Converse 39

4.4 Contrapositive and Converse

Two particular statements, the contrapositive and the converse, which are derived fromA⇒ B, occur frequently in mathematics.

Definition 4.4.1

Contrapositive

The statement ¬B ⇒ ¬A is called the contrapositive of A⇒ B.

We can use truth tables to show that A⇒ B ≡ ¬B ⇒ ¬A.

A B A⇒ B ¬B ¬A ¬B ⇒ ¬AT T T F F T

T F F T F F

F T T F T T

F F T T T T

Since the columns representing A ⇒ B and ¬B ⇒ ¬A are identical, we can conclude thatA⇒ B ≡ ¬B ⇒ ¬A.

REMARK

The logical equivalence of a statement and its contrapositive is extremely useful. If provingA⇒ B seems difficult, we could try to prove ¬B ⇒ ¬A instead. It may be easier!

Definition 4.4.2

Contrapositive

The statement B ⇒ A is called the converse of A⇒ B.

We can use truth tables to show that A⇒ B 6≡ ¬B ⇒ ¬A.

A B A⇒ B B ⇒ A

T T T T

T F F T

F T T F

F F T T

Since the columns representing A⇒ B and B ⇒ A are not identical, we can conclude thatA⇒ B 6≡ B ⇒ A.

REMARK

It is a common mistake for beginning mathematicians to assume that A ⇒ B and B ⇒ Aare the same. They are not! Consider the following statement.

If Lassie is a dog, then Lassie has four legs.

This is a true statement (assuming Lassie has had no amputations or birth defects). Thecontrapositive of this statement is

If Lassie has four legs, then Lassie is a dog.

which is clearly false. Many animals other than dogs have four legs.

Page 40: MATH 135 Course Note

40 Chapter 4 Truth Tables

4.5 More Examples

1. Use a truth table to determine whether or not A ∨ (B ∧ C) is equivalent to(A ∨B) ∧ (A ∨ C).

A B C B ∧ C A ∨ (B ∧ C) A ∨B A ∨ C (A ∨B) ∧ (A ∨ C)

T T T T T T T T

T T F F T T T T

T F T F T T T T

T F F F T T T T

F T T T T T T T

F T F F F T F F

F F T F F F T F

F F F F F F F F

Since the columns associated with the statements A∨(B∧C) and (A∨B)∧(A∨C) areidentical, the two statements are equivalent. That is, A∨ (B∧C) ≡ (A∨B)∧ (A∨C).

4.6 Practice

1. Use truth tables to show that for statements A, B and C, the Associativity Lawshold. That is

(a) A ∨ (B ∨ C) ≡ (A ∨B) ∨ C(b) A ∧ (B ∧ C) ≡ (A ∧B) ∧ C

2. Use truth tables to show that for statements A, B and C, the Distributivity Lawshold. That is

(a) A ∧ (B ∨ C) ≡ (A ∧B) ∨ (A ∧ C)

(b) A ∨ (B ∧ C) ≡ (A ∨B) ∧ (A ∨ C)

3. Give a logical statement that is equivalent to ¬(A ⇒ B). Provide evidence in theform of a truth table.

4. Construct a truth table for A⇒ B ∨ C ⇐⇒ (A⇒ B) ∨ (A⇒ C).

Page 41: MATH 135 Course Note

Chapter 5

Introduction to Sets

5.1 Objectives

The technique objectives are:

1. Define and gain experience with set, element, set-builder notation, defining property,subset, superset, equality of sets, empty set, universal set, complement, cardinality,union, intersection and difference.

2. Be able to read and use Venn diagrams.

5.2 Describing a Set

Sets are foundational in mathematics and literally appear everywhere.

Definition 5.2.1

Set, Element

A set is a collection of objects. The objects that make up a set are called its elements (ormembers).

Sets can contain any type of object. Since this is a math course, we frequently use sets ofnumbers. But sets could contain letters, the letters of the alphabet for example, or books,such as those in a library collection.

It is customary to use uppercase letters (A,B,C . . .) to represent sets and lowercase letters(a, b, c, . . .) to represent elements. If a is an element of the set A, we write a ∈ A. If a isnot an element of the set A, we write a 6∈ A.

Small sets can be explicitly listed. For example, the set of even numbers less than 10 is

{2, 4, 6, 8}

Our next set requires prime numbers.

Definition 5.2.2

Prime

An integer p > 1 is called a prime if its only positive divisors are 1 and p; otherwise it iscalled composite.

41

Page 42: MATH 135 Course Note

42 Chapter 5 Introduction to Sets

The set of prime numbers less than 10 is

{2, 3, 5, 7}

When explicitly listing sets, we use curly braces, {}, and separate elements with a comma.Many sets are either too large to be listed (the set of all primes less than 10,000) or aredefined by a rule. In these cases, we employ set-builder notation which makes use of adefining property of the set. For example, the set of all real numbers between 1 and 2inclusive could be written as

{x ∈ R | 1 ≤ x ≤ 2}The part of the description following the bar (|) is the defining property of the set. Someauthors use a colon (:) instead of a bar and write

{x ∈ R : 1 ≤ x ≤ 2}

As when explicitly listing sets, we use curly braces, {}.

Some letters have become associated with specific sets.

N natural numbers, 1, 2, 3, . . .Z integersQ rational numbers, {pq | p, q ∈ Z, q 6= 0}Q irrational numbersR real numbersC complex numbers {x+ yi | x, y ∈ R}

Computer scientists begin counting at 0 so the notation N used in a computer sciencecontext likely means the set of integers 0, 1, 2, 3, . . .. Be sure to clarify which set is intended.

Example 1 (Set-Builder Notation)

1. The set of all even integers can be described as

{n ∈ Z : 2 | n}

There is frequently more than one way of describing a set. Another way of describingthe set of even integers is

{2k | k ∈ Z}

2. The set of all real solutions to x2 + 4x− 2 = 0 can be described as

{x ∈ R | x2 + 4x− 2 = 0}

and, in general, the set of all real solutions to f(x) = 0 can be described as

{x ∈ R | f(x) = 0}

3. The set of all positive divisors of 30 can be written as

{n ∈ N : n | 30}

4. In calculus, we often use intervals of real numbers. The closed interval [a, b] isdefined as the set

{x ∈ R | a ≤ x ≤ b}

Page 43: MATH 135 Course Note

Section 5.2 Describing a Set 43

Definition 5.2.3

Subset

A set A is called a subset of a set B, and is written A ⊆ B, if every element of A belongsto B. Symbolically, we write

A ⊆ B means x ∈ A⇒ x ∈ B

or equivalentlyA ⊆ B means “For all x ∈ A, x ∈ B”

We sometimes say that A is contained in B.

Example 2{1, 2, 3} ⊆ {1, 2, 3, 4}

Definition 5.2.4

Proper Subset

A set A is called a proper subset of a set B, and written A ⊂ B, if every element of Abelongs to B and there exists an element in B which does not belong to A.

In the previous example, it is also the case that

Example 3{1, 2, 3} ⊂ {1, 2, 3, 4}

Definition 5.2.5

Superset

A set A is called a superset of a set B, and written A ⊇ B, if every element of B belongsto A. A ⊇ B is equivalent to B ⊆ A.

Example 4{1, 2, 3, 4} ⊇ {1, 2, 3}

Definition 5.2.6

Proper Subset

As before, a set A is called a proper superset of a set B, and written A ⊃ B, if everyelement of B belongs to A and there exists an element in A which does not belong to B.

Example 5{1, 2, 3, 4} ⊃ {1, 2, 3}

Definition 5.2.7

Set Equality

Saying that two sets A and B are equal, and writing A = B, means that A and B haveexactly the same elements. The usual way of showing A = B is to show mutual inclusion,that is, show A is contained in B and B is contained in A. Symbolically, we write

A = B means A ⊆ B AND B ⊆ A

Page 44: MATH 135 Course Note

44 Chapter 5 Introduction to Sets

Definition 5.2.8

Empty Set

There is a special set, called the empty set and denoted by ∅, which contains no elements.The empty set is a subset of every set.

Definition 5.2.9

Universal Set

When we discuss sets, we are often concerned with subsets of some implicit or specified setU , called the universal set. In our work on divisibility and greatest common divisors, wewill be concerned with integers as the universal set, even when we don’t explicitly say so.

Definition 5.2.10

Set Complement

Relative to a universal set U , the complement of a subset A of U , written A, is the set ofall elements in U but not in A. Symbolically, we write

A = {x | x ∈ U AND x 6∈ A} = {x | (x ∈ U) ∧ (x 6∈ A)}

Definition 5.2.11

Cardinality

Lastly, the cardinality of a set A, written |A|, is the number of elements in the set.

Example 6 For example, if A = {1, 2, 3, 4}, then |A| = 4. Here’s a pair of mind-blowing questions.What is the cardinality of N? How much larger is Q than N?

Example 7 Let S = {x ∈ R | x2 = 2} and T = {x ∈ Q | x2 = 2}.

1. Describe the set S by listing its elements. What is the cardinality of S?

2. Describe the set T by listing its elements. What is the cardinality of T?

3. List all of the subsets of S.

Solution:

1. S = {√

2,−√

2}. |S| = 2.

2. T = ∅. |T | = 0.

3. ∅, {√

2}, {−√

2}, S

Page 45: MATH 135 Course Note

Section 5.3 Set Operations 45

Example 8 Let the universal set for this question be U , the set of natural numbers less than twenty.Let T be the set of integers divisible by three and F be the set of integers divisible by five.

1. Describe T by explicitly listing the set and by using set-builder notation in at leasttwo ways.

2. Find a subset of T of cardinality three.

3. Find an element which belongs to both T and F .

4. Find an element which belongs to neither T nor F .

5. Explicitly list the set T .

Solution:

1. Explicitly listing the set gives T = {3, 6, 9, 12, 15, 18}. Two set-builder descriptions ofthe set are T = {n ∈ N : 3 | n, n < 20} and T = {3k | k ∈ N, 3k < 20}

2. {3, 6, 9}. There are several choices possible.

3. 15. Notice that this is an element, not a set.

4. 1. There are several choices possible.

5. {1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19}

5.3 Set Operations

Definition 5.3.1

Union

The union of two sets A and B, written A∪B, is the set of all elements belonging to eitherset A or set B. Symbolically we write

A ∪B = {x | x ∈ A OR x ∈ B} = {x | (x ∈ A) ∨ (x ∈ B)}

Note that when we say “set A or set B” we mean the mathematical use of or. That is, theelement can belong to A, B or both A and B.

Definition 5.3.2

Intersection

The intersection of two sets A and B, written A ∩B, is the set of all elements belongingto both set A and set B. Symbolically we write

A ∩B = {x | x ∈ A AND x ∈ B} = {x | (x ∈ A) ∧ (x ∈ B)}

Page 46: MATH 135 Course Note

46 Chapter 5 Introduction to Sets

Definition 5.3.3

Difference

The difference of two sets A and B, written A − B (or A \ B), is the set of all elementsbelonging to A but not B. Symbolically we write

A−B = {x | x ∈ A AND x 6∈ B} = {x | (x ∈ A) ∧ (x 6∈ B)}

If U is the universal set and A ⊆ U then A = U −A.

Example 9 Let the universal set for this question be U , the set of natural numbers less than or equalto twelve. Let T be the set of integers divisible by three, F be the set of integers divisibleby five and P the set of primes. Determine each of the following.

1. T ∪ F

2. T ∩ F

3. P

4. P ∩ (T ∪ F )

5. T ∪ F

6. (T ∪ F )− P

Solution:

1. T ∪ F = {3, 5, 6, 9, 10, 12}

2. T ∩ F = ∅

3. P = {1, 4, 6, 8, 9, 10, 12}

4. P ∩ (T ∪ F ) = {3, 5}

5. T ∪ F = {1, 2, 4, 5, 7, 8, 10, 11}

6. (T ∪ F )− P = {6, 9, 10, 12}

Page 47: MATH 135 Course Note

Section 5.4 Comparing Sets 47

5.3.1 Venn Diagrams

Venn diagrams can serve as useful illustrations of set relationships. In Figure 5.3.1 below,the universal set is U = {a, b, c, d, e, w}, the set A = {a, b, c, d} and the set B = {d, e}.The element d lies in the intersection of sets A and B. Since d is the only such element,A ∩B = {d}. The element w does not lie in either set A or B.

A B

a

b

c

de

w

Figure 5.3.1: Venn Diagram

5.4 Comparing Sets

5.4.1 Sets of Solutions

One common use of sets is to describe values which are solutions to an equation, but carein expression is required here. The following two sentences mean different things.

1. Let a, b, c ∈ R, a 6= 0 and b2 − 4ac ≥ 0. The solutions to the quadratic equation

ax2 + bx+ c = 0

are

x =−b±

√b2 − 4ac

2a

2. Let a, b, c ∈ R, a 6= 0 and b2 − 4ac ≥ 0. Then

x =−b±

√b2 − 4ac

2a

are solutions to the quadratic equation

ax2 + bx+ c = 0

The first sentence asserts that a complete description of all solutions is given. The secondsentence only asserts that x = (−b ±

√b2 − 4ac)/2a are solutions, not that they are the

complete solution. In the language of sets, if S is the complete solution to ax2 + bx+ c = 0,and T = {(−b±

√b2 − 4ac)/2a}, Sentence 1 asserts that S = T (which implies S ⊆ T and

T ⊆ S) but Sentence 2 only asserts that T ⊆ S.

This point can be confusing. Statements about solutions are often implicitly divided intotwo sets: the set S of all solutions and a set T of proposed solutions. One must be careful

Page 48: MATH 135 Course Note

48 Chapter 5 Introduction to Sets

to determine whether the statement is equivalent to S = T or T ⊆ S. Phrases like thesolution or complete solution or all solutions indicate S = T . Phrases like a solution or aresolutions indicate T ⊆ S.

Similar confusion arises when showing that sets have more than one representation. Forexample, a circle centred at the origin O is often defined geometrically as the set of pointsequidistant from O. Others define a circle algebraically in the Cartesian plane as the set ofpoints satisfying x2 + y2 = r2. To show that the two definitions describe the same object,one must show that the two sets of points are equal.

5.4.2 An Example

Given a set S and a set T , there are two very frequent tasks one must perform: one mustshow S ⊆ T or S = T . In fact, the second task is usually just two instances of the firsttask: to show S = T one can show S ⊆ T and T ⊆ S.

So, the important message here is that mathematicians must become skilled at demonstrat-ing that S ⊆ T . The plan in all cases is the same: choose a generic element of S and showthat it belongs to T . Symbolically

S ⊆ T means x ∈ S ⇒ x ∈ T

or equivalentlyS ⊆ T means For all x ∈ S, x ∈ T

The element chosen must be completely generic and could, if forced, be instantiated as anyelement of the set S. Showing that a specific element of S belongs to T is inadequate.

Example 10 Consider the statement:

Integer multiples of π are roots of f(x) = (x2 − 1) sinx.

1. Explicitly identify two sets used in this statement.

2. Are the two sets equal?

3. Is the statement true?

Solution:

1. Let S be the set of all roots of f(x) = (x2 − 1) sinx. (We could write S moresymbolically as S = {x ∈ R | f(x) = 0}.) Let T be the set of integer multiples of π.(We could also write T more symbolically as T = {nπ | n ∈ Z}).

2. To show that S = T we must show T ⊆ S and S ⊆ T . Since sin(nπ) = 0 for allintegers n, we know that f(nπ) = 0. Now, the defining property of S is that a realnumber x belongs to S if f(x) = 0. Since f(nπ) = 0, nπ ∈ S. This is equivalent to: ifnπ ∈ T then nπ ∈ S, or equivalently, T ⊆ S. Now consider x = 1. The value x = 1 isa solution to (x2 − 1) sinx = 0 and so belongs to S, but it is not an integer multipleof π, so it does not belong to T . That is, S 6⊆ T and so the two sets are not equal.

3. The statement is true. The statement only claims that T ⊆ S, not S = T .

Page 49: MATH 135 Course Note

Section 5.5 Practice 49

5.5 Practice

1. Consider the following proposition.

If A and B are sets, then |A ∪B| = |A|+ |B| − |A ∩B|.Complete the following table and verify that the proposition holds for each of thefollowing pairs of sets.

(a) A = {n ∈ Z : n | 30} and B = {n ∈ Z : n | 42}(b) A = {x ∈ R | sinx = 0,−2π ≤ x ≤ 2π} and

B = {x ∈ R | cosx = 0,−2π ≤ x ≤ 2π}

Page 50: MATH 135 Course Note

Chapter 6

More on Sets

6.1 Objectives

The technique objectives are:

1. To gain more experience working with sets.

6.2 Showing Two Sets Are Equal

Let’s take a look at two proofs of the same statement about sets. The first uses a chain ofif and only if statements, the second uses mutual inclusion.

Proposition 1 Let A, B and C be arbitrary sets.

A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)

Proof: This proof uses a chain of if and only if statements to show that both A ∪ (B ∩C)and (A ∪B) ∩ (A ∪ C) have exactly the same elements. Let x ∈ A ∪ (B ∩ C). Then

x ∈ A ∪ (B ∩ C)

⇐⇒ (x ∈ A) ∨ (x ∈ (B ∩ C)) definition of union

⇐⇒ (x ∈ A) ∨ ((x ∈ B) ∧ (x ∈ C)) definition of intersection

⇐⇒ ((x ∈ A) ∨ (x ∈ B)) ∧ ((x ∈ A) ∨ (x ∈ C)) Distributive Law of logic

⇐⇒ (x ∈ A ∪B) ∧ (x ∈ A ∪ C) definition of union

⇐⇒ x ∈ ((A ∪B) ∩ (A ∪ C)) definition of intersection

Proof: This proof uses mutual inclusion. That is, we will show

1. A ∪ (B ∩ C) ⊆ (A ∪B) ∩ (A ∪ C)

50

Page 51: MATH 135 Course Note

Section 6.3 More Examples 51

2. A ∪ (B ∩ C) ⊇ (A ∪B) ∩ (A ∪ C)

Equivalently, we must show

1. If x ∈ A ∪ (B ∩ C), then x ∈ (A ∪B) ∩ (A ∪ C).

2. If x ∈ (A ∪B) ∩ (A ∪ C), then x ∈ A ∪ (B ∩ C).

Let x ∈ A∪(B∩C). By the definition of union, x ∈ A or x ∈ (B∩C). If x ∈ A, then by thedefinition of union, x ∈ A ∪B and x ∈ A ∪C, that is x ∈ (A ∪B) ∩ (A ∪C). If x ∈ B ∩C,then by the definition of intersection, x ∈ B and x ∈ C. But then by the definition of union,x ∈ A ∪B and x ∈ A ∪ C. Hence, by the definition of intersection, x ∈ (A ∪B) ∩ (A ∪ C).In both cases, x ∈ (A ∪B) ∩ (A ∪ C) as required.

Let x ∈ (A ∪B) ∩ (A ∪ C). By the definition of intersection, x ∈ A ∪B and x ∈ A ∪ C. Ifx ∈ A, then by the definition of union, x ∈ A∪ (B ∩C). If x 6∈ A, then by the definition ofunion and the fact that x ∈ A ∪ B, x ∈ B. Similarly, x ∈ C. But then, by the definitionof intersection, x ∈ B ∩ C. By the definition of union, x ∈ A ∪ (B ∩ C). In both cases,x ∈ A ∪ (B ∩ C).

The first of these two proofs also uses mutual inclusion. Do you see how?

REMARK

Which technique is better for proving the equality of two sets: a chain of if and only ifstatements or mutual inclusion? Though some of the choice is personal style, the choice isprimarily determined by the “reversibility” of each step in the proof. A chain of if and onlyif statements only works if each step in the chain is reversible. That’s pretty unusual. Mostof the time when you are proving two sets are equal, you will need to use mutual inclusion.

6.3 More Examples

1. (a) Give a specific example to show that the statement “U ∩ (S ∪T ) = (U ∩S)∪T”is false.

(b) Prove the following statement. Let S, T, U be sets. Then

U ∩ (S ∪ T ) = (U ∩ S) ∪ (U ∩ T )

Solution:

(a) Let U = ∅, S = {1} and T = {2}. Then U ∩ (S ∪ T ) = ∅ and (U ∩ S)∪ T = {2}.In this case U ∩ (S ∪ T ) 6= (U ∩ S) ∪ T

(b) Proof: To show U ∩ (S ∪ T ) = (U ∩ S) ∪ (U ∩ T ) we must show

i. U ∩ (S ∪ T ) ⊆ (U ∩ S) ∪ (U ∩ T ), and

ii. U ∩ (S ∪ T ) ⊇ (U ∩ S) ∪ (U ∩ T ).

This is equivalent to showing

Page 52: MATH 135 Course Note

52 Chapter 6 More on Sets

i. If x ∈ U ∩ (S ∪ T ), then x ∈ (U ∩ S) ∪ (U ∩ T ), and

ii. If x ∈ (U ∩ S) ∪ (U ∩ T ), then x ∈ U ∩ (S ∪ T ).

In the first case, let x ∈ U ∩ (S ∪ T ). By the definition of set intersection, x ∈ UAND x ∈ S∪T . If x ∈ S, then x ∈ U ∩S and so x ∈ (U ∩S)∪ (U ∩T ). If x ∈ T ,then x ∈ U ∩T and so x ∈ (U ∩S)∪ (U ∩T ). In either case, x ∈ (U ∩S)∪ (U ∩T )as needed.

In the second case, let x ∈ (U ∩ S) ∪ (U ∩ T ). By the definition of set unionx ∈ U ∩ S OR x ∈ U ∩ T . If x ∈ U ∩ S, then by the definition of set intersectionx ∈ U AND x ∈ S. But then x ∈ U and x ∈ S ∪ T so x ∈ U ∩ (S ∪ T ). Ifx ∈ U ∩T , then by the definition of set intersection x ∈ U AND x ∈ T . So again,x ∈ U and x ∈ S ∪T so x ∈ U ∩ (S ∪T ). In either case, x ∈ x ∈ U ∩ (S ∪T ).

Page 53: MATH 135 Course Note

Part III

Proof Techniques

53

Page 54: MATH 135 Course Note

Chapter 7

Quantifiers

7.1 Objectives

The technique objectives are:

1. Learn the basic structure of quantifiers.

2. Learn how to use the Object, Construct and Select Methods.

7.2 Quantifiers

Not all mathematical statements are obviously in the form “If A, then B”. You will en-counter statements of the form there is, there are, there exists, it has or for all, for each, forevery, for any. The first four are all examples of the existential quantifier there is andthe final four are all examples of the universal quantifier for all. The word existence isused to make it clear that we are looking for or looking at a particular mathematical object.The word universal is used to make it clear that we are looking for or looking at a set ofobjects all of which share some desired behaviour.

REMARK

All statements which use quantifiers are similar to one of the following two statements,though some elements of the sentence may be implicit or appear in a different order.

There exists an x in the set S such that P (x) is true.For every x in the set S, P (x) is true.

where P (x) is an open sentence that uses the variable x.

Some mathematicians prefer a more symbolic approach. The symbol ∃ stands for theEnglish expression “there exists”. The symbol ∀ stands for the English expression “for all”.Symbolically, the two quantified sentences above are written as:

∃x ∈ S, P (x)

∀x ∈ S, P (x)

54

Page 55: MATH 135 Course Note

Section 7.2 Quantifiers 55

REMARK

All statements which use quantifiers share a basic structure.

1. a quantifier which will be either an existential or universal quantifier,

2. a variable which can be any mathematical object,

3. a set which is the domain of the variable, often implicit, and

4. an open sentence which involves the variable,

It is crucial that you be able to identify the four parts in the structure of quantified state-ments.

Here are some examples. Let’s begin with something we have already seen.

Example 1

1. There exists an integer k so that n = km

Quantifier: ∃Variable: kDomain: ZOpen sentence: n = km

Our next example could come from any of several branches of mathematics.

2. There exists a real number x such that f(x) = 0.

Quantifier: ∃Variable: xDomain: ROpen sentence: f(x) = 0

This is a good point to illustrate the influence of the domain. Suppose in this examplewe are interested in the specific function f(x) = x2 − 2. Then the statement

There exists a real number x such that x2 − 2 = 0.

is true since we can find an x,√

2, so that x2 − 2 = 0.

But if we change the domain to integers, the statement

There exists an integer x such that x2 − 2 = 0.

is false because neither of the two real roots,√

2 or −√

2, are integers. So changingthe domain can change the truth value of the statement. In practice, the domain isoften not explicitly stated and is inferred from context.

Page 56: MATH 135 Course Note

56 Chapter 7 Quantifiers

3. For every integer n > 5, 2n > n2.

Quantifier: ∀Variable: nDomain: {n ∈ Z | n > 5}Open sentence: 2n > n2

The sentence might appear as “2n > n2 for all integers n > 5”. The order is differentbut the meaning is the same.

4. There exists an angle θ such that sin(θ) = 1.

Quantifier: ∃Variable: an angle θDomain: R, inferred from the contextOpen sentence: sin(θ) = 1

Note that in this example, the domain is implicit. Note also that there can be manyobjects, many angles θ, which satisfy the statement.

5. For every angle θ, sin2(θ) + cos2(θ) = 1.

Quantifier: ∀Variable: θDomain: R, inferred from contextOpen sentence: sin2(θ) + cos2(θ) = 1

6. If f is continuous on [a, b] and differentiable on (a, b) and f(a) = f(b), then thereexists a real number c ∈ (a, b) such that f ′(c) = 0.

The conclusion of this implication uses an existential quantifier. The hypothesis andthe conclusion are:

Hypothesis: f is continuous on [a, b] and differentiable on (a, b) and f(a) = f(b).

Conclusion: There exists a real number c ∈ (a, b) such that f ′(c) = 0.

For the conclusion, the parts of the quantified statement are given below.

Quantifier: ∃Variable: cDomain: (a, b) ⊂ ROpen sentence: f ′(c) = 0

It takes practice to become fluent in reading and writing statements that use quantifiers.

Page 57: MATH 135 Course Note

Section 7.3 The Object Method 57

7.3 The Object Method

REMARK

We use the Object Method when an existential quantifier occurs in the hypothesis. Supposethat we must prove “A implies B” and A uses an existential quantifier. That is, A lookslike

There exists an x in the set S such that P (x) is true.

We proceed exactly as the English language interpretation would suggest - we assume thatthe object x exists. We should:

1. Identify the four parts of the quantified statement.

2. Assume that a mathematical object x exists within the set S so that the statementP (x) is true.

3. Make use of this information to generate another statement.

For example, let’s look at the proof of the Transitivity of Divisibility again.

Proposition 1 (Transitivity of Divisibility (TD))

Let a, b and c be integers. If a | b and b | c, then a | c.

Proof: Since a | b, there exists an integer r so that ra = b. Since b | c, there exists aninteger s so that sb = c. Substituting ra for b in the previous equation, we get (sr)a = c.Since sr is an integer, a | c.

You might ask “Where is the existential quantifier?”. It isn’t obvious – yet. But recall thedefinition of divisibility.

An integer m divides an integer n, and we write m | n, if there exists an integerk so that n = km.

The sentence “there exists an integer k so that n = km” uses the existential quantifier. Itis very common in mathematics that sentences contain implicit quantifiers and you shouldbe alert for them. Returning to divisibility, we have already identified the four parts of thequantified sentence.

Quantifier: ∃Variable: kDomain: ZOpen sentence: n = km

Page 58: MATH 135 Course Note

58 Chapter 7 Quantifiers

How would the Object Method work? Consider the statement a | b. It uses an implicitexistential quantifier. Since a | b occurs in the hypothesis, we assume the existence of aninteger, say r, so that ra = b. And if you return to examine our proof of Transitivity ofDivisibility, this is precisely what appears in the first sentence of the proof. Similarly, theObject Method can be used with b | c to assert that there exists an integer s so that sb = c.Together, the first two sentences of the proof allow us to derive the third sentence.

7.4 The Construct Method

REMARK

We use the Construct Method when an existential quantifier occurs in the conclusion.Suppose that we must prove “A implies B” and B uses an existential quantifier. That is,B looks like

There exists an x in the set S such that P (x) is true.

We proceed exactly as the English language interpretation would suggest - we show thatthe object x exists, that x is in the set S, and that P (x) is true. We should:

1. Identify the four parts of the quantified statement.

2. Construct a mathematical object x.

3. Show that x ∈ S.

4. Show that P (x) is true.

For example, let us discover a proof of the following proposition.

Proposition 2 If n is of the form 4`+ 1 for some positive integer `, then 8 | (n2 − 1).

As usual, let us begin by explicitly identifying the hypothesis, the conclusion and the coreproof technique.

Hypothesis: n is of the form 4`+ 1 for some integer `.

Conclusion: 8 | (n2 − 1).

Core Proof Technique: Since the definition of divisibility contains an existential quan-tifier, and 8 | (n2 − 1) occurs in the conclusion, we will use the Construct Method.

What, precisely should we construct? Again, thinking of the definition of divisibility andthe requirement of the Construct Method, we should construct a k and then show that k isan integer and that 8k = n2 − 1. We can record this as a proof in progress.

Page 59: MATH 135 Course Note

Section 7.4 The Construct Method 59

Proof in Progress

1. Construct k. Following the plan, we must construct a mathematical object x.

2. Show that k is an integer. We must show that x ∈ S.

3. Show that 8k = n2 − 1. We must show that the statement P (x) is true.

Where is this k going to come from? Let’s start with the hypothesis, n is of the form 4`+ 1for some integer `. Substituting n = 4`+ 1 into n2 − 1 gives

n2 − 1 = (4`+ 1)2 − 1 = 16`2 + 8`+ 1− 1 = 16`2 + 8` = 8(2`2 + `)

Updating our proof in progress gives the following.

Proof in Progress

1. Let n = 4`+ 1.

2. Substituting n = 4`+ 1 into n2 − 1 gives

n2 − 1 = (4`+ 1)2 − 1 = 16`2 + 8`+ 1− 1 = 16`2 + 8` = 8(2`2 + `)

3. Construct k.

4. Show that k is an integer.

5. Show that 8k = n2 − 1.

It seems that a suitable choice for k would be 2`2 + `. Since ` is an integer and the productof integers is an integer and the sum of integers is an integer, k is an integer. It is also clearfrom the equation above that 8k = n2 − 1.

A proof might look like the following.

Proof: Substituting n = 4`+ 1 into n2 − 1 gives

n2 − 1 = (4`+ 1)2 − 1 = 16`2 + 8`+ 1− 1 = 16`2 + 8` = 8(2`2 + `)

Since 2`2 + ` is an integer, 8 | (n2 − 1).

Note that the proof does not explicitly name the Construct Method.

Our next proposition may seem unusual because it does not have an explicit hypothesis.

Proposition 3 There is a real number θ ∈ [0, 2π] such that sin θ = cos θ.

Page 60: MATH 135 Course Note

60 Chapter 7 Quantifiers

Even before we see a proof we should be able to guess at the structure of the proof. As usual,we begin with the hypothesis, conclusion, core proof technique and preliminary material.

Hypothesis: None.

Conclusion: There is a real number θ ∈ [0, 2π] such that sin θ = cos θ.

Core Proof Technique: Since there is an existential quantifier in the conclusion, we usethe Construct Method.

Preliminary Material: Elementary trigonometry

Since we are working with a quantifier, let’s be very clear about the four parts.

Quantifier: ∃Variable: θDomain: [0, 2π]Open sentence: sin θ = cos θ

Following from the remarks at the beginning of this section, the proof will probably looklike

Proof in Progress

1. Consider θ = . . . ... This is the constructed object.

2. Since . . . θ ∈ [0, 2π] This is where we show that the constructed object is in the domain.

3. Now we show that sin θ = cos θ This is where we show that the constructed objectsatisfies the open sentence.

Here is a proof. Take a minute to read it and see how closely it matches the expectedstructure. Also observe that no indication is given of how θ was constructed.

Proof: Consider θ =π

4. Clearly, θ ∈ [0, 2π]. Since

sin θ = sinπ

4=

1√2

and cos θ = cosπ

4=

1√2

sin θ = cos θ as required.

Page 61: MATH 135 Course Note

Section 7.5 The Select Method 61

7.5 The Select Method

REMARK

We use the Select Method whenever a universal quantifier occurs. Suppose a statementlooks like

For every x in the set S, P (x) is true.

Observe that this statement is equivalent to

If x is in the set S, then P (x) is true.

We proceed exactly as the English language interpretation would suggest - we show thatwhenever an object x in the set S exists, P (x) is true. We should:

1. Identify the four parts of the quantified statement.

2. Select a representative mathematical object x ∈ S. This cannot be a specific object.It has to be a placeholder so that our argument would work for any specific memberof S. Note that if the the set S is empty, we proceed no further. The statement isvacuously true.

3. Show that P (x) is true.

For example, let us discover a proof of the following proposition.

Proposition 4 For every odd integer n, 4 | (n2 + 4n+ 3).

Let’s begin by identifying the four parts of the quantified statement.

Quantifier: ∀Variable: nDomain: odd integersOpen sentence: 4 | (n2 + 4n+ 3)

Now we select a representative mathematical object from the set. Let’s call the odd integerthat we selected n0. We could certainly call it n. I am using n0 to emphasize that we haveselected a representative element. Now we must show that 4 | (n20 + 4n0 + 3). This much isalready very representative of a typical proof using the Select Method.

Proof in Progress

1. Let n0 be an odd integer. (Select a representative mathematical object x ∈ S.)

2. Show that 4 | (n20 + 4n0 + 3). (Show that P (x) is true.)

Page 62: MATH 135 Course Note

62 Chapter 7 Quantifiers

Since n0 is odd, we can write it as n0 = 2m + 1 for some integer m. Substituting inton20 + 4n0 + 3 gives

n20 + 4n0 + 3 = 4m2 + 4m+ 1 + 8m+ 4 + 3 = 4m2 + 12m+ 8 = 4(m2 + 3m+ 2)

which implies 4 | (n20 + 4n0 + 3).

A proof might look like the following.

Proof: Let n0 be an odd integer. We can write n0 as 2m+1 for some integerm. Substitutingn0 = 2m+ 1 into n20 + 4n0 + 3 gives

n20 + 4n0 + 3 = 4m2 + 4m+ 1 + 8m+ 4 + 3 = 4m2 + 12m+ 8 = 4(m2 + 3m+ 2)

Since m2 + 3m+ 2 is an integer, 4 | (n20 + 4n0 + 3).

The same proof would work if we converted the universal statement into an “If ... then ”form. The equivalent statement would be

Proposition 5 If n is an odd integer, then 4 | (n2 + 4n+ 3).

7.6 Sets and Quantifiers

It is important to emphasize the connection between sets and quantifiers. The basic struc-tures of all quantified statements use sets.

There exists an x in the set S such that P (x) is true.For every x in the set S, P (x) is true.

To correctly prove or use quantified statements, you must first correctly identify the setbeing used.

Also, quantifiers frequently appear in the defining property of a set. For example, the setof even integers

{n ∈ Z : 2 | n}

uses an implicit existential quantifier in the definition of divides.

To show that S ⊆ T , we use the universally quantified statement

∀x ∈ S, x ∈ T

Sets and quantifiers are very closely linked.

Page 63: MATH 135 Course Note

Section 7.7 A Non-Proof 63

7.7 A Non-Proof

Making mistakes is easy. Let’s take a look at a “proof” which is not a proof. Let’s find outwhy it fails.

Proposition 6 If r is a positive real number with r 6= 1, then there is an integer n such that 21n < r.

Proof: (For reference purposes, each sentence of the proof is written on a separate line.)

1. Let n be any integer with n >1

log2(r).

2. It then follows that1

n< log2(r).

3. Hence 21n < 2log2(r) = r.

Analysis of Proof Let’s begin by identifying the hypothesis and the conclusion. An in-terpretation of sentences 1 through 3 will follow.

Hypothesis: r is a positive real number. r 6= 1.

Conclusion: There is an integer n such that 21n < r.

Sentence 1 Let n be any integer with n > 1/ log2(r).

Since an existential quantifier occurs in the conclusion, the author uses the ConstructMethod. The four parts of the quantifier are:

Quantifier: ∃Variable: nDomain: ZOpen sentence: 2

1n < r

In the first sentence of the proof, the author constructs an integer n. Later in theproof, the author intends to show that n satisfies the open sentence of the quantifier.Since r is a real number (not equal to 1), 1/ log2(r) evaluates to a real number andwe can certainly find an integer greater than any given real number.

Sentence 2 It then follows that 1n < log2(r).

Here the author takes the reciprocal of n > 1/ log2(r).

Sentence 3 Hence 21n < 2log2(r) = r.

Use the left and right sides of 1n < log2(r) as exponents of 2 and recall that the

function 2x always increases as x increases.

Even the analysis looks good. What went wrong? Let’s look again at Sentence 2. Here weused the statement

Page 64: MATH 135 Course Note

64 Chapter 7 Quantifiers

Statement 7 If a, b ∈ R, neither equal to 0, and a < b, then 1/b < 1/a.

A proof seems pretty straightforward – divide both sides of a < b by ab. Except thatthe statement is false. Consider the case a = −2 and b = 4. −2 < 4 but 1

4 ≮1−2 . Our

proposition really should be

Statement 8 If a, b ∈ R, and 0 < a < b, then 1/b < 1/a.

Now we can find the problem in our proof. Choose r so that 0 < r < 1, say r = 1/2. Thatwill make log2(r) negative and hence 1/ log2(r) negative. Choose n = 1. Now Sentence 1 issatisfied but Sentence 2 fails.

Can you think of any way to correct the proposition or the proof?

Page 65: MATH 135 Course Note

Chapter 8

Nested Quantifiers

8.1 Objectives

The technique objectives are:

1. Recognize nested quantifiers.

2. Learn how to parse nested quantifiers.

3. Learn which techniques to apply to a sentence containing nested quantifiers.

The content objectives are:

1. Define function, domain and codomain.

2. Define onto (or surjective).

3. Use nested quantifiers to prove whether or not a function is onto.

4. Use nested quantifiers to establish a limit.

8.2 Onto (Surjective) Functions

8.2.1 Definition of Function

One of the most fundamental notions of modern mathematics is that of a function.

Definition 8.2.1

Function, Domain,Codomain, Value

Let S and T be two sets. A function f from S to T , denoted by f : S → T , is a rule thatassigns to each element s ∈ S a unique element f(s) ∈ T . The set S is called the domainof the function and the set T is called the codomain. The element f(s) is called the valueof the function f at s.

65

Page 66: MATH 135 Course Note

66 Chapter 8 Nested Quantifiers

Definition 8.2.2

Image

The set of values of the function is called the image of f and is denoted by f(S). The setf(S) is often a proper subset of the codomain, not the entire codomain.

f(S) = {f(s) | s ∈ S} ⊆ T

Some authors use range instead of image, but since other authors use range to meancodomain, we will avoid the word range entirely.

Example 1 The familiar function sinx is often defined with domain R, codomain R and image [−1, 1].

The floor function, denoted by bxc, maps a real number x to the largest integer less thanor equal to x. For example,

1. b3.14c = 3.

2. b3.99c = 3.

3. b−3.14c = −4. Since the floor of x is the largest integer less than or equal to x, −3cannot be the floor of −3.14 since −3 > −3.14.

The floor function has domain R, codomain Z and image Z.

8.2.2 Definition of Onto (Surjective)

Definition 8.2.3

Onto, Surjective

Let S and T be two sets. A function f : S → T is onto (or surjective) if and only if forevery y ∈ T there exists an x ∈ S so that f(x) = y.

More prosaically, every element of T is a value of some element of S.

In Calculus, S and T are often equal to R or are subsets of R.

Though you may not fully understand the definition, the important observation for us is thatthe definition contains two quantifiers. Let’s carefully parse the definition beginning withthe universal quantifier “For every”. Recall that we must identify the quantifier, variable,domain and open sentence.

Quantifier: ∀Variable: yDomain: TOpen sentence: there exists an x ∈ S so that f(x) = y

The open sentence itself contains a quantifier! So we can again identify the four parts ofthis quantifier.

Quantifier: ∃Variable: xDomain: SOpen sentence: f(x) = y

Page 67: MATH 135 Course Note

Section 8.2 Onto (Surjective) Functions 67

REMARK

Because the existential quantifier is “nested” within the universal quantifier, this definitionis an example of nested quantifiers. There are really two basic principles for workingwith nested quantifiers.

1. Process quantifiers from left to right. (This captures the “nested” structure.)

2. Use Object, Construct and Select methods as you proceed from left to right.

Moving from left to right is important. The order of quantifiers matters.

For example, consider the following statement about the integers.

∀x ∃y, y > x

Translated into prose, this statement can be read as “Given any integer x, there exists alarger integer y.” This is a true statement. Now let’s make a small modification. We willjust change the order of the quantifiers. Our new statement is

∃y ∀x, y > x

A translation for this statement would be “There exists an integer y which is larger thanall integers.” A very different, and false, statement.

Let’s return to the definition of onto. We should be able to determine the structure of anyproof that a function is onto. Let’s keep the definition in mind.

Let S and T be two sets. A function f : S → T is onto (or surjective) if andonly if for every y ∈ T there exists an x ∈ S so that f(x) = y.

The order of quantifiers is

For all there exists

so we would expect the proof to be structured

Select Method Construct Method

A proof in progress that captures the structure of an onto proof is given below.

Page 68: MATH 135 Course Note

68 Chapter 8 Nested Quantifiers

Proof in Progress

1. Let y ∈ T . This comes from the Select Method.

2. Consider the object x. This comes from the Construct Method.

3. First, we show that x ∈ S. We show that the constructed object is within the domain.

4. Now we show that f(x) = y. We show that the open sentence is satisfied.

8.2.3 Reading

Let’s work through an example. Notice how closely the proof follows our proof in progress.

Proposition 1 Let m 6= 0 and b be fixed real numbers. The function f : R→ R defined by f(x) = mx+ bis onto.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Let y ∈ R.

2. Consider x = (y − b)/m.

3. Since y ∈ R, x ∈ R.

4. But then f(x) = f((y − b)/m) = m((y − b)/m) + b = y as needed.

Let’s perform an analysis of this proof.

Analysis of Proof The definition of onto uses a nested quantifier.

Hypothesis: m 6= 0 and b are fixed real numbers. f(x) = mx+ b.

Conclusion: f(x) is onto.

Core Proof Technique: Nested quantifiers.

Preliminary Material: Let us remind ourselves of the definition of the definingproperty of onto as it applies in this situation.

For every y ∈ R there exists x ∈ R so that f(x) = y.

Sentence 1 Let y ∈ R.

The first quantifier in the definition of onto is a universal quantifier so the author usesthe Select Method. That is, the author chooses an element (y) in the domain (R).The author must now show that the open sentence is satisfied (there exists an x ∈ Rso that f(x) = y).

Page 69: MATH 135 Course Note

Section 8.2 Onto (Surjective) Functions 69

Sentence 2 Consider x = (y − b)/m.

The second quantifier in the definition is a nested existential quantifier so the authoruses the Construct Method. The constructed object in this example is not surprising– we can simply solve for x in y = mx + b. In general, though, it can be difficult toconstruct a suitable object. Note also that the choice of x depends on y so it is notsurprising that x is a function of y.

Sentence 3 Since y ∈ R, x ∈ R.

Because this step is usually straightforward, it is often omitted. It is included here toemphasize that the constructed object lies in the appropriate domain.

Sentence 4 But then f(x) = f((y − b)/m) = m((y − b)/m) + b = y as needed.

Here the author confirms that the open sentence is satisfied.

8.2.4 Discovering

Having read a proof, let’s discover one.

Proposition 2 The function f : [1, 2]→ [4, 7] defined by f(x) = x2 + 3 is onto.

We can begin with the basic proof structure that we discussed earlier.

Proof in Progress

1. Let y ∈ [4, 7].

2. Consider x = . . .. We must construct x.

3. Show that x ∈ [1, 2]. To be completed.

4. Now we show that f(x) = y. To be completed.

What is our candidate value for x? Since x must satisfy

y = x2 + 3

we can solve for x to getx = ±

√y − 3

Since we want x ∈ [1, 2], we will choose the positive square root. Let’s update the proof inprogress.

Proof in Progress

1. Let y ∈ [4, 7].

2. Consider x =√y − 3.

3. Show that x ∈ [1, 2]. To be completed.

4. Now we show that f(x) = y. To be completed.

Page 70: MATH 135 Course Note

70 Chapter 8 Nested Quantifiers

It is not immediately obvious that x ∈ [1, 2]. Some arithmetic manipulation with inequalitieshelps us here. Since y ∈ [4, 7], we know that

4 ≤ y ≤ 7

Subtracting three gives1 ≤ y − 3 ≤ 4

Now taking the positive square root gives

1 ≤√y − 3 ≤ 2

and since x =√y − 3 we have

1 ≤ x ≤ 2

which is exactly what we need. We can update our proof in progress.

Proof in Progress

1. Let y ∈ [4, 7].

2. Consider x =√y − 3.

3. Now4 ≤ y ≤ 7⇒ 1 ≤ y − 3 ≤ 4⇒ 1 ≤

√y − 3 ≤ 2⇒ 1 ≤ x ≤ 2

4. Now we show that f(x) = y. To be completed.

Substitution will give us the last step. Here is a complete proof. Note that techniques arenot named and the steps in the arithmetic are not explicitly justified. These are left to thereader.

Proof: Let y ∈ [4, 7]. Consider x =√y − 3. Now

4 ≤ y ≤ 7⇒ 1 ≤ y − 3 ≤ 4⇒ 1 ≤√y − 3 ≤ 2⇒ 1 ≤ x ≤ 2

Sincef(x) = x2 + 3 = (

√y − 3)2 + 3 = y

f is onto.

The choice of the domain and codomain for the function is important. Consider the state-ment

Statement 3 The function f : R→ R defined by f(x) = x2 + 3 is onto.

This is very similar to the proposition we just proved, and you might think that the sameproof would work. But it doesn’t. Consider the choice y = 0 ∈ R. What value of x maps to0? Since f(x) = x2 + 3 ≥ 3 for all real numbers x, there is no choice of x so that f(x) = 0,and Statement 3 is false.

Page 71: MATH 135 Course Note

Section 8.2 Onto (Surjective) Functions 71

8.2.5 A Difficult Proof

Mathematics makes great use of the composition of functions. The next proposition, whoseproof may be intimidating the first time you see it, states that the composition of ontofunctions is also onto.

Proposition 4 Let f : T → U and g : S → T be onto functions. Then f ◦ g is an onto function.

Analysis of Proof The definition of onto uses nested quantifiers.

Hypothesis: f : T → U and g : S → T are both onto functions.

Conclusion: f ◦ g is onto.

Core Proof Technique: Nested quantifiers.

Preliminary Material: Let us recast the definition of onto for f ◦ g. To do this weneed to be aware of the fact that f : T → U and g : S → T and f ◦ g : S → U .So the statement we need to prove is:

For every y ∈ U there exists x ∈ S so that f(g(x)) = y.

There are three instances of onto in the proposition. Two occur in the hypothesis and areassociated with the functions f and g. The third occurs in the conclusion and is associatedwith the function f ◦ g. That is the one that interests us right now. The definition of ontobegins with a universal qualifier. So we will use the Select Method applied to f ◦ g. Usingour proof template we have the following.

Proof in Progress

1. Let y ∈ U .

2. Consider the object x. We must construct the object x.

3. First, we show that x ∈ S. To be completed.

4. Now we show that f(g(x)) = y. To be completed.

Constructing x seems difficult. We do not know what the sets S, T and U are and we haveno idea what the functions f and g look like. But we have not made use of our hypothesesat all so let’s see if they can give us any ideas.

Since f : T → U is onto, we know that for any u ∈ U , there exists a t ∈ T so that f(t) = u.

Since g : S → T is onto, we know that for any t ∈ T , there exists an s ∈ S so that g(s) = t.

How does y fit in? Observe that y ∈ U . But f : T → U and is onto, so there exists at′ ∈ T so that f(t′) = y. Since t′ ∈ T and g : S → T is onto, there exists an s′ ∈ S so thatg(s′) = t′.

But what have we constructed? If we let x = s′ then we have an element that maps fromS to T and then from T to U for which f(g(s′)) = y. Let’s record these thoughts.

Page 72: MATH 135 Course Note

72 Chapter 8 Nested Quantifiers

Proof in Progress

1. Let y ∈ U .

2. Since f : T → U is onto, there exists a t′ ∈ T so that f(t′) = y.

3. Since t′ ∈ T and g : S → T is onto, there exists an s′ ∈ S so that g(s′) = t′.

4. Hence, there exists s′ ∈ S so that f(g(s′)) = f(t′) = y.

5. Hence, there exists x ∈ S so that f(g(x)) = y.

Notice that our last two lines are essentially duplicates. When doing rough work, thisis common. However, when writing up a proof, such duplications should be removed,consistent notation should be enforced and omitted steps should be included. In this case,the proof is almost done for us.

Proof: Let y in U . Since f : T → U is onto, there exists a t′ ∈ T so that f(t′) = y. Sincet′ ∈ T and g : S → T is onto, there exists an s′ ∈ S so that g(s′) = t′. Hence, there existss′ ∈ S so that f(g(s′)) = f(t′) = y.

8.3 Limits

8.3.1 Definition

Almost everyone who takes a calculus course encounters the notion of a limit. When wewrite

limx→a

f(x) = L

we informally mean that we can make the values of f(x) arbitrarily close to L by takingx sufficiently close to, but not equal to a. But formally we need to be more explicit aboutwhat “arbitrarily” and “sufficiently” mean. That leads to the infamous ε − δ definition ofa limit.

Definition 8.3.1

Limit

The limit of f(x), as x approaches a, equals L means that for every real number ε > 0there exists a real number δ > 0 such that

0 < |x− a| < δ ⇒ |f(x)− L| < ε

Let’s carefully parse the definition beginning with the universal quantifier “For every”.

Quantifier: ∀Variable: εDomain: real numbers > 0Open sentence: there exists a real number δ > 0 such that

0 < |x− a| < δ ⇒ |f(x)− L| < ε

The open sentence itself contains a quantifier, so we must again identify the four parts ofthe quantifier.

Page 73: MATH 135 Course Note

Section 8.3 Limits 73

Quantifier: ∃Variable: δDomain: real numbers > 0Open sentence: 0 < |x− a| < δ ⇒ |f(x)− L| < ε

It is vitally important to observe that the open sentence is an implication. Because theexistential quantifier is “nested” within the universal quantifier, this definition is anotherexample of nested quantifiers.

We should take a minute here to think about x. The definition of limit began with theexpression “The limit of f(x), as x approaches a” so x is a real number. The implicationin the definition could be more explicitly phrased as

If x ∈ R and 0 < |x− a| < δ, then |f(x)− L| < ε

Keeping in mind our earlier remarks about implications with variables in the hypothesisbeing equivalent to quantifiers, we could replace the implication by the quantified statement

∀x ∈ {x ∈ R : 0 < |x− a| < δ}, |f(x)− L| < ε

which would be a third level of nesting! We’ll stay with the implication form because it’ssimpler.

8.3.2 Reading A Limit Proof

Before we begin our example, we should be able to determine the structure of any limitproof. The order of quantifiers is

For all ε there exists δ

so we would expect the proof to be structured

Select Method Construct Method

The choice of δ will depend on the choice of ε and so δ will be a function of ε. The ConstructMethod identifies a mathematical object, shows that the object is within the appropriatedomain, and that the object satisfies the corresponding open sentence. The open sentence inthis case is an implication with hypothesis 0 < |x−a| < δ(ε) and conclusion |f(x)−L| < ε.We assume that the hypothesis is true and show that the conclusion is true. So a limitproof will look like the following.

Proof in Progress

1. Let ε > 0 be a real number. This comes from the Select Method.

2. Consider the real number δ(ε) = . . .. This comes from the Construct Method. Mosttexts will use simply δ. Here we use δ(ε) to emphasize that δ is a function of ε.

3. First, we show that δ(ε) > 0. This shows δ is within the domain.

4. Now let 0 < |x−a| < δ(ε). This is the hypothesis of the open sentence in the definitionof limit.

5. We show that |f(x)− L| < ε. This is the conclusion of the open sentence.

The difficulty lies in finding a suitable choice of δ(ε). Let’s analyze a proof where someoneelse has made the choice of δ(ε) for us.

Page 74: MATH 135 Course Note

74 Chapter 8 Nested Quantifiers

Proposition 5 Let m 6= 0 be a real number.limx→a

mx+ b = ma+ b

Proof: (For reference purposes, each sentence of the proof is written on a separate line.)

1. Let ε > 0 be a real number.

2. Consider the real number δ(ε) =ε

|m|.

3. Since ε > 0 and |m| > 0, δ(ε) =ε

|m|> 0.

4. Now

0 < |x− a| < δ(ε)⇒ 0 < |x− a| < ε

|m|⇒ |m||x− a| < ε

⇒ |m(x− a)| < ε

⇒ |m(x− a) + (b− b)| < ε

⇒ |(mx+ b)− (ma+ b)| < ε

⇒ |f(x)− L| < ε

as required.

Analysis of Proof As usual, we begin with the hypothesis and the conclusion.

Hypothesis: m 6= 0 is a real number.

Conclusion: limx→amx+ b = ma+ b.

Core Proof Technique: Nested quantifiers.

Preliminary Material: Definition of a limit. Notice how closely this proof followsthe proof in progress.

Sentence 1 Let ε > 0 be a real number.

The definition of limit begins with a universal quantifier so the first proof techniqueis the Select Method, just as in the proof in progress.

Sentence 2 Consider the real number δ(ε) =ε

|m|.

The next quantifier is an existential quantifier in the conclusion and so we use theConstruct Method. This again follows the pattern of the proof structure. The con-

structed object is the real number δ(ε) =ε

|m|. The author gives no indication why

that particular value was chosen or how it was derived.

Page 75: MATH 135 Course Note

Section 8.3 Limits 75

Sentence 3 Since ε > 0 and |m| > 0, δ(ε) =ε

|m|> 0.

After an object is constructed, the Construct Method requires that the object be inthe domain and that it satisfy the open sentence. Sentence 3 of the proof shows thatδ is in the domain, the set of real numbers greater than zero.

Sentence 4 Now . . .

Sentence 4 demonstrates that δ satisfies the open sentence. The hypothesis of theopen sentence is 0 < |x − a| < δ(ε) and the conclusion is |f(x) − L| < ε. The chainof reasoning begins with the hypothesis, and after arithmetic manipulation, arrives atthe conclusion.

Exercise 1 Justify each line of arithmetic in Sentence 4.

8.3.3 Discovering a Limit Proof

We will prove

Proposition 6 If f(x) = x2, thenlimx→0

f(x) = 0

We begin by explicitly identifying our hypothesis and conclusion.

Hypothesis: f(x) = x2

Conclusion: limx→0 f(x) = 0

This is a standard limit proof so we use our proof in progress to provide a structure.

Proof in Progress

1. Let ε > 0 be a real number.

2. Consider the real number δ(ε) = . . ..

3. First, we show that δ(ε) > 0.

4. Now let 0 < |x| < δ(ε). (This is just 0 < |x− a| < δ(ε) with a = 0.)

5. We show that |x2| < ε. (This is just |f(x)− L| < ε with f(x) = x2 and L = 0.)

The problem is: How do we construct a suitable δ? Because ε is not numerically specified,our construction for δ will be a function of ε. Now is the time to go to scrap paper. Sincewe need

|x2| < ε

we begin there and work backwards to get to 0 < |x| < δ(ε). Since |x2| = x2, we have

x2 < ε

Page 76: MATH 135 Course Note

76 Chapter 8 Nested Quantifiers

Take the positive square root of both sides to get

x <√ε

It makes sense to tryδ(ε) =

√ε

and we can update our proof in progress.

Proof in Progress

1. Let ε > 0 be a real number.

2. Consider the real number δ(ε) =√ε.

3. First, we show that√ε > 0.

4. Now let 0 < |x| <√ε.

5. We show that |x2| < ε.

Sentence 3 will follow directly from ε > 0. Sentence 5 will follow from Step 4 by squaringthe terms. A complete proof follows.

Proof: Let ε > 0 be a real number. Consider the real number δ(ε) =√ε. Since ε > 0,√

ε > 0. Now0 < |x| <

√ε⇒ 0 < |x|2 < ε⇒ |x|2 < ε⇒ |x2| < ε

as needed.

This proof was relatively easy, in part because a was 0. Let’s consider a slightly morecomplicated setting.

Proposition 7 If f(x) = x2, thenlimx→3

f(x) = 9

Our standard limit proof will look like the following.

Proof in Progress

1. Let ε > 0 be a real number.

2. Consider the real number δ(ε) = . . ..

3. First, we show that δ(ε) > 0.

4. Now let 0 < |x− 3| < δ(ε). (This is just 0 < |x− a| < δ(ε) with a = 3.)

5. We show that |x2 − 9| < ε. (This is just |f(x)− L| < ε with f(x) = x2 and L = 9.)

Page 77: MATH 135 Course Note

Section 8.3 Limits 77

Let’s try what we did before and see how far we get. Since we need

|x2 − 9| < ε

we begin there and work backwards to get to 0 < |x − 3| < δ(ε). In the previous case, wetook the square root, but the square root of |x2 − 9| will be hard to work with. Let’s tryanother way.

|x2 − 9| < ε⇒ |(x− 3)(x+ 3)| < ε (factor)

⇒ |x− 3||x+ 3| < ε (|ab| = |a||b|)

We have the |x − 3| we need. What do we do with the |x + 3|? We could divide by the|x+ 3| to get

|x− 3| < ε

|x+ 3|

and let δ(ε) =ε

|x+ 3|. But δ is a function of ε, not ε and x. Somehow we need to make a

choice of δ that does not involve x. Let’s be a little more careful about the range of valuesx can take.

The notion of limit applies only when x is close to a, say |x− a| < 1. In our particular casethis means |x− 3| < 1. This implies

|x− 3| < 1⇒ −1 < x− 3 < 1⇒ 5 < x+ 3 < 7

Let’s look again at|x− 3||x+ 3| < ε

We know that x+3 < 7 so |x−3||x+3| < 7|x−3|. If we were to choose ε so that x−3 <ε

7then

|x− 3||x+ 3| < ε

7· 7 = ε

which is exactly what we need.

But now we have two restrictions, |x− 3| < 1 and |x− 3| < ε

7so it makes sense to choose

the smallest of the two as our δ.

δ(ε) = min{

1,ε

7

}This complicates our proof somewhat because we have two cases to check in the fifth stepof the proof. Here is a complete proof.

Proof: Let ε > 0 be a real number. Consider the real number δ(ε) = min{

1,ε

7

}. Since

ε > 0, δ(ε) > 0. Observe that

|x− 3| < 1⇒ −1 < x− 3 < 1⇒ 5 < x+ 3 < 7

Suppose δ(ε) = 1. Then

0 < |x− a| < δ(ε)⇒ |x− 3| < 1 (hypothesis in definition of limit)

⇒ |x− 3||x+ 3| < |x+ 3| (multiply by |x+ 3|)⇒ |(x− 3)(x+ 3)| < |x+ 3| (|a||b| = |ab|)⇒ |x2 − 9| < 7 (x+ 3 < 7 from observation above)

⇒ |x2 − 9| < ε (1 ≤ ε

7⇒ 7 ≤ ε)

Page 78: MATH 135 Course Note

78 Chapter 8 Nested Quantifiers

as needed.

Now suppose that δ(ε) = ε7 then

0 < |x− a| < δ(ε)⇒ |x− 3| < ε

7(hypothesis in definition of limit)

⇒ |x− 3||x+ 3| < ε

7· |x+ 3| (multiply by |x+ 3|)

⇒ |(x− 3)(x+ 3)| < ε

7· 7 (x+ 3 < 7 from observation above)

⇒ |x2 − 9| < ε

as needed.

8.3.4 A Harder Proof

We will prove

Proposition 8 If f(x) = e−1/x2, then

limx→0

f(x) = 0.

You might object that the function is not even defined at 0, which is true. But the definitionof limx→a f(x) does not require f to be defined at a. As usual, we begin by explicitlyidentifying our hypothesis and conclusion.

Hypothesis: f(x) = e−1/x2

Conclusion: limx→0 f(x) = 0

This is a standard limit proof so we use our existing structure.

Proof in Progress

1. Let ε > 0 be a real number.

2. Consider the real number δ(ε).

3. First, we show that δ(ε) > 0.

4. Now let 0 < |x| < δ(ε). (This is just 0 < |x− a| < δ(ε) with a = 0.)

5. We show that |e−1/x2 | < ε. (This is just |f(x)−L| < ε with f(x) = e−1/x2

and L = 0.)

The problem is: How do we construct a suitable δ? Because ε is not numerically specified,our construction for δ will be a function of ε. Now is the time to go to scrap paper. Sincewe need

|e−1/x2 | < ε

we begin there and work backwards to get to 0 < |x| < δ(ε). e−1/x2> 0 for all x so we do

not need the absolute value signs.1

e1/x2< ε

Page 79: MATH 135 Course Note

Section 8.4 Summary 79

Now divide by ε (we are using the hypothesis that ε 6= 0) and multiply by e1/x2

(we areusing the fact that e1/x

2> 0) to get the following.

1

ε< e1/x

2

Taking the natural log gives

ln

(1

ε

)<

1

x2

This is hopeful. We can invert the fractions to get

x2 <1

ln(1/ε)

and since x2 > 0 we now have

0 < x2 <1

ln(1/ε)

Taking square roots gives

0 < |x| <

√1

ln(1/ε)

And this is precisely the form we want. Our constructed delta is

δ =

√1

ln(1/ε)

This looks great. Unfortunately, we have made a dangerous assumption, that is ln(1/ε) > 0.This is only true when ε < 1. However, it is mathematical practice to consider ε as small,much smaller than one. We will adopt standard practice and ignore the case ε ≥ 1 thoughdetails could be given for it as well.

We have already worked out the math so now we are in a position to write out the proof.Take a minute to read the proof.

Proof: Let ε > 0. Since ε is small, we assume ε < 1. Consider δ =√

1ln(1/ε) . Since ε < 1,

1/ε > 1 which implies ln(1/ε) > 0 and so δ > 0. Now

0 < |x| <

√1

ln(1/ε)⇒ 0 < x2 <

1

ln(1/ε)⇒ ln

(1

ε

)<

1

x2⇒ 1

ε< e1/x

2 ⇒ |e−1/x2 | < ε

as required.

8.4 Summary

To prove a statement containing nested quantifiers, follow these steps.

1. For each quantifier encountered from left to right, identify the quantifier, variable,domain and open sentence.

2. Apply the appropriate Construct or Select Methods based on the order of the quan-tifiers as they appear from left to right.

Page 80: MATH 135 Course Note

Chapter 9

Practice, Practice, Practice:Quantifiers and Sets

9.1 Objectives

This class provides an opportunity to practice working with quantifiers and sets.

9.2 Worked Examples

Example 1 For each of the following definitions, identify each quantifier, its parts and the proof tech-niques that you would use to prove that a specific object satisfies the definition.

1. Saying that the function f of one real variable is bounded above means that thereis a real number y such that for every real number x, f(x) ≤ y.

Solution: We begin with the first quantifier

Quantifier: ∃Variable: yDomain: ROpen sentence: for every real number x, f(x) ≤ y

which contains a nested quantifier

Quantifier: ∀Variable: xDomain: ROpen sentence: f(x) ≤ y

A proof should use the Construct Method (for y) followed bythe Select Method (with x).

80

Page 81: MATH 135 Course Note

Section 9.2 Worked Examples 81

2. Saying that the function f of one real variable is continuous at the point x meansthat for every real number ε > 0 there is a real number δ > 0 such that, for all realnumbers y with |x− y| < δ, |f(x)− f(y)| < ε.

Solution: There are three quantifiers in this definition. The first is

Quantifier: ∀Variable: εDomain: {ε ∈ R | ε > 0}Open sentence: there is a real number δ > 0 such that,

for all real numbers y with |x− y| < δ, |f(x)− f(y)| < ε

which contains a nested quantifier

Quantifier: ∃Variable: δDomain: {δ ∈ R | δ > 0}Open sentence: for all real numbers y with |x− y| < δ, |f(x)− f(y)| < ε

which, in turn, contains the nested quantifier

Quantifier: ∀Variable: yDomain: {y ∈ R : |x− y| < δ}Open sentence: |f(x)− f(y)| < ε

A proof should use the Select Method (with ε), followed by the Construct Method(for δ) followed by the Select Method (for y).

Example 2 For each of the following statements, identify each quantifier (including implicit quantifiers),its parts and your approach to a proof of the statement.

1. There exists an x ∈ [0, 2π] so that, for all a ∈ R, a sinx = 0

Solution: This statement uses nested quantifiers. The first quantifier is an existentialquantifier

Quantifier: ∃Variable: xDomain: [0, 2π] ⊂ ROpen sentence: for all a ∈ R, a sinx = 0

and the second quantifier is a universal quantifier.

Quantifier: ∀Variable: aDomain: ROpen sentence: a sinx = 0

Corresponding to the existential quantifier and the nested universal quantifier, wecould use the Construct Method followed by the Select Method. The proof mightbegin “Consider x = . . . Let a ∈ R. We will show that x ∈ [0, 2π] and that a sinx = 0”

Page 82: MATH 135 Course Note

82 Chapter 9 Practice, Practice, Practice: Quantifiers and Sets

2. For every integer a, 2 | a(a+ 1).

Solution: There are two quantifiers in this statement, one explicit (for every integera) and one implicit (divides).

The parts of the explicit quantifier are:

Quantifier: ∀Variable: aDomain: ZOpen sentence: 2 | a(a+ 1)

The parts of the implicit quantifier are:

Quantifier: ∃Variable: kDomain: ZOpen sentence: 2k = a(a+ 1)

Corresponding to the universal quantifier and the implicitly nested existential quan-tifier, we could use the Select Method followed by the Construct Method. The proofmight begin “Let a ∈ Z. We find an integer k so that 2k = a(a+ 1).”

3. If n is an integer, then 8 | (52n + 7).

Solution: There is an implicit quantifier (divides) in the conclusion, so we would usethe Construct Method. The parts of the quantifier are:

Quantifier: ∃Variable: kDomain: ZOpen sentence: 8k = 52n + 7

The proof could begin “Let n ∈ Z. We find an integer k so that 8k = 52n + 7.”

Note that the statement could be rephrased as “ For all integers n, 8 | (52n + 7)”which we could also treat as nested quantifiers.

Example 3 A sequence is a set of numbers written in a definite order.

x1, x2, x3, . . . , xn, . . .

Alternative notation is {xi} or {xi}∞n=1.

A sequence {xi} converges to L if, for every ε > 0 there is a corresponding integer N sothat n > N implies |xn − L| < ε.

Consider the sequence {xi} defined by xi =1

i.

1. What are the first five terms in the sequence?

Solution:

1,1

2,1

3,1

4,1

5

Page 83: MATH 135 Course Note

Section 9.2 Worked Examples 83

2. Prove that the sequence converges to 0.

Solution: Using the structure of the nested quantifiers in the definition of converges,the proof will look like

Proof in Progress

(a) Let ε > 0. Use the Select Method corresponding to the universal quantifier.

(b) Consider N = . . .. Use the Construct Method corresponding to the existentialquantifier.

(c) Since . . . , N ∈ Z. The Construct Method requires that we show that the con-structed object is in the required domain.

(d) Let n > N . The open sentence of the existential quantifier contains the implica-tion “If n > N , then |xn − L| < ε.” This sentence corresponds to the hypothesisof this implication. The remainder of the proof demonstrates the conclusion.

(e) Hence, |xn − L| < ε. To be completed.

Since xn =1

nand L is zero, |xn − L| < ε becomes

1

n< ε which implies

1

ε< n. For

our N we can choose any integer which is greater than1

ε. A complete proof is given

below.

Proof: Let ε > 0. For N , choose any integer which is greater than1

ε. Since N >

1

ε,

ε >1

N. Now let n > N . Then

|xn − L| =∣∣∣∣ 1n − 0

∣∣∣∣ =1

n<

1

N< ε

as required.

Page 84: MATH 135 Course Note

Chapter 10

Simple Induction

10.1 Objectives

The technique objectives are:

1. Learn how to use sum and product notation, and recognize recurrence relations.

2. Learn how to use Simple Induction.

10.2 Notation

A number of examples we will discuss use sum, product and recursive notation that youmay not be familiar with.

10.2.1 Summation Notation

The sum of the first ten perfect squares could be written as

12 + 22 + 32 + · · ·+ 102

In mathematics, a more compact and more helpful notation is used.

10∑i=1

i2

Definition 10.2.1

SummationNotation

The notationn∑

i=m

xi

is called summation notation and it represents the sum

xm + xm+1 + xm+2 + · · ·+ xn

The summation symbol,∑

, is the upper case Greek letter sigma. The letter i is the indexof summation; the letter m is the lower bound of summation, and the letter n is theupper bound of summation. The expression i = m under the summation symbol meansthat the index i begins with an initial value of m and increments by 1 and stops when i = n.The index of summation is a dummy variable and any letter could be used in its place.

84

Page 85: MATH 135 Course Note

Section 10.2 Notation 85

Example 17∑i=3

i2 = 32 + 42 + 52 + 62 + 72

3∑k=0

sin(kπ) = sin(0) + sin(π) + sin(2π) + sin(3π)

n∑i=1

1

i2= 1 +

1

4+

1

9+ · · ·+ 1

n2

This notation is often generalized to an arbitrary logical condition, and the sum runs overall values satisfying the condition.

Example 2 For example, the expression ∑x∈S

f(x)

is the sum of f(x) over all elements x in the set S. The expression∑d|n,d>0

d

is the sum of all positive divisors of n.

There are a number of rules that help us manipulate sums.

Proposition 1 (Properties of Summation)

1. Multiplying by a constant

n∑i=m

cxi = c

n∑i=m

xi where c is a constant

2. Adding two sumsn∑

i=m

xi +

n∑i=m

yi =

n∑i=m

(xi + yi)

3. Subtracting two sumsn∑

i=m

xi −n∑

i=m

yi =n∑

i=m

(xi − yi)

4. Changing the bounds of the index of summation

n∑i=m

xi =

n+k∑i=m+k

xi−k

The first three properties require indices with the same upper and lower bounds. The lastproperty allows us to change the bounds of the index of summation, which is often usefulwhen combining summation expressions.

Page 86: MATH 135 Course Note

86 Chapter 10 Simple Induction

10.2.2 Product Notation

Just as summation notation using∑

is an algebraic shorthand for a sum, product notationusing

∏is an algebraic shorthand for a product.

Definition 10.2.2

Product Notation

The notationn∏

i=m

xi

is called product notation and it represents the product

xm · xm+1 · xm+2 · · · · · xn

The product symbol,∏

, is the upper case Greek letter pi. The index i and the upper andlower bounds m and n behave just as they do for sums.

Example 3n∏i=2

(1− 1

i2

)=

(1− 1

4

)(1− 1

9

)(1− 1

16

)· · ·(

1− 1

n2

)

10.2.3 Recurrence Relations

You are accustomed to seeing mathematical expressions in one of two ways: iterative andclosed form. For example, the sum of the first n integers can be expressed iteratively as

1 + 2 + 3 + · · ·+ n

or in closed form asn(n+ 1)

2

There is a third way.

Definition 10.2.3

Recurrence Relation

A recurrence relation is an equation that defines a sequence of numbers and which isgenerated by one or more initial terms, and expressions involving prior terms.

You are probably familiar with the Fibonacci sequence which is a recurrence relation.

Example 4 (Fibonacci Sequence)

The initial two terms are defined as f1 = 1 and f2 = 1. All subsequent terms are defined bythe recurrence relation fn = fn−1 + fn−2. The first eight terms of the Fibonacci sequenceare 1, 1, 2, 3, 5, 8, 13, 21.

Page 87: MATH 135 Course Note

Section 10.4 Introduction to Induction 87

Example 5 (Sum of First n Integers)

We can define the sum of the first n terms recursively as

f(1) = 1 and

f(n) = f(n− 1) + n for n > 1

10.3 Introduction to Induction

Induction is a common and powerful technique and should be a consideration whenever youencounter a statement of the form

For every integer n ≥ 1, P (n) is true.

where P (n) is a statement that depends on n.

Here are two examples of propositions in this form.

Proposition 2 For every integer n ≥ 1n∑i=1

i2 =n(n+ 1)(2n+ 1)

6.

Often the clause “For every integer n ≥ 1” is implied and does not actually appear in theproposition, as in the following version of the same theorem.

Proposition 3 The sum of the first n perfect squares isn(n+ 1)(2n+ 1)

6.

The second example uses sets, not equations.

Proposition 4 Every set of size n has exactly 2n subsets.

10.4 Principle of Mathematical Induction

Definition 10.4.1

Axiom

An axiom of a mathematical system is a statement that is assumed to be true. No proofis given. From axioms we derive propositions and theorems.

Sometimes axioms are described as self-evident, though many are not. Axioms are definingproperties of mathematical systems. The Principle of Mathematical Induction is one suchaxiom.

Page 88: MATH 135 Course Note

88 Chapter 10 Simple Induction

Axiom 1 Principle of Mathematical Induction (POMI)

Let P (n) be a statement that depends on n ∈ N.

If

1. P (1) is true, and

2. P (k) is true implies P (k + 1) is true for all k ∈ N

then P (n) is true for all n ∈ N.

We use the Principle of Mathematical Induction to prove statements of the form

For every integer n ≥ 1, P (n) is true.

The structure of a proof by induction models the Principle of Mathematical Induction. Thethree parts of the structure are as follows.

Base Case Verify that P (1) is true. This is usually easy. You will often see the statement“It is easy to see that the statement is true for n = 1.” It is best to write this stepout completely.

Inductive Hypothesis Assume that P (k) is true for some integer k ≥ 1. It is best towrite out the statement P (k).

Inductive Conclusion Using the assumption that P (k) is true, show that P (k + 1) istrue. Again, it is best to write out the statement P (k + 1) before trying to prove it.

10.4.1 Why Does Induction Work?

The basic idea is simple. We show that P (1) is true. We then use P (1) to show that P (2)is true. And then we use P (2) to show that P (3) is true and continue indefinitely. That is

P (1)⇒ P (2)⇒ P (3)⇒ . . .⇒ P (k)⇒ P (k + 1)⇒ . . .

10.4.2 Two Examples of Simple Induction

Our first example is very typical and uses an equation containing the integer n.

Proposition 5 For every integer n ∈ N,n∑i=1

i2 =n(n+ 1)(2n+ 1)

6.

Proof: We begin by formally writing out our inductive statement

P (n) :n∑i=1

i2 =n(n+ 1)(2n+ 1)

6.

Page 89: MATH 135 Course Note

Section 10.4 Principle of Mathematical Induction 89

Base Case We verify that P (1) is true where P (1) is the statement

P (1) :1∑i=1

i2 =1(1 + 1)(2× 1 + 1)

6.

As in most base cases involving equations, we can evaluate the expressions on theleft hand side and right hand side of the equals sign. The left hand side expressionevaluates to

1∑i=1

i2 = 12 = 1

and the right hand side expression evaluates to

1(1 + 1)(2× 1 + 1)

6= 1.

Since both sides equal each other, P (1) is true.

Inductive Hypothesis We assume that the statement P (k) is true for some integer k ≥ 1.

P (k) :

k∑i=1

i2 =k(k + 1)(2k + 1)

6.

Inductive Conclusion Now we show that the statement P (k + 1) is true.

P (k + 1) :

k+1∑i=1

i2 =(k + 1)((k + 1) + 1)(2(k + 1) + 1)

6.

This is the difficult part. When working with equations, you can often start with themore complicated expression and decompose it into an instance of P (k) with someleftovers. That’s what we will do here.

k+1∑i=1

i2 =

(k∑i=1

i2

)+((k + 1)2

)(partition into P (k) and other)

=

(k(k + 1)(2k + 1)

6

)+((k + 1)2

)(use the inductive hypothesis)

=k(k + 1)(2k + 1) + 6(k + 1)2

6(algebraic manipulation)

=(k + 1)

(2k2 + 7k + 6

)6

(factor out k + 1, expand the rest)

=(k + 1)(k + 2)(2k + 3)

6(factor)

=(k + 1)((k + 1) + 1)(2(k + 1) + 1)

6

The result is true for n = k+1, and so holds for all n by the Principle of MathematicalInduction.

Our next example does not have any equations.

Page 90: MATH 135 Course Note

90 Chapter 10 Simple Induction

Proposition 6 Let Sn = {1, 2, 3, . . . , n}. Then Sn has 2n subsets.

Let’s be very clear about what our statement P (n) is.

P (n): Sn has 2n subsets.

Now we can begin the proof.

Proof: Base Case We verify that P (1) is true where P (1) is the statement

P (1): S1 has 2 subsets.

We can enumerate all of the sets of S1 easily. They are { } and {1}, exactly two asrequired.

Inductive Hypothesis We assume that the statement P (k) is true for some integer k ≥ 1.

P (k): Sk has 2k subsets.

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): Sk+1 has 2k+1 subsets.

The subsets of Sk+1 can be partitioned into two sets. The set A in which no subsetcontains the element k+1, and the complement of A, A, in which every subset containsthe element k+1. Now A is just the subsets of Sk and so, by the inductive hypothesis,has 2k subsets of Sk. A is composed of the subsets of Sk to which the element k + 1is added. So, again by our inductive hypothesis, there are 2k subsets of A. SinceA and A are disjoint and together contain all of the subsets of Sk+1, there must be2k + 2k = 2k+1 subsets of Sk+1.

The result is true for n = k+1, and so holds for all n by the Principle of MathematicalInduction.

10.4.3 A Different Starting Point

Some true statements cannot start with “for all integers n, n ≥ 1”. For example, “2n > n2”is false for n = 2, 3, and 4 but true for n ≥ 5. But the basic idea holds. If we can showthat a statement is true for some base case n = b, and then show that

P (b)⇒ P (b+ 1)⇒ P (b+ 2)⇒ . . .⇒ P (k)⇒ P (k + 1)⇒ . . .

this is also induction. Perhaps this is not surprising because we can always recast a state-ment “For every integer n ≥ b, P (n)” as an equivalent statement “For every integer m ≥ 1,P (m)”. For example,

For every integer n ≥ 5, 2n > n2.

is equivalent to

Page 91: MATH 135 Course Note

Section 10.4 Principle of Mathematical Induction 91

For every integer m ≥ 1, 2m+4 > (m+ 4)2.

In this case, we have just replaced n by m+ 4.

The basic structure of induction is the same. To prove the statement

For every integer n ≥ b, P (n) is true.

the only changes we need to make are that our base case is P (b) rather than P (1), and thatin our inductive hypothesis we assume P (k) is true for k ≥ b rather than k ≥ 1.

Here is an example.

Proposition 7 For every integer n ≥ 3, n2 > 2n+ 1.

As usual, let’s be very clear about what our statement P (n) is.

P (n): n2 > 2n+ 1.

Now we can begin the proof.

Proof: Base Case We verify that P (3) is true where P (3) is the statement

P (3): 32 > 2(3) + 1

This is just arithmetic.32 = 9 > 7 = 2(3) + 1

Inductive Hypothesis We assume that the statement P (k) is true for some integer k ≥ 3.

P (k): k2 > 2k + 1

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): k + 12 > 2(k + 1) + 1

k + 12 = k2 + 2k + 1 > (2k + 1) + (2k + 1) = 4k + 2 > 2k + 3 = 2(k + 1) + 1

The first inequality follows from the inductive hypothesis and the second inequality usesthe fact that k > 0.

Since the result is true for n = k+1, and so holds for all n by the Principle of MathematicalInduction.

Here is another, similar example.

Proposition 8 For every integer n ≥ 5, 2n > n2.

The statement P (n) is:

P (n): 2n > n2.

Page 92: MATH 135 Course Note

92 Chapter 10 Simple Induction

Proof: Base Case We verify that P (5) is true where P (5) is the statement

P (5): 25 > 52

This is just arithmetic.25 = 32 > 25 = 52

Inductive Hypothesis We assume that the statement P (k) is true for some integer k ≥ 5.

P (k): 2k > k2

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): 2k+1 > (k + 1)2

We will use the fact that for k ≥ 5, k2 > 2k + 1 which follows from the previousproposition.

2k+1 = 2× 2k > 2× k2 = k2 + k2 > k2 + 2k + 1 = (k + 1)2

The result is true for n = k + 1, and so holds for all n by the Principle of MathematicalInduction.

10.5 An Interesting Example

A triomino is a tile of the form

Proposition 9 A 2n × 2n grid of squares with one square removed can be covered by triominoes.

As usual, we begin by explicitly stating P (n).

P (n): A 2n × 2n grid of squares with one square removed can be covered bytriominoes.

We will use Simple Induction.

Proof: Base Case We verify that P (1) is true.

P (1): A 2 × 2 grid of squares with one square removed can be covered bytriominoes.

A 2× 2 grid with one square removed looks like or or or .

Each of these can be covered by one triomino.

Inductive Hypothesis We assume that the statement P (k) is true k ≥ 1.

P (k): A 2k× 2k grid of squares with one square removed can be covered bytriominoes.

Page 93: MATH 135 Course Note

Section 10.6 An Interesting Example 93

Note that our inductive hypothesis covers every possible position for the empty squarewithin the grid.

Inductive Conclusion We now show that the statement P (k + 1) is true.

P (k + 1): A 2k+1 × 2k+1 grid of squares with one square removed can becovered by triominoes.

Consider a 2k+1 × 2k+1 grid with any square removed.

Split the 2k+1 × 2k+1 grid in half vertically and horizontally.

The missing square occurs in one of the four 2k × 2k subgrids formed. We’ll start byplacing one tile around the centre of the grid, not covering any of the 2k×2k subgridswhere the square is missing:

We can now view the grid as being made up of four 2k × 2k subgrids, each with onesquare missing. The Inductive Hypothesis tells us that each of these can be coveredby triominoes. Together with one more triomino in the centre, the whole 2k+1× 2k+1

grid can be covered. The result is true for n = k + 1, and so holds for all n by thePrinciple of Mathematical Induction.

Page 94: MATH 135 Course Note

94 Chapter 10 Simple Induction

10.6 Practice

1. Each of the following “proofs” by induction incorrectly “prove” a statement that isactually false. State what is wrong with each proof.

(a) For all n ∈ N, n > n+ 1.

Proof: Let P (n) be the statement: n > n+ 1.

Assume that P (k) is true for some integer k ≥ 1. That is, k > k + 1 for someinteger k ≥ 1. We must show that P (k + 1) is true, that is, k + 1 > k + 2. Butthis follows immediately by adding one to both sides of k > k + 1. Since theresult is true for n = k + 1, it holds for all n by the Principle of MathematicalInduction.

2. Prove the following statements by induction.

(a) For all n ∈ N,n∑i=1

(2i− 1) = n2

(b) For all n ∈ N,n∑i=1

i =n(n+ 1)

2

(c) For all n ∈ N,n∑i=1

i2 =n(n+ 1)(2n+ 1)

6

(d) For all n ∈ N,n∑i=1

i3 =n2(n+ 1)2

4

(e) For all n ∈ Z, n ≥ 0n∑i=0

2i = 2n+1 − 1

(f) For all r ∈ R, r 6= 1 and n ∈ N,

n∑i=1

ri =1− rn+1

1− r

(g) For all n ∈ N,n∑i=1

i

(i+ 1)!= 1− 1

(n+ 1)!

(h) For all r ∈ R, r 6= 1 and n ∈ N,

n∑i=1

ri =1− rn+1

1− r

Page 95: MATH 135 Course Note

Section 10.6 Practice 95

(i) For all r ∈ R, r 6= 1 and n ∈ N,

n∑i=1

i

2i= 2− n+ 2

2n

3. Prove the following statements by induction.

(a) For all n ∈ N, 4 | (5n − 1).

(b) For all n ∈ N, 3n > n2.

(c) For all n ∈ N where n ≥ 4, n! > 2n.

(d) For all n ∈ N where n ≥ 4, n! > n2.

4. Consider the productn∏i=2

(1− 1

i2

)(a) What is the value of this product for n = 2, 3, 4.

(b) Conjecture a value for the product as a function of n.

(c) Use induction to prove your conjecture.

5. Let y = lnx.

(a) Determinedy

dx,d2y

dx2,d3y

dx3,d4y

dx4.

(b) Conjecture an expression fordny

dxn.

(c) Use induction to prove your conjecture.

6. An integer n is perfect if the sum of all of its positive divisors (including 1 and itself)is 2n.

(a) Is 6 a perfect number? Give reasons for your answer.

(b) Is 7 a perfect number? Give reasons for your answer.

(c) Prove the following statement:If k is a positive integer and 2k − 1 is prime, then 2k−1(2k − 1) is perfect.

Page 96: MATH 135 Course Note

Chapter 11

Strong Induction

11.1 Objectives

The technique objectives are:

1. Learn when to use Strong Induction.

2. Learn how to use Strong Induction.

11.2 Strong Induction

Sometimes Simple Induction doesn’t work where it looks like it should. We then need tochange our approach a bit. The following example is similar to examples that we’ve doneearlier. Lets try to make Simple Induction work and see where things go wrong.

Proposition 1 Let the sequence {xn} be defined by x1 = 0, x2 = 30 and xm = xm−1 + 6xm−2 for m ≥ 3.Then

xn = 2 · 3n + 3 · (−2)n for n ≥ 1.

The proposition is saying that the recursive definition of xn implies the closed form of xn.This seems like a classic case for induction since the conclusion clearly depends on theinteger n. Let’s begin with our statement P (n).

P (n): xn = 2 · 3n + 3 · (−2)n.

Now we can begin the proof.

Proof: Base Case We verify that P (1) is true where P (1) is the statement

P (1): x1 = 2 · 31 + 3 · (−2)1.

From the definition of the sequence x1 = 0. The right side of the statement P (1)evaluates to 0 so P (1) is true.

96

Page 97: MATH 135 Course Note

Section 11.2 Strong Induction 97

Inductive Hypothesis We assume that the statement P (k) is true for k ≥ 1.

P (k): xk = 2 · 3k + 3 · (−2)k.

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): xk+1 = 2 · 3k+1 + 3 · (−2)k+1.

xk+1 = xk + 6xk−1 (by the definition of the sequence)

= 2 · 3k + 3 · (−2)k + 6xk−1 (by the Inductive Hypothesis)

Now two problems are exposed. The more obvious problem is what do we do with xk−1?The more subtle problem is whether we can even validly write the first line. When k+1 = 2we get

x2 = x1 + 6x0

and x0 is not even defined.

The basic principle that earlier instances imply later instances is sound. We need tostrengthen our notion of induction in two ways. First, we need to allow for more thanone base case so that we avoid the problem of undefined terms. Second, we need to allowaccess to any of the statements P (1), P (2), P (3), ... , P (k) when showing that P (k + 1) istrue. This may seem like too strong an assumption but is, in fact, quite acceptable. Thispractice is based on the Principle of Strong Induction.

Axiom 2 Principle of Strong Induction (POSI)

Let P (n) be a statement that depends on n ∈ N.

If

1. P (1), P (2), . . . , P (b) are true for some positive integer b, and

2. P (1), P (2), . . . , P (k) are all true implies P (k + 1) is true for all k ∈ N,

then P (n) is true for all n ∈ N.

Just as before, there are three parts in a proof by strong induction.

Base Cases Verify that P (1), P (2), . . . , P (b) are all true. This is usually easy.

Inductive Hypothesis Assume that P (1), P (2), . . . , P (k) are true for some k ≥ b. This issometimes written as Assume that P (i) is true for i = 1, 2, 3, . . . , k, k ≥ b or Assumethat P (i) is true for 1 ≤ i ≤ k, k ≥ b.

Inductive Conclusion Using the assumption that P (1), P (2), . . . , P (k) are true,show that P (k + 1) is true.

Page 98: MATH 135 Course Note

98 Chapter 11 Strong Induction

As a rule of thumb, use Strong Induction when the general case depends on more than oneprevious case. Though we could use Strong Induction all the time, Simple Induction is ofteneasier.

Let’s return to our previous proposition.

Proposition 2 Let the sequence {xn} be defined by x1 = 0, x2 = 30 and xm = xm−1 + 6xm−2 for m ≥ 3.Then

xn = 2 · 3n + 3 · (−2)n for n ≥ 1.

We will use Strong Induction. Recall our statement P (n).

P (n): xn = 2 · 3n + 3 · (−2)n.

Now we can begin the proof.

Proof: Base Case We verify that P (1) and P (2) are true.

P (1): x1 = 2 · 31 + 3 · (−2)1.

From the definition of the sequence x1 = 0. The right side of the statement P (1)evaluates to 0 so P (1) is true.

P (2): x2 = 2 · 32 + 3 · (−2)2.

From the definition of the sequence x2 = 30. The right side of the statement P (2)evaluates to 30 so P (2) is true.

Inductive Hypothesis We assume that the statement P (i) is true for 1 ≤ i ≤ k, k ≥ 2.

P (i): xi = 2 · 3i + 3 · (−2)i.

Inductive Conclusion Now we show that the statement P (k + 1) is true.

P (k + 1): xk+1 = 2 · 3k+1 + 3 · (−2)k+1.

xk+1 = xk + 6xk−1 (by the definition of the sequence)

= 2 · 3k + 3 · (−2)k + 6(2 · 3k−1 + 3 · (−2)k−1) (by the Inductive Hypothesis)

= 3k−1[2 · 3 + 6 · 2] + (−2)k−1[3 · (−2) + 6 · 3] (expand and factor)

= 18 · 3k−1 + 12 · (−2)k−1

= 2 · 32 · 3k−1 + 3 · (−2)2 · (−2)k−1

= 2 · 3k+1 + 3 · (−2)k+1

The result is true for n = k + 1, and so holds for all n by the Principle of StrongInduction.

Page 99: MATH 135 Course Note

Section 11.3 Strong Induction 99

Proposition 3 Every integer n ≥ 9 can be written in the form 3x+ 4y for positive integers x and y.

Before we attempt a proof let’s check small values.

x y 3x+ 4y

3 0 9

2 1 10

1 2 11

4 0 12

3 1 13

2 2 14

There seems to be a pattern. After every group of three integers n, we can generate thenext group of three integers by adding one to the preceding values of x. Since this is a casewhere previous values allow us to generate later values, induction may work.

Our first task is to come up with a suitable statement P (n).

P (n): There exist positive integers x and y so that 3x+ 4y = n.

Now we can begin the proof.

Proof: Base Case We verify that P (9), P (10) and P (11) are true. We repeat the tableabove for the required values of 9, 10 and 11. Note that x and y are positive integers.

x y 3x+ 4y

3 0 9

2 1 10

1 2 11

Inductive Hypothesis We assume that the statement P (i) is true for 1 ≤ i ≤ k, k ≥ 9.

P (i): There exist positive integers x and y so that 3x+ 4y = i.

Inductive Conclusion Now we show that the statement P (k + 1) is true.

P (k + 1): There exist positive integers x and y so that 3x+ 4y = k + 1.

Consider the integer (k + 1) − 3 = k − 2. Since k − 2 < k we can use the InductiveHypothesis to assert the existence of positive integers x0 and y0 such that3x0 + 4y0 = k − 2. Now consider the positive integers x1 = x0 + 1 and y1 = y0.

3x1 + 4y1 = 3(x0 + 1) + 4y0 = 3x0 + 4y0 + 3 = (k − 2) + 3 = k + 1

The result is true for n = k + 1, and so holds for all n by the Principle of StrongInduction.

Page 100: MATH 135 Course Note

100 Chapter 11 Strong Induction

11.3 Practice

1. Each of the following “proofs” by induction incorrectly “prove” a statement that isactually false. State what is wrong with each proof.

(a) For all n ∈ N, 1n−1 = 2n−1.

Proof: Let P (n) be the statement: 1n−1 = 2n−1.

When n = 1 we have 10 = 1 = 20 so P (1) is true. Assume that P (i) is true for1 ≤ i ≤ k. That is, 1i−1 = 2i−1 for for 1 ≤ i ≤ k. We must show that P (k+ 1) istrue, that is, 1(k+1)−1 = 2(k+1)−1 or 1k = 2k. By our inductive hypothesis, P (2)is true so 11 = 21. Also by our inductive hypothesis, P (k) is true so 1k−1 = 2k−1.Multiplying these two equations together gives 1k = 2k. Since the result is truefor n = k + 1, and so holds for all n by the Principle of Strong Induction.

(b) A sequence {xn} is defined by x1 = 3, x2 = 20 and xi = 5xi−1 for i ≥ 3. Then,for all n ∈ N, xn = 3× 5n−1.

Proof: Let P (n) be the statement: xn = 3× 5n−1.

When n = 1 we have 3× 50 = 3 = x1 so P (1) is true. Assume that P (k) is truefor some integer k ≥ 1. That is, xk = 3× 5k−1 for some integer k ≥ 1. We mustshow that P (k + 1) is true, that is, xk+1 = 3× 5k. Now

xk+1 = 5xk = 5(3× 5k−1) = 3× 5k

as required. Since the result is true for n = k + 1, and so holds for all n by thePrinciple of Mathematical Induction.

2. Prove the following statements by induction.

(a) A sequence {xn} is defined recursively by x1 = 8, x2 = 32 and xi = 2xi−1+3xi−2for i ≥ 3. For all n ∈ N, xn = 2× (−1)n + 10× 3n−1.

(b) A sequence {tn} is defined recursively by tn = 2tn−1 + n for all integers n > 1.The first term is t1 = 2. For all n ∈ N, tn = 5 × 2n−1 − 2 − n for all integersn ≥ 1.

(c) A sequence {xn} is defined by x1 = 11, x2 = 23 and xn = xn−1 + 12xn−2 for alln ≥ 3. Prove that xn = 2 · 4n − (−3)n.

3. You know that the sum of the interior angles of a triangle is 180◦.

(a) Use this fact about triangles to determine the sum of the interior angles of aconvex quadrilateral. (A polygon is convex if every line segment joining non-adjacent vertices lies wholly inside the polygon.)

(b) Use (a) and the fact about triangles to determine the sum of the interior anglesof a convex pentagon.

(c) Conjecture a value for the sum of the interior angles of a convex polygon with nsides.

(d) Use induction to prove your conjecture.

4. The Fibonacci sequence is defined as the sequence {fn} where f1 = 1, f2 = i andfi = fi−1 + fi−2 for i ≥ 3. Use induction to prove the following statements.

Page 101: MATH 135 Course Note

Section 11.3 Practice 101

(a) For all n ∈ N,

fn+1 <

(7

4

)n(b) For n ≥ 2,

f1 + f2 + · · ·+ fn−1 = fn+1 − 1

(c) Let a =1 +√

5

2and b =

1−√

5

2. For all n ∈ N,

fn =an − bn√

5

Page 102: MATH 135 Course Note

Chapter 12

Binomial Theorem

12.1 Objectives

The technique objectives are:

1. Define binomial coefficient.

2. Read a proof of the Binomial Theorem.

3. Practice using the Binomial Theorem.

12.2 Binomial Theorem

Definition 12.2.1

Binomial

A binomial is the sum of two quantities, a+ b for example.

You have probably encountered the following powers of a binomial.

(a+ b)2 = a2 + 2ab+ b2

(a+ b)3 = a3 + 3a2b+ 3ab2 + b3

The obvious question is: what is the expansion of (a+ b)n for a positive integer n?

The expansion of (a+ b)n uses binomial coefficients.

Definition 12.2.2

Binomial Coefficient

If 0 ≤ b ≤ a, then the binomial coefficient(ab

)is defined by(

a

b

)=

a!

b!(a− b)!

where 0! is defined to be 1 so that(aa

)= 1.

102

Page 103: MATH 135 Course Note

Section 12.2 Binomial Theorem 103

Example 1 (6

2

)=

6!2!4! = 15(

10

1

)=

10!1!9! = 10(

a

0

)=a!

0!a! = 1

The following proposition states an extremely useful property of binomial coefficients.

Proposition 1 (Sum of Binomials)

If 1 ≤ r ≤ n, then (n+ 1

r

)=

(n

r − 1

)+

(n

r

)

Proof: (n

r − 1

)+

(n

r

)=

n!

(r − 1)!(n− r + 1)!+

n!

r!(n− r)!

=n!

(r − 1)!(n− r + 1)!× r

r+

n!

r!(n− r)!× n− r + 1

n− r + 1

=r(n!) + (n− r + 1)(n!)

r!(n− r + 1)!

=(n+ 1)(n!)

r!(n− r + 1)!(factor n! out in the numerator)

=(n+ 1)!

r!(n− r + 1)!

=

(n+ 1

r

)

Now we are ready to state and prove the Binomial Theorem.

Proposition 2 (Binomial Theorem)

Let x and y be any numbers. Then, for all n ∈ N,

(x+ y)n =

n∑r=0

(n

r

)xn−ryr

Page 104: MATH 135 Course Note

104 Chapter 12 Binomial Theorem

Example 2

(x+ y)3 =3∑r=0

(3

r

)x3−ryr

=

(3

0

)x3−0y0 +

(3

1

)x3−1y1 +

(3

2

)x3−2y2 +

(3

3

)x3−3y3

= x3 + 3x2y + 3xy2 + y3

Example 3

(2x− 3)3 =

3∑r=0

(3

r

)(2x)3−r(−3)r = 8x3 − 36x2 + 54x− 27

Proof: Let P (n) be the statement:

(x+ y)n =n∑r=0

(n

r

)xn−ryr.

Base Case We verify that P (1) is true where P (1) is the statement

P (n) : (x+ y)1 =1∑r=0

(1

r

)x1−ryr.

Since1∑r=0

(1

r

)x1−ryr =

(1

0

)x1−0y0 +

(1

1

)x1−1y1 = x+ y = (x+ y)1

the base case P (1) holds.

Inductive Hypothesis We assume that the statement P (k) is true for k ≥ 1.

P (k) : (x+ y)k =

k∑r=0

(k

r

)xk−ryr.

Inductive Conclusion We now show that the statement P (k + 1) is true.

P (k + 1) : (x+ y)k+1 =

k+1∑r=0

(k + 1

r

)xk+1−ryr.

Page 105: MATH 135 Course Note

Section 12.2 Binomial Theorem 105

(x+ y)k+1 = (x+ y)(x+ y)k (break the problem into two parts)

= x(x+ y)k + y(x+ y)k (expand)

(now invoke the Inductive Hypothesis)

= x

(k∑r=0

(k

r

)xk−ryr

)+ y

(k∑r=0

(k

r

)xk−ryr

)(multiply the x and y through using Properties of Summation (a))

=

(k∑r=0

(k

r

)xk+1−ryr

)+

(k∑r=0

(k

r

)xk−ryr+1

)(separate the first term from the left sum and the last term of the right sum)

=

(k

0

)xk+1 +

k∑r=1

(k

r

)xk+1−ryr +

k−1∑r=0

(k

r

)xk−ryr+1 +

(k

k

)yk+1

(change the bounds of summation using Properties of Summation (d))

=

(k

0

)xk+1 +

k∑r=1

(k

r

)xk+1−ryr +

k∑r=1

(k

r − 1

)xk−r+1yr +

(k

k

)yk+1

(simplify first and last terms, add sums using Properties of Summation (b))

= xk+1 +

k∑r=1

((k

r

)+

(k

r − 1

))xk+1−ryr + yk+1

(use the Sum of Binomials)

= xk+1 +

k∑r=1

(k + 1

r

)xk+1−ryr + yk+1

(rewrite the first and last terms)

=

(k + 1

0

)xk+1 +

k∑r=1

(k + 1

r

)xk+1−ryr +

(k + 1

k + 1

)yk+1

(finally, combine into a single sum)

=

k+1∑r=0

(k + 1

r

)xk+1−ryr

The result is true for n = k+1, and so holds for all n by the Principle of MathematicalInduction.

Page 106: MATH 135 Course Note

106 Chapter 12 Binomial Theorem

12.3 More Examples

1. Expand (2x+

3

y

)4

Solution:(2x+

3

y

)4

=

4∑r=0

(4

r

)(2x)4−r

(3

y

)r=

(4

0

)(2x)4 +

(4

1

)(2x)3

(3

y

)1

+

(4

2

)(2x)2

(3

y

)2

+

(4

3

)(2x)1

(3

y

)3

+

(4

4

)(3

y

)4

= 16x4 +96x3

y+

216x2

y2+

216x

y3+

81

y4

2. What is the coefficient of the term containing x3 in the expansion of(x2 +

4

x

)12

Solution: (x2 +

4

x

)12

The i-th term in the expansion is(12

i

)(x2)12−i( 4

x

)i=

(12

i

)4ix24−3i

The term containing x3 corresponds to the term generated when i = 7. The coefficient is(12

7

)47

12.4 Practice

1. Prove the following statements related to the Binomial Theorem.

(a) (n

k

)=

(n

n− k

)(b) Using induction, prove that(

n

r

)is an integer for 0 ≤ r ≤ n

Page 107: MATH 135 Course Note

Chapter 13

Negation

13.1 Objectives

The technique objectives are:

1. To learn how to negate statements.

2. To learn when to use counter-examples.

3. To practice finding counter-examples.

13.2 Negating Statements

You will frequently encounter the negation of a statement A.

Definition 13.2.1

Negation

The negation of the statement A is the statement NOT A. Because statements cannot beboth true and false, exactly only one of A and NOT A can be true.

In some instances, finding the negation of a statement is easy. For example,

Example 1 (Negating a Statement)

A: f(x) has a real root.

NOT A: f(x) does not have a real root.

When A is already negated, a truth table tells us what to do.

A ¬A ¬(¬A)

T F T

F T F

Thus, ¬(¬A) = A. Two negatives are a positive, or equivalently, one NOT cancels anotherNOT. For example,

107

Page 108: MATH 135 Course Note

108 Chapter 13 Negation

Example 2 (A Double Negative)

A: 7 is not a divisor of 28.

NOT A: 7 is a divisor of 28.

You have already seen DeMorgan’s Laws when we worked with truth tables. DeMorgan’sLaws tell us how to negate statements containing AND and OR.

Proposition 1 (De Morgan’s Law’s (DML))

If A and B are statements, then

1. ¬(A ∧B) ≡ (¬A) ∨ (¬B)

2. ¬(A ∨B) ≡ (¬A) ∧ (¬B)

REMARK

From DeMorgan’s Laws, there is a specific rule applied when negating a statement contain-ing the word AND.

A: B AND C

NOT A: (NOT B) OR (NOT C)

Note that the connecting word has changed from AND to OR and that each term in theexpression has been negated. The brackets are not needed because NOT precedes OR inlogical evaluation, but the brackets are useful to emphasize the change. Here is a specificexample.

Example 3 (Negating statements containing AND)

A: a | b and a | c.NOT A: a - b or a - c.

REMARK

Similar to the conjunctive AND, DeMorgan’s Laws provide a specific rule when negating astatement containing the word OR.

A: B OR C

NOT A: (NOT B) AND (NOT C)

Page 109: MATH 135 Course Note

Section 13.3 Negating Statements with Quantifiers 109

Note that the connecting word has changed from OR to AND and, again, each term in theexpression has been negated. As before, the brackets are not needed because NOT precedesAND in logical evaluation, but the brackets are useful to emphasize the change. Here is anexample.

Example 4 (Negating statements containing OR)

A: a | b or a | c.NOT A: a - b and a - c.

13.3 Negating Statements with Quantifiers

Negating statements that contains quantifiers is more complicated. We first observe that:

• The negation of a universal statement results in an existential statement.

• The negation of an existential statement results in a universal statement.

REMARK

A statement with an existential quantifier looks like

There exists an x in the set S such that P (x) is true.

Its negation is

For every x in the set S, P (x) is false.

A statement with a universal quantifier looks like

For every x in the set S, P (x) is true.

Its negation is

There exists an x in the set S such that P (x) is false.

Page 110: MATH 135 Course Note

110 Chapter 13 Negation

REMARK

To negate a statement using nested quantifiers, do the following.

Step 1 Put the word NOT in front of the entire statement.

Step 2 Move the NOT from left to right replacing quantifiers by their opposites and ineach case place the NOT just before the open sentence. Repeat until there are noquantifiers to the right of NOT.

Step 3 When all of the quantifiers are to the left of NOT, incorporate the NOT into theopen sentence.

Let’s do some examples.

Example 5

1. For every x ∈ S, f(x) = 0.

(a) NOT [For every x ∈ S, f(x) = 0.]

(b) There exists x ∈ S such that NOT [f(x) = 0].

(c) There exists x ∈ S such that f(x) 6= 0.

2. There exists x ∈ S such that f(x) = 0.

(a) NOT [There exists x ∈ S such that f(x) = 0.]

(b) For every x ∈ S, NOT [f(x) = 0].

(c) For every x ∈ S, f(x) 6= 0.

3. For every x ∈ S and for every f ∈ F , f(x) = 0.

(a) NOT [For every x ∈ S and for every f ∈ F , f(x) = 0.]

(b) There exists x ∈ S such that NOT [for every f ∈ F , f(x) = 0].There exists x ∈ S and there exists f ∈ F such that NOT [f(x) = 0].

(c) There exists x ∈ S and there exists f ∈ F such that f(x) 6= 0.

4. There exists x ∈ S such that, for every f ∈ F , f(x) = 0.

(a) NOT [There exists x ∈ S such that for every f ∈ F , f(x) = 0.]

(b) For every x ∈ S, NOT [for every f ∈ F , f(x) = 0].For every x ∈ S there exists a f ∈ F , NOT [f(x) = 0].

(c) For every x ∈ S there exists a f ∈ F , f(x) 6= 0.

13.3.1 Counterexamples

So far in the course, we have worked on proving that statements are true. How do we provethat a statement is false? In principle, this is relatively easy. To show that the statementA is false, we only need to prove that the statement NOT A is true.

Page 111: MATH 135 Course Note

Section 13.4 Negating Statements with Quantifiers 111

Suppose A is the statement:

A: For every x ∈ [−π, π], sin(x) = 0.

This statement is very similar to our first example. NOT A is the statement

NOT A: There exists x ∈ [−π, π] such that sin(x) 6= 0.

In this case, NOT A is easy to prove using our construction method. If I consider x = 0, Iknow that 0 ∈ [−π, π] and sin(x) = 1 6= 0. The number 0 is a counterexample.

Definition 13.3.1

Counterexample

In general, if we wish to prove that a universal statement A is false, we show that itsnegation, which is an existential statement, is true. The particular object which we use toshow that the existential statement is true is called a counterexample of statement A.

The same idea arises when we want to show that a statement of the form “A implies B”is false. It is enough to show a particular instance where A is true and B is false, orequivalently NOT B is true. For example, consider the following statement.

Statement 2 S: If a, b and c are integers, and a | (bc), then a | b and a | c.

The hypothesis is

A: a, b and c are integers, and a | (bc)

and the conclusion is

B: a | b and a | c.

To show that S is false, we must find a specific instance where A is true and B is false. Toshow that B is false we must show that NOT B is true.

NOT B: a - b or a - c.

Choosing a = 3, b = 6 and c = 7 we have an instance where the hypothesis A is true (since3 | 42) and the conclusion B is false, equivalently, NOT B is true. The values a = 3, b = 6and c = 7 are a counterexample for S.

Page 112: MATH 135 Course Note

112 Chapter 13 Negation

13.4 Practice

1. Consider the following statement. For all a, b, c ∈ Z, there exists an integer solutionto ax2 + by2 = c whenever gcd(a, b) | c.

(a) Write down the hypothesis of the statement.

(b) Write down the conclusion of the statement.

(c) Prove or disprove the statement.

2. Let f be a function that maps from S to T .

(a) Define the expression “f maps S onto T”.

(b) Negate the definition of onto.

(c) With reference to the definition of onto or its negation, determine whether ornot f(x) = ex where f : R→ R is onto.

3. For each of the following statements, either prove the statement or disprove it usinga counterexample.

(a) Let a, b, c, d ∈ Z. If d | ac and d | bc, then d | c.(b) For any integer a, gcd(11a+ 5, 2a+ 1) = 1.

(c) If r is irrational, then 1/r is irrational.

Page 113: MATH 135 Course Note

Chapter 14

Contradiction

14.1 Objectives

The technique objectives are:

1. Learn how to read and discover proofs by contradiction.

The content objectives are:

1. Read a proof of Prime Factorization.

2. Discover a proof of Infinitely Many Primes.

14.2 How To Use Contradiction

We have mostly used the Direct Method to discover proofs, often in conjunction with oneof the methods associated with quantifiers. There are times when this is difficult. A proofby contradiction provides a new method.

Suppose that we wish to prove that the statement “A implies B” is true. We assume that Ais true. We must show that B is true. What would happen if B were true, but we assumedit was false and continued our reasoning based on the assumption that B was false? Since amathematical statement cannot be both true and false, it seems likely we would eventuallyencounter a mathematically non-sensical statement. Then we would ask ourselves “Howdid we arrive at this nonsense?” and the answer would have to be that our assumption thatB was false was wrong and B is, in fact, true.

113

Page 114: MATH 135 Course Note

114 Chapter 14 Contradiction

REMARK

A proof by contradiction of the statement “A implies B” structures proofs in exactly thisway. Proceed as follows.

1. Assume that A is true.

2. Assume that B is false, or equivalently, assume that NOT B is true.

3. Reason forward from A and NOT B to reach a contradiction.

Unfortunately, it is not always clear what contradiction to find, or how to find it. What ismore clear is when to use contradiction.

14.2.1 When To Use Contradiction

The general rule of thumb is to use contradiction when the statement NOT B gives youuseful information. There are typically two instances when this is useful. The first instanceis when the statement B is one of only two alternatives. For example, if the conclusion Bis the statement f(x) = 0 then the only two possibilities are f(x) = 0 and f(x) 6= 0. NOTB is the statement f(x) 6= 0 which could be useful to you. The second instance is when Bcontains a negation. As we saw earlier, NOT B eliminates the negation.

14.2.2 Reading a Proof by Contradiction

Suppose we want to prove the following proposition.

Proposition 1 (Prime Factorization (PF))

If n is an integer greater than 1, then n can be expressed as a product of primes.

Example 1 The integers 2, 3, 5 and 7 are primes and each is a product unto itself, that is, it is a productconsisting of one factor. The integers 4 = 2 × 2, 6 = 2 × 3 and 8 = 2 × 2 × 2 have beenfactored as products of primes.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Let N be the smallest integer, greater than 1, that cannot be written as a product ofprimes.

2. N is not itself a prime, so we can write N = rs where 1 < r ≤ s < N .

3. Since r and s are less than N , they can be written as a product of primes.

4. But then it follows that N = rs can be written as a product of primes, a contradiction.

Page 115: MATH 135 Course Note

Section 14.2 How To Use Contradiction 115

Analysis of Proof An interpretation of sentences 1 through 4 follows.

Sentence 1 Let N be the smallest integer, greater than 1, that cannot be written as aproduct of primes.

The first sentence of a proof by contradiction usually gives the specific form of NOTB that the author is going to work with. In this case, the author identifies that this isa proof by contradiction by assuming the existence of an object which contradicts theconclusion, an integer N which cannot be written as a product of primes. Moreover,of all such candidates for N the author chooses the smallest one. Though it may notbe obvious when first encountering the proof why the author would stipulate such acondition, it always has to do with something needed later in the argument.

Once you know that this is a proof by contradiction, look ahead to find the contra-diction. In this case, the contradiction appears in Sentence 4.

Sentence 2 N is not itself a prime, so we can write N = rs where 1 < r ≤ s < N .

If N were prime, then N by itself is a product of primes (with just one factor). Butthe author has assumed that N is not a product of primes, hence N is composite andcan be written as the product of two non-trivial factors r and s.

Sentence 3 Since r and s are less than N , they can be written as a product of primes.

This sentence makes it clear why N needs to be the smallest integer that cannot bewritten as a product of primes. In order to generate the contradiction, r and s mustbe written as products of primes. If it were the case that N was not the smallest suchinteger, it might be the case that neither r nor s could be written as a product ofprimes.

Sentence 4 But then it follows that N = rs can be written as a product of primes, acontradiction.

Since both r and s can be written as a product of primes, the product rs = N cancertainly be written as a product of primes. But this contradicts the assumption inSentence 1 that N cannot be written as a product of primes.

Since our reasoning is correct, it must be the case that our assumption that there is aninteger which cannot be written as a product of primes is incorrect. That is, every integercan be written as a product of primes.

14.2.3 Discovering and Writing a Proof by Contradiction

Discovering a proof by contradiction can be difficult and often requires several attempts atfinding the path to a contradiction. Let’s see how we might discover a proof to a famoustheorem recorded by Euclid.

Proposition 2 (Infinitely Many Primes (INF P))

The number of primes is infinite.

We should always be clear about our hypothesis and conclusion. There is no explicit hy-pothesis in this case and the conclusion is the statement

Page 116: MATH 135 Course Note

116 Chapter 14 Contradiction

Conclusion: The number of primes is infinite.

This statement contains a negation, infinite is an abbreviation of not finite, and so is acandidate for a proof by contradiction. Our first statement in a proof by contradiction is anegation of the conclusion so we have

Proof in Progress

1. Assume that the number of primes is finite. (This is NOT B.)

2. To be completed.

Now comes the tough part. What do we do from here? How do we generate a contradiction?Well, if the number of primes is finite, could we somehow use that assumption to find a“new” prime not in our finite list of primes? Our candidate should not have any of thefinite primes as a factor. At this point, it sounds like we need to list our primes.

Proof in Progress

1. Assume that the number of primes is finite. (This is NOT B.)

2. Label the finite number of primes p1, p2, p3, . . . , pn.

3. To be completed.

Now we have a way to express a candidate for a “new” prime.

Proof in Progress

1. Assume that the number of primes is finite. (This is NOT B.)

2. Label the finite number of primes p1, p2, p3, . . . , pn.

3. Consider the integer N = p1p2p3 · · · pn + 1.

4. To be completed.

Clearly N is larger than any of the pi so, by the first sentence, N cannot be in the list ofprimes. Thus

Proof in Progress

1. Assume that the number of primes is finite. (This is NOT B.)

2. Label the finite number of primes p1, p2, p3, . . . , pn.

3. Consider the integer N = p1p2p3 · · · pn + 1.

4. Since N > pi for all i, N is not a prime.

5. To be completed.

Page 117: MATH 135 Course Note

Section 14.2 How To Use Contradiction 117

And this is where we can find our contradiction. N has no non-trivial factors since dividingN by any of the pi leaves a remainder of 1. But that means N cannot be written as aproduct of primes, which contradicts the previous proposition. The contradiction in thisproof arises from a result which is inconsistent with something else we have proved.

Proof in Progress

1. Assume that the number of primes is finite. (This is NOT B.)

2. Label the finite number of primes p1, p2, p3, . . . , pn.

3. Consider the integer N = p1p2p3 · · · pn + 1.

4. Since N > pi for all i, N is not a prime.

5. Since N = piq + 1 for each of the primes pi, no pi is a factor of N . Hence N cannotbe written as a product of primes, which contradicts our previous proposition.

Putting all of the statements together gives the following proof.

Proof: Assume that there are only a finite number of primes, say p1, p2, p3, . . . , pn. Considerthe integer N = p1p2p3 · · · pn + 1. Since N > pi for all i, N is not a prime. But N = piq+ 1for each of the primes pi, so no pi is a factor of N . Hence N cannot be written as a productof primes, which contradicts our previous proposition.

Page 118: MATH 135 Course Note

Chapter 15

Contrapositive

15.1 Objectives

The technique objectives are:

1. Define the contrapositive.

2. Read a proof using the contrapositive.

3. Discover and write a proof using the contrapositive.

15.2 The Contrapositive

Recall the definition of contrapositive from the chapter on truth tables.

Definition 15.2.1

Contrapositive

The statement ¬B ⇒ ¬A is called the contrapositive of A⇒ B.

The logical equivalence between a statement and its contrapositive gives us another prooftechnique. Instead of proving “A implies B” we prove “ NOT B implies NOT A” usingany of the existing techniques.

15.2.1 When To Use The Contrapositive

This is very similar to contradiction. Use the contrapositive when the statement NOT Aor the statement NOT B gives you useful information. This is most likely to occur whenA or B contains a negation or is one of two possible choices. When both A and B containnegations, it is highly likely that using the contrapositive will be productive.

15.3 Reading a Proof That Uses the Contrapositive

Consider the following proposition.

118

Page 119: MATH 135 Course Note

Section 15.3 Reading a Proof That Uses the Contrapositive 119

Proposition 1 Suppose a is an integer. If 32 - ((a2 + 3)(a2 + 7)) then a is even.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. We will prove the contrapositive.

2. If a is odd we can write a as 2k + 1 for some integer k.

3. Substitution gives

(a2 + 3)(a2 + 7) = ((2k + 1)2 + 3)((2k + 1)2 + 7)

= (4k2 + 4k + 1 + 3)(4k2 + 4k + 1 + 7)

= (4k2 + 4k + 4)(4k2 + 4k + 8)

= 4(k2 + k + 1)× 4(k2 + k + 2)

= 16(k2 + k + 1)(k2 + k + 2)

4. Since one of k2 + k+ 1 or k2 + k+ 2 must be even, and the last line above shows thata factor of 16 already exists disjoint from (k2 + k + 1)(k2 + k + 2), (a2 + 3)(a2 + 7)must contain a factor of 32. That is 32 | ((a2 + 3)(a2 + 7)).

Analysis of Proof Since the hypothesis of the proposition contains a negation, and theconclusion is one of two possible choices, it makes sense to consider the contrapositive.

Sentence 1 We will prove the contrapositive.

Not all authors will be so obliging as to state the proof technique up front. Theprovided proof would also be correct if this sentence was omitted. Correct, but lesseasy to understand.

As usual, we begin by identifying the hypothesis and the conclusion.

Hypothesis: A: 32 - ((a2 + 3)(a2 + 7)).

Conclusion: B: a is even.

For the contrapositive

Hypothesis: NOT B: a is odd.

Conclusion: NOT A: 32 | ((a2 + 3)(a2 + 7))

How would we know that the author was using the contrapositive if this sentence wereomitted? The clause “If a is odd” is NOT B so the author is using one of only twoproof techniques that begin this way, contradiction or contrapositive. Looking aheadto the last line, we see that the author concludes with NOT A, so this is a proof ofthe contrapositive. Had the author concluded with a contradiction, we would knowthat this is a proof by contradiction.

Page 120: MATH 135 Course Note

120 Chapter 15 Contrapositive

Sentence 2 If a is odd we can write a as 2k + 1 for some integer k.

This is the statement NOT B. Knowing from Sentence 1 that the author is using thecontrapositive we would expect to see statements moving forward from the hypothesisof the contrapositive (a is odd) or backwards from the conclusion of the contrapositive(32 | ((a2 + 3)(a2 + 7))).

Sentence 3 Substitution gives (a2 + 3)(a2 + 7) = . . . = 16(k2 + k + 1)(k2 + k + 2).

This is just arithmetic.

Sentence 4 Since one of k2+k+1 or k2+k+2 must be even, and the last line above showsthat a factor of 16 already exists disjoint from (k2 +k+1)(k2 +k+2), (a2 +3)(a2 +7)must contain a factor of 32. That is 32 | ((a2 + 3)(a2 + 7)).

These sentences establish the conclusion of the contrapositive. Since the contrapositiveis true, the original statement is true.

15.3.1 Discovering and Writing a Proof Using The Contrapositive

The important observation here is that once you decide to use the contrapositive, all of yourexisting skills apply. The difficulty is in deciding whether or not to use the contrapositive.

For our example, we will begin with a definition.

Definition 15.3.1

Bounded

A set S of real numbers is bounded if there is a real number M > 0 such that, for allelements x ∈ S, |x| < M .

Proposition 2 Suppose that S and T are sets of real numbers with S ⊆ T . If S is not bounded, then T isnot bounded.

We should always be clear about our hypothesis and conclusion.

Hypothesis: A: S is not bounded.

Conclusion: B: T is not bounded.

Since both the hypothesis and conclusion are negated, it makes sense to try to prove thecontrapositive “If T is bounded, then S is bounded.” This gives us two statements in ourproof.

Proof in Progress

1. Suppose that T is bounded. (This is just NOT B.)

2. To be completed.

3. Hence, S is bounded. (This is just NOT A.)

Working backwards from the conclusion we can ask “How do we show that S is bounded?”Using the definition of bounded, we can write

Page 121: MATH 135 Course Note

Section 15.3 Reading a Proof That Uses the Contrapositive 121

Proof in Progress

1. Suppose that T is bounded. (This is just NOT B.)

2. To be completed.

3. For every x ∈ S, we have |x| < M ′.

4. Hence, S is bounded. (This is just NOT A.)

Now the question becomes “Where can we find such an M ′?” If we use the definition ofbounded and work forward from the hypothesis we can write

Proof in Progress

1. Suppose that T is bounded. (This is just NOT B.)

2. Since T is bounded, there exists a real number M ′ > 0 such that, for all x ∈ T ,|x| < M ′.

3. To be completed.

4. For every x ∈ S, we have |x| < M ′.

5. Hence, S is bounded. (This is just NOT A.)

Next, we need to connect the two sets and show that the M ′ of the set T is the same as theM ′ of the set S. But we know

Since x ∈ S and S ⊆ T , x ∈ T .

Combining this with second sentence we have

Since x ∈ S, x ∈ T and so |x| < M ′.

Putting all of the statements together gives the following proof.

Proof: We will prove the contrapositive. Suppose that T is bounded. Hence, there existsa real number M ′ > 0 such that, for all x ∈ T , |x| < M ′. Let x ∈ S. Since S ⊆ T , x ∈ Tand so |x| < M ′. But then S is bounded as required.

Sometimes, the contrapositive can make an apparently difficult proof quite easy. Try thefollowing exercise.

Exercise 1 Let S and T be sets. Prove that if x 6∈ S ∩ T , then x 6∈ S or x 6∈ T .

Page 122: MATH 135 Course Note

Chapter 16

Uniqueness

16.1 Objectives

The technique objective is:

1. Learn how to prove an implication where a statement about uniqueness occurs in theconclusion.

16.2 Introduction

You have already encountered statements that contain the adjective unique. Instead of theword “unique” you may see “one and only one” or “exactly one” or “distinct”.

Prior to this course you have probably seen statements like the following.

Example 1

1. Two lines in the plane which are not parallel will intersect in one and only one point.

2. There is a unique function F (x) such that F ′(x) = f(x).

And earlier in this course you saw the Division Algorithm.

Proposition 1 (Division Algorithm (DA))

If a and b are integers, and b > 0, then there exist unique integers q and r such that

a = qb+ r where 0 ≤ r < b.

122

Page 123: MATH 135 Course Note

Section 16.3 Showing X = Y 123

To prove a statement of the form

If . . ., then there is a unique object x in the set S such that P (x) is true.

there are basically two approaches.

1. Demonstrate that there is at least one object in the set S that satisfies P . Assumethat there are two objects X and Y in the set S such that P (X) and P (Y ) are true.Show that X = Y .

2. Demonstrate that there is at least one object in the set S that satisfies P . Assumethat there are two distinct objects X and Y in the set S such that P (X) and P (Y )are true. Derive a contradiction.

You can use whichever is easier in the circumstance.

16.3 Showing X = Y

The method is as follows.

1. Demonstrate that there is at least one object in the set S that satisfies P .

2. Assume that there are two objects X and Y in the set S such that P (X) and P (Y )are true.

3. Show that X = Y .

For example, let us prove the following statement.

Proposition 2 If a and b are integers with a 6= 0 and a | b, then there is a unique integer k so that b = ka.

As usual, we begin by explicitly identifying the hypothesis and conclusion.

Hypothesis: a and b are integers with a 6= 0 and a | b.

Conclusion: There is a unique integer k so that b = ka.

The appearance of “unique” in the conclusion tells us to use one of the two approachesdescribed in the previous section. In this case, we will assume the existence of two integersk1 and k2 and show that k1 = k2. But first, we need to show that at least one integer kexists, and this follows immediately from the definition of divisibility.

Proof in Progress

1. Since a | b, at least one integer k exists so that b = ka.

Page 124: MATH 135 Course Note

124 Chapter 16 Uniqueness

2. Let k1 and k2 be integers such that b = k1a and b = k2a. (Note how closely thisfollows the standard pattern. k1 corresponds to X. k2 corresponds to Y . Both comefrom the set of integers and if P (x) is the statement “b = xa”, then P (X) and P (Y )are assumed to be true.)

3. To be completed.

4. Hence, k1 = k2.

The obvious thing to do is equate the two equations to get

k1a = k2a

Since a is not zero we can divide both sides by a to get

k1 = k2

A proof might look like the following.

Proof: Since a | b, by the definition of divisibility there exists an integer k so that b = ka.Now let k1 and k2 be integers such that b = k1a and b = k2a. But then k1a = k2a anddividing by a gives k1 = k2.

16.4 Finding a Contradiction

The method is as follows.

1. Demonstrate that there is at least one object in the set S that satisfies P .

2. Assume that there are two distinct objects X and Y in the set S such that P (X)and P (Y ) are true.

3. Derive a contradiction.

For example, let us prove the following statement.

Proposition 3 Suppose a solution to the simultaneous linear equations y = m1x + b1 and y = m2x + b2exists. If m1 6= m2, then there is a unique solution to the simultaneous linear equationsy = m1x+ b1 and y = m2x+ b2.

As usual, we begin by explicitly identifying the hypothesis and conclusion.

Hypothesis: A solution to the simultaneous linear equations y = m1x+b1 and y = m2x+b2exists. m1 6= m2.

Conclusion: There is a unique solution to the simultaneous linear equations y = m1x+ b1and y = m2x+ b2.

Page 125: MATH 135 Course Note

Section 16.5 The Division Algorithm 125

The appearance of “unique” in the conclusion tells us to use one of the two approachesdescribed in the previous section. In this case, we will assume the existence of two distinctpoints of intersection and derive a conclusion.

Proof in Progress

1. Suppose that y = m1x+ b1 and y = m2x+ b2 intersect in the distinct points (x1, y1)and (x2, y2). (The existence of at least one solution is guaranteed by the hypothesis.Note again how closely this follows the standard pattern. (x1, y1) corresponds to X.(x2, y2) corresponds to Y . Both come from the set of ordered pairs and both satisfythe statement “are a solution to the simultaneous linear equations y = m1x+ b1 andy = m2x+ b2.”)

2. To be completed, hence a contradiction.

But now if we substitute (x1, y1) and (x2, y2) into y = m1x+ b1 we get

y1 = m1x1 + b1 (16.1)

y2 = m1x2 + b1 (16.2)

which implies thaty1 − y2 = m1(x1 − x2)

Similarly, substituting (x1, y1) and (x2, y2) into y = m2x+ b2 gives

y1 − y2 = m2(x1 − x2)

Equating the two expressions for y1 − y2 gives

(m1 −m2)(x1 − x2) = 0

Since m1 6= m2, m1 −m2 6= 0 and we can divide by (m1 −m2). This gives x1 − x2 = 0.That is, x1 = x2. But then,

y1 − y2 = m1(x1 − x2) and x1 − x2 = 0

implyy1 − y2 = 0

That is, y1 = y2. But then the points (x1, y1) and (x2, y2) are not distinct, a contradiction.

Exercise 1 Write a proof for the preceding proposition.

16.5 The Division Algorithm

Suppose that in a proof of the Division Algorithm it has already been established thatintegers q and r exist and only uniqueness remains. A proposed proof of uniqueness follows.

Proposition 4 (Division Algorithm)

If a and b are integers and b > 0, then there exist unique integers q and r such that

a = qb+ r where 0 ≤ r < b

Page 126: MATH 135 Course Note

126 Chapter 16 Uniqueness

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Suppose that a = q1b + r1 with 0 ≤ r1 < b. Also, suppose that a = q2b + r2 with0 ≤ r2 < b and r1 6= r2.

2. Without loss of generality, we can assume r1 < r2.

3. Then 0 < r2 − r1 < b and

4. (q1 − q2)b = r2 − r1.

5. Hence b | (r2 − r1).

6. By Bounds By Divisibility, b ≤ r2 − r1 which contradicts the fact that r2 − r1 < b.

7. Therefore, the assumption that r1 6= r2 is false and in fact r1 = r2.

8. But then (q1 − q2)b = r2 − r1 implies q1 = q2.

Let’s make sure that we understand every line of the proof.

Sentence 1 Suppose that a = q1b + r1 with 0 ≤ r1 < b. Also, suppose that a = q2b + r2with 0 ≤ r2 < b and r1 6= r2.

Since a statement about uniqueness appears in the conclusion, we would expect oneof the two uniqueness methods to be used. In fact, both are used. The assertion ofuniqueness applies to both q and r. Since the author writes r1 6= r2, that is, there aredistinct values of r1 and r2, we should look for a contradiction regarding r. But theauthor does not assume distinct values of q and so we would expect that the authorwill show q1 = q2.

Sentence 2 Without loss of generality, we can assume r1 < r2.

“Without loss of generality” is an expression that means the upcoming argumentwould hold identically if we made any other choice, so we will simply assume one ofthe possibilities.

Sentence 3 Then 0 < r2 − r1 < b and

This is a particularly important line. It comes, in part, from r1 < r2 by subtracting r1from both sides (this gives 0 < r2 − r1) and by remembering that the largest possiblevalue of r2 is b − 1 and the smallest possible value of r1 is 0, so the largest possibledifference is b− 1, thus r2 − r1 < b

Sentence 4 (q1 − q2)b = r2 − r1.

This follows from equating a = q1b+ r1 and a = q2b+ r2.

Sentence 5 Hence b | (r2 − r1).This follows from the definition of divisibility.

Sentence 6 By BBD, b ≤ r2 − r1 which contradicts the fact that r2 − r1 < b.

Note the importance of the strict inequality in the relation

b ≤ r2 − r1 < b

Page 127: MATH 135 Course Note

Section 16.5 The Division Algorithm 127

Sentence 7 Therefore, the assumption that r1 6= r2 is false and in fact r1 = r2.

The contradiction we were looking for. The Division Algorithm states that both qand r are unique. So far, only the uniqueness of r has been established.

Sentence 7 But then (q1 − q2)b = r2 − r1 implies q1 = q2.

And this is where the uniqueness of q is established. Originally, the author assumedthe existence of q1 and q2 and now has shown that they are, in fact, the same.

Page 128: MATH 135 Course Note

Chapter 17

Elimination

17.1 Objectives

The technique objectives are:

1. Learn when to use the Elimination Method.

2. Learn how to use the Elimination Method

17.2 When to Use the Elimination Method

We use the Elimination Method whenever we encounter a statement of the form

If A, then B or C.

or symbolically,A⇒ B ∨ C

17.3 How to Use the Elimination Method

We begin this section with a very important exercise.

Exercise 1 Prove thatA⇒ B ∨ C ≡ (A⇒ B) ∨ (A⇒ C) ≡ A ∧ ¬B ⇒ C

Let’s interpret what these logical equivalences are telling us. The first equivalence says thatto prove A ⇒ B ∨ C it is enough to prove A ⇒ B or A ⇒ C. We do not need to proveboth. And what if we cannot prove A ⇒ B? The second equivalence tells us that we canuse A and ¬B to show that C is true.

And this makes sense. If we want to prove A⇒ B ∨C and we can show that A⇒ B, thenwe are done. But if A ⇒ B is false, then B must be false so we must show that C is truewhen A is true and B is false.

128

Page 129: MATH 135 Course Note

Section 17.4 Reading 129

REMARK

Thus, to prove

If A, then B or C.

we can prove the logically equivalent statement

If A and ¬B, then C.

The Elimination Method gets its name by eliminating one of the cases to consider.

17.4 Reading

Consider the following proposition, proof and analysis.

Proposition 1 If x2 − 7x+ 12 ≥ 0, then x ≤ 3 or x ≥ 4.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Suppose that x2 − 7x+ 12 ≥ 0 and x > 3.

2. Factoring gives (x− 3)(x− 4) ≥ 0.

3. Since x > 3, x− 3 > 0.

4. Dividing the inequality in Sentence 2 by x− 3 gives x− 4 ≥ 0, or

5. x ≥ 4 as desired.

Analysis of Proof Since the word or appears in the conclusion, it would make sense forthe author to use the Elimination Method. The statements corresponding to A, Band C are:

• A: x2 − 7x+ 12 > 0

• B: x ≤ 3

• C: x ≥ 4

The Elimination Method assumes A and ¬B and uses these assumptions to prove C.

Sentence 1 Suppose that x2 − 7x+ 12 ≥ 0 and x > 3.

This is exactly A and ¬B so the author is indicating that the Elimination Methodwill be used.

Page 130: MATH 135 Course Note

130 Chapter 17 Elimination

Sentence 2 Factoring gives (x− 3)(x− 4) ≥ 0

The author uses A and factors. This new expression indicates where the 3 and 4 inthe conclusion come from.

Sentence 3 Since x > 3, x− 3 > 0.

This is arithmetic with ¬B.

Sentence 4 Dividing the inequality in Sentence 2 by x− 3 gives x− 4 ≥ 0

Division by x−3 is only possible if x−3 6= 0 which is guaranteed by Step 3. Moreover,x− 3 is positive so division does not change the inequality sign in the relation.

Sentence 5 x ≥ 4 as desired.

The author makes one small step from x− 4 ≥ 0 to get C.

17.5 Writing and Discovering

Let’s discover a proof of the following statement.

Proposition 2 Let U be a universal set containing sets S and T . Then

S ∩ T ⊆ S ∪ T

This may be mystifying. The word or does not appear. But let’s rephrase the statement as

If x ∈ S ∩ T , then x ∈ S ∪ T

orIf x ∈ S ∩ T , then x ∈ S or x ∈ T

Now the use of the word or is apparent. As usual, we begin by identifying the hypothesis,conclusion, core proof technique and preliminary material.

Hypothesis: x ∈ S ∩ T

Conclusion: x ∈ S or x ∈ T

Core Proof Technique: Since or occurs in the conclusion, we will use the EliminationMethod.

Preliminary Material: Properties of sets.

Since we will use the Elimination Method, we will negate the first part of the conclusionand establish the second part of the conclusion.

Page 131: MATH 135 Course Note

Section 17.5 Writing and Discovering 131

Proof in Progress

1. Suppose x ∈ S ∩ T and x 6∈ S.

2. To be completed.

3. Hence, x ∈ T .

We can make some progress just by using set definitions. If x ∈ S ∩ T , then x 6∈ S ∩ T .One might be tempted to say that this implies x 6∈ S and x 6∈ T but that would be wrong.(Can you find a counter-example?)

Now let’s make use of the statement x 6∈ S. Since x 6∈ S, x ∈ S. Let’s record what we havedone.

Proof in Progress

1. Suppose x ∈ S ∩ T and x 6∈ S.

2. Since x ∈ S ∩ T , x 6∈ S ∩ T .

3. Since x 6∈ S, x ∈ S.

4. To be completed.

5. Hence, x ∈ T .

In order for x ∈ T we must have x 6∈ T . What would happen if x ∈ T? Since x ∈ S fromSentence 3 that would imply that x ∈ S ∩ T , contradicting Sentence 2. So x cannot be inT , which is exactly what we need.

Here is a complete proof. Notice that the author assumes that the reader can make thetransition from

S ∩ T ⊆ S ∪ T

toIf x ∈ S ∩ T , then x ∈ S or x ∈ T

without remark.

Proof: Suppose x ∈ S ∩ T and x 6∈ S. Since x ∈ S ∩ T , x 6∈ S ∩ T . Since x 6∈ S, x ∈ S.Now x 6∈ T for otherwise if x ∈ T , then x ∈ S ∩ T , a contradiction. Since x 6∈ T , x ∈ T asrequired.

Page 132: MATH 135 Course Note

Part IV

Securing Internet Commerce

132

Page 133: MATH 135 Course Note

Chapter 18

The Greatest Common Divisor

18.1 Objectives

The content objectives are:

1. To discover a proof of the proposition GCD With Remainders.

2. Do an example of the Euclidean Algorithm.

3. Prove the GCD Characterization Theorem.

18.2 Greatest Common Divisor

Definition 18.2.1

Greatest CommonDivisor

Let a and b be integers, not both zero. An integer d > 0 is the greatest common divisorof a and b, written gcd(a, b), if and only if

1. d | a and d | b (this captures the common part of the definition), and

2. if c | a and c | b then c ≤ d (this captures the greatest part of the definition).

Example 1

• gcd(24, 30) = 6

• gcd(17, 25) = 1

• gcd(−12, 0) = 12

• gcd(−12,−12) = 12

• gcd(0, 0) =??

133

Page 134: MATH 135 Course Note

134 Chapter 18 The Greatest Common Divisor

Definition 18.2.2

gcd(0, 0)

For a 6= 0, the definition implies that gcd(a, 0) = |a| and gcd(a, a) = |a|. We define gcd(0, 0)as 0. This may sound counterintuitive, since all integers are divisors of 0, but it is consistentwith gcd(a, 0) = |a| and gcd(a, a) = |a|.

Let’s prove a seemingly unusual proposition about gcds.

Proposition 1 (GCD With Remainders (GCD WR))

If a and b are integers not both zero, and q and r are integers such that a = qb + r, thengcd(a, b) = gcd(b, r).

Before we begin the proof, let’s take a look at a numeric example.

Example 2 Suppose a = 72 and b = 30. Now 72 = 2×30+12 so the proposition GCD With Remaindersasserts that gcd(72, 30) = gcd(30, 12). And this is true. The gcd(72, 30) and gcd(30, 12) is6.

How would we discover a proof for GCD With Remainders? Let’s try the usual approach:identify the hypothesis and conclusion, and begin asking questions.

Hypothesis: a, b, q and r are integers such that a = qb+ r.

Conclusion: gcd(a, b) = gcd(b, r)

My first question typically starts with the conclusion and works backward. What is asuitable first question? How about “How do we show that two integers are equal?” Thereare lots of possible answers: show that their difference is zero, their ratio is one, each isless than or equal the other. However, here we are working with gcds rather than genericintegers so perhaps a better question would be “How do we show that a number is a gcd?”The broad answer is relatively easy. Use the definition of gcd. After all, right now it isthe only thing we have! A specific answer is less easy. Do we want to focus on gcd(a, b) orgcd(b, r)? Here is an easy way to do both. Let d = gcd(a, b). Then show that d = gcd(b, r).That gets us two statements in our proof.

Proof in Progress

1. Let d = gcd(a, b).

2. To be completed.

3. Hence d = gcd(b, r).

But how do we show that d = gcd(b, r)? Use the definition. Our proof can expand to

Proof in Progress

1. Let d = gcd(a, b).

Page 135: MATH 135 Course Note

Section 18.2 Greatest Common Divisor 135

2. We will show

(a) d | b and d | r, and

(b) if c | b and c | r then c ≤ d.

3. To be completed.

4. Hence d = gcd(b, r).

For the first part of the definition, we ask “How do we show that one number divides anothernumber?” Interestingly enough, there are two different answers - one for b and one for r,though that is not obvious. For b there is already a connection between d and b in the firstsentence. Since d = gcd(a, b), we know from the definition of gcd that d | b.

What about r? Using the definition of divisibility seems problematic. What propositionscould we use? Transitivity of Divisibility doesn’t seem to apply. How about using theDivisibility of Integer Combinations? Recall

Proposition 2 (Divisibility of Integer Combinations)

Let a, b and c be integers. If a | b and a | c, then a | (bx+ cy) for any x, y ∈ Z.

Observe that r = a − qb. Since d | a and d | b, d divides any integer combination of a andb by the Divisibility of Integer Combinations. That is, d | (a(1) + b(−q)) so d | r. Let’sextend our proof in progress.

Proof in Progress

1. Let d = gcd(a, b).

2. We will show

(a) d | b and d | r, and

(b) if c | b and c | r then c ≤ d.

3. Since d = gcd(a, b), we know from the definition of gcd that d | b.

4. Observe that r = a− qb. Since d | a and d | b, d | (a(1) + b(−q)) by the Divisibility ofInteger Combinations, so d | r.

5. To be completed.

6. Hence d = gcd(b, r).

That leaves us with the greatest part of greatest common divisor. This second part of thedefinition is itself an implication, so we assume that c | b and c | r and we must show c ≤ d.How do we show one number is less than or equal to another number? There doesn’t seemto be anything obvious but ask “Have I seen this anywhere before?”. Yes, we have. In thesecond part of the definition of gcd. But then you might ask “Isn’t that assuming what wehave to prove?” Let’s be precise about what we are saying. We can use d for one inequality.

Since d = gcd(a, b), for any c where c | a and c | b, c ≤ d.

What we need to show is: if c | b and c | r then c ≤ d.

Page 136: MATH 135 Course Note

136 Chapter 18 The Greatest Common Divisor

These two statements are close, but not the same. Make sure that you see the difference.In one, we are using the fact that d = gcd(a, b). In the other, we are showing that anycommon factor of b and r is less than or equal to d.

If we assume that c | b and c | r, then c | (b(q) + r(1)) by the Divisibility of IntegerCombinations (again). Since a = qb + r, c | a. And now, since d = gcd(a, b) and c | a andc | b, c ≤ d as needed. Let’s add that to our proof in progress.

Proof in Progress

1. Let d = gcd(a, b).

2. We will show

(a) d | b and d | r, and

(b) if c | b and c | r then c ≤ d.

3. Since d = gcd(a, b), we know from the definition of gcd that d | b.

4. Observe that r = a− qb. Since d | a and d | b, d | (a(1) + b(−q)) by the Divisibility ofInteger Combinations, so d | r.

5. Let c | b and c | r. Then c | (b(q) + r(1)) by the Divisibility of Integer Combinations.Since a = qb+ r, c | a. And now, since d = gcd(a, b) and c | a and c | b, c ≤ d by thesecond part of the definition of gcd.

6. Hence d = gcd(b, r).

Having discovered a proof, we should now write the proof. Whenever you write, you shouldhave an audience in mind. You actually have two audiences to keep in mind: your peers withwhom you collaborate, and the markers. You do not need to specify each proof technique,since your peers and markers know all of them. It does help to provide an overall plan ifyou can. Also, proofs tend to work much more forwards than backwards because that helpsto emphasize the notion of starting with hypotheses and ending with the conclusion. Hereis one possible proof.

Proof: Let d = gcd(a, b). We will use the definition of gcd to show that d = gcd(b, r).

Since d = gcd(a, b), d | b. Observe that r = a− qb. Since d | a and d | b, d | (a− qb) by theDivisibility of Integer Combinations. Hence d | r, and d is a common divisor of b and r.

Let c be a divisor of b and r. Since c | b and c | r, c | (qb+ r) by the Divisibility of IntegerCombinations. Now a = qb+r, so c | a. Because d = gcd(a, b) and c | a and c | b, c ≤ d.

REMARK

1. If a = b = 0 this proposition is also true since the only possible choices for b and r areb = r = 0.

2. In general, there are many ways to work forwards and backwards.

3. The proof may records steps in a different order than their appearance in the discoveryprocess.

Page 137: MATH 135 Course Note

Section 18.3 Certificate of Correctess 137

4. Proofs are short and usually omit the discovery process.

5. Be sure that you can identify where each of the hypotheses was used in the proof.

18.3 Certificate of Correctess

Suppose we wanted to compute gcd(1386, 322). We could factor both numbers, find theircommon factors and select the greatest. In general, this is very slow.

Repeated use of GCD With Remainders allows us to efficiently compute gcds. For example,let’s compute gcd(1386, 322).

Example 3Since 1386 = 4× 322 + 98, gcd(1386, 322) = gcd(322, 98).Since 322 = 3× 98 + 28, gcd(322, 98) = gcd(98, 28).Since 98 = 3× 28 + 14, gcd(98, 28) = gcd(28, 14).Since 28 = 2× 14 + 0, gcd(28, 14) = gcd(14, 0).

Since gcd(14, 0) = 14, the chain of equalities from the column on the right gives us

gcd(1386, 322) = gcd(322, 98) = gcd(98, 28) = gcd(28, 14) = gcd(14, 0) = 14.

This process is known as the Euclidean Algorithm.

Exercise 1 Randomly pick two positive integers and compute their gcd using the Euclidean Algorithm.How do you know that you have the correct answer? Keep your work. You’ll need it soon.

Because mistakes happen when performing arithmetic by hand, and mistakes happen whenprogramming computers, it would be very useful if there were a way to certify that ananswer is correct. Think of a certificate of correctness this way. You are a manager. Youask one of your staff to solve a problem. The staff member comes back with the proposedsolution and a certificate of correctness that can be used to verify that the proposed solutionis, in fact, correct. The certificate has two parts: a theorem which you have already provedand which relates to the problem in general, and data which relates to this specific problem.

For example, here’s a proposition that allows us to produce a certificate for gcd(a, b).

Proposition 3 (GCD Characterization Theorem (GCD CT))

If d is a positive common divisor of the integers a and b, and there exist integers x and yso that ax+ by = d, then d = gcd(a, b).

Our certificate would consist of this theorem along with integers x and y. If our proposedsolution was d and d | a, d | b and ax+ by = d, then we could conclude without doubt thatd = gcd(a, b).

Page 138: MATH 135 Course Note

138 Chapter 18 The Greatest Common Divisor

In Example 3 above, the proposed gcd of 1386 and 322 is 14. Our certificate of correctnessconsists of the GCD Characterization Theorem and the integers d = 14, x = 10 and y = −43.Note that 14 | 1386 and 14 | 322 and 1386 × 10 + 322 × (−43) = 14, so we can concludethat 14 = gcd(1386, 322).

Here is a proof of the GCD Characterization Theorem.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. We will show that d satisfies the definition of gcd(a, b).

2. From the hypotheses, d | a and d | b.

3. Now let c | a and c | b.

4. By the Divisibility of Integer Combinations, c | (ax+ by) so c | d.

5. By the Bounds by Divisibility, c ≤ d, and so d = gcd(a, b).

Let’s do an analysis of the proof.

Analysis of Proof As usual, we will begin by explicitly identifying the hypothesis andthe conclusion.

Hypothesis: d is a positive common divisor of the integers a and b. There existintegers x and y so that ax+ by = d.

Conclusion: d = gcd(a, b)

Core Proof Technique: Work forwards recognizing an existential quantifier in thehypothesis.

Preliminary Material: Definition of gcd. An integer d > 0 is the gcd(a, b) if andonly if

1. d | a and d | b, and

2. if c | a and c | b then c ≤ d.

Sentence 1 We will show that d satisfies the definition of gcd(a, b).

The author states the plan - always a good idea. The author is actually answeringthe question “How do I show that one number is the gcd of two other numbers?”

Sentence 2 From the hypotheses, d | a and d | b.The author is working forwards from the hypothesis. This handles the first part ofthe definition of gcd.

Sentence 3 Now let c | a and c | b.The second part of the definition of gcd is an implication with hypothesis c | a andc | b. The author must show c ≤ d.

Page 139: MATH 135 Course Note

Section 18.4 More Examples 139

Sentence 4 By the Divisibility of Integer Combinations, c | (ax+ by) so c | d.

This is where the author uses an existential quantifier in the hypothesis. The authorassumes the existence of two integers x and y such that ax+ by = d. The author doesnot state this explicitly.

Having made this assumption, the author can use Sentence 3 to satisfy the hypothesesof Divisibility of Integer Combinations and so invoke the conclusion, that is,c | (ax+ by).

Sentence 5 By the Bounds By Divisibility, c ≤ d, and so d = gcd(a, b).

Bounds by Divisibility concludes with a statement involving absolute values. Wheredid the absolute vales signs go? From Sentence 4 we know that c | d and from thehypothesis we know that d 6= 0 so Bounds by Divisibility implies that |c| ≤ |d|. Fromthe hypothesis we know more than d 6= 0. We know that d is positive, so |c| ≤ d.Regardless of the sign of c, if |c| ≤ d, it must be the case that c ≤ d. Havingdetermined that c ≤ d, both parts of the definition of gcd are satisfied and so theauthor can conclude that d = gcd(a, b).

Now the obvious questions is: “How do we find x and y?”

18.4 More Examples

1. Use the definition of gcd to prove the following statement. (Hint: Use the proof ofthe GCD With Remainders proposition as a model.)

Let x, y ∈ Z and let d = gcd(x, y). Then d = gcd(x, 3x+ y).

Proof: We will show that d satisfies the definition of gcd for the pair x and 3x + y.Specifically, we must show that

(a) d | x and d | (3x+ y), and

(b) if c | x and c | (3x+ y) then c ≤ d.

Since d = gcd(x, y), d | x. Also, since d | x and d | y, d divides any integer combinationof x and y, hence d | (3x+ y).

Now suppose that c | x and c | (3x + y). Then c divides the integer combinationx(−3) + (3x+ y)(1)), that is, c | y. But since c | x and c | y and d = gcd(x, y), c ≤ d.

All of the conditions of the definition of the gcd are satisfied so d = gcd(x, 3x+y).

Page 140: MATH 135 Course Note

140 Chapter 18 The Greatest Common Divisor

18.5 Practice

1. Consider the following statement: For all a ∈ Z, gcd(9a+ 4, 2a+ 1) = 1.

(a) Which proposition belongs in the following proof of this statement?

Proof: Let a ∈ Z. By ,

gcd(9a+ 4, 2a+ 1) = gcd(2a+ 1, a) = gcd(a, 1)

Since gcd(a, 1) = 1, gcd(9a+ 4, 2a+ 1) = 1.

(b) If gcd(x, y) = d, express gcd(18x+ 3y, 3x) in terms of d. Justify your answer.

2. Let a and b be non-zero integers. Prove each of the following statements.

(a) If a | b, then ac | bc.(b) If c > 0, then gcd(ac, bc) = c gcd(a, b). (Suggestion: Let d = gcd(a, b). Show

cd = gcd(ac, bc).)

(c) If gcd(a, b) = 1, then gcd(2a+ b, a+ 2b) is 1 or 3.

3. Prove or disprove the following statements. Let a, b, c be fixed integers.

(a) If there exists an integer solution to ax2 + by2 = c, then gcd(a, b) | c.(b) If gcd(a, b) | c, then there exists an integer solution to ax2 + by2 = c.

4. Two integers a and b are coprime if gcd(a, b) = 1. Consider the following propositionand proof: If a and b are consecutive integers, then a and b are co-prime.

Proof: (For reference purposes, each sentence of the proof is written on a separateline.)

(i) Suppose b > a.

(ii) We can write b as a+ 1.

(iii) Since 1(a+ 1)− 1(a) = 1, we know by the thatgcd(a, b) = gcd(a, a+ 1) = 1 as required.

(iv) The argument is similar if a > b.

(a) State the hypothesis of Proposition 1.

(b) State the conclusion of Proposition 1.

(c) What proposition or theorem should appear in line (iii) of the proof? State theproposition or theorem precisely.

(d) Recall that propositions or theorems can only be invoked if their hypotheses aresatisfied. Show that all of the hypotheses of the proposition or theorem youquoted in (c) are satisfied.

Page 141: MATH 135 Course Note

Chapter 19

The Extended EuclideanAlgorithm

19.1 Objectives

The content objectives are:

1. Compute gcds and certificates using the Extended Euclidean Algorithm.

19.2 The Extended Euclidean Algorithm (EEA)

Given two positive integers, a and b, the EEA is an efficient way to compute not onlyd = gcd(a, b) but the data x and y for the certificate. We’ll begin with an example andthen formally state the algorithm.

First though, we need to know what the floor of a number is.

Definition 19.2.1

floor

The floor of x, written bxc, is the largest integer less than or equal to x.

Example 1

1. b9.713c = 9.

2. b9.025c = 9.

3. b9c = 9.

4. b−9.713c = −10. Since the floor of x is the largest integer less than or equal to x, −9cannot be the floor of −9.713 since −9 > −9.713.

5.

⌊7

2

⌋= 3.

141

Page 142: MATH 135 Course Note

142 Chapter 19 The Extended Euclidean Algorithm

Let’s compute gcd(1386, 322) using the EEA. We begin by creating four columns labelledx, y, r (for remainder) and q (for quotient). We will construct a sequence of rows that willtell us the gcd and provide a certificate. For the i-th row we will label the column entriesxi, yi, ri and qi. There is something very important to observe about the table. If we arecomputing gcd(a, b), in each row of the table

axi + byi = ri

Where have you seen an expression like that before?

Assuming a > b, the first two rows are always

x y r q

1 0 a 0

0 1 b 0

so in our specific problem the first two rows are

x y r q

1 0 1386 0

0 1 322 0

We construct each of the remaining rows by using the two preceding rows. To generate thethird row we must first compute a quotient q3 using the formula

qi ←⌊ri−2ri−1

⌋Here we get

q3 =

⌊r1r2

⌋=

⌊1386

322

⌋= 4

To construct the next row we use the formula

Rowi ← Rowi−2 − qiRowi−1

When i = 3 we getRow3 ← Row1 − q3Row2

With q3 = 4 we getRow3 ← Row1 − 4× Row2

Writing this in the table gives

x y r q

Row1 1 0 1386 0

−4× Row2 0 1 322 0

= Row3 1 −4 98 4

In a similar fashion we get the fourth row. To generate the fourth row we must first computea quotient q4 using the formula

qi ←⌊ri−2ri−1

⌋Here we get

q4 =

⌊r2r3

⌋=

⌊322

98

⌋= 3

Page 143: MATH 135 Course Note

Section 19.2 The Extended Euclidean Algorithm (EEA) 143

To construct the next row we use the formula

Rowi ← Rowi−2 − qiRowi−1

When i = 4 we getRow4 ← Row2 − q4Row3

With q4 = 3 we getRow4 ← Row2 − 3× Row3

and sox y r q

1 0 1386 0

Row2 0 1 322 0

−3× Row3 1 −4 98 4

= Row4 −3 13 28 3

The completely worked out example follows.

x y r q

1 0 1386 0

0 1 322 0

1 −4 98 4

−3 13 28 3

10 −43 14 3

−23 99 0 2

We stop when the remainder is 0. The second last row provides the desired d, x andy. The gcd d is the entry in the r column, x is the entry in the x column and y is theentry in the y column. Hence, d = 14 (as before), and we can check the conditions of theGCD Characterization Theorem to certify correctness. Since 14 | 1386 and 14 | 322 and1386× 10 + 322× (−43) = 14, we can conclude that 14 = gcd(1386, 322).

If a or b is negative, apply the EEA to gcd(|a|, |b|) and then change the signs of x and yafter the EEA is complete. If a < b, simply swap their places in the algorithm. This worksbecause gcd(a, b) = gcd(b, a).

Page 144: MATH 135 Course Note

144 Chapter 19 The Extended Euclidean Algorithm

Here is a formal statement of the algorithm.

Algorithm 1 Extended Euclidean Algorithm

Require: a > b > 0 are integers.Ensure: The following conditions hold at the end of the algorithm.rn+1 = 0.rn = gcd(a, b).ri−2 = qiri−1 + ri where 0 ≤ ri < ri−1.In every row, axi + byi = ri.x = xn, y = yn is a solution to ax+ by = gcd(a, b).{Initialize}Construct a table with four columns so thatThe columns are labelled x, y, r and q.The first row in the table is (1, 0, a, 0).The second row in the table is (0, 1, b, 0).{To produce the remaining rows (i ≥ 3)}repeat

qi ←⌊ri−2

ri−1

⌋Rowi ← Rowi−2 − qiRowi−1

until ri = 0

We treat the EEA as a proposition where the preconditions of the algorithm are the hy-potheses and the postconditions of the algorithm are the conclusions. Let’s record thealgorithm in the form of a theorem.

Proposition 1 (Extended Euclidean Algorithm (EEA))

If a and b are positive integers, then d = gcd(a, b) can be computed and there exist integersx and y so that ax+ by = d.

Exercise 1 Earlier you computed the gcd of two numbers. Repeat that exercise using the EEA andverify that you can produce a certificate of correctness for your proposed gcd.

19.3 More Examples

1. Let d = gcd(231, 660).

(a) Use the Extended Euclidean Algorithm to compute d and provide a certificatethat d is correct.

(b) Using part (a) , find d1 = gcd(231,−660) and provide a certificate that d1 iscorrect.

(c) Using part (a) of this question, find d2 = gcd(−231,−660) and provide a certifi-cate that d2 is correct.

Solution:

Page 145: MATH 135 Course Note

Section 19.3 More Examples 145

(a)x y r q

1 0 660 0

0 1 231 0

1 −2 198 2

−1 3 33 1

7 −20 0 6

By the EEA, d = 33. Our certificate consists of the GCD CharacterizationTheorem together with d = 33 (d is positive and divides both 660 and 231), andthe integers −1 and 3 (since 660(−1) + 231(3) = 33).

(b) Since gcd(231,−660) = gcd(231, 660), d1 = 33. Our certificate consists of theGCD Characterization Theorem together with d1 = 33 (d1 is positive and dividesboth −660 and 231), and the integers 1 and 3 (since −660(1) + 231(3) = 33).

(c) Since gcd(−231,−660) = gcd(231, 660), d2 = 33. Our certificate consists of theGCD Characterization Theorem together with d2 = 33 (d2 is positive and dividesboth −660 and −231), and the integers 1 and −3 (since −660(1)−231(−3) = 33).

2. What is the complete solution to the linear Diophantine equation 1950x−770y = 30?

We begin with the EEA applied to 1950 and 770. We will adjust the signs later.

x y r q

1 0 1950 0

0 1 770 0

1 −2 410 2

−1 3 360 1

2 −5 50 1

−15 38 10 7

77 195 0 5

Now we see that1950(−15)− 770(−38) = 10

Multiplying by 3 gives one particular solution, x0 = −45, y0 = −114 to1950x− 770y = 30. The complete solution is

x = −45− 77n

y = −114− 195n

for n ∈ Z.

Check: 1950x−770y = 1950(−45−77n)−770(−114−195n) = 1950(−45)−1950(77n)+770(114) + 770(195n) = 1950(−45) + 770(114) = −87750 + 87780 = 30.

Page 146: MATH 135 Course Note

Chapter 20

Properties Of GCDs

20.1 Objectives

The technique objectives are:

1. To practice working with existential quantifiers.

The content objectives are:

1. Define coprime.

2. Discover a proof of Coprimeness and Divisibility.

3. Discover a proof of GCD Of One

4. Exercise: Discover a proof of Division by the GCD.

5. Exercise: Discover a proof of Primes and Divisibility.

20.2 Some Useful Propositions

We begin with a proposition on coprimeness and divisibility.

Definition 20.2.1

Coprime

Two integers a and b are coprime if gcd(a, b) = 1.

Proposition 1 (Coprimeness and Divisibility (CAD))

If a, b and c are integers and c | ab and gcd(a, c) = 1, then c | b.

This proposition has two implicit existential quantifiers, one in the hypothesis and one inthe conclusion. You might object and ask “Where?” They are hidden - in the definition ofdivides. Recall the definition. An integer m divides an integer n if there exists an integer kso that n = km.

We treat an existential quantifier in the hypothesis differently from an existential quantifierin the conclusion. Recall the following remarks from the chapter on quantifiers.

146

Page 147: MATH 135 Course Note

Section 20.2 Some Useful Propositions 147

REMARK

When proving that “A implies B” and A uses an existential quantifier, use theObject Method.

1. Identify the four parts of the quantified statement “there exists an x in the set S suchthat P (x) is true.”

2. Assume that a mathematical object x exists within the domain S so that the statementP (x) is true.

3. Make use of this information to generate another statement.

When proving that “A implies B” and B uses an existential quantifier, use theConstruct Method.

1. Identify the four parts of the quantified statement. “there exists an x in the set Ssuch that P (x) is true.”

2. Construct a mathematical object x.

3. Show that x ∈ S.

4. Show that P (x) is true.

With all of this in mind, how do we go about discovering a proof for Coprimeness andDivisibility? As usual, we will begin by explicitly identifying the hypothesis, the conclusion,the core proof technique and any preliminary material we think we might need.

Hypothesis: a, b and c are integers and c | ab and gcd(a, c) = 1.

Conclusion: c | b.

Core Proof Technique: We use the Object Method because of the existential quantifierin the hypothesis, and the Construct Method because of the existential quantifier inthe conclusion.

Preliminary Material: Definition of divides and gcd.

Let’s work backwards from the conclusion by asking the question “How do we show thatone integer divides another?” We can answer with “the definition of divisibility.” We mustconstruct an integer k so that b = ck. We will record this as follows.

Proof in Progress

1. To be completed.

2. Since b = kc, c | b.

Page 148: MATH 135 Course Note

148 Chapter 20 Properties Of GCDs

The problem is that it is not at all clear what k should be. Let’s work forwards from thehypothesis.

Somehow we need an equation with a b alone on one side of the equality sign. We can’tstart there but we can get an equation with a b. Since gcd(a, c) = 1, the EEA guaranteesthat we can find integers x and y so that ax+ cy = 1. We could multiply this equation byb. Let’s record these forward statements.

Proof in Progress

1. Since gcd(a, c) = 1, the EEA guarantees that we can find integers x and y so thatax+ cy = 1 (1).

2. Multiplying (1) by b gives abx+ cby = b (2).

3. To be completed.

4. Since b = kc, c | b.

If we could factor the left hand side of (2), we’d be able to get a c and other stuff that wecould treat as our k. But the first term has no c. Or maybe it does. Since c | ab thereexists an integer h so that ch = ab. Substituting ch for ab in (2) gives chx + cby = b (3).We record this as

Proof in Progress

1. Since gcd(a, c) = 1, the EEA guarantees that we can find integers x and y so thatax+ cy = 1 (1).

2. Multiplying (1) by b gives abx+ cby = b (2).

3. Since c | ab there exists an integer h so that ch = ab. Substituting ch for ab in (2)gives chx+ cby = b (3).

4. To be completed.

5. Since b = kc, c | b.

Now factor.

Proof in Progress

1. Since gcd(a, c) = 1, the EEA guarantees that we can find integers x and y so thatax+ cy = 1 (1).

2. Multiplying (1) by b gives abx+ cby = b (2).

3. Since c | ab there exists an integer h so that ch = ab. Substituting ch for ab in (2)gives chx+ cby = b (3).

4. This gives c(hx+ by) = b.

5. But then if we let k = hx+ by we have an integer k so that ck = b.

6. Since b = kc, c | b.

Page 149: MATH 135 Course Note

Section 20.2 Some Useful Propositions 149

Here is a proof.

Proof: By the Extended Euclidean Algorithm and the hypothesis gcd(a, c) = 1, there existintegers x and y so that ax + cy = 1. Multiplying by b gives abx + cby = b. Since c | abthere exists an integer h so that ch = ab. Substituting ch for ab gives chx+ cby = b. Lastly,factoring produces (hx+ by)c = b. Since hx+ by is an integer, c | b.

As a corollary of Coprimeness and Divisibility we have the following proposition.

Corollary 2 (Primes and Divisibility (PAD))

If p is a prime and p | ab, then p | a or p | b.

Exercise 1 Prove Primes and Divisibility. Because of the “or” in the conclusion, you will need to usethe Elimination Method.

Let us consider more properties of the greatest common divisor.

Proposition 3 (GCD Of One (GCD OO))

Let a and b be integers. Then gcd(a, b) = 1 if and only if there are integers x and y withax+ by = 1.

This proposition has similar elements to the one we just proved, so it won’t be a surprise ifwe use similar reasoning.

REMARK

The important difference is that this statement is an “if and only if” statement. To prove“A if and only if B” we must prove two statements:

1. If A, then B.

2. If B, then A.

Symbolically, we write “A if and only if B” as A ⇐⇒ B. We established the equivalenceof A ⇐⇒ B and (A⇒ B) ∧ (B ⇒ A) in the chapter Truth Tables.

We can restate the proposition as

Proposition 4 (GCD Of One (GCD OO))

Let a and b be integers.

1. If gcd(a, b) = 1, then there are integers x and y with ax+ by = 1.

2. If there are integers x and y with ax+ by = 1, then gcd(a, b) = 1.

Page 150: MATH 135 Course Note

150 Chapter 20 Properties Of GCDs

In statement (1), there is an existential quantifier in the conclusion, so we would expect touse the Construction Method. The problem is “Where do we get x and y?” In the previousproof, we used the EEA and it makes sense to use it here as well. By the EEA and thehypothesis gcd(a, b) = 1, there exist integers x and y so that ax+ by = 1.

In statement (2), an existential quantifier occurs in the hypothesis so we use the ObjectMethod and assume the existence of integers x and y so that ax + by = 1. Also, 1 | a and1 | b. These are exactly the hypotheses of the GCD Characterization Theorem, so we canconclude that gcd(a, b) = 1.

Here is a proof of the GCD Of One proposition.

Proof: Since gcd(a, b) = 1, the EEA assures the existence of integers x and y so thatax+ by = 1. Statement 1 is proved.

Now, 1 | a and 1 | b. Also, by the hypothesis of Statement 2, there exist integers x and y sothat ax+ by = 1. These are exactly the hypotheses of the GCD Characterization Theorem,so we can conclude that gcd(a, b) = 1 and Statement 2 is proved.

REMARK

This proof illustrates the connection between the GCD Characterization Theorem and theExtended Euclidean Algorithm. Both assume integers a and b. The GCD CharacterizationTheorem starts with an integer d where d | a, d | b and integers x and y so that ax+ by = dand concludes that d = gcd(a, b). The Extended Euclidean Algorithm computes a d so thatd = gcd(a, b), hence it produces a d so that d | a and d | b, and also computes integers xand y so that ax+ by = d.

So, if we encounter a gcd in the conclusion, we can try the GCD Characterization Theorem.If we encounter a gcd in the hypothesis, we can try the Extended Euclidean Algorithm.

Here is another property of gcds.

Proposition 5 (Division by the GCD (DB GCD))

Let a and b be integers. If gcd(a, b) = d 6= 0, then gcd

(a

d,b

d

)= 1.

As we often do, let’s get a sense of the proposition by using numeric examples.

Example 1 First, observe that gcd

(a

d,b

d

)is meaningful. Since d | a and d | b, both

a

dand

b

dare

integers.

Now gcd(18, 24) = 6. By the proposition Division by the GCD,

gcd

(18

6,24

6

)= 1

which is exactly what we would expect from gcd(3, 4).

Page 151: MATH 135 Course Note

Section 20.3 Practice 151

Now take minute to read the proof.

Proof: We will use the GCD Characterization Theorem. Since gcd(a, b) = d, the EEAassures the existence of integers x and y so that ax+ by = d. Dividing by d gives

a

dx+

b

dy = 1

Since 1 divides botha

dand

b

d, the GCD Characterization Theorem implies that

gcd

(a

d,b

d

)= 1.

20.3 Practice

1. Consider the following statement and proof.

Let a, b, c ∈ Z. If gcd(a, b) = 1 and c | (a+ b), then gcd(a, c) = 1.

Proof: (For reference purposes, each sentence of the proof is written on a separateline.)

(i) Since gcd(a, b) = 1, by there exist integers x and y such thatax+ by = 1.

(ii) Since c | (a+ b), by there exists an integer k such that a+ b = ck.

(iii) Substituting a = ck − b into the first equation, we get1 = (ck − b)x+ by = b(−x+ y) + c(kx).

(iv) Since 1 is a common divisor of b and c and−x+y and kx are integers, gcd(b, c) = 1by .

(a) What proposition or definition should be cited in line (i) of the proof?

(b) What proposition or definition should be cited in line (ii) of the proof?

(c) What proposition or definition should be cited in line (iv) of the proof?

2. Consider the following proposition and proof.

Let a, b, c ∈ Z. If gcd(a, b) = 1 and c | a, then gcd(b, c) = 1.

Proof: Since gcd(a, b) = 1, we know that there exist integers x and y so thatax + by = 1 (1). Since c | a, there exists an integer k so that a = ck. Substitutingthis expression for a into Equation (1) gives c(kx) + b(y) = 1. Since kx is an integer,gcd(b, c) = 1.

Justify each line of the proof by writing down each definition or proposition used.Write down the entire definition or proposition, not just the name. For propositions,show that the assumptions of the proposition are satisfied. If only arithmetic is used,write down “By arithmetic.”

Page 152: MATH 135 Course Note

152 Chapter 20 Properties Of GCDs

3. Let a, b ∈ Z. For each of the following statements, either prove the statement ordisprove it using a counterexample.

(a) If p is a prime, and p | ab, then p | a or p | b.(b) If 2a2 = b2 where a, b ∈ Z, then 2 is a common divisor of a and b.

(c) For any integer a, gcd(11a+ 5, 2a+ 1) = 1.

4. Prove the following statement. If gcd(a, b) = 1, then gcd(a, bc) = gcd(a, c). (Hint:Let d = gcd(a, c) and let e = gcd(a, bc).)

Page 153: MATH 135 Course Note

Chapter 21

Linear Diophantine Equations:One Solution

21.1 Objectives

The technique objectives are:

1. To practice working with existential quantifiers.

The content objectives are:

1. Define Diophantine equations.

2. Prove the Linear Diophantine Equation Theorem (Part 1)

21.2 Linear Diophantine Equations

In high school, you looked at linear equations that involved real numbers. We will look atlinear equations involving only integers.

Definition 21.2.1

DiophantineEquations

Equations with integer co-efficients for which integer solutions are sought, are calledDiophantine equations after the Greek mathematician, Diophantus of Alexandria, whostudied such equations. Diophantine equations are called linear if each term in the equationis a constant or a constant times a single variable of degree 1.

The simplest linear Diophantine equation is

ax = b

To emphasize, a and b are given integers in Z and we want an x ∈ Z that solves ax = b.From the definition of divisibility, we know that this equation has an integer solution x ifand only if a | b, and if a | b, then x = b

a .

What about linear Diophantine equations with two variables?

ax+ by = c

153

Page 154: MATH 135 Course Note

154Chapter 21 Linear Diophantine Equations:

One Solution

21.2.1 Finding One Solution to ax+ by = c

Theorem 1 (Linear Diophantine Equation Theorem, Part 1 (LDET 1))

Let gcd(a, b) = d. The linear Diophantine equation

ax+ by = c

has a solution if and only if d | c.

Before we study a proof of this theorem, let’s see how it works in practice.

Example 1 Which of the following linear Diophantine equations has a solution?

1. 33x+ 18y = 10

2. 33x+ 18y = 15

Solution:

1. Since gcd(33, 18) = 3, and 3 does not divide 10, the first equation has no integersolutions.

2. Since gcd(33, 18) = 3, and 3 does divide 15, the second equation does have an integersolution.

But how do we find a solution? Here are two simple steps that will allow us to find asolution.

1. Use the Extended Euclidean Algorithm to find d = gcd(a, b) and x1 and y1 where

ax1 + by1 = d. (21.1)

2. Multiply Equation 21.1 by k =c

dto get akx1 + bky1 = kd = c. A solution is x = kx1

and y = ky1.

Applying these two steps to Part 2 of the example, the Extended Euclidean Algorithm gives

x y r q

1 0 33 0

0 1 18 0

1 −1 15 1

−1 2 3 1

6 −11 0 5

hence33×−1 + 18× 2 = 3

Page 155: MATH 135 Course Note

Section 21.2 Linear Diophantine Equations 155

Multiplying by k =c

d=

15

3= 5 gives

33×−5 + 18× 10 = 15

so one particular solution is x = −5 and y = 10.

But are there more solutions? That’s where Part 2 of the Linear Diophantine EquationTheorem comes in and we will cover it later.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. First, suppose that the linear Diophantine equation ax+by = c has an integer solutionx = x0, y = y0. That is, ax0 + by0 = c.

2. Since d = gcd(a, b), d | a and d | b.

3. But then, by the Divisibility of Integer Combinations, d | (ax0 + by0). That is d | c.

4. Conversely, suppose that d | c.

5. Then there exists an integer k such that c = kd.

6. Now, by the Extended Euclidean Algorithm, there exist integers x1 and y1 so that

ax1 + by1 = d.

7. Multiplying this equation by k =c

dgives

akx1 + bky1 = kd = c

which, in turn, implies that x = kx1 and y = ky1 is a solution to ax+ by = c.

Let’s perform an analysis of this proof.

Analysis of Proof This is an “if and only if” statement so we must prove two statements.

1. If the linear Diophantine equation ax+ by = c has a solution, then d | c.2. If d | c, then the linear Diophantine equation ax+ by = c has a solution.

Core Proof Technique: Both statements contain an existential quantifier in thehypothesis, so each will start with the Object Method. Though both statementsalso contain an existential quantifier in the conclusion, only one uses the Con-struct Method. The other uses a proposition we have already proved.

Sentence 1 First, suppose that the linear Diophantine equation ax+ by = c has an integersolution x = x0, y = y0. That is, ax0 + by0 = c.

The author does not explicitly rephrase the “if and only if” as two statements. Rather,Sentence 1 indicates which of the two implicit statements will be proved by stating thehypothesis of Statement 1. Moreover, the first statement uses an existential quantifierin the hypothesis. The hypothesis of the first statement could be restated as

Page 156: MATH 135 Course Note

156Chapter 21 Linear Diophantine Equations:

One Solution

there exists an integer solution x0, y0 to the linear Diophantine equationax+ by = c

The four parts are

Quantifier: ∃Variable: x0, y0Domain: ZOpen sentence: ax+ by = c.

Since the existential quantifier occurs in the hypothesis, the author uses the ObjectMethod. The author assumes the existence of the corresponding objects (x0, y0) in asuitable domain (Z) and assumes that these objects satisfy the related open sentence(ax+ by = c).

Sentence 2 Since d = gcd(a, b), d | a and d | b.This follows from the definition of gcd.

Sentence 3 But then, by the Divisibility of Integer Combinations, d | (ax0 + by0). That isd | c.Since the hypotheses of DIC (a, b and d are integers, and d | a and d | b) are satisfied,the author can invoke the conclusion of DIC (d | (ax0 + by0)). And from Sentence 1,ax0 + by0 = c so d | c.

Sentence 4 Conversely, suppose that d | c.The conversely indicates that the author is about to prove Statement 2. Recall thatan “if and only if” always consists of a statement and its converse. The hypothesisof the converse is d | c. The definition of divides contains an existential quantifierand so, in Sentence 5, the authors uses the Object Method. The conclusion of State-ment 2 contains an existential quantifier (there exists an integer solution to the linearDiophantine equation), so the author uses the Construct Method to build a suitablesolution. Here are the parts of the existential quantifier in the conclusion.

Quantifier: ∃Variable: x, yDomain: ZOpen sentence: ax+ by = c.

Sentence 5 Then there exists an integer k such that c = kd.

This is the Object Method and follows from the definition of divisibility.

Sentence 6 Now, by the Extended Euclidean Algorithm, there exist integers x1 and y1 sothat

ax1 + by1 = d.

The author is making use of a previously proved proposition.

Sentence 7 Multiplying this equation by k =c

dgives

akx1 + bky1 = kd = c

which, in turn, implies that x = kx1 and y = ky1 is a solution to ax+ by = c.

Page 157: MATH 135 Course Note

Section 21.2 Linear Diophantine Equations 157

This is where the solution is constructed, x = kx1 and y = ky1, and where theopen sentence is verified. The author does not explicitly check that kx1 and kx2 areintegers, though we must when we analyse the proof.

Page 158: MATH 135 Course Note

Chapter 22

Linear Diophantine Equations:All Solutions

22.1 Objectives

The technique objectives are:

1. To practice working with universal quantifiers.

2. To practice working with subsets.

The content objectives are:

1. Discover a proof to the Linear Diophantine Equation Theorem (Part 2).

2. Examples of the Linear Diophantine Equation Theorem.

22.2 Finding All Solutions to ax+ by = c

LDET 1 tells us when solutions exist and how to construct a solution. It does not find allof the solutions. That happens next.

Theorem 1 (Linear Diophantine Equation Theorem, Part 2, (LDET 2))

Let gcd(a, b) = d 6= 0. If x = x0 and y = y0 is one particular integer solution to the linearDiophantine equation ax+ by = c, then the complete integer solution is

x = x0 +b

dn, y = y0 −

a

dn, ∀n ∈ Z.

Before we discover a proof, let’s make sure we understand the statement.

158

Page 159: MATH 135 Course Note

Section 22.2 Finding All Solutions to ax+ by = c 159

Example 1 Find all solutions to 33x+ 18y = 15.

Solution: Since gcd(33, 18) = 3, and 3 does divide 15, this equation does have integersolutions by the Linear Diophantine Equation Theorem, Part 1. If we can find one solution,we can use the Linear Diophantine Equation Theorem, Part 2 to find all solutions. Sincewe earlier found the solution x = −5 and y = 10 the complete solution is

{(x, y) | x = −5 + 6n, y = 10− 11n, n ∈ Z}

You we can check that these are solutions by substitution.

Check:

33x+ 18y = 33(−5 + 6n) + 18(10− 11n) = −165 + 198n+ 180− 198n = 15

This check does not verify that we have found all solutions. It verifies that all of the pairsof integers we have found are solutions.

The expression “complete integer solution” in the statement of LDET 2 hides the use ofsets. Let’s be explicit about what those sets are and what we need to do with them. Thereare, in fact, two sets in the conclusion, the set of solutions, and the set of x and y pairs.We define them formally as follows.

Complete solution Let S = {(x, y) | x, y ∈ Z, ax+ by = c}

Proposed solution Let T = {(x, y) | x = x0 +b

dn, y = y0 −

a

dn, ∀n ∈ Z}

The conclusion of LDET 2 is S = T .

How do we show that two sets are equal? Two sets S and T are equal if and only if S ⊆ Tand T ⊆ S. That is, at the risk of being repetitive, to establish that S = T we must showtwo things.

1. S ⊆ T and

2. T ⊆ S

Normally one of the two is easy and the other is harder.

Suppose we want to show S ⊆ T . How do universal quantifiers figure in? Showing thatS ⊆ T is equivalent to the following statement.

S ⊆ T if and only if, for every member s ∈ S, s ∈ T .

If you prefer symbolic notation you could write ∀s ∈ S, s ∈ T or s ∈ S ⇒ s ∈ T .

What are the components of the universal quantifier?

Quantifier: ∀Variable: sDomain: SOpen sentence: s ∈ T

Page 160: MATH 135 Course Note

160Chapter 22 Linear Diophantine Equations:

All Solutions

The Select Method works perfectly in these situations.

As frequently as sets are used, they are usually implicit and our first task is to discern whatsets exist and how they are used. Let’s return to the proof of LDET 2 where our sets are:

Complete solution Let S = {(x, y) | x, y ∈ Z, ax+ by = c}

Proposed solution Let T = {(x, y) | x = x0 +b

dn, y = y0 −

a

dn, ∀n ∈ Z}

Let us discover a proof. We must keep in mind that we have two things to prove

1. S ⊆ T and

2. T ⊆ S

In this case, item 2 is easier so we will do it first. How do we show that T ⊆ S? Wemust show that “for all x ∈ T, x ∈ S”. We certainly don’t want to individually check everyelement of T so we choose a representative element of T , one that could be replaced by anyelement of T and the subsequent argument would hold. This is just the Select Method andit provides our first statement.

Let n0 ∈ Z. Then (x0 +b

dn0, y0 −

a

dn0) ∈ T .

To show that this element is in S we must show that the element satisfies the definingproperty of S, that is, the element is a solution.

ax+ by = a

(x0 +

b

dn0

)+ b

(y0 −

a

dn0

)= ax0 + by0 +

ab

dn0 −

ab

dn0

= ax0 + by0

= c (by hypothesis, x = x0 and y = y0 is an integer solution)

And now we can conclude

(x0 +b

dn0, y0 −

a

dn0) ∈ S

To show that S ⊆ T we will need to recall the proposition Division by the GCD.

Proposition 2 (Division by the GCD)

Let a and b be integers. If gcd(a, b) = d 6= 0, then gcd

(a

d,b

d

)= 1

Let’s begin our analysis of S ⊆ T . How do we show that S ⊆ T? We choose a representativeelement in S and show that it is in T , that is, that it satisfies the defining property of T .

Specifically, we must show that an arbitrary solution (x, y) has the form (x0 +b

dn, y0−

a

dn).

Page 161: MATH 135 Course Note

Section 22.2 Finding All Solutions to ax+ by = c 161

Let (x, y) be an arbitrary solution. Then (x, y) ∈ S and we must show (x, y) ∈ T . Let(x0, y0) be a particular solution to the linear Diophantine equation ax + by = c. Theexistence of (x0, y0) is assured by the hypothesis. Let’s do the obvious thing and substituteboth solutions into the equation.

ax + by = cax0 + by0 = c

Eliminating c and factoring gives

a(x− x0) = −b(y − y0)

We know that d = gcd(a, b) is a common factor of a and b soa

dand

b

dare both integers.

Dividing the previous equation by d gives

a

d(x− x0) = − b

d(y − y0) (22.1)

Using Division by the GCD, gcd

(a

d,b

d

)= 1. Since

b

ddivides

a

d(x − x0) we know from

Coprimeness and Divisibility that

b

d

∣∣∣∣ (x− x0)By the definition of divisibility, there exists an n ∈ Z so that

x− x0 = nb

d⇒ x = x0 +

b

dn

Substituting nb

dfor x− x0 in Equation (22.1) yields

y = y0 −a

dn

So every solution is of the form

(x, y) = (x0 +b

dn, y0 −

a

dn)

and so

(x, y) ∈ T

A very condensed proof of Linear Diophantine Equation Theorem, Part 2 might look likethe following. Notice the lack of mention of sets.

Page 162: MATH 135 Course Note

162Chapter 22 Linear Diophantine Equations:

All Solutions

Theorem 3 (Linear Diophantine Equation Theorem, Part 2, (LDET 2))

Let gcd(a, b) = d 6= 0. If x = x0 and y = y0 is one particular integer solution to the linearDiophantine equation ax+ by = c, then the complete integer solution is

x = x0 +b

dn, y = y0 −

a

dn, ∀n ∈ Z.

Proof: Substitution shows that integers of the form x = x0 + nb

d, y = y0 −

a

dn, n ∈ Z are

solutions.

Now, let (x, y) be an arbitrary solution and let (x0, y0) be a particular solution to the linearDiophantine equation ax+ by = c. Then

ax + by = cax0 + by0 = c

Eliminating c and factoring gives a(x − x0) = −b(y − y0) (1). Dividing by d and using

Division by the GCD and Coprimeness and Divisibility we haveb

d

∣∣∣∣ (x− x0). Hence, there

exists an n ∈ Z so that x = x0 +b

dn (2). Substituting (2) in (1) gives y = y0 −

a

dn as

needed.

Exercise 1 Find all solutions to

1. 35x+ 21y = 28

2. 35x− 21y = 28

22.3 More Examples

1. Prove the following statement. If k and ` are coprime positive integers, then thelinear Diophantine equation kx− `y = c has infinitely many solutions in the positiveintegers.

Proof: Since k and ` are coprime, gcd(k, `) = 1. By the EEA there exist integers x0,y0 such that

kx0 + `y0 = 1

Equivalentlykx0 − `(−y0) = 1

Multiplying by c givesk(cx0)− `(−cy0) = c

Page 163: MATH 135 Course Note

Section 22.4 Practice 163

so x = cx0 and y = −cy0 is one particular solution to kx − `y = c. By LDET 2, thecomplete solution to kx− `y = c is

x = cx0 − `ny = −cy0 − kn

where n ∈ Z.

Since k and ` are positive, if we choose n < 0 then −nk and −n` are positive. Sincewe want

x = cx0 − `n > 0 and y = −cy0 − kn > 0

we must haven <

cx0`

and n < −cy0k

Thus

x = cx0 − `ny = −cy0 − kn

for n < min{cx0` ,−

cy0k

}gives infinitely many positive integer solutions to

kx− `y = c.

22.4 Practice

1. Solve the following problems.

(a) Find the complete solution to 7x+ 11y = 3.

(b) Find the complete solution to 35x− 42y = 14.

(c) Find the complete solution to 28x+ 60y = 10.

(d) For what value of c does 8x+ 5y = c have exactly one solution where both x andy are strictly positive?

2. Let a, b, c ∈ Z. Consider the following statement:

For every integer x0, there exists an integer y0 such that ax0 + by0 = c.

(a) Determine conditions on a, b, c such that the statement is true if and only if theseconditions hold. State and prove this if and only if statement.

(b) Using part (a), write down one set of values for a, b, c for which the statement isfalse.

(c) Write down the negation of the statement without using any form of the word“not” (the symbol 6= is acceptable).

(d) Prove that the negated statement of part (c) is true for the set of values you havechosen in part (b).

3. Let a, b, c, n ∈ Z. Consider the following two linear Diophantine equations:

ax+ by = c (22.2)

ax+ by = nc (22.3)

Let S and T be the set of all integer solutions to equations (22.2) and (22.3) respec-tively. The following set S∗ might be the same as set T :

S∗ = {(nx0, ny0) | (x0, y0) ∈ S}.

Page 164: MATH 135 Course Note

164Chapter 22 Linear Diophantine Equations:

All Solutions

(a) Prove that S∗ ⊆ T for all values of a, b, c, n ∈ Z.

(b) Determine whether or not S∗ = T for all values of a, b, c, n ∈ Z. Justify youranswer with a proof or a counterexample.

4. Prove each of the following propositions.

(a) Suppose a and b are fixed integers. Then

{ax+ by | x, y ∈ Z} = {n · gcd(a, b) | n ∈ Z}.

Page 165: MATH 135 Course Note

Chapter 23

Congruence

23.1 Objectives

The content objectives are:

1. Define a is congruent to b modulo m.

2. Read a proof of Congruence is an Equivalence Relation.

3. Discover the proof of Properties of Congruence.

4. Read the proof of Congruences and Division.

5. Do examples.

23.2 Congruences

23.2.1 Definition of Congruences

One of the difficulties in working out properties of divisibility is that we don’t have an“arithmetic” of divisibility. Wouldn’t it be nice if we could solve problems about divisibilityin much the same way that we usually do arithmetic: add, subtract, multiply and divide?

Carl Friedrich Gauss (1777 – 1855) was the greatest mathematician of the last two cen-turies. In a landmark work, Disquisitiones Arithmeticae, published when Gauss was 23, heintroduced congruences and provided a mechanism to treat divisibility with arithmetic.

Definition 23.2.1

Congruent

Let m be a fixed positive integer. If a, b ∈ Z we say that a is congruent to b modulo m,and write

a ≡ b (mod m)

if m | (a− b). If m - (a− b), we write a 6≡ b (mod m).

Example 1 Verify each of the following

165

Page 166: MATH 135 Course Note

166 Chapter 23 Congruence

1. 20 ≡ 2 (mod 6)

2. 2 ≡ 20 (mod 6)

3. 20 ≡ 8 (mod 6)

4. −20 ≡ 4 (mod 6)

5. 24 ≡ 0 (mod 6)

6. 5 6≡ 3 (mod 7)

REMARK

One already useful trait of this definition is the number of equivalent ways we have to workwith it.

a ≡ b (mod m)

⇐⇒ m | (a− b)⇐⇒ ∃k ∈ Z 3 a− b = km

⇐⇒ ∃k ∈ Z 3 a = km+ b

23.3 Elementary Properties

Another extraordinarily useful trait of this definition is that it behaves a lot like equality.Equality is an equivalence relation. That is, it has the following three properties:

1. reflexivity, a = a.

2. symmetry, If a = b then b = a.

3. transitivity, If a = b and b = c, then a = c.

Most relationships that you can think of do not have these three properties. The relationgreater than fails reflexivity. The relation divides fails symmetry. The non-mathematicalrelation is a parent of fails transitivity.

Proposition 1 (Congruence Is An Equivalence Relation (CER))

Let a, b, c ∈ Z. Then

1. a ≡ a (mod m).

2. If a ≡ b (mod m), then b ≡ a (mod m).

3. If a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m)

Page 167: MATH 135 Course Note

Section 23.3 Elementary Properties 167

These may seem obvious but as the earlier examples showed, many relations do not havethese properties. So, a proof is needed. We will give a proof for all of them, and then ananalysis for part 3.

Proof: We show each part in turn.

1. Because a− a = 0 and m | 0, the definition of congruence gives a ≡ a (mod m).

2. Since a ≡ b (mod m), m | (a − b) which in turn implies that there exists k ∈ Z sothat km = a− b. But if km = a− b, then (−k)m = b− a and so m | (b− a). By thedefinition of congruence, b ≡ a (mod m).

3. Since a ≡ b (mod m), m | (a − b). Since b ≡ c (mod m), m | (b − c). Now, by theDivisibility of Integer Combinations, m | ((1)(a − b) + (1)(b − c)) so m | (a − c). Bythe definition of congruence, a ≡ c (mod m).

Analysis of Proof We will prove part 3 of the proposition Congruence Is An EquivalenceRelation.

Hypothesis: a, b, c ∈ Z, a ≡ b (mod m) and b ≡ c (mod m).

Conclusion: a ≡ c (mod m).

Sentence 1 Since a ≡ b (mod m), m | (a− b).The author is working forward from the hypothesis using the definition of congruence.

Sentence 2 Since b ≡ c (mod m), m | (b− c).The author is working forward from the hypothesis using the definition of congruence.

Sentence 3 Now, by the Divisibility of Integer Combinations, m | ((1)(a− b) + (1)(b− c))so m | (a− c).Here it is useful to keep in mind where the author is going. The question “How do Ishow that one number is congruent to another number?” has the answer, in this case,of showing that m | (a− c) so the author needs to find a way of generating a− c. Anda− c follows nicely from an application of the Divisibility of Integer Combinations.

Sentence 4 By the definition of congruence, a ≡ c (mod m).

The author is working forward from m | (a− c) using the definition of congruence.

Proposition 2 (Properties of Congruence (PC))

Let a, a′, b, b′ ∈ Z. If a ≡ a′ (mod m) and b ≡ b′ (mod m), then

1. a+ b ≡ a′ + b′ (mod m)

2. a− b ≡ a′ − b′ (mod m)

3. ab ≡ a′b′ (mod m)

Page 168: MATH 135 Course Note

168 Chapter 23 Congruence

This proposition allows us to perform substitutions of congruent values. We will discover aproof of the third part and leave the first two parts as exercises.

As usual we begin by identifying the hypothesis and the conclusion.

Hypothesis: a ≡ a′ (mod m) and b ≡ b′ (mod m)

Conclusion: ab ≡ a′b′ (mod m)

Let’s consider the question “How do we show that two numbers are congruent to oneanother?” The obvious abstract answer is “Use the definition of congruent.” We may wantto keep in mind, however, that there are several equivalent forms.

a ≡ b (mod m)

⇐⇒ m | (a− b)⇐⇒ ∃k ∈ Z 3 a− b = km

⇐⇒ ∃k ∈ Z 3 a = km+ b

It is not at all clear which is best or whether, in fact, several could work. Since theconclusion of part three involves the arithmetic operation of multiplication, and we don’thave multiplication properties for equivalence or divisibility, it makes sense to considereither the third or fourth of the equivalent forms. There isn’t much to separate them. I’llchoose the last form and see how it works. So, the answer to “How do we show that twonumbers are congruent to one another?” in the notation of this proof is “We must find aninteger k so that ab = km+ a′b′. Let’s record that.

Proof in Progress

1. To be completed.

2. Since there exists k so that ab = km+ a′b′, ab ≡ a′b′ (mod m).

The problem is how to find k. There is no obvious way backwards here so let’s start workingforward. The two hypotheses a ≡ a′ (mod m) and b ≡ b′ (mod m) can be restated in anyof their equivalent forms. Since we have already decided that we would work backwardswith the fourth form, it makes sense to use the same form working forwards. That givestwo statements.

Proof in Progress

1. Since a ≡ a′ (mod m), there exists an integer j such that a = mj + a′ (1).

2. Since b ≡ b′ (mod m), there exists an integer h such that b = mh+ b′ (2).

3. To be completed.

4. Since there exists k so that ab = km+ a′b′, ab ≡ a′b′ (mod m).

Page 169: MATH 135 Course Note

Section 23.3 Elementary Properties 169

But now there seems to be a rather direct way to produce an ab and an a′b′ which we wantfor the conclusion. Just multiply equations (1) and (2) together. Doing that produces

ab = m2jh+mjb′ + a′mh+ a′b′ = (mjh+ jb′ + a′h)m+ a′b′

If we let k = mjh + jb′ + a′h then k is an integer and satisfies the property we needed inthe last line of the proof, that is ab = km+ a′b′. Let’s record this.

Proof in Progress

1. Since a ≡ a′ (mod m), there exists an integer j such that a = mj + a′ (1).

2. Since b ≡ b′ (mod m), there exists an integer h such that b = mh+ b′ (2).

3. Multiplying (1) by (2) gives ab = m2jh+mjb′+a′mh+a′b′ = (mjh+jb′+a′h)m+a′b′.

4. Since there exists k so that ab = km+ a′b′, ab ≡ a′b′ (mod m).

Lastly, we write a proof. Note that the reader of the proof is expected to be familiar withthe equivalent forms.

Proof: Since a ≡ a′ (mod m), there exists an integer j such that a = mj + a′ (1). Sinceb ≡ b′ (mod m), there exists an integer h such that b = mh+ b′ (2). Multiplying (1) by (2)gives

ab = m2jh+mjb′ + a′mh+ a′b′ = (mjh+ jb′ + a′h)m+ a′b′.

Since mjh+ jb′ + a′h is an integer, ab ≡ a′b′ (mod m).

Exercise 1 Prove the remainder of the Properties of Congruence proposition.

There are four arithmetic operations with integers, but analogues to only three have beengiven. It turns out that division is problematic. A statement of the form

ab ≡ ab′ (mod m)⇒ b ≡ b′ (mod m)

seems natural enough, simply divide by a. This works with the integer equation ab = ab′.But consider the case where m = 12, a = 6, b = 3 and b′ = 5. It is indeed true that

18 ≡ 30 (mod 12)

and so6× 3 ≡ 6× 5 (mod 12)

But “dividing” by 6 gives the clearly false statement

3 ≡ 5 (mod 12).

Division works only under the specific conditions of the next proposition.

Proposition 3 (Congruences and Division (CD))

If ac ≡ bc (mod m) and gcd(c,m) = 1, then a ≡ b (mod m).

Before we read the proof, let’s look at an example.

Page 170: MATH 135 Course Note

170 Chapter 23 Congruence

Example 2 Examples of division in congruence relations.

1. 8× 7 ≡ 17× 7 (mod 3)⇒ 8 ≡ 17 (mod 3)

2. For 6× 3 ≡ 6× 5 (mod 12), CD cannot be invoked. Why?

Because gcd(c,m) = gcd(6, 12) = 6 6= 1, the hypotheses of CD are not satisfied andso the conclusion of CD cannot be invoked.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Since ac ≡ bc (mod m), m | (ac− bc). That is, m | c(a− b).

2. By the proposition Coprimeness and Divisibility, m | (a− b).

3. Hence, by the definition of congruence a ≡ b (mod m).

Exercise 2 Analyze the proof of the proposition on Congruences and Division.

23.4 Practice

1. This question deals with divisibility by nine.

(a) Let n = 387140 and let d be the sum of the digits of n.

i. Determine the value of d?

ii. Does 9 | d?

iii. Does 9 | n?

(b) Let n = 6532488 and let d be the sum of the digits of n.

i. Determine the value of d?

ii. Does 9 | d?

iii. Does 9 | n?

(c) Prove the following statement. Let n be a positive integer and let d be the sumof the digits of n. Then n is divisible by 9 if and only if d is divisible by 9.

Hint: Let the decimal representation of n be arar−1ar−2 . . . a1a0. Then

n = 10rar + 10r−1ar−1 + 10r−2ar−2 + . . .+ 10a1 + a0

Page 171: MATH 135 Course Note

Chapter 24

Congruence and Remainders

24.1 Objectives

The content objectives are:

1. Read the proof of Congruent Iff Same Remainder.

2. Do examples.

24.2 Congruence and Remainders

We now give one more statement that is equivalent to a ≡ b (mod m).

Proposition 1 (Congruent Iff Same Remainder (CISR))

a ≡ b (mod m) if and only if a and b have the same remainder when divided by m.

Because this proposition is an “if and only if” proposition, there are two parts to the proof:a statement and its converse. We can restate the proposition to make the two parts moreexplicit.

Proposition 2 (Congruent Iff Same Remainder (CISR))

1. If a ≡ b (mod m), then a and b have the same remainder when divided by m.

2. If a and b have the same remainder when divided by m, then a ≡ b (mod m).

In practice, the two statements are not usually written out separately. The author assumesthat you do that whenever you read “if and only if”. Many “if and only if” proofs beginwith some preliminary material that will help both parts of the proof. For example, theyoften introduce notation that will be used in both parts.

Let’s look at a proof of the Congruent Iff Same Remainder proposition. Before we do ananalysis, make sure that you can identify

171

Page 172: MATH 135 Course Note

172 Chapter 24 Congruence and Remainders

1. preliminary material (if any exists)

2. the proof of a statement

3. the proof of the converse of the statement

Proof: The Division Algorithm applied to a and m gives

a = q1m+ r1,where 0 ≤ r1 < m

The Division Algorithm applied to b and m gives

b = q2m+ r2,where 0 ≤ r2 < m

Subtracting the second equation from the first gives

a− b = (q1 − q2)m+ (r1 − r2),where −m < r1 − r2 < m

If a ≡ b (mod m), then m | (a− b) and there exists an integer h so that hm = a− b. Hence

a− b = (q1 − q2)m+ (r1 − r2)⇒ hm = (q1 − q2)m+ (r1 − r2)⇒ r1 − r2 = m(h− q1 + q2)

which implies m | (r1 − r2). But, −m < r1 − r2 < m so r1 − r2 = 0.

Conversely, if a and b have the same remainder when divided by m, then r1 = r2 anda− b = (q1 − q2)m so a ≡ b (mod m).

The preliminary material is quoted below.

The Division Algorithm applied to a and m gives

a = q1m+ r1,where 0 ≤ r1 < m

The Division Algorithm applied to b and m gives

b = q2m+ r2,where 0 ≤ r2 < m

Subtracting the second equation from the first gives

a− b = (q1 − q2)m+ (r1 − r2),where −m < r1 − r2 < m

The proof of Statement 1 is

If a ≡ b (mod m), then m | (a − b) and there exists an integer h so thathm = a− b. Hence

a−b = (q1−q2)m+(r1−r2)⇒ hm = (q1−q2)m+(r1−r2)⇒ r1−r2 = m(h−q1+q2)

which implies m | (r1 − r2). But, −m < r1 − r2 < m so r1 − r2 = 0.

The proof of the converse of Statement 1, Statement 2, is

Page 173: MATH 135 Course Note

Section 24.2 Congruence and Remainders 173

Conversely, if a and b have the same remainder when divided by m, then r1 = r2and a− b = (q1 − q2)m so a ≡ b (mod m).

We will do an analysis of the proof of Statement 1. An analysis of the proof of Statement2 is left as an exercise.

Analysis of Proof In many “if and only if” statements one direction is much easier thanthe other. In this particular case, we are starting with the harder of the two directions.

Hypothesis: a ≡ b (mod m).

Conclusion: a and b have the same remainder when divided by m.

Sentence 1 If a ≡ b (mod m), then m | (a − b) and there exists an integer h so thathm = a− b.Here the author is working forwards using two definitions. The definition of congru-ence allows the author to assert that “If a ≡ b (mod m), then m | (a − b)”. Thedefinition of divisibility allows the author to assert that “m | (a − b) [implies that]there exists an integer h so that hm = a− b.”

Sentence 2 Hence

a−b = (q1−q2)m+(r1−r2)⇒ hm = (q1−q2)m+(r1−r2)⇒ r1−r2 = m(h−q1+q2)

which implies m | (r1 − r2).This is mostly arithmetic. The author begins with a− b = (q1− q2)m+ (r1− r2) fromthe preliminary paragraph, substitutes hm for a − b, isolates r1 − r2 and factors outan m from the remaining terms. Since h − q1 + q2 is an integer, the author deducesthat m | (r1 − r2).

Sentence 3 But, −m < r1 − r2 < m so r1 − r2 = 0.

This part is not so obvious. The author is working with two pieces of information.The prefatory material provides −m < r1 − r2 < m. Let’s take a minute to thinkabout why this statement is true. Sentence 2 provides m | (r1 − r2). Now, what arethe possible values of r1 − r2? Certainly r1 − r2 can be zero but are there any otherpossible choices? If there were another choice it would be of the form mx with x 6= 0.But that would make r1 − r2 = xm ≥ m or r1 − r2 = xm ≤ −m both of which areimpossible because −m < r1 − r2 < m. Hence, r1 − r2 = 0.

The conclusion does not say r1−r2 = 0. It says that a and b have the same remainderwhen divided by m. Since r1 and r2 are those remainders, and r1− r2 = 0⇒ r1 = r2,the author leaves it to the reader to deduce the conclusion.

Exercise 1 Perform an analysis of the proof of Statement 2.

Page 174: MATH 135 Course Note

174 Chapter 24 Congruence and Remainders

REMARK

The proposition Congruent Iff Same Remainder gives us another part to our chain of equiv-alent statements.

a ≡ b (mod m)

⇐⇒ m | (a− b)⇐⇒ ∃k ∈ Z 3 a− b = km

⇐⇒ ∃k ∈ Z 3 a = km+ b

⇐⇒ a and b have the same remainder when divided by m

The propositions covered in this lecture are surprisingly powerful. Consider the followingexample.

Example 1 What is the remainder when 347 is divided by 7?

Solution: You could attempt to compute 347 with your calculator but it might explode.Here is a simpler way. By the Division Algorithm,

347 = 7q + r where 0 ≤ r < 7

If we reduce this expression modulo 7 we get

347 ≡ 7q + r (mod 7)

≡ r (mod 7)

Thus, the remainder when 347 is divided by 7 is just 347 (mod 7). Now observe that32 ≡ 2 (mod 7) and 33 ≡ 27 ≡ 6 ≡ −1 (mod 7). But then

347 ≡ 34532 (mod 7) arithmetic

≡ (33)1532 (mod 7) arithmetic

≡ (−1)15(2) (mod 7) Properties of Congruence (3), twice

≡ (−1)(2) (mod 7) arithmetic

≡ −2 (mod 7) arithmetic

≡ 5 (mod 7) since 0 ≤ r < 7

Hence, the remainder when 347 is divided by 7 is 5.

Example 2 Is 347 ≡ 521 (mod 7)?

Solution: By Congruences Iff the Same Remainder 347 ≡ 521 (mod 7) if and only if 347

and 521 have the same remainder when divided by 7. The previous example showed that 4is the remainder when 347 is divided by 7. We only need to compute the remainder when521 is divided by 7.

Page 175: MATH 135 Course Note

Section 24.4 More Examples 175

By the Division Algorithm,

521 = 7q + r where 0 ≤ r < 7

If we reduce this expression modulo 7 we get

521 ≡ 7q + r (mod 7)

≡ r (mod 7)

Since 5 ≡ −2 (mod 7) and −23 ≡ −8 ≡ −1 (mod 7), we know 53 ≡ −1 (mod 7) hence

521 ≡ (53)7 ≡ (−1)7 ≡ −1 ≡ 6 (mod 7)

Thus,347 6≡ 521 (mod 7)

24.3 More Examples

1. What is the remainder when 22713314 is divided by 7? Provide justification for yourwork.

Solution: First, observe that 23 ≡ 1 (mod 7) and 33 ≡ −1 (mod 7) and so by theproposition on the Properties of Congruence,

22713314 ≡ (23)9021(33)10432 ≡ (1)9021(−1)10432 ≡ 2 · 9 ≡ 18 ≡ 4 (mod 7)

Thus, by the proposition Congruent Iff Same Remainder, 22713314 has remainder 4when divided by 7.

24.4 Practice

1. This question deals with divisibility by nine.

(a) Let n = 387144 and d be the sum of the digits of n.

i. Determine the value of d.

ii. Does 9 | d?

iii. Does 9 | n?

(b) Let n = 6532422 and d be the sum of the digits of n.

i. Determine the value of d.

ii. Does 9 | d?

iii. Does 9 | n?

(c) Prove the following statement.

Let n be a positive integer and let d be the sum of the digits of n. Then n isdivisible by 9 if and only if d is divisible by 9.

Hint: Let the decimal representation of n be arar−1ar−2 . . . a1a0. Then

n = 10rar + 10r−1ar−1 + 10r−2ar−2 + . . .+ 10a1 + a0

Page 176: MATH 135 Course Note

Chapter 25

Modular Arithmetic

25.1 Objectives

The content objectives are:

1. Define the congruence class modulo m.

2. Construct Zm and perform modular arithmetic. Highlight the role of additive andmultiplicative identities, and additive and multiplicative inverses.

25.2 Modular Arithmetic

In this section we will see the creation of a number system which will likely be new to you.

Definition 25.2.1

Congruence Class

The congruence class modulo m of the integer a is the set of integers

[a] = {x ∈ Z | x ≡ a (mod m)}

Example 1 For example, when m = 4

[0] = {x ∈ Z | x ≡ 0 (mod m)} = {. . . ,−8,−4, 0, 4, 8, . . .} = {4k | k ∈ Z}[1] = {x ∈ Z | x ≡ 1 (mod m)} = {. . . ,−7,−3, 1, 5, 9, . . .} = {4k + 1 | k ∈ Z}[2] = {x ∈ Z | x ≡ 2 (mod m)} = {. . . ,−6,−2, 2, 6, 10, . . .} = {4k + 2 | k ∈ Z}[3] = {x ∈ Z | x ≡ 3 (mod m)} = {. . . ,−5,−1, 3, 7, 11, . . .} = {4k + 3 | k ∈ Z}

176

Page 177: MATH 135 Course Note

Section 25.2 Modular Arithmetic 177

REMARK

Note that congruence classes have more than one representation. In the example above[0] = [4] = [8] and, in fact [0] has infinitely many representations. If this seems strange toyou, remember that fractions are another example of where one number has infinitely manyrepresentations. For example 1/2 = 2/4 = 3/6 = · · · .

Definition 25.2.2

Zm

We define Zm to be the set of m congruence classes

Zm = {[0], [1], [2], . . . , [m− 1]}

and we define two operations on Zm, addition and multiplication, as follows:

[a] + [b] = [a+ b]

[a] · [b] = [a · b]

Though the definition of these operations may seem obvious there is a fair amount goingon here.

1. Sets are being treated as individual “numbers”. Modular addition and multiplicationare being performed on congruence classes which are sets.

2. The addition and multiplication symbols on the left of the equals signs are in Zm andthose on the right are operations in the integers.

3. We are assuming that the operations are well-defined. That is, we are assumingthat these operations make sense even when there are multiple representatives of acongruence class.

REMARK

Since[a] = {x ∈ Z | x ≡ a (mod m)}

we can extend our list of equivalent statements to

[a] = [b] in Zm⇐⇒ a ≡ b (mod m)

⇐⇒ m | (a− b)⇐⇒ ∃k ∈ Z 3 a− b = km

⇐⇒ ∃k ∈ Z 3 a = km+ b

⇐⇒ a and b have the same remainder when divided by m

Just as there were addition and multiplication tables in grade school for the integers, wehave addition and multiplication tables in Zm.

Page 178: MATH 135 Course Note

178 Chapter 25 Modular Arithmetic

Example 2 Addition and multiplication tables in Z4

+ [0] [1] [2] [3]

[0] [0] [1] [2] [3]

[1] [1] [2] [3] [0]

[2] [2] [3] [0] [1]

[3] [3] [0] [1] [2]

· [0] [1] [2] [3]

[0] [0] [0] [0] [0]

[1] [0] [1] [2] [3]

[2] [0] [2] [0] [2]

[3] [0] [3] [2] [1]

Note that all of the entries have representatives between 0 and 3. Even though there aremany representatives for each congruence class, we usually choose a representative between0 and m− 1.

Exercise 1 Write out the addition and multiplication tables in Z5

25.2.1 [0] ∈ Zm

By looking at the tables for Z4 and Z5 it seems that [0] ∈ Zm behaves just like 0 ∈ Z. In Z

∀a ∈ Z, a+ 0 = a

∀a ∈ Z, a · 0 = 0

and in Zm

∀[a] ∈ Zm, [a] + [0] = [a]

∀[a] ∈ Zm, [a] · [0] = [0]

This actually follows from our definition of addition and multiplication in Zm.

∀[a] ∈ Zm, [a] + [0] = [a+ 0] = [a]

∀[a] ∈ Zm, [a] · [0] = [a · 0] = [0]

25.2.2 [1] ∈ Zm

In a similar fashion, by looking at the multiplication tables for Z4 and Z5 it seems that[1] ∈ Zm behaves just like 1 ∈ Z. In Z

∀a ∈ Z, a · 1 = a

and in Zm

∀[a] ∈ Zm, [a] · [1] = [a]

This follows from our definition of multiplication in Zm.

∀[a] ∈ Zm, [a] · [1] = [a · 1] = [a]

Page 179: MATH 135 Course Note

Section 25.2 Modular Arithmetic 179

25.2.3 Identities and Inverses in Zm

Many of us think of subtraction and division as independent from the other arithmeticoperations of addition and multiplication. In fact, subtraction is just addition of the inverse.Now, what’s an inverse? To answer that question we must first define an identity.

Definition 25.2.3

Identity

Given a set and an operation, an identity is, informally, “something that does nothing”.More formally, given a set S and an operation designated by ◦, an identity is an elemente ∈ S so that

∀a ∈ S, a ◦ e = a

The element e has no effect. Having something that does nothing is extremely useful –though parents might not say that of teenagers.

Example 3 Here are examples of sets, operations and identities.

• The set of integers with the operation of addition has the identity 0.

• The set of rational numbers excluding 0 with the operation of multiplication has theidentity 1.

• The set of real valued functions with the operation of function composition has theidentity f(x) = x.

• The set of integers modulo m with the operation of modular addition has the identity[0].

Definition 25.2.4

Inverse

The element b ∈ S is an inverse of a ∈ S if a ◦ b = b ◦ a = e.

Example 4 Here are examples of inverses.

• Under the operation of addition, the integer 3 has inverse −3 since 3 + (−3) = (−3) +3 = 0.

• Under the operation of multiplication, the rational number 34 has inverse 4

3 since34 ·

43 = 4

3 ·34 = 1.

• Under the operation of function composition lnx has the inverse ex since ln(ex) =elnx = x

• Under the operation of modular addition, [3] has the inverse [−3] in Z7 since [3] +[−3] = [−3] + [3] = [0].

When the operation is addition, we usually denote the inverse by −a. Otherwise, wetypically denote the inverse of a by a−1. This does cause confusion. Many students interpret

Page 180: MATH 135 Course Note

180 Chapter 25 Modular Arithmetic

a−1 as the reciprocal. This works for real or rational multiplication but fails in other contextslike function composition. We will use −a to mean the inverse of a under addition and a−1

to mean the inverse under all other operations.

25.2.4 Subtraction in Zm

Let’s return to Zm. The identity under addition in Zm is [0] since

∀[a] ∈ Zm, [a] + [0] = [a]

Given any [a] ∈ Zm, [−a] exists and

[a] + [−a] = [a− a] = [0]

That is, every element [a] ∈ Zm has an additive inverse, [−a]. This allows us to definesubtraction in Zm.

Definition 25.2.5

Subtraction

We will define subtraction as addition of the inverse. Thus

[a]− [b] = [a] + [−b] = [a− b]

25.2.5 Division in Zm

Division is related to multiplication in the same way that subtraction is related to addition.So first, we must identify the multiplicative identity in Zm. Since

∀[a] ∈ Zm, [a][1] = [a]

we know that [1] is the identity under multiplication in Zm.

Inverses are more problematic with multiplication. Looking at the multiplication table forZ5 we see that [2]−1 = [3] since [2][3] = [6] = [1]. But what is the inverse of [2] in Z4? Itdoesn’t exist! Looking at the row containing [2] in the multiplication table for Z4 we cannotfind [1]. Unlike addition in Zm where every element has an additive inverse, it is not alwaysthe case that a non-zero element in Zm has a multiplicative inverse.

We define division analogously to subtraction.

Definition 25.2.6

Division

Division by a ∈ Zm is defined as multiplication by the multiplicative inverse of a ∈ Zm,assuming that the multiplicative inverse exists.

25.3 More Examples

1.

Page 181: MATH 135 Course Note

Chapter 26

Fermat’s Little Theorem

26.1 Objectives

The content objectives are:

1. State Fermat’s Little Theorem.

2. Read a proof of Fermat’s Little Theorem.

3. Read a proof to a corollary of Fermat’s Little Theorem.

4. Discover a proof to the Existence of Inverses in Zp.

26.2 Fermat’s Little Theorem

Pierre de Fermat proved a useful result called Fermat’s Little Theorem. This should notbe confused with one of the great conjectures, now theorem, of the last 400 years, Fermat’sLast Theorem.

Theorem 1 (Fermat’s Little Theorem (F`T))

If p is a prime number that does not divide the integer a, then

ap−1 ≡ 1 (mod p)

Let’s begin by understanding what the theorem is saying by using a numeric example.

Example 1 Suppose p = 29 and a = 18. Computing 1828 and reducing it modulo 29 is difficult withoutthe aid of a computer. However, by Fermat’s Little Theorem we know that

1828 ≡ 1 (mod 29)

Take a minute to read the rather complicated proof.

181

Page 182: MATH 135 Course Note

182 Chapter 26 Fermat’s Little Theorem

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. If p - a, we first show that all of the integers

a, 2a, 3a, . . . , (p− 1)a

are all distinct modulo p.

2. Suppose that ra ≡ sa mod p where 1 ≤ r < s ≤ p− 1.

3. Since gcd(a, p) = 1, Congruences and Division tells us that r ≡ s mod p, but this isnot possible when 1 ≤ r < s ≤ p− 1.

4. Because a, 2a, 3a, . . . , (p − 1)a are all distinct mod p, it must be the case that theseintegers are equivalent to the integers 1, 2, 3, . . . , p− 1 in some order.

5. Multiplying these integers together gives

a · 2a · 3a · · · (p− 1)a ≡ 1 · 2 · 3 · · · (p− 1) (mod p)

(p− 1)!ap−1 ≡ (p− 1)! (mod p)

6. Since gcd(p, (p− 1)!) = 1, Congruences and Division (again) tells us that

ap−1 ≡ 1 (mod p)

Let’s analyze the proof. As usual, we begin by identifying the hypothesis and the conclusion.

Hypothesis: p is a prime number. p - a.

Conclusion: ap−1 ≡ 1 (mod p)

Analysis of Proof This is the most complicated proof in the course so far, so we will bevery thorough. In fact, this proof contains a proof within a proof.

Sentence 1 If p - a, we first show that the integers a, 2a, 3a, . . . , (p − 1)a are all distinctmodulo p.

The reason for this sentence is not at all obvious. The sentence is needed, but notuntil Sentence 4. The word distinct should alert us to a need to prove uniqueness.

Sentence 2 Suppose that ra ≡ sa mod p where 1 ≤ r < s ≤ p− 1.

The author treats Sentence 1 as a mini-proposition and begins a proof of the distinct-ness of the integers a, 2a, 3a, . . . , (p− 1)a. How? The author assumes that two of theintegers, ra and sa with r 6= s, are the same modulo p and looks for a contradiction.The expression 1 ≤ r < s ≤ p− 1 is needed to make clear that ra and sa come fromthe integers under consideration, that is, the set {a, 2a, 3a, . . . , (p − 1)a} and thatr 6= s. Since r and s are not the same, one is less than the other. Without any loss ofgenerality, we can assume r < s.

Page 183: MATH 135 Course Note

Section 26.2 Fermat’s Little Theorem 183

Sentence 3 Since gcd(a, p) = 1, Congruences and Division tells us that r ≡ s mod p, butthis is not possible when 1 ≤ r < s ≤ p− 1.

The statement gcd(a, p) = 1 is not one of the hypotheses. Where did it come from?Since p is a prime and p - a, p and a have no non-trivial factors in common. Hence,it must be the case that gcd(a, p) = 1. It is always useful to identify where thehypotheses of a proposition are used in a proof. The hypotheses of Fermat’s LittleTheorem (p is a prime and p - a) are used right here.

To invoke Congruences and Division, we must show that its hypotheses are satisfied.One of those hypotheses is ra ≡ sa mod p which we get from Sentence 2. The otheris gcd(a, p) = 1 which we have just deduced. Invoking CD gives r ≡ s mod p. But rand s are distinct, positive integers less than p, so this is not possible. This concludesthe proof of distinctness of the integers a, 2a, 3a, . . . , (p− 1)a.

Sentence 4 Because a, 2a, 3a, . . . , (p− 1)a are all distinct mod p, it must be the case thatthese integers are equivalent to the integers 1, 2, 3, . . . , p− 1 in some order.

The set {a, 2a, 3a, . . . , (p − 1)a} is a set of p − 1 integers all distinct mod p. The set{1, 2, 3, . . . , p−1} is a set of p−1 integers all distinct mod p. Thus, the two sets mustbe the same modulo p.

Sentence 5 Multiplying these integers together gives

a · 2a · 3a · · · (p− 1)a ≡ 1 · 2 · 3 · · · (p− 1) (mod p)

(p− 1)!ap−1 ≡ (p− 1)! (mod p)

This is arithmetic. It is, however, another sentence whose purpose is not yet clear.

Sentence 6 Since gcd(p, (p − 1)!) = 1, Congruences and Division (again) tells us thatap−1 ≡ 1 (mod p).

The second of the congruences above is almost what we need. If we could divide outthe (p− 1)! we would be done. But Congruences and Division allows us to do exactlythat.

Now we examine two corollaries.

Corollary 2 For any integer a and any prime p

ap ≡ a (mod p)

Proof: Let a ∈ Z and let p be a prime. If p - a, then ap−1 ≡ 1 (mod p). Multiplying bothsides of the equivalence by a gives ap ≡ a (mod p). If p | a, then a ≡ 0 (mod p) and ap ≡ 0(mod p). Thus ap ≡ a (mod p).

Let’s make sure we understand the proof.

Page 184: MATH 135 Course Note

184 Chapter 26 Fermat’s Little Theorem

Analysis of Proof There are two important items to note: the use of nested quantifiersand the use of cases.

Sentence 1 Let a ∈ Z and let p be a prime.

The corollary begins with two universal quantifiers, so we use the Select Method twice,once for integers and once for primes.

Sentence 2 If p - a, then ap−1 ≡ 1 (mod p).

The author breaks up the proof into two parts depending on whether or not p dividesa. The author will need two distinct cases because the approach differs based on thecase. In the case where p does not divide a, the author uses Fermat’s Little Theorem.

Sentence 3 Multiplying both sides of the equivalence by a gives ap ≡ a (mod p).

This is just modular arithmetic.

Sentence 4 If p | a, then a ≡ 0 (mod p) and ap ≡ 0 (mod p). Thus ap ≡ a (mod p).

This is the second case where p does divide a. Both ap and a are congruent to zero modp so they are congruent to each other by the transitivity of the congruence relation.

Corollary 3 (Existence of Inverses in Zp (INV Zp))

Let p be a prime number. If [a] is any non-zero element in Zp, then there exists an element[b] ∈ Zp so that [a] · [b] = [1]

This corollary is equivalent to stating that every non-zero element of Zp has an inverse.Let’s discover a proof. As usual, we begin by identifying the hypothesis and the conclusion.

Hypothesis: p is a prime number. [a] is any non-zero element in Zp.

Conclusion: There exists an element [b] ∈ Zp so that [a] · [b] = [1].

Three points are salient. First, the corollary only states that an inverse exists. It doesn’t tellus what the inverse is or how to compute the inverse. Second, there are three quantifiers.

1. Let p be a prime number is equivalent to For all primes p. Since this is an instanceof a universal quantifier we would expect to use the Select Method.

2. [a] is any non-zero element in Zp is another instance of a universal quantifier so wewould expect to use the Select Method again.

3. There is an existential quantifier in the conclusion so we would expect to use theConstruct Method.

Together these give us the following.

Page 185: MATH 135 Course Note

Section 26.2 Fermat’s Little Theorem 185

Proof in Progress

1. Let p be a prime number.

2. Let [a] be a non-zero element in Zp.

3. Construct [b] as follows.

4. To be completed.

The third salient point is that this statement is a corollary of Fermat’s Little Theorem. NowFermat’s Little Theorem uses congruences, not congruence classes. But we could restateFermat’s Little Theorem with congruence classes as

Theorem 4 (Fermat’s Little Theorem (F`T))

If p is a prime number that does not divide the integer a, then

[ap−1] = [1] in Zp

Now an analogy to real numbers provides the final step. In the reals ap−1 = a · ap−2 so whynot let [b] = [ap−2]? This would give

Proof in Progress

1. Let p be a prime number.

2. Let [a] be a non-zero element in Zp.

3. Consider [b] = [ap−2].

4. To be completed.

Now we can invoke Fermat’s Little Theorem but first we need to make sure the hypothesesare satisfied.

Proof in Progress

1. Let p be a prime number.

2. Let [a] be a non-zero element in Zp.

3. Consider [b] = [ap−2].

4. Since [a] 6= [0] in Zp, p - a and so by F`T

[a][b] = [a][ap−2] = [ap−1] = [1]

A proof might look as follows.

Proof: Let p be a prime number. Let [a] be a non-zero element in Zp. Consider [b] = [ap−2].Since [a] 6= [0] in Zp, p - a and so by Fermat’s Little Theorem

[a][b] = [a][ap−2] = [ap−1] = [1]

Page 186: MATH 135 Course Note

186 Chapter 26 Fermat’s Little Theorem

REMARK

In summary, if p is a prime number and [a] is any non-zero element in Zp, then

[a]−1 = [ap−2]

Exercise 1 What is [3]−1 in Z7?

26.3 More Examples

1. For each of the given elements, determine its inverse, if an inverse exists. Express theinverse as [b] where 1 ≤ b < m.

(a) [5] ∈ Z10

(b) [5] ∈ Z47

Solution:

(a) Finding [5]−1 ∈ Z10 is equivalent to solving [5][b] = [1] in Z10. Since gcd(5, 10) =5 and 5 - 1, this equation has no solution by LCT 2.

(b) Finding [5]−1 ∈ Z47 is equivalent to solving [5][b] = [1] in Z47. Since gcd(5, 47) =1 and 1 | 1, this equation has a solution by LCT 2. Now, solving [5][b] = [1] inZ47 is equivalent to solving 5b+47y = 1. We can use the EEA to find a solution.

b y r q

1 0 47 0

0 1 5 0

1 −9 2 9

−2 19 1 2

5 −47 0 2

(Note that the x of the EEA has been written as b to be consistent with the linearDiophantine equation.) The EEA gives 5(19) + 47(−2) = 1 and so [5]−1 = [19]in Z47.

26.4 Practice

(a) i. Prove that: if a | c and b | c and gcd(a, b) = 1, then ab | c.ii. Show that the following statement is false. If a | c and b | c, then ab | c.iii. Prove that: For all integers n, 21 | (3n7 + 7n3 + 11n).

Page 187: MATH 135 Course Note

Chapter 27

Linear Congruences

27.1 Objectives

The content objectives are:

1. Define a linear congruence in the variable x.

2. State and prove the Linear Congruence Theorem.

3. Do examples.

27.2 The Problem

One of the advantages of congruence over divisibility is that we have an “arithmetic” ofcongruence. This allows us to solve new kinds of “equations”.

Definition 27.2.1

Linear Congruence

A relation of the formax ≡ c (mod m)

is called a linear congruence in the variable x. A solution to such a linear congruenceis an integer x0 so that

ax0 ≡ c (mod m)

The problem for this lecture is to determine when linear congruences have solutions andhow to find them.

Recalling our table of statements equivalent to a ≡ b (mod m) we see that

187

Page 188: MATH 135 Course Note

188 Chapter 27 Linear Congruences

REMARK

ax ≡ c (mod m) has a solution

⇐⇒ there exists an integer x0 such that ax0 ≡ c (mod m)

⇐⇒ there exist integers x0, y0 such that ax0 +my0 = c

⇐⇒ gcd(a,m) | c (by the Linear Diophantine Equation Theorem, Part 1)

Moreover, the Linear Diophantine Equation Theorem, Part 2 tells us what the solutions toax+ by = c look like.

Theorem 1 (Linear Diophantine Equation Theorem, Part 2, (LDET 2))

Let gcd(a,m) = d 6= 0.If x = x0 and y = y0 is one particular integer solution to the linear Diophantine equationax+my = c, then the complete integer solution is

x = x0 +m

dn, y = y0 −

a

dn, ∀n ∈ Z.

But then, if x0 ∈ Z is one solution to ax ≡ c (mod m) the complete solution will be

x ≡ x0 (modm

d) where d = gcd(a,m)

Let’s think about why that is. If we reduce the solution given in LDET 2 above modulom

d, then the term involving

m

devaluates to 0 leaving x ≡ x0 (mod

m

d).

Since the original problem was posed modulo m, we might like to give solutions modulo m.

In which case, x ≡ x0 (modm

d) is equivalent to

x ≡ x0, x0 +m

d, x0 + 2

m

d, · · · , x0 + (d− 1)

m

d(mod m)

Note that there are d = gcd(a,m) distinct solutions modulo m and one solution modulom

d.

We record this discussion as the following theorem.

Page 189: MATH 135 Course Note

Section 27.2 The Problem 189

Theorem 2 (Linear Congruence Theorem, Version 1, (LCT 1))

Let gcd(a,m) = d 6= 0.

The linear congruenceax ≡ c (mod m)

has a solution if and only if d | c.

Moreover, if x = x0 is one particular solution, then the complete solution is

x ≡ x0 (modm

d)

or, equivalently,

x ≡ x0, x0 +m

d, x0 + 2

m

d, · · · , x0 + (d− 1)

m

d(mod m)

Another way of considering the same problem is to reframe it in Zm. Since

[a] = {x ∈ Z | x ≡ a (mod m)}

solvingax ≡ c (mod m)

is equivalent to finding a congruence class [x0] ∈ Zm that solves

[a][x] = [c] in Zm

Thus

Theorem 3 (Linear Congruence Theorem, Version 2, (LCT 2))

Let gcd(a,m) = d 6= 0.

The equation[a][x] = [c] in Zm

has a solution if and only if d | c.

Moreover, if x = x0 is one particular solution, then the complete solution is{[x0] ,

[x0 +

m

d

],[x0 + 2

m

d

], · · · ,

[x0 + (d− 1)

m

d

]}in Zm

Page 190: MATH 135 Course Note

190 Chapter 27 Linear Congruences

27.3 Extending Equivalencies

Putting all of this together we have several views of the same problem.

REMARK

[a][x] = [c] has a solution in Zm⇐⇒ ax ≡ c (mod m) has a solution

⇐⇒ there exists an integer x0 such that ax0 ≡ c (mod m)

⇐⇒ there exist integers x0, y0 such that ax0 +my0 = c

⇐⇒ gcd(a,m) | c

Moreover, if x0, y0 is a particular integer solution to ax+my = c then

the complete solution to ax+my = c is x = x0 +m

dn, y = y0 −

a

dn, ∀n ∈ Z

⇐⇒ the complete solution to ax ≡ c (mod m) is x ≡ x0 (modm

d)

⇐⇒ the complete solution to ax ≡ c (mod m) is

x ≡ x0, x0 +m

d, x0 + 2

m

d, · · · , x0 + (d− 1)

m

d(mod m)

⇐⇒ the complete solution to [a][x] = [c] in Zm is{[x0] ,

[x0 +

m

d

],[x0 + 2

m

d

], · · · ,

[x0 + (d− 1)

m

d

]}in Zm

27.4 Examples

Example 1 If possible, solve the linear congruence

3x ≡ 5 (mod 6)

Solution: Since gcd(3, 6) = 3 and 3 - 5, there is no solution to 3x ≡ 5 (mod 6) by theLinear Congruence Theorem, Version 1.

Page 191: MATH 135 Course Note

Section 27.4 Examples 191

Example 2 If possible, solve the linear congruence

4x ≡ 6 (mod 10)

Solution: Since gcd(4, 10) = 2 and 2 | 6, we would expect to find two solutions to 4x ≡ 6(mod 10). Since ten is a small modulus, we can simply test all possibilities modulo 10.

x (mod 10) 0 1 2 3 4 5 6 7 8 9

4x (mod 10) 0 4 8 2 6 0 4 8 2 6

Hence, x ≡ 4 or 9 (mod 10).

Example 3 If possible, solve the linear congruence

3x ≡ 5 (mod 76)

Solution: Since gcd(3, 76) = 1 and 1 | 5, we would expect to find one solution to 3x ≡ 5(mod 76). We could try all 76 possibilities but there is a more efficient way. Thinking ofour list of equivalencies, solving 3x ≡ 5 (mod 76) is equivalent to solving 3x+ 76y = 5 andthat we know how to do that using the Extended Euclidean Algorithm.

x y r q

1 0 76 0

0 1 3 0

1 −25 1 25

−3 −76 0 3

From the second last row, 76(1) + 3(−25) = 1, or to match up with the order of the originalequation, 3(−25) + 76(1) = 1. Multiplying the equation by 5 gives 3(−125) + 76(5) = 5.Hence

x ≡ −125 ≡ 27 (mod 76)

We can check our work by substitution. 3 · 27 ≡ 81 ≡ 5 (mod 76).

Example 4 Find the inverse of [13] in Z29.

Solution: By definition, the inverse of [13] in Z29 is the congruence class [x] so that[13][x] = [1] in Z29. Since gcd(13, 29) = 1, we know by the Linear Congruence Theorem,Version 2 that there is exactly one solution. We could try all 29 possibilities or recall thatsolving

[13][x] = [1] in Z29

is equivalent to solving13x+ 29y = 1

and that we know how to do using the Extended Euclidean Algorithm.

Page 192: MATH 135 Course Note

192 Chapter 27 Linear Congruences

x y r q

1 0 29 0

0 1 13 0

1 −2 3 2

−4 9 1 4

13 −29 0 3

From the second last row, 29(−4) + 13(9) = 1, or to match up with the order of the originalequation, 13(9) + 29(−4) = 1. Hence

[13]−1 = [9] in Z29

We can check our work by substitution. [13][9] = [117] = [1] in Z29.

27.5 Practice

1. For each linear congruence, determine the complete solution, if a solution exists.

(a) 3x ≡ 11 (mod 18)

(b) 4x ≡ 5 (mod 21)

(c) 36x ≡ 8 (mod 116)

2. For each of the given elements, determine its inverse, if an inverse exists. Express theinverse as [b] where 1 ≤ b < m.

(a) [5] ∈ Z10

(b) [5] ∈ Z47

3. This question asks you to carefully examine the properties of linear congruences.

(a) Find integers c 6= 0, a, b,m such that the solution set of ax ≡ b (mod m) isdifferent from the solution set of cax ≡ cb (mod m).

(b) Suppose we want a proposition that says:

If , then ax ≡ b (mod m) and cax ≡ cb (mod m) have thesame set of solutions.

Determine a simple condition on c and m for the hypothesis that makes thisproposition correct, and prove this proposition.

Page 193: MATH 135 Course Note

Chapter 28

Chinese Remainder Theorem

28.1 Objectives

The content objectives are:

1. Do examples of solving simultaneous linear congruences.

2. Discover a proof of the Chinese Remainder Theorem.

28.2 An Old Problem

The following problem was posed, likely in the third century CE, by Sun Zi in his Math-ematical Manual and republished in 1247 by Qin Jiushao in the Mathematical Treatise inNine Sections.

There are certain things whose number is unknown. Repeatedly divided by 3,the remainder is 2; by 5 the remainder is 3; and by 7 the remainder is 2. Whatwill be the number?

The word problem asks us to find an integer n that simultaneously satisfies the followingthree linear congruences.

n ≡ 2 (mod 3)

n ≡ 3 (mod 5)

n ≡ 2 (mod 7)

Before we solve this problem with three simultaneous linear congruences, we will begin withtwo simultaneous congruences whose moduli are coprime.

193

Page 194: MATH 135 Course Note

194 Chapter 28 Chinese Remainder Theorem

28.3 Chinese Remainder Theorem

Example 1 Solve

n ≡ 2 (mod 5)

n ≡ 9 (mod 11)

Solution: The first congruence is equivalent to

n = 5x+ 2 where x ∈ Z (28.1)

Substituting this into the second congruence we get

5x+ 2 ≡ 9 (mod 11)⇒ 5x ≡ 7 (mod 11)

Have we seen anything like this before? Of course, this is just a linear congruence andwe solved those in the previous chapter. Since gcd(5, 7) = 1, there is exactly one solutionmodulo 11,

x ≡ 8 (mod 11)

Now x ≡ 8 (mod 11) is equivalent to

x = 11y + 8 where y ∈ Z (28.2)

Substituting Equation 29.4 into Equation 29.3 gives the solution

n = 5(11y + 8) + 2 = 55y + 42 for all y ∈ Z

which is equivalent ton ≡ 42 (mod 55)

We can check by substitution. If n = 55y + 42, then n ≡ 2 (mod 5) and n ≡ 9 (mod 11).

We can formalize this process.

Theorem 1 (Chinese Remainder Theorem (CRT))

If gcd(m1,m2) = 1, then for any choice of integers a1 and a2, there exists a solution to thesimultaneous congruences

n ≡ a1 (mod m1)

n ≡ a2 (mod m2)

Moreover, if n = n0 is one integer solution, then the complete solution is

n ≡ n0 (mod m1m2)

Page 195: MATH 135 Course Note

Section 28.3 Chinese Remainder Theorem 195

Before we begin our discovery of a solution, let’s be clear that there are two things to prove.First, that a solution exists and second, what a complete solution looks like.

With regard to the first part let’s identify, as usual, the hypothesis and the conclusion.

Hypothesis: gcd(m1,m2) = 1.

Conclusion: For any choice of integers a1 and a2, there exists a solution to the simulta-neous congruences

n ≡ a1 (mod m1)

n ≡ a2 (mod m2)

Since there is an existential quantifier in the conclusion, we use the Construct Method andconstruct a solution. There is nothing obvious from the statement of the theorem that willhelp us, but we have already solved such a problem once in Example 1. Perhaps we couldmimic what we did there.

From the first linear congruence

The integer n satisfies n ≡ a1 (mod m1) if and only if

n = a1 +m1x for some x ∈ Z

The next thing we did was substitute this expression into the second congruence.

The number n satisfies the second congruence if and only if

a1 +m1x ≡ a2 (mod m2)

m1x ≡ a2 − a1 (mod m2)

Have we seen anything like this before? Of course, this is just a linear congruence!

Since gcd(m1,m2) = 1, the Linear Congruence Theorem tells us that this con-gruence has a solution, say x = b and that the complete solution is

x = b+m2y for all y ∈ Z

If we set y = 0 we get x = b and hence n = a1 +m1b is one particular solution.

Now let’s consider the second part, a complete solution. Following on what we have doneabove, an integer n satisfies the simultaneous congruences if and only if

n = a1 +m1x

= a1 +m1(b+m2y)

= (a1 +m1b) +m1m2y for all y ∈ Z

But these are the elements of exactly one congruence class modulo m1m2. That is, all ofthe solutions belong to a single congruence class modulo m1m2. Therefore, if n = n0 is onesolution, the complete solution is

n ≡ n0 (mod m1m2)

Page 196: MATH 135 Course Note

196 Chapter 28 Chinese Remainder Theorem

Exercise 1 Using the analysis above, write a proof for the Chinese Remainder Theorem.

Exercise 2 Solve

n ≡ 2 (mod 3)

n ≡ 3 (mod 5)

Solution: The first congruence is equivalent to

n = 3x+ 2 where x ∈ Z (28.3)

Substituting this into the second congruence we get

3x+ 2 ≡ 3 (mod 5)⇒ 3x ≡ 1 (mod 5)

This linear congruence has the solution

x ≡ 2 (mod 5)

Now x ≡ 2 (mod 5) is equivalent to

x = 5y + 2 where y ∈ Z (28.4)

Substituting Equation (28.4) into Equation (28.3) gives the solution

n = 3(5y + 2) + 2 = 15y + 8 for all y ∈ Z

which is equivalent ton ≡ 8 (mod 15)

We can check by substitution. If n = 15y + 8, then n ≡ 2 (mod 3) and n ≡ 3 (mod 5).

Exercise 3 Solve

n ≡ 2 (mod 3)

n ≡ 3 (mod 5)

n ≡ 4 (mod 11)

Solution: The first two of the three linear congruences were solved above so we can replace

n ≡ 2 (mod 3)

n ≡ 3 (mod 5)

byn ≡ 8 (mod 15)

This reduces a problem of three linear congruences to a problem in two linear congruences.

n ≡ 8 (mod 15)

n ≡ 4 (mod 11)

We leave the remainder of the exercise to the reader.

Page 197: MATH 135 Course Note

Section 28.5 More Examples 197

The exercises above make it clear that we can solve more than two simultaneous linearcongruences simply by solving pairs of linear congruences successively. We record this as

Theorem 2 (Generalized Chinese Remainder Theorem (GCRT))

If m1,m2, . . . ,mk ∈ Z and gcd(mi,mj) = 1 whenever i 6= j, then for any choice of integersa1, a2, . . . , ak, there exists a solution to the simultaneous congruences

n ≡ a1 (mod m1)

n ≡ a2 (mod m2)

...

n ≡ ak (mod mk)

Moreover, if n = n0 is one integer solution, then the complete solution is

n ≡ n0 (mod m1m2 . . .mk)

You should ask yourself “What happens if the moduli are not coprime?” That investigationis left as an exercise.

Exercise 4 Solve the problem posed by Sun Zi that began this lecture.

28.4 More Examples

1. What is the complete solution to the following pair of simultaneous linear congruences?

x ≡ 3 (mod 7)

x ≡ 5 (mod 12)

Solution: Since gcd(7, 12) = 1, we know by the Chinese Remainder Theorem thata solution to this pair of linear congruences exists. Rewriting x ≡ 3 (mod 7) asx = 7y + 3 (1) for y ∈ Z and substituting into the second linear congruence gives7y + 3 ≡ 5 (mod 12). This reduces to 7y ≡ 2 (mod 12) and the solution is y ≡ 2(mod 12). Rewriting y ≡ 2 (mod 12) as y = 12z + 2 for z ∈ Z and substituting inEquation 1 gives x = 7(12z + 2) + 3 = 17 + 84z for z ∈ Z, or, equivalently,

x ≡ 17 (mod 84)

Check 17 ≡ 3 (mod 7) and 17 ≡ 5 (mod 12).

28.5 Practice

1. Provide the complete solution for each of the following.

Page 198: MATH 135 Course Note

198 Chapter 28 Chinese Remainder Theorem

(a)

x ≡ 7 (mod 11)

x ≡ 5 (mod 12)

(b)

3x− 2 ≡ 7 (mod 11)

5 ≡ 4x− 1 (mod 9)

2. The Chinese Remainder Theorem deals with the case where the moduli are coprime.We now investigate what happens if the moduli are not coprime.

(a) Consider the following two systems of linear congruences:

A :

{n ≡ 2 (mod 12)n ≡ 10 (mod 18)

B :

{n ≡ 5 (mod 12)n ≡ 11 (mod 18)

Determine which one has solutions and which one has no solutions. For the onewith solutions, give the complete solutions to the system. For the one with nosolutions, explain why no solutions exist.

(b) Let a1, a2 be integers, and let m1,m2 be positive integers. Consider the followingsystem of linear congruences

S :

{n ≡ a1 (mod m1)n ≡ a2 (mod m2)

Using your observations in (a), complete the following two statements.

The system S has a solution if and only if .

(This blank needs to be filled with a simple condition on a1, a2,m1,m2.)

If n0 is a solution to S, then the complete solution is

n ≡ .

(c) Prove the first statement.

3. (a) Prove: If gcd(m1,m2) = 1 then x ≡ a (mod m1m2) iff x ≡ a (mod m1) andx ≡ a (mod m2).

(b) Let p be a prime number greater than 15. Determine the remainder of p360

divided by 1001.

4. Let a and n be positive integers. A sequence of n consecutive positive integers (a, a+1, a+2, ..., a+(n−1)) is called a Wolczuk of length n if every integer in the sequenceis divisible by some perfect square greater than 1. For example, (8, 9) is a Wolczuk oflength 2 since 22 | 8 and 32 | 9.

(a) Verify that (48, 49, 50) is a Wolczuk of length 3.

(b) Consider the system of linear congruences

a ≡ 0 (mod 4)

a ≡ −1 (mod 25)

a ≡ −2 (mod 49)

Solve this system and hence generate two distinct Wolczuks of length 3.

(c) Prove that for any positive integer n, there exist infinitely many Wolczuks oflength n.

Page 199: MATH 135 Course Note

Chapter 29

Practice, Practice, Practice:Congruences

29.1 Objectives

The content objectives are:

1. Computational practice.

2. Preparing for RSA.

29.2 Worked Examples

Let’s recall how to solve linear congruences.

Example 1 Solve 13x ≡ 1 (mod 60).

Solution: Since this is a linear congruence, we will use the Linear Congruence Theorem.Because gcd(13, 60) = 1 and 1 | 1 we would expect to find one congruence class mod60 as a solution to 13x ≡ 1 (mod 60). Now 13x ≡ 1 (mod 60) is equivalent to the linearDiophantine equation 13x+60y = 1 so we can use the EEA. (Note that we have interchangedthe labels for x and y. Why?)

y x r q

1 0 60 0

0 1 13 0

1 −4 8 4

−1 5 5 1

2 −9 3 1

−3 14 2 1

5 −23 1 1

−13 60 0 2

Thus 13(−23)+60(5) = 1 and so x ≡ −23 ≡ 37 (mod 60) is a solution to 13x ≡ 1 (mod 60).

199

Page 200: MATH 135 Course Note

200 Chapter 29 Practice, Practice, Practice: Congruences

Though we have efficient means to solve linear congruences, we have no equivalent meansto solve polynomial congruences.

Example 2 Solve x2 ≡ 1 (mod 8) by substitution.

Your first reaction might be that there are zero, one or two solutions as there would bewhen working with real numbers.

Solution: We use a table to test all possible values of x.

x (mod 8) 0 1 2 3 4 5 6 7

x2 (mod 8) 0 1 4 1 0 1 4 1

Hence, the solution is x ≡ 1, 3, 5 or 7 (mod 8).

Example 3 Solve 36x47 + 5x9 + x3 + x2 + x + 1 ≡ 2 (mod 5). Reduce terms and use Fermat’s LittleTheorem or its corollaries before substitution.

Solution: Since 36 ≡ 1 (mod 5) the term 36x47 reduces to x47 (mod 5).Since 5 ≡ 0 (mod 5) the term 5x9 reduces to 0 (mod 5). Thus,

36x47 + 5x9 + x3 + x2 + x+ 1 ≡ 2 (mod 5)

reduces tox47 + x3 + x2 + x+ 1 ≡ 2 (mod 5)

Now observe that x ≡ 0 (mod 5) cannot be a solution, otherwise we have 1 ≡ 2 (mod 5)by substitution in the preceding equation. Since 5 is a prime and 5 - x, we can use Fermat’sLittle Theorem which implies that x4 ≡ 1 (mod 5) and so

x47 ≡ x44x3 ≡ (x4)11x3 ≡ 111x3 ≡ x3 (mod 5)

and the polynomial congruence further reduces to

x3 + x3 + x2 + x+ 1 ≡ 2 (mod 5)

or, more simply,2x3 + x2 + x+ 1 ≡ 2 (mod 5)

Now we can use a table.

x (mod 5) 0 1 2 3 4

2x3 + x2 + x+ 1 (mod 5) 1 0 3 2 4

Hence, the only solution to

36x47 + 5x9 + x3 + x2 + x+ 1 ≡ 2 (mod 5)

isx ≡ 3 (mod 5)

Page 201: MATH 135 Course Note

Section 29.2 Worked Examples 201

Example 4 Solve n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 35).

Solution: We could try all 35 possibilities but even then, computing something like 2037

is a problem. Perhaps there is another way. Observing that 35 = 5×7 and both factors arerelatively prime, maybe we could split the problem into two linear congruences and thenapply the Chinese Remainder Theorem. Unfortunately, the polynomial is not linear. Let’ssee what happens anyway.

If n0 is a solution to

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 35)

then n0 is also a solution to

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 5) (29.1)

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 7) (29.2)

Well, have we seen anything like these before? Indeed, we have. The previous examplesolved congruences just like these. We’ll solve each of the polynomial congruences individ-ually. As in the previous example, we can reduce terms and use Fermat’s Little Theoremor its corollaries to simplify the congruence before substitution. Let’s start with Equation(29.1).

Since 10 ≡ 0 (mod 5) the term 10n8 reduces to 0 (mod 5).Since 14 ≡ 4 (mod 5) the term 14n7 reduces to 4n7 (mod 5).Finally, since 5 ≡ 0 (mod 5), the right hand side constant reduces to 0 (mod 5).Thus,

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 5)

reduces to

n37 + 4n7 + 1 ≡ 0 (mod 5)

This looks like progress! Now observe that n0 ≡ 0 (mod 5) cannot be a solution, otherwisewe have 1 ≡ 0 (mod 5) by substitution in the preceding equation. Since 5 is a prime and5 - n0, we use Fermat’s Little Theorem to get n4 ≡ 1 (mod 5). Hence

n37 ≡ n36n ≡ (n4)9n ≡ 19n ≡ n (mod 5)

and

n7 ≡ n4n3 ≡ n3 (mod 5)

and so the polynomial congruence further reduces to

n+ 4n3 + 1 ≡ 0 (mod 5)

Now we can use a table.

n (mod 5) 0 1 2 3 4

n+ 4n3 + 1 (mod 5) 1 1 0 2 1

Page 202: MATH 135 Course Note

202 Chapter 29 Practice, Practice, Practice: Congruences

Hence, the only solution to

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 5)

isx ≡ 2 (mod 5)

This is a linear congruence so that supports the idea of using the Chinese RemainderTheorem. Now let’s examine Equation (29.2) repeated below.

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 7)

Reducing each term modulo 7 gives

n37 + 3n8 + 1 ≡ 5 (mod 7)

Since n0 ≡ 0 (mod 7) cannot be a solution, otherwise 1 ≡ 5 (mod 7), and 7 is a prime, wecan use Fermat’s Little Theorem to assert n6 ≡ 1 (mod 7). This allows us to say

n37 ≡ n36n ≡ (n6)6n ≡ 16n ≡ n (mod 7)

andn8 ≡ n6n2 ≡ n2 (mod 7)

Thus, Equation (29.2) reduces to

n+ 3n2 + 1 ≡ 5 (mod 7)

This is a good time to use a table.

n (mod 7) 0 1 2 3 4 5 6

n+ 3n2 + 1 (mod 7) 1 5 1 3 4 4 3

Hence, the only solution to

n37 + 10n8 + 14n7 + 1 ≡ 5 (mod 7)

isn ≡ 1 (mod 7)

But now we have two simultaneous linear congruences

n ≡ 2 (mod 5)

n ≡ 1 (mod 7)

Since the moduli are coprime, we know by the Chinese Remainder Theorem that a solutionexists. The proof of CRT gave us a way to solve two simultaneous linear congruences.

The first congruence is equivalent to

n = 5x+ 2 where x ∈ Z (29.3)

Substituting this into the second congruence we get

5x+ 2 ≡ 1 (mod 7)⇒ 5x ≡ 6 (mod 7)

Page 203: MATH 135 Course Note

Section 29.2 Worked Examples 203

Solving this linear congruence gives

x ≡ 4 (mod 7)

Now x ≡ 4 (mod 7) is equivalent to

x = 7y + 4 where y ∈ Z (29.4)

Substituting Equation (29.4) into Equation (29.3) gives the solution

n = 5(7y + 4) + 2 = 35y + 22 for all y ∈ Z

which is equivalent ton ≡ 22 (mod 35)

Thus, the solution ton37 + 10n8 + 14n7 + 1 ≡ 5 (mod 5)

isn ≡ 22 (mod 35)

Example 5 Solve n3 ≡ 127 (mod 165).

Solution: We could try all 165 possibilities but perhaps it is better to follow the lead of theprevious question. Observing that 165 = 3×5×11 and all three factors are relatively primeas pairs, maybe we can split the problem into three linear congruences and then apply theChinese Remainder Theorem.

If n0 is a solution ton3 ≡ 127 (mod 165)

then n0 is a solution to

n3 ≡ 127 ≡ 1 (mod 3)

n3 ≡ 127 ≡ 2 (mod 5)

n3 ≡ 127 ≡ 6 (mod 11)

Let’s consider each of the three congruences separately. In the case n3 ≡ 1 (mod 3) wecan use a corollary to Fermat’s Little Theorem. Since n3 ≡ n (mod 3) by Fermat’s LittleTheorem, n3 ≡ 1 (mod 3) reduces to n ≡ 1 (mod 3) which is just the solution to the firstcongruence.

For the case n3 ≡ 2 (mod 5) we will use a table.

n (mod 5) 0 1 2 3 4

n3 (mod 5) 0 1 3 2 4

The only solution to n3 ≡ 2 (mod 5) is n ≡ 3 (mod 5)

For the case n3 ≡ 6 (mod 11) we will again use a table.

Page 204: MATH 135 Course Note

204 Chapter 29 Practice, Practice, Practice: Congruences

n (mod 11) 0 1 2 3 4 5 6 7 8 9 10

n3 (mod 11) 0 1 8 5 9 4 7 2 6 3 10

The only solution to n3 ≡ 6 (mod 11) is n ≡ 8 (mod 11)

Hence, a solution to n3 ≡ 127 (mod 165) can be found by solving the simultaneous linearcongruences

n ≡ 1 (mod 3)

n ≡ 3 (mod 5)

n ≡ 8 (mod 11)

Though these could be solved by eye (note that n ≡ 8 (mod 55) is a solution to the lasttwo) we will solve these, for practice, by writing out and substituting equations.

From n ≡ 1 (mod 3) we have

n = 3x+ 1 where x ∈ Z (29.5)

Substituting into the second congruence we get

3x+ 1 ≡ 3 (mod 5)⇒ 3x ≡ 2 (mod 5)⇒ x ≡ 4 (mod 5)

Now x ≡ 4 (mod 5) is equivalent to

x = 5y + 4 where y ∈ Z (29.6)

Substituting Equation (29.6) into Equation (29.5) gives the solution to the first two linearcongruences.

n = 3(5y + 4) + 1 = 15y + 13 for all y ∈ Zwhich is equivalent to

n ≡ 13 (mod 15)

Now we need to solve

n ≡ 13 (mod 15)

n ≡ 8 (mod 11)

From n ≡ 13 (mod 15) we have

n = 15x+ 13 where x ∈ Z (29.7)

Substituting into the second congruence we get

15x+13 ≡ 8 (mod 11)⇒ 4x+2 ≡ 8 (mod 11)⇒ 4x ≡ 6 (mod 11)⇒ x ≡ 7 (mod 11)

Now x ≡ 7 (mod 11) is equivalent to

x = 11y + 7 where y ∈ Z (29.8)

Substituting Equation (29.8) into Equation (29.7) gives the solution.

n = 15(11y + 7) + 13 = 165y + 118 for all y ∈ Z

which is equivalent ton ≡ 118 (mod 165)

and this is the solution to the original problem n3 ≡ 127 (mod 165).

Checking we have n2 ≡ 1182 ≡ 64 (mod 165) and n3 ≡ n2 · n ≡ 64× 118 ≡ 127 (mod 165).

Page 205: MATH 135 Course Note

Section 29.3 Preparing for RSA 205

REMARK

Let’s summarize what we have learned from these examples.

• By the Linear Congruence Theorem, all linear congruences can be solved.

• There is no efficient means to solving a polynomial congruence. Substitution alwaysworks but can be very slow.

• Polynomial congruences may have many solutions.

• One approach that sometimes works when the modulus is composite, is to break theproblem into parts, solve each of the parts, and then combine the partial solutions toget a complete solution. Specifically,

1. Create a new polynomial congruence for each prime factor of the modulus.

2. Solve each of these new polynomial congruences by reducing coefficients, applyingFermat’s Little Theorem to reduce exponents (which is why we need to use primefactors), and then using observation, the Linear Congruence Theorem or a tableof values.

3. If the original problem has a solution, this process will give at least one linearcongruence for each factor. Use the Chinese Remainder Theorem to combinethese solutions into a solution for the original problem.

29.3 Preparing for RSA

This exercise will help us understand the implementation of the RSA scheme which we willlook at next. In commercial practice the numbers chosen are large but here, choose numberssmall enough to work with by hand.

I will give an example. You follow along but use your own numbers.

1. Choose two distinct primes p and q and let n = pq. I will choose p = 7 and q = 11 son = 77.

2. Select an integer e so that gcd(e, (p− 1)(q− 1)) = 1 and 1 < e < (p− 1)(q− 1). I willchoose e = 13 which satisfies gcd(13, 60) = 1 and 1 < 13 < 60.

3. Solveed ≡ 1 (mod (p− 1)(q − 1))

for an integer d where 1 < d < (p− 1)(q − 1). In my case, I must solve

13d ≡ 1 (mod 60)

The solution is d = 37.

Page 206: MATH 135 Course Note

Chapter 30

The RSA Scheme

30.1 Objectives

The content objectives are:

1. Illustrate the difference between private key and public key cryptography.

2. Illustrate the use of RSA.

3. Prove that the message sent will be the message received.

30.2 Private Key Cryptography

30.2.1 Introduction

The need for secret communications has been known for millenia. And equally, the oppor-tunities that would arise from the ability to read someone else’s secret communications havealso been known for millenia. In the modern world, the need for secret communication ismuch larger than it was even in the recent past. Certainly the traditional areas of militaryand diplomatic continue, but the credit card, debit card and web transactions of moderncommerce, as well as privacy concerns for health, citizenship and other electronic records,have raised the need for secure communications and storage dramatically.

In its most elemental form, the objective of any secret communication scheme is to allow twoparties, usually referred to as Alice (for person A) and Bob (for person B), to communicateover an insecure channel so that an opponent, often called Oscar, cannot understand whatis being communicated. In wartime, a general (Alice) wishes to provide orders to a fieldcommander (Bob) over the radio (insecure channel) so that enemy radio operators (Oscar)cannot understand the orders. When you order a book from Amazon, you (Alice) provideyour order to Amazon (Bob) through a web connection (insecure channel) so that hackers(Oscar) cannot get your credit card information.

The information Alice wishes to communicate is called the message or the plaintext. Theact of transforming the plaintext into a ciphertext is called enciphering or encryption.The rules for enciphering make use of a key, which is an input to the algorithm. Theact of transforming the ciphertext to plaintext using the key is called deciphering ordecryption.

206

Page 207: MATH 135 Course Note

Section 30.2 Private Key Cryptography 207

Figure 30.2.1: Cryptographic Communication (to be replaced by a b&w version)

30.2.2 Substitution Cipher

In a substitution cipher, one letter of the alphabet used in the cipher text replaces oneletter of the alphabet used in the plaintext. We simply permute the alphabet. For example,consider the substitution rule below.

A B C D E F G H I J K L M

Q M W N B E R V T C Y X U

N O P Q R S T U V W X Y Z

Z I L O K P H A G S F J D

This table acts as the key. The algorithm for encryption is simple: for each letter in theplaintext, replace it with the letter below it to produce the ciphertext. For example, theplaintext:

We shall fight on the beaches,

We shall fight on the landing grounds,

We shall fight in the fields and in the streets,

We shall fight in the hills;

We shall never surrender

(from Winston Churchill’s speech, “Blood, Sweat and Tears”, 4 June 1940)

corresponds to the cipher text (with punctuation removed and converted to uppercase):

SB PVQXX ETRVH IZ HVB MBQWVBP

SB PVQXX ETRVH IZ HVB XQZNIZG GKIAZNP

SB PVQXX ETRVH TZ HVB ETBXNP QZN TZ HVB PHKBBHP

SB PVQXX ETRVH TZ HVB VTXXP

SB PVQXX ZBHBK PAKKBZNBK

The algorithm for decryption is equally simple: for each letter in the ciphertext, replace itwith the letter above it to produce the plaintext.

Now suppose we had somehow gotten hold of this particular ciphertext and wanted toreconstruct the original message. Also suppose that we knew the message was in English,and that a substitution cipher had been used. We could use a computer to try all possiblesubstitutions. Since there are 26 letters, there are 26! possible substitutions or permutations.Even for modern computers, this is too large a number to reasonably attempt.

But careful observation should help. First, spaces between words were left in and this makesour task much easier. Consider the following observations.

Page 208: MATH 135 Course Note

208 Chapter 30 The RSA Scheme

• Many words are repeated. In particular, each phrase begins the same way.

• The three letter word “HVB” appears five times.

• Two letter words are also frequently repeated.

• Many of the unrepeated words end in “P”.

These hints alone are probably enough to make great headway. The most common threeletter word in the English language is “THE” so “HVB” probably corresponds to “THE”.Working with this assumption we assume that “H” maps to “T”, “V” maps to “E” and “B”maps to “E”. Now look at the word “SB” that begins each of the phrases. We know that“B” corresponds to “E” so we are looking at a two letter word of the form “ E”. There aremore choices than we might think: “BE” or “HE” or “ME” or “RE” or “WE”. But “ME”and “RE” are unlikely to begin phrases so that leaves us with “BE” or “HE” or “WE”.Though we may not yet be able to choose, the ciphertext letter “S” will likely map to “B”,“H” or “W”.

Lets look at the other two letter words “IZ” and “TZ”. There are many two letter words butnot that many that end in the same letter and can precede the word “THE”. Two obviouspairs of candidates are “IN” and “ON”, and “TO” and “DO”. Lets work with the first pair.We would map “Z” to “N”. Now consider the remaining three letter word, “QZN” whichmaps, so far, to “ N ”. Almost certainly this will be the word “AND” and so we can map“Q” to “A” and “N” to “D”. Intuitively, most of us know that “E” is the most commonletter and that other letters like “S, T, R, A, O , I” are also common, though not as commonas “E”. We do know that “S” commonly ends words. Since “P” is both common and at theend of many words, it makes sense to guess that “P” maps to “S”.

A B C D E F G H I J K L M

E T

N O P Q R S T U V W X Y Z

D S A H N

Now consider the word “ETBXNP” which, so far, maps to “ IE DS” or “ OE DS”. Persis-tence, and access to a dictionary, will go a long way now.

The important part of this exercise was to recognize that patterns alone can go a long wayto allowing us to “break the code”. Despite the vast numbers of possible keys, it did nottake us too long to make considerable progress.

Suppose that the sender of the message was more cautious and removed all of the spaces (orrandomly inserted characters into the spaces) and blocked all of the characters into groupsof five. The ciphertext then becomes

SBPVQ XXETR VHIZH VBMBQ WVBPS BPVQXX ETRVH IZHVB XQZNI ZGGKI AZNPS BPVQX XETRV

HTZHV BETBX NPQZN TZHVB PHKBB HPSBP VQXXET RVHTZ HVBVT XXPSB PVQXX ZBHBK PAKKB

ZNBK

Our previous analysis fails here. The lesson: Oscar looks for patterns and Alice and Bobwish to eliminate patterns.

Page 209: MATH 135 Course Note

Section 30.2 Private Key Cryptography 209

30.2.3 Looking for Patterns

Earlier, we made use of our intuitive sense of the English language. “E” was a very commonletter. “S” was common but not as common as “E”. “Z” is a rare letter. “THE” is a verycommon three letter word. If we compute the relative frequency of the letters of the alphabetin many reasonably long passages, a very consistent pattern of relatively frequency occurs.The table below replicates a table by Beker and Piper in their book Cipher Systems ofpercentages that each character appears in a collection of passages. The passages had allpunctuation and spaces removed.

A B C D E F G H I J K L M

8.17 1.49 2.78 4.25 12.70 2.23 2.02 6.09 6.97 0.15 0.77 4.03 2.41

N O P Q R S T U V W X Y Z

6.75 7.51 1.93 0.10 5.99 6.33 9.06 2.76 0.98 2.36 0.15 1.97 0.07

The relatively frequency becomes even clearer in a chart.

Figure 30.2.2: Relative Frequency of Letters in the English Language

The letters fall into distinct groups. In order of relative frequency the letters are:

• E

• T, A, O, I, N, S, H, R

• D, L

• C, U, M, W, F, G, Y, P, B

• V, K, J, X, Q, Z

The ten most common combinations of two and three letters, and their relative frequenciesare also given below.

TH HE IN ER AN RE ED ON ES ST

3.015 3.004 1.872 1.860 1.419 1.353 1.305 1.182 1.170 1.147

THE ING AND HER ERE ENT THA NTH WAS ETH

2.032 0.747 0.667 0.547 0.448 0.376 0.353 0.353 0.336 0.312

Page 210: MATH 135 Course Note

210 Chapter 30 The RSA Scheme

Now let’s return to our ciphertext and see, even without spaces, if we can make progress.In this particular case, it’s important to note that the passage is shorter than we wouldlike. It is also not typical of normal discourse and so the distribution of letters is unusual.Nonetheless, lets tally up the instances of each letter in the ciphertext.

A B C D E F G H I J K L M

2 19 0 0 0 5 2 12 4 0 5 0 1

N O P Q R S T U V W X Y Z

5 0 12 8 4 5 9 0 16 1 14 0 10

The letter “B” looks like it should map to “E”, though “V” is also a possibility. Thereare many pairs and triples of letters that are relatively frequent, and this is unexpectedgiven the usual distributions. Nonetheless, the triple “HVB”, or “ E” partially decrypted,occurs as often as any other triple and so it would make sense, in a first attempt, to guessthat “HVB” corresponds to “THE”. With “H”, “V” and “B”, and hence “T”, “H” and“E” dealt with, it is likely that the remaining common letters “H”, “P”, “Q”, “T”, “X”,and “Z” map to “A”, “O”, “I”, “N”, “S” and “R”. We leave it to the reader to continueexperimenting.

30.2.4 Vigenere Ciphers

Substitution ciphers have a grave weakness. Given any reasonably long ciphertext, patternsof distribution can be used to break them. A Vigenere cipher is intended to make thefrequency distribution more uniform. Here’s how it works. First, we treat the alphabet asnumbers modulo 26. Thus, we have the correspondence given in the table below.

A B C D E F G H I J K L M

0 1 2 3 4 5 6 7 8 9 10 11 12

N O P Q R S T U V W X Y Z

13 14 15 16 17 18 19 20 21 22 23 24 25

We choose as our key any text string and also treat each of the characters in the string asintegers modulo 26. For encryption we add, character by character modulo 26, our key tothe message. For decryption we subtract, character by character modulo 26, our key fromthe ciphertext. If the key is shorter than the message, we repeat the key. We assume thatall punctuation and spacing has been removed from the message text, and that the messagetext is blocked into groups of five characters. For example, the source text (from “MobyDick” by Herman Melville )

CALL ME ISHMAEL

becomes the plaintext

CALLM EISHM AEL

We add the key

HERMAN

as follows

Page 211: MATH 135 Course Note

Section 30.2 Private Key Cryptography 211

C A L L M E I S H M A E L

H E R M A N H E R M A N H

J E C X M R P W Y Y A R S

noting that

2 0 11 11 12 4 8 18 7 12 0 4 11

+ 7 4 17 12 0 13 7 4 17 12 0 13 7

≡ 9 4 2 23 12 17 15 22 24 24 0 17 18

In particular L + R = C corresponds to 11 + 17 ≡ 2 (mod 26). It is important to observethat the same letter in the plaintext can be mapped to different letters in the ciphertext.For example, “L” is mapped to “C”, “X” and “S”.

Lets examine the following Vigenere ciphertext.

DWBSE KUGXL GUYTB TQERY OMZZY PNBOA HXBMA JOZRJ MWZSE VVZIM KIOTY KXKRG XLPUW

UHTSB LBKTH KCQAZ RMZKB MNIMC ZAVIG OYVBL WIGKB QNRDP VTQAB ABOEU CAAGD QBTKT

CXYLH IDQSC OAUUE TQPEL TKKUR XSKNH IBUGD KBAXB FGSZC UVTHZ SWAGX LPOQI EKDBR

GNDRX DQFOX ONTNI ZHETN TMMFZ YKYKK ZBABP VMREN ECWSI KZAGQ MVZMW HTDAF VOKVG

VTBIU ASUBW HXNWB XCIAJ DPRPK QYYPW EZRWF KGPBH BMNQD PRSSB PUEVG YDPRJ OAGXE

KGOYV BLYCE XOLJU YLFGX LGNOT BYCWS UEZAG DCEGV EBTNM EOXKU GYBVI CXEGG TVZMW

HTDAA GZIYS KVQZR MPUCB BLKVH IVMNX GIENO IQGXL NXWWE KNKNX CNBXZ WYOMM JNYNV

MRBEO YBFOX WHXCB EKOBF ODKBA XBFCR QGSKV FXSNY KKVQY ZMPQC SAOPM NTNBU KDMYK

FQFOY VCXYO EGWAJ NSKUM VWEOP GIOYT RTMMV TYZQK BBBYO TYZYG FZYWH XMPVR NZRTI

MGZRM TXYAF TKBVU XIYVB WQAMB QUOAA UDIYR YESUB BUKRM NRDPB LYCEI RQYJB MAZRM

DAKTV ZIWSZ RMVXO LHIKB VUXWE ZRMWU IWSZR MVXZT NESBQ UOAAU DQAIV CQKDP RHOIH

ZIWSU EZCUO BEEYZ GNOAG XOVTZ RWSUE ZZGBZ VGQMF ZRMVT DMYRS ORTMM BLYCE VEJYO

MLRHK BRUBB UKSVG KQZVZ IWSUE ZCALT VIYNS OMQNR CQGSO IFABM FTOQG NOZBA BEVZX

WEUEZ PUEZN MOVRO DPRXY CECSA QUWVB XYCER OIETS VTTOQ GNOZB ABKBS ZIFYS WATYZ

BABLR BYBVU XBBUE ZPUEV GXIQG SOIFA BMFKF MEEDP VTQQA YRWEZ OFPKZ BGNKB JNSKU

SKSRY VQSKG WEZRE UOVMN TNQGZ OTYYE ARBOZ LZRQA MKJBA DIZKB QPGOF PKZBJ NIERG

BMCXY CQZRI GCOIE KKURX SKNTC

The relative frequency of the letters in this ciphertext is much more even than in samplesof ordinary text and therefore much harder to decrypt.

Figure 30.2.3: Frequency of Letters in the Vigenere Ciphertext

Nonetheless, Vigenere ciphers are easily broken nowadays.

Page 212: MATH 135 Course Note

212 Chapter 30 The RSA Scheme

30.3 Why Public Key Cryptography?

In a private key cryptographic scheme, like the substitution cipher or Vigenere cipher thatyou have already learned about, participants share a common key. This raises the problemof how to distribute a large number of keys between users, especially if these keys need tobe changed frequently. For example, there are almost 200 countries in the world. If Canadamaintains an embassy in each country and allows Canadian embassies to communicate withone another, the embassies must exchange a common key between each pair of embassies.That means there are

(2002

)= 19, 900 keys to exchange. Worse yet, for security reasons,

keys should be changed frequently and so 19, 900 keys might need to be exchanged daily.

In a public key cryptographic scheme, keys are divided into two parts: a private decryptionkey held secretly by each participant, and a public encryption key, derived from the privatekey, which is shared in an open repository of some sort. For user A to send a private messageto user B, A would look up B’s public key, encrypt the message and send it to B. SinceB is the only person who possesses the secret key required for decryption, only B can readthe message.

Such an arrangement solves the key distribution problem. The public keys do not need tobe kept secret and only one per participant needs to be available. Thus, in our embassyexample previously, only 200 keys need to be published.

The possibility of public key cryptography was first published in 1976 in a paper by Diffie,Hellman and Merkle. The RSA scheme, named after its discoverers Rivest, Shamir andAdleman is an example of a commercially implemented public key scheme.

RSA is now widely deployed. The following protocols and products, which embed RSA, areused by many of us daily. SSL (Secure Sockets Layer) is the most commonly used protocolfor secure communication over the web. It is frequently used to encrypt payment databefore sending that data to a server. PGP (Pretty Good Privacy) is used by individualsand businesses to encrypt and authenticate messages. It was originally intended for emailmessages and attachments but is now also used for encrypting files, folders or entire harddrives. EMV (Europay, MasterCard and VISA) is a global standard for authenticatingcredit and debit card transactions at point of sale (POS) or automated teller machines(ATM).

Page 213: MATH 135 Course Note

Section 30.4 Implementing RSA 213

30.4 Implementing RSA

In RSA, messages are integers. How does one get an integer from plaintext? In much thesame way we did with a Vigenere cipher, assign a number to each letter of the alphabetand then concatenate the digits together.

30.4.1 Setting up RSA

1. Choose two large, distinct primes p and q and let n = pq.

2. Select an integer e so that gcd(e, (p− 1)(q − 1)) = 1 and 1 < e < (p− 1)(q − 1).

3. Solveed ≡ 1 (mod (p− 1)(q − 1))

for an integer d where 1 < d < (p− 1)(q − 1).

4. Publish the public encryption key (e, n).

5. Keep secure the private decryption key (d, n).

30.4.2 Sending a Message

To send a message:

1. Look up the recipient’s public key (e, n).

2. Generate the integer message M so that 0 ≤M < n.

3. Compute the ciphertext C as follows:

M e ≡ C (mod n) where 0 ≤ C < n

4. Send C.

30.4.3 Receiving a Message

To decrypt a message:

1. Use your private key (d, n).

2. Compute the messagetext R from the ciphertext C as follows:

Cd ≡ R (mod n) where 0 ≤ R < n

3. R is the original message.

Page 214: MATH 135 Course Note

214 Chapter 30 The RSA Scheme

30.4.4 Example

All of the computation in this part was done in Maple.

Setting up RSA

1. Choose two large, distinct primes p and q and let n = pq.Let p be9026694843 0929817462 4847943076 6619417461

5791443937,

and let q be7138718791 1693596343 0802517103 2405888327

6844736583

so n is6443903609 8539423089 8003779070 0502485677

1034536315 4526254586 6290164606 1990955188

1922989980 3977447271.

2. Select an integer e so that gcd(e, (p− 1)(q − 1)) = 1 and 1 < e < (p− 1)(q − 1).Now (p− 1)(q − 1) is6443903609 8539423089 8003779070 0502485677

1034536313 8360840952 3666750800 6340495008

2897684191 1341266752.

Choose e as9573596212 0300597326 2950869579 7174556955

8757345310 2344121731.

It is indeed the case that gcd(e, (p− 1)(q − 1)) = 1 and 1 < e < (p− 1)(q − 1).

3. Solveed ≡ 1 (mod (p− 1)(q − 1))

for an integer d where 1 < d < (p− 1)(q − 1). Solving this LDE gives d as5587652122 6351022927 9795248536 5522717791

7285682675 6100082011 1849030646 3274981250

2583120946 4072548779.

4. Publish the public encryption key (e, n).

5. Keep secure the private decryption key (d, n).

Sending a Message

To send a message:

1. Look up the recipient’s public key (e, n).

2. Generate the integer message M so that 0 ≤M < n.We will let M = 3141592653.

Page 215: MATH 135 Course Note

Section 30.5 Does M = R? 215

3. Compute the ciphertext C as follows:

M e ≡ C (mod n) where 0 ≤ C < n

Computing gives C4006696554 3080815610 2814019838 8509626485

8151054441 5245547382 5506759308 1333888622

4491394825 3742205367.

4. Send C.

Receiving a Message

To decrypt a message:

1. Use your private key key (d, n).

2. Compute the messagetext R from the ciphertext C as follows:

Cd ≡ R (mod n) where 0 ≤ R < n

3. R is the original message.R = 3141592653.

30.5 Does M = R?

Are we confident that the message sent is the message received?

Theorem 1 (RSA)

If

1. p and q are distinct primes,

2. n = pq

3. e and d are positive integers such that ed ≡ 1 (mod (p− 1)(q − 1)),

4. 0 ≤M < n

5. M e ≡ C (mod n)

6. Cd ≡ R (mod n) where 0 ≤ R < n

then R = M .

The proof is long and can appear intimidating but, in fact, it is structurally straightforwardif we break it into pieces. The proof is done in four parts.

Page 216: MATH 135 Course Note

216 Chapter 30 The RSA Scheme

1. Write R as a function of M , specifically

R ≡MMk(p−1)(q−1) (mod n)

2. Show that R ≡M (mod p). We will do this in two cases: (i) p -M and (ii) p |M .

3. Show that R ≡M (mod q).

4. Use the Chinese Remainder Theorem to deduce that R = M .

Proof: First, we will show that

R ≡MMk(p−1)(q−1) (mod n)

Since ed ≡ 1 (mod (p− 1)(q − 1)), there exists an integer k so that

ed = 1 + k(p− 1)(q − 1)

Now

R ≡ Cd (mod n)

≡ (M e)d (mod n)

≡M ed (mod n)

≡M1+k(p−1)(q−1) (mod n)

≡MMk(p−1)(q−1) (mod n)

Second, we will show that R ≡ M (mod p). Suppose that p - M . By Fermat’s LittleTheorem,

Mp−1 ≡ 1 (mod p)

Hence

Mk(p−1)(q−1) ≡ (Mp−1)k(q−1) (mod p)

≡ 1k(q−1) (mod p)

≡ 1 (mod p)

Multiplying both sides by M gives

MMk(p−1)(q−1) ≡M (mod p)

SinceR ≡MMk(p−1)(q−1) (mod n)⇒ R ≡MMk(p−1)(q−1) (mod p)

we haveR ≡M (mod p)

Now suppose that p | M . But then M ≡ 0 (mod p) and so MMk(p−1)(q−1) ≡ 0 (mod p).That is,

MMk(p−1)(q−1) ≡M (mod p)

Again, since

R ≡MMk(p−1)(q−1) (mod n)⇒ R ≡MMk(p−1)(q−1) (mod p)

Page 217: MATH 135 Course Note

Section 30.6 How Secure Is RSA? 217

we haveR ≡M (mod p)

In either case, we have R ≡M (mod p).

Third, we will show that R ≡M (mod q). But this is very similar to R ≡M (mod p).

Fourth and last, we will show that R = M . So far we have generated two linear congruencesthat have to be satisfied simultaneously.

R ≡M (mod p)

R ≡M (mod q)

Since gcd(p, q) = 1 we can invoke the Chinese Remainder Theorem and conclude that

R ≡M (mod pq)

Since pq = n we haveR ≡M (mod n)

Now, R and M are both integers congruent to each other modulo n, and both lie between0 and n− 1, so R = M .

30.6 How Secure Is RSA?

The basic idea behind RSA is that multiplying large integers is easy and factoring largeintegers is difficult. Despite enormous efforts, both theoretically and computationally, noefficient method of factoring has been discovered. In practice, the risk of successful attackagainst an RSA user usually lies with implementation details, not in the underlying theory.

Page 218: MATH 135 Course Note

Part V

Bijections and Counting

218

Page 219: MATH 135 Course Note

Chapter 31

Injections and Bijections

31.1 Objectives

The content objectives are:

1. Define injection.

2. Read and discover proofs that specified functions are injections.

3. Define bijection.

31.2 One-to-one (Injective)

31.2.1 Definition

The definition of onto or surjective functions contained nested quantifiers that were different.The next definition uses nested quantifiers that are the same.

Definition 31.2.1

One-to-one,Injective

Let S and T be two sets. A function f : S → T is one-to-one (or injective) if and only iffor every x1 ∈ S and every x2 ∈ S, f(x1) = f(x2) implies that x1 = x2.

Just as with onto functions, let’s parse the definition beginning with the universal quan-tifier “For every”. Recall that we must identify the quantifier, variable, domain and opensentence.

Quantifier: ∀Variable: x1Domain: SOpen sentence: for every x2 ∈ S, f(x1) = f(x2) implies that x1 = x2

The open sentence itself contains a quantifier. We can again identify the four parts of thisquantifier.

219

Page 220: MATH 135 Course Note

220 Chapter 31 Injections and Bijections

Quantifier: ∀Variable: x2Domain: SOpen sentence: f(x1) = f(x2) implies that x1 = x2

It is important to note that the open sentence is an implication!

We should be able to determine the structure of any proof that a function is one-to-one.The order of quantifiers is

For all For all

so we would expect the proof to be structured

Select Method Select Method

The Select Method selects a representative mathematical object within the appropriatedomain, and shows that the object satisfies the corresponding open sentence. So a one-to-one proof will look like this.

Proof in Progress

1. Let s1 ∈ S. This comes from the Select Method.

2. Let s2 ∈ S. This comes from the Select Method.

3. Suppose that f(s1) = f(s2). This is the hypothesis of the open sentence. Since wewish to show that the open sentence is true, we assume the hypothesis is true.

4. Now we show that s1 = s2. This is the conclusion of the open sentence. Since wewish to show that the open sentence is true, we must show the conclusion is true.

31.2.2 Reading

Let’s work through an example. Notice how closely the proof follows the structure of aone-to-one proof.

Proposition 1 Let m 6= 0 and b be fixed real numbers. The function f : R→ R defined by f(x) = mx+ bis one-to-one.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Let x1, x2 ∈ S.

2. Suppose that f(x1) = f(x2).

3. Now we show that x1 = x2.

4. Since f(x1) = f(x2), mx1 + b = mx2 + b.

5. Subtracting b from both sides and dividing by m gives x1 = x2 as required.

Page 221: MATH 135 Course Note

Section 31.2 One-to-one (Injective) 221

Let’s perform an analysis of this proof.

Analysis of Proof The definition of one-to-one uses a nested quantifier.

Hypothesis: m 6= 0 and b are fixed real numbers. f(x) = mx+ b.

Conclusion: f(x) is one-to-one.

Core Proof Technique: Nested quantifiers.

Preliminary Material: Let us remind ourselves of the definition of the definingproperty of one-to-one as it applies in this situation.

For every x1 ∈ R and every x2 ∈ R, f(x1) = f(x2) implies that x1 = x2.

Sentence 1 Let x1, x2 ∈ R.

The author combines the first two sentences of the structure of a one-to-one proof intoa single sentence. This works because both of the first two quantifiers in the definitionare universal quantifiers and so the author uses the Select Method twice. That is, theauthor chooses elements (x1 and x2) in the domain (R). The author must now showthat the open sentence is satisfied (f(x1) = f(x2) implies that x1 = x2).

Sentences 2 and 3 Suppose that f(x1) = f(x2). Now we show that x1 = x2.

The open sentence that must be verified is an implication, and f(x1) = f(x2) is thehypothesis. To prove an implication, we assume the hypothesis and demonstrate thatthe conclusion, x1 = x2, is true.

Sentence 3 Since f(x1) = f(x2), mx1 + b = mx2 + b.

This is just substitution.

Sentence 4 Subtracting b from both sides and dividing by m gives x1 = x2 as required.

Here the author confirms that the open sentence is satisfied. Observe that the hy-pothesis m 6= 0 is used here.

31.2.3 Discovering

Having read a proof, let’s discover one.

Proposition 2 The function f : [1, 2]→ [4, 7] defined by f(x) = x2 + 3 is one-to-one.

We can begin with the basic proof structure that we discussed earlier.

Proof in Progress

1. Let x1, x2 ∈ [1, 2].

2. Suppose that f(x1) = f(x2).

3. Now we show that x1 = x2. To be completed.

Page 222: MATH 135 Course Note

222 Chapter 31 Injections and Bijections

The obvious starting point is to write down f(x1) = f(x2) and see if algebraic manipulationcan take us to x1 = x2. And that is indeed the case.

f(x1) = f(x2)⇒ x21 + 3 = x22 + 3⇒ x21 = x22

We need to be careful here since x21 = x22 does not generally imply x1 = x2. For example,x1 = 5 and x2 = −5 satisfy x21 = x22 but not x1 = x2. However, in this case becausethe domain is [1, 2] we are justified in taking the positive square root and concluding thatx1 = x2. Here is a complete proof.

Proof: Let x1, x2 ∈ [1, 2]. Suppose that f(x1) = f(x2). But then x21 + 3 = x22 + 3 andso x21 = x22. Since x1, x2 ∈ [1, 2] we can take the positive square root of both sides to getx1 = x2.

Just as with onto functions, the choice of the domain and codomain for the function isimportant. Consider the statement

Statement 3 The function f : R→ R defined by f(x) = x2 + 3 is one-to-one.

This is very similar to the proposition we just proved, but this statement is false. It is easierto see why by working with the contrapositive of f(x1) = f(x2)⇒ x1 = x2. Recall that thecontrapositive is logically equivalent to the original statement. For one-to-one functions, wecan make the following statement which is equivalent to the definition.

Statement 4 Let S and T be two sets. A function f : S → T is one-to-one (or injective) if and only iffor every x1 ∈ S and every x2 ∈ S, if x1 6= x2, then f(x1) 6= f(x2).

For the function f(x) = x2 + 3, consider x1 = 1 and x2 = −1. It is indeed the casethat x1 6= x2, but f(x1) = 4 = f(x2) which contradicts the definition of one-to-one. So,f : R→ R defined by f(x) = x2 + 3 is not one-to-one.

31.2.4 A Difficult Proof

The next proposition asserts that the composition of one-to-one functions is also one-to-one.

Proposition 5 Let f : T → U and g : S → T be one-to-one functions. Then f ◦ g is a one-to-one function.

Analysis of Proof The definition of one-to-one uses nested quantifiers.

Hypothesis: f : T → U and g : S → T are both one-to-one functions.

Conclusion: f ◦ g is one-to-one.

Core Proof Technique: Nested quantifiers.

Preliminary Material: Let us recast the definition of one-to-one for f ◦ g.

For every x1 ∈ S and every x2 ∈ S, (f ◦g)(x1) = (f ◦g)(x2) implies thatx1 = x2.

Page 223: MATH 135 Course Note

Section 31.3 Bijections 223

There are three instances of one-to-one in the proposition. Two occur in the hypothesisand are associated with the functions f and g. The third occurs in the conclusion and isassociated with the function f ◦ g. Let’s use the structure of a one-to-one proof as ourstarting point.

Proof in Progress

1. Let x1, x2 ∈ S.

2. Suppose that (f ◦ g)(x1) = (f ◦ g)(x2).

3. Now we show that x1 = x2.

4. To be completed.

5. Hence, x1 = x2 as required.

Since f and g are not specified, this may seem impossible. But let’s “follow our nose” andsee what happens. Since (f ◦ g)(x1) = (f ◦ g)(x2), we know that f(g(x1)) = f(g(x2)).But since f is one-to-one, we know that g(x1) = g(x2). If this seems confusing, since f isone-to-one, f(y1) = f(y2) implies y1 = y2. In this case, y1 = g(x1) and y2 = g(x2). Nowback to g(x1) = g(x2). Since g is one-to-one, we know that x1 = x2, which is exactly whatwe needed to show.

A proof might look like the following.

Proof: Let x1, x2 ∈ S. Suppose that (f ◦g)(x1) = (f ◦g)(x2). Since (f ◦g)(x1) = (f ◦g)(x2),we know that f(g(x1)) = f(g(x2)). Since f is one-to-one, we know that g(x1) = g(x2). Andsince g is one-to-one, x1 = x2 as required.

31.3 Bijections

An extraordinarily useful class of functions is described next.

Definition 31.3.1

Bijective

A function f : S → T is bijective if and only if f is both surjective and injective.

Example 1 We have already shown that for m 6= 0 and b a fixed real numbers, the function f : R→ Rdefined by f(x) = mx+ b is both surjective and injective. Hence, f is bijective.

Let’s summarize the definitions related to functions.

Page 224: MATH 135 Course Note

224 Chapter 31 Injections and Bijections

REMARK

Suppose f is a rule that defines a mapping from set S to set T .

• f is a function if it assigns to each element s ∈ S exactly one element f(s) ∈ T .

• f is surjective if, for each element t ∈ T , there is at least one element s ∈ S so thatf(s) = t.

• f is injective if, for each element t ∈ T , there is at most one element s ∈ S so thatf(s) = t.

• f is bijective if, for each element t ∈ T , there is exactly one element s ∈ S so thatf(s) = t.

Bijections are commonly used in calculus to identify invertible functions. Bijections areused in linear algebra and group theory to show that two algebraic structures, which maylook very different, are essentially the same. We will use bijections to count.

31.4 Practice

1. For each of the following mappings f , first determine whether or not f is a function.If f is a function, determine whether or not f is surjective, injective or bijective. Inall cases, provide reasons for your answer.

(a) Let S be the set of words in the English language. Let T be the English alphabet,that is, T = {a, b, c, . . . , z}. The mapping f : S → T maps a word to the word’sfirst letter. For example, f(mathematics) = m.

(b) Let f : N→ N be defined by

f(n) =∑d|n

d

That is, n maps to the sum of the divisors of n.

(c) Let f : Z7 → Z7 be defined by f(x) = [3]x.

2. Prove the following statement: If f and g are bijections, then f ◦ g is a bijection.

Page 225: MATH 135 Course Note

Chapter 32

Counting

32.1 Objectives

The content objectives are:

1. Define what it means for two sets to have the same cardinality.

2. State and prove the Cardinality of Disjoint Sets.

3. State and prove the Cardinality of Intersecting Sets.

32.2 African Shepherds

Many, many years ago, I lived high up in the mountains of southern Africa. Herd boyswould be sent with their flocks of sheep and goats to the high pastures to allow the animalsto graze. The herd boys were uneducated, and very few knew how to “count”. So, how didthey know if they had the right number of animals at any given time? An animal mightget lost at night, be out of sight among the ridges during the day, or be taken by jackals.

Before the herd boys were sent out from their family compounds they would be given avery small bag that contained pebbles, one pebble for each animal. So, to “count” theanimals, they would simply match up a pebble against each animal they could see. If therewere more pebbles than animals, an animal was missing. If there were more animals thanpebbles, another animal had joined their flock, presumably from a nearby herd. If therewas exactly one pebble for each animal, the herd boy had the correct number of animals.

The herd boys “counted” by forming a bijection between the set of pebbles in their bagand the set of animals in their flock. When we count by saying 1, 2, 3, . . . we are creatinga bijection between a subset of the integers and the set of objects we are counting. Now,how do we formalize this idea?

225

Page 226: MATH 135 Course Note

226 Chapter 32 Counting

32.3 What Does It Mean To Count?

Recall that we used the notation |S| to mean the cardinality, or number of elements, in theset S. Now it is time to be clear about what that really means.

Definition 32.3.1

Cardinality

If there exists a bijection between the sets S and T , we say that the sets have the samecardinality and we write |S| = |T |.

Let Nn denote the set of all natural numbers less than or equal to n.

• N0 = ∅

• N1 = {1}

• N2 = {1, 2}

• N3 = {1, 2, 3}

• Nn = {1, 2, 3, . . . , n}

Definition 32.3.2

Number ofElements, Finite,

Infinite

If there exists a bijection between a set S and Nn, we say that the number of elementsin S is n, and we write |S| = n. Moreover, we also say that S is a finite set. If no bijectionexists between a set S and Nn, we say that S is an infinite set.

This formal definition corresponds exactly to what herd boys do with pebbles, what childrendo when “counting” on fingers, and what we do when “counting” with the words “one, two,three”. This definition extends the bijection notion to infinite sets as well, but that extensionbrings some weirdness which we will see next lecture.

32.4 Showing That A Bijection Exists

To show that |S| = |T | using a bijection is equivalent to proving a proposition of thefollowing form.

Proposition 1 Let S = . . . Let T = . . . Then there exists a bijection f : S → T . Hence, |S| = |T |.

The presence of an existential quantifier in the conclusion suggests we use the ConstructMethod. Let’s begin by identifying the parts of the quantified sentence.

Quantifier: ∃Variable: fDomain: all functions from S to TOpen sentence: f : S → T is a bijection.

Page 227: MATH 135 Course Note

Section 32.5 Finite Sets 227

To show that the open sentence is true, we must show that f is a bijection, that is, we mustshow that f is surjective and injective. So any proof that |S| = |T | which uses bijectionswill have the following structure.

Proof in Progress

1. Consider the rule f : S → T defined by f(s) = to be completed.

2. We show that f is a function. This shows f is in the domain.

3. We show that f is surjective. To be completed.

4. We show that f is injective. To be completed.

5. Hence, f : S → T is a bijection and |S| = |T |.

Since we already know how to handle Sentences 2 – 4, we can produce a more completestructure.

Proof in Progress

1. Consider the rule f : S → T defined by f(s) = to be completed.

2. We show that f is a function. Since a function is defined by unique values for elementsin the domain, we use either of the uniqueness methods. For example: Let s ∈ S andlet t1 = f(s) and t2 = f(s) where t1 6= t2. Derive a contradiction.

3. We show that f is surjective. Let t ∈ T . Consider s = to be completed. We show thats ∈ S to be completed. Now we show that f(s) = t to be completed.

4. We show that f is injective. Let s1, s2 ∈ S and suppose that f(s1) = f(s2). Now weshow that s1 = s2 to be completed.

5. Hence, f : S → T is a bijection and |S| = |T |.

The structure contains three parts which are, in themselves, proofs: a proof that f is afunction, a proof that f is surjective, and a proof that f is injective.

We should emphasize that bijections are not the only way to show that two sets have thesame cardinality. We can use bijections to establish propositions which are simpler to workwith, and then use the propositions.

32.5 Finite Sets

We begin by proving two fundamental theorems about counting and sets for which youprobably already have an intuitive understanding but may never have proved.

Definition 32.5.1

Disjoint

Sets S and T are disjoint if S ∩ T = ∅.

Page 228: MATH 135 Course Note

228 Chapter 32 Counting

Proposition 2 (Cardinality of Disjoint Sets (CDS))

If S and T are disjoint finite sets, then

|S ∪ T | = |S|+ |T |

A simple example can be taken from any room in any building. If S is a set of m chairs inthe room, and T is a set of n tables in the room, then the number of tables and chairs ism+ n.

Before we read a proof of the Cardinality of Disjoint Sets, it is important to keep two thingsin mind. First, we are proving a statement about set cardinality, not a statement aboutset equality. Second, to establish basic properties of set cardinality we must work withbijections.

The intuitive idea underlying the proof is very simple. Count the first m elements in S, andthen continue counting the next n elements in T . As you will see, a formal proof is morecomplicated. Note how closely the proof follows the structure described in the previoussection.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Since S is a finite set, there exists a bijection f : S → Nm for some non-negativeinteger m, and |S| = m.

2. Since T is a finite set, there exists a bijection g : T → Nn for some non-negativeinteger n, and |T | = n.

3. Construct a rule h : S ∪ T → Nm+n as follows.

h(x) =

{f(x) if x ∈ Sg(x) +m if x ∈ T

4. To show that h is a function, suppose there exist x ∈ S ∪ T and y1, y2 ∈ Nm+n suchthat h(x) = y1 and h(x) = y2 and y1 6= y2. Because the sets S and T are disjoint, xcan only be in one of S or T . If x ∈ S, then y1 = h(x) = f(x) and y2 = h(x) = f(x).Since f is a function, f(x) is unique. But then y1 = f(x) = y2, a contradiction. Ifx ∈ T , then y1 = h(x) = g(x) + m and y2 = h(x) = g(x) + m. Since g is a function,g(x) is unique. But then y1 = g(x) +m = y2, a contradiction.

5. To show that h is surjective, let y ∈ Nm+n. If y ≤ m, then because f is surjective,there exists an element x ∈ S so that f(x) = y, hence h(x) = y. If m+1 ≤ y ≤ m+n,then because g is surjective, there exists an element x ∈ T so that g(x) = y −m andso h(x) = (y −m) +m = y.

6. To show that h is injective, let x1, x2 ∈ S ∪ T and suppose that h(x1) = h(x2). Ifh(x) ≤ m then h(x) = f(x) so if h(x1) ≤ m we have

h(x1) = h(x2)⇒ f(x1) = f(x2)

But since f is a bijection f(x1) = f(x2) implies x1 = x2 as needed.

Page 229: MATH 135 Course Note

Section 32.5 Finite Sets 229

If h(x) > m then h(x) = g(x) so if h(x1) > m we have

h(x1) = h(x2)⇒ g(x1) +m = g(x2) +m⇒ g(x1) = g(x2)

But since g is a bijection g(x1) = g(x2) implies x1 = x2 as needed.

Since h is a function which is both injective and surjective, h is bijective.

7. Thus|S ∪ T | = |Nm+n| = m+ n = |Nm|+ |Nn| = |S|+ |T |

Let’s spend some time analyzing the proof.

Analysis of Proof As usual, we begin with the hypothesis and the conclusion.

Hypothesis: S and T are disjoint finite sets

Conclusion: |S ∪ T | = |S|+ |T |

Sentence 1 Since S is a finite set, there exists a bijection f : S → Nm for some non-negative integer m, and |S| = m.

This makes use of the hypothesis and the definition of Nm. The second sentence issimilar.

Sentence 2 Since T is a finite set, there exists a bijection g : T → Nn for some non-negative integer n, and |T | = n.

Sentence 3 Before looking at Sentence 3, we are going to skip ahead to the last sentence.Fortunately, when reading a proof we are free to do that. This last sentence driveswhat we need to do. Sentence 3 constructs a rule h : S ∪ T → Nm+n. How are wegoing to use h?

|S ∪ T | = |Nm+n| because of the bijection h

= m+ n from the cardinality of the finite set Nm+n

= |Nm|+ |Nn| from the cardinality of the finite sets Nm and Nn= |S|+ |T | because of the bijections f and g

The first equality sign relies on the bijection h. All of the remaining equality signscan be justified from the definition of N` or Sentences 1 and 2. The difficult part isconstructing h and then establishing that h is a bijection. Sentence 3 constructs amapping h : S ∪ T → Nm+n as follows.

h(x) =

{f(x) if x ∈ Sg(x) +m if x ∈ T

Notice that h is defined in terms of f and g. Note also that elements in the set S willbe mapped to the integers 1, 2, . . . ,m and the elements in the set T will be mappedto the integers m+ 1,m+ 2, . . . ,m+ n.

Having defined a mapping h, the author must still establish

• h is a function

Page 230: MATH 135 Course Note

230 Chapter 32 Counting

• h is surjective

• h is injective

This occurs in the next three paragraphs, each of which is a proof in its own right.

Paragraph 4 To show that h is a function, . . .

In this paragraph the author establishes that h is a function by using the definitionof function. The checking of each sentence is left to the reader.

Paragraph 5 To show that h is surjective, . . .

In this paragraph the author establishes that h is surjective by using the definition ofsurjective. The checking of each sentence is left to the reader.

Paragraph 6 To show that h is injective, . . .

In this paragraph the author establishes that h is injective by using the definition ofinjective. The checking of each sentence is left to the reader.

Who would have thought that counting was so complicated!

Proposition 3 (Cardinality of Intersecting Sets (CIS))

If S and T are any finite sets, then

|S ∪ T | = |S|+ |T | − |S ∩ T |

After having just endured an arduous proof, you might be disinclined to go looking for acomplicated mapping and then proving that it is a bijection. That’s sensible. What we cando in this case is to use the Cardinality of Disjoint Sets by writing S∪T and T as the unionof disjoint sets.

Proof in Progress

1. S ∪ T = S ∪ (T − S) where S and T − S are disjoint sets. (Draw a Venn diagram tomake this clear.)

2. T = (S∩T )∪ (T −S) where S∩T and T −S are disjoint sets. (Draw a Venn diagramto make this clear.)

3. To be completed.

But now that we have the unions of finite disjoint sets we can invoke the Cardinality ofDisjoint Sets.

Proof in Progress

1. S ∪ T = S ∪ (T − S) where S and T − S are disjoint sets.

2. Hence, by the Cardinality of Disjoint Sets, |S ∪ T | = |S|+ |T − S|.

3. T = (S ∩ T ) ∪ (T − S) where S ∩ T and T − S are disjoint sets.

Page 231: MATH 135 Course Note

Section 32.5 Finite Sets 231

4. Hence, by the Cardinality of Disjoint Sets, |T | = |S ∩ T |+ |T − S|

5. To be completed.

Subtracting the two cardinality equations and rearranging will give us what we need. Takea minute to read a complete proof.

Proof: Since S and T − S are disjoint sets, and

S ∪ T = S ∪ (T − S)

the Cardinality of Disjoint Sets implies

|S ∪ T | = |S|+ |T − S|

Since S ∩ T and T − S are disjoint sets, and

T = (S ∩ T ) ∪ (T − S)

the Cardinality of Disjoint Sets implies

|T | = |S ∩ T |+ |T − S|

Subtracting the two cardinality equations gives

|S ∪ T | − |T | = |S| − |S ∩ T |

hence|S|+ |T | − |S ∩ T |

as required.

Page 232: MATH 135 Course Note

Chapter 33

Cardinality of Infinite Sets

33.1 Objectives

The content objectives are:

1. State and prove the Cardinality of Subsets of Finite Sets.

2. Discover a proof that |N| = |2N|.

3. State and prove that |Q>0| = |N|.

4. State and prove that |N| 6= |(0, 1)|.

33.2 Infinite Sets Are Weird

With respect to counting, finite sets behave pretty much as we expect. For example, if S isa proper subset of T , then |S| < |T |.

Proposition 1 (Cardinality of Subsets of Finite Sets (CSFS))

If S and T are finite sets, and S ⊂ T , then |S| < |T |.

The proof uses the same partitioning idea that was used in the proof of the Cardinality ofIntersecting Sets.

Proof: The sets S and T − S are disjoint sets where

S ∪ (T − S) = T

By the Cardinality of Disjoint Sets and the fact above

|S|+ |T − S| = |S ∪ (T − S)| = |T |

Since S ⊂ T , T − S is a non-empty finite subset so |T − S| > 0. Hence

|S|+ |T − S| = |T | ⇒ |S| < |T |

232

Page 233: MATH 135 Course Note

Section 33.2 Infinite Sets Are Weird 233

This is not the case for infinite sets. Consider the following proposition.

Proposition 2 (|N| = |2N|)

Let 2N be the set of positive even natural numbers. Then |N| = |2N|.

Let’s be clear about what this proposition is saying. Even though the set of positive evennumbers is a proper subset of the set of natural numbers, and even though there are infinitelymany odd numbers excluded from the set even numbers, the cardinality of the sets of evennumbers and all natural numbers is the same!

How would we prove this? Two sets have the same cardinality if and only if there exists abijection between the two sets. So we can use the same proof structure that was used inthe previous chapter to build a bijection between two sets.

Proof in Progress

1. Consider the rule f : N→ 2N defined by f(s) = to be completed.

2. We show that f is a function. Let s ∈ N and let t1 = f(s) and t2 = f(s) where t1 6= t2.Derive a contradiction.

3. We show that f is surjective. Let t ∈ 2N. Consider s = to be completed. We showthat s ∈ N to be completed. Now we show that f(s) = t to be completed.

4. We show that f is injective. Let s1, s2 ∈ N and suppose that f(s1) = f(s2). Now weshow that s1 = s2 to be completed.

5. Hence, f : N→ T is a bijection and |N| = |2N|.

How do we construct a bijection? There is an obvious mapping from N to 2N:

f(s) = 2s

N 1 2 3 4 . . .↓ ↓ ↓ ↓

2N 2 4 6 8 . . .

Let’s update the proof in progress.

Proof in Progress

1. Consider the rule f : N→ 2N defined by f(s) = 2s.

2. We show that f is a function. Let s ∈ N and let t1 = f(s) and t2 = f(s) where t1 6= t2.Derive a contradiction.

3. We show that f is surjective. Let t ∈ 2N. Consider s = to be completed. We showthat s ∈ N to be completed. Now we show that f(s) = t to be completed.

4. We show that f is injective. Let s1, s2 ∈ N and suppose that f(s1) = f(s2). Now weshow that s1 = s2 to be completed.

5. Hence, f : N→ 2N is a bijection and |N| = |2N|.

Page 234: MATH 135 Course Note

234 Chapter 33 Cardinality of Infinite Sets

Exercise 1 Complete the proof that |N| = |2N|.

33.3 Infinite Sets are Even Weirder Than You Thought

There are infinitely many rational numbers between the natural numbers 1 and 2 so it isa real shock to most people that the cardinality of the positive rational numbers and thenatural numbers is the same.

Proposition 3 (|Q>0| = |N|)

LetQ>0 =

{ ab

∣∣∣ a, b ∈ N, gcd(a, b) = 1}

Then |Q>0| = |N|.

To prove this we will make use of the following proposition, which is not difficult to prove,but requires some facts not yet covered in the course.

Proposition 4 ( Even-Odd Factorization of Natural Numbers (EOFNN) )

Any natural number n can be written uniquely as n = 2iq where i is a non-negative integerand q is an odd natural number.

Example 1 Here are some examples of the Even-Odd Factorization of Natural Numbers.

60 = 22 × 15

64 = 26 × 1

65 = 20 × 65

Here is a proof that |Q>0| = |N|. Notice how closely it follows the proof structure that wehave been using.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Consider the rule f : Q>0 → N defined by f(a/b) = 2a−1(2b− 1).

2. We show that f is a function. Let a/b ∈ Q>0 and let t1 = f(a/b) and t2 = f(a/b)where t1 6= t2. Since gcd(a, b) = 1, a/b is the unique representative of fractions equalto a/b. Hence, t1 = f(a/b) = 2a−1(2b − 1) = t2, contradicting the assumption thatt1 6= t2.

Page 235: MATH 135 Course Note

Section 33.4 Not All Infinite Sets Have The Same Cardinality 235

3. We show that f is surjective. Let t ∈ N. By the Even-Odd Factorization of NaturalNumbers, t = 2iq where i is a non-negative integer and q is an odd natural number.Since q is odd, there exists a natural number b such that q = 2b− 1. If t is odd thent = 20(2b − 1) and f(1/b) = t. If t is even then there exists a natural number a sothat t = 2a−1(2b− 1) and f(a/b) = t.

4. We show that f is injective. Let a/b, c/d ∈ Q>0 and suppose that f(a/b) = f(c/d).But then

2a−1(2b− 1) = 2c−1(2d− 1)⇒ (2a−1 = 2c−1) and (2b− 1 = 2d− 1)

⇒ (a = c) and (b = d)

⇒ a

b=c

d

as required.

5. Hence, f : Q>0 → N is a bijection and |Q>0| = |N|.

You might well ask, do all infinite sets have the same size? The surprising answer is no.

33.4 Not All Infinite Sets Have The Same Cardinality

Recall that (0, 1) denotes the open interval of real numbers between 0 and 1. That is

(0, 1) = {x ∈ R | 0 < x < 1}

Proposition 5 (|N| 6= |(0, 1)|)

The set of natural numbers and the open interval (0, 1) of real numbers do not have thesame cardinality. That is, |N| 6= |(0, 1)|

Proof: By way of contradiction, assume that |N| = |(0, 1)|. But then some bijectionf : N→ |(0, 1)| must exist. Write each element of |(0, 1)| as an infinite decimal and list allof the real numbers in (0, 1) as follows.

f(1) = 0.a11a12a13a14 . . .

f(2) = 0.a21a22a23a24 . . .

f(3) = 0.a31a32a33a34 . . .

...

f(n) = 0.an1an2an3an4 . . .

...

Construct the real number c = 0.c1c2c3c4 . . . as follows. For ci, choose any digit from1, 2, 3, . . . , 8 with the property that ci 6= aii. The number c does not end in an infinitesequence of 0’s or 9’s so has only one decimal representation (a subtlety that requires itsown explanation in another course). The real number c appears nowhere in the list since itdiffers from f(i) in position i for every i.

But then f is not surjective, hence not bijective which contradicts our assumption.

Page 236: MATH 135 Course Note

236 Chapter 33 Cardinality of Infinite Sets

This chapter raises a whole set of questions about infinite sets.

• How many “infinities” are there?

• Can we say that the cardinality of one infinite set is less than or greater than anotherinfinite set?

• Can there be infinite sets whose cardinality lies between that of other infinite sets ofdistinct cardinalities?

• How does one construct “new” infinite sets?

These are very interesting questions with even more interesting answers. Unfortunately, thequestions and answers will have to be left to another course.

Page 237: MATH 135 Course Note

Chapter 34

Practice, Practice, Practice:Bijections and Cardinality

34.1 Objectives

This class provides an opportunity to practice working with bijections and cardinality.

34.2 Worked Examples

Example 1 For each of the following functions, determine if the function is a surjection, injection, orbijection.

1. f : R→ R defined by f(x) = ex.

Solution: This function is not surjective. Consider the real number −1. Sincef(x) > 0 for all x ∈ R, there is no real number x0 so that f(x0) = −1. To showthat this function is injective, let x1, x2 ∈ R and suppose that ex1 = ex2 . Taking thenatural log of both sides gives ln(ex1) = ln(ex2) which implies that x1 = x2. Since fis not surjective, it is not bijective.

2. f : R→ (0,+∞) defined by f(x) = ex.

Solution: To show that this function is surjective, let y ∈ (0,+∞). Considerx0 = ln y. Now x0 ∈ R and f(x0) = ex0 = eln y = y. To show that this function isinjective, let x1, x2 ∈ R and suppose that ex1 = ex2 . Taking the natural log of bothsides gives ln(ex1) = ln(ex2) which implies that x1 = x2. Since f is both surjectiveand injective, f is bijective.

3. Let p be a prime and let f : Zp → Zp be defined by f(x) = [3]x.

Solution: Since p is a prime, [3] has an inverse by the corollary Existence of Inversesin Zp. To show that this function is surjective, let y ∈ Zp. Consider x0 = [3]−1y.Now x0 ∈ Zp and f(x0) = [3]([3]−1y) = ([3][3]−1)y = y. To show that this functionis injective, let x1, x2 ∈ Zp and suppose that [3]x1 = [3]x2. Multiplying both sidesby [3]−1 gives [3]−1([3]x1) = [3]−1([3]x2) which implies that x1 = x2. Since f is bothsurjective and injective, f is bijective.

237

Page 238: MATH 135 Course Note

238 Chapter 34 Practice, Practice, Practice: Bijections and Cardinality

4. f : Z→ Z7 defined by f(x) = [x].

Solution: Recall that Z7 = {[0], [1], [2], [3], [4], [5], [6]}. Since f(i) = [i] fori = 0, 1, 2, 3, 4, 5, 6, f is surjective. This function is not injective since 0 and 7 bothmap to [0]. Since f is not injective, it is not bijective.

5. f : N→ N where d(n) is the number of natural number divisors of n.

Solution: To show that this function is surjective, let y ∈ N. Since the naturalnumber 2y−1 has the y divisors 20, 21, 22, . . . , 2y−1, f(2y−1) = y so f is surjective.This function is not injective since d(2) = d(3) = 2. Since f is not injective, it is notbijective.

Example 2 Let S denote the set of all finite subsets of the natural numbers. Let D(n) denote the set ofall natural number divisors of n. Thus, D(12) = {1, 2, 3, 4, 6, 12}. Is the function f : N→ Sdefined by D(n) a surjection?

Solution: D is not a surjection. Consider any set without the element 1, T = {2, 3} forexample. Suppose there exists an integer n so that D(n) = T . Since 1 | n, 1 must be in T ,but it is not. Hence, no natural number can map to T .

Example 3 Prove the following proposition.

Proposition 1 Let S, T, U be sets. If |S| = |T | and |T | = |U |, then |S| = |U |.

Proof: Since |S| = |T |, there exists a bijection f : S → T . Since |T | = |U |, there exists abijection g : T → U . By Proposition 5 in Section 31.2.4, g ◦ f : S → U is a bijection fromS to U so |S| = |U |.

Page 239: MATH 135 Course Note

Part VI

Complex Numbers and Euler’sFormula

239

Page 240: MATH 135 Course Note

Chapter 35

Complex Numbers

35.1 Objectives

The content objectives are :

1. N ⊂ Z ⊂ Q ⊂ R ⊂ C

2. Define: complex number, C, real part, imaginary part

3. Operations: complex addition, complex multiplication, equality of complex numbers

4. State and prove properties of complex numbers.

35.2 Different Equations Require Different Number Systems

When humans first counted, we tallied. We literally made notches on sticks, stones andbones. Thus the natural numbers, N, were born. But it wouldn’t be long before thenecessity of fractions became obvious. One animal to be shared by four people (we willassume uniformly) meant that we had to develop the notion of 1/4. Though it would nothave been expressed this way, the equation

4x = 1

does not have a solution in N and so we would have had to extend our notion of numbersto include fractions, the rationals.

Q ={ ab

∣∣∣ a, b ∈ Z, b 6= 0}

This is an overstatement historically, because recognition of zero and negative numberswhich are permitted in Q were very slow to come. But even these new numbers would nothelp solve equations of the form

x2 = 2

which would arise naturally from isosceles right angled triangles. For this, the notionof number had to be extended to include irrational numbers, which combined with therationals, give us the real numbers.

240

Page 241: MATH 135 Course Note

Section 35.3 Complex Numbers 241

Eventually, via Hindu and Islamic scholars, western mathematics began to recognize andaccept both zero and negative numbers. Otherwise, equations like

3x = 5x

or2x+ 4 = 0

have no solution. Thus, mathematicians recognized that

N ⊂ Z ⊂ Q ⊂ R

but even R was inadequate because equations of the form

x2 + 1 = 0

had no real solutions.

And so, our number system was extended again.

35.3 Complex Numbers

Definition 35.3.1

Complex Number

A complex number z in standard form is an expression of the form x+yi where x, y ∈ R.The set of all complex numbers is denoted by

C = {x+ yi | x, y ∈ R}

Example 1 Some examples are 3 + 4i, 0 + 5i (usually written 5i), 7− 0i (usually written 7) and 0 + 0i(usually written 0).

Definition 35.3.2

Real Part,Imaginary Part

For a complex number z = x+ yi, the real number x is called the real part and is written<(z) and the real number y is called the imaginary part and is written =(z).

So <(3 + 4i) = 3 and =(3 + 4i) = 4. If z is a complex number where =(z) = 0, we will treatz as a real number and we will not write the term containing i. For example, z = 3 + 0iwill be treated as a real number and will be written z = 3. Thus

R ⊂ C

and soN ⊂ Z ⊂ Q ⊂ R ⊂ C

One has to wonder how much further the number system needs to be extended!

Definition 35.3.3

Equality

The complex numbers z = x+ yi and w = u+ vi are equal if and only if x = u and y = v.

Page 242: MATH 135 Course Note

242 Chapter 35 Complex Numbers

Definition 35.3.4

Addition

Addition is defined as

(a+ bi) + (c+ di) = (a+ c) + (b+ d)i

Example 2(1 + 7i) + (2− 3i) = (1 + 2) + (7− 3)i = 3 + 4i

Definition 35.3.5

Multiplication

Multiplication is defined as

(a+ bi) · (c+ di) = (ac− bd) + (ad+ cb)i

Example 3 Let’s begin with what is really the defining property of C.

i · i = (0 + 1i) · (0 + 1i) = (0 · 0− 1 · 1) + (0 · 1 + 0 · 1)i = −1

This property that i2 = −1 is what gives complex numbers their strangeness and theirstrength. In the next example, note that the definition of multiplication coincides exactlywith the usual binomial multiplication where i2 is replaced by −1.

(1 + 7i) · (2− 3i) = (1 · 2− 7 · (−3)) + (1 · (−3) + 7 · 2)i = 23 + 11i

The multiplication symbol is usually omitted and we write zw or (a+ bi)(c+ di).

Exercise 1 Let u = 3 + i and v = 2− 7i. Compute

1. u+ v

2. u− v

3. uv

4. u2v

5. u3

6.v

u(write the solution in the form x+ yi where x, y ∈ R)

Solution:

1. u+ v = (3 + i) + (2− 7i) = 5− 6i

2. u− v = (3 + i)− (2− 7i) = 1 + 8i

3. uv = (3 + i)(2− 7i) = (6− (−7)) + (−21 + 2)i = 13− 19i

4. u2v = (3 + i)2(2− 7i) = (3 + i)((3 + i)(2− 7i)) = (3 + i)(13− 19i) = 58− 44i

Page 243: MATH 135 Course Note

Section 35.3 Complex Numbers 243

5. u3 = (3 + i)3 = (3 + i)2(3 + i) = (8 + 6i)(3 + i) = 18 + 26i

6.v

u=

2− 7i

3 + i=

2− 7i

3 + i· 3− i

3− i=−1− 23i

10=−1

10+−23

10i

Exercise 2 Compute

1. i4k for any non-negative integer k

2. i4k+1 for any non-negative integer k

3. i4k+2 for any non-negative integer k

4. i4k+3 for any non-negative integer k

Solution:

1. i4k = 1 for any non-negative integer k

2. i4k+1 = i for any non-negative integer k

3. i4k+2 = −1 for any non-negative integer k

4. i4k+3 = −i for any non-negative integer k

The usual properties of associativity, commutativity, identities, inverses and distributivitythat we associate with rational and real numbers also apply to complex numbers.

Proposition 1 Let u, v, z ∈ C. Then

1. Associativity of addition: (u+ v) + z = u+ (v + z)

2. Commutativity of addition: u+ v = v + u

3. Additive identity: 0 = 0 + 0i has the property that z + 0 = z

4. Additive inverses: If z = x+ yi then there exists an additive inverse of z, written −zwith the property that z+(−z) = 0. The additive inverse of z = x+yi is −z = −x−yi.

5. Associativity of multiplication: (u · v) · z = u · (v · z)

6. Commutativity of multiplication: u · v = v · u

7. Multiplicative identity: 1 = 1 + 0i has the property that z · 1 = z whenever z 6= 0.

8. Multiplicative inverses: If z = x + yi 6= 0 then there exists a multiplicative inverseof z, written z−1, with the property that z · z−1 = 1. The multiplicative inverse ofz = x+ yi is z−1 = x−yi

x2+y2.

9. Distributivity: z · (u+ v) = z · u+ z · v

Page 244: MATH 135 Course Note

244 Chapter 35 Complex Numbers

We will only prove the eighth property.

Proof: We only need to demonstrate thatx− yix2 + y2

is well-defined and that

x+ yi · x− yix2 + y2

= 1

Since z 6= 0, x2 + y2 6= 0 and sox− yix2 + y2

is well-defined. Now we simply use complex

arithmetic.

x+ yi · x− yix2 + y2

=x2 + xy − xy − y2i2

x2 + y2=x2 + y2

x2 + y2= 1

Page 245: MATH 135 Course Note

Section 35.4 More Examples 245

35.4 More Examples

1. Let z = 3+4i, u = 1−2i and w = 3i. Express each of the following in standard form.

(a) z + 3u− wi(b) z/u

Solution:

(a) z + 3u− wi = (3 + 4i) + (3− 6i) + (3) = 9− 2i

(b)z

u=

3 + 4i

1− 2i=

3 + 4i

1− 2i· 1 + 2i

1 + 2i=−5 + 10i

5= −1 + 2i

Page 246: MATH 135 Course Note

Chapter 36

Properties Of Complex Numbers

36.1 Objectives

The content objectives are:

1. Define conjugate and modulus

2. State and prove several properties of complex numbers.

36.2 Conjugate

Definition 36.2.1

Conjugate

The complex conjugate of z = x+ yi is the complex number

z = x− yi

The conjugate of z = 2 + 3i is z = 2− 3i.

Proposition 1 (Properties of Conjugates (PCJ))

If z and w are complex numbers, then

1. z + w = z + w

2. zw = z w

3. z = z

4. z + z = 2<(z)

5. z − z = 2i=(z)

We will prove the first of these properties and leave the remainder as exercises.

246

Page 247: MATH 135 Course Note

Section 36.2 Conjugate 247

Proof: Let z = x+ yi and w = u+ vi. Then

z + w = (x+ yi) + (u+ vi) (substitution)

= (x+ u) + (y + v)i (defn of addition)

= (x+ u)− (y + v)i (defn of conjugate)

= (x− yi) + (u− vi) (Properties of Addn and Mult)

= z + w (defn of conjugate)

Exercise 1 Prove each of the remaining parts of the Properties of Conjugates proposition.

Example 1 Prove: Let z ∈ C. The complex number z is a real number if and only if z = z.

Solution: Let z = x+ yi.

z is real ⇐⇒ =(z) = 0 (from the previous lecture)

⇐⇒ y = 0

⇐⇒ x+ 0i = x− 0i

⇐⇒ z = z

Exercise 2 Prove: Let z ∈ C and z 6= 0. The complex number z is purely imaginary (<(z) = 0) if andonly if z = −z.

Exercise 3 Let w and z be complex numbers in standard form. Prove that(1

w

)=

1

w

and hence ( zw

)=z

w

Page 248: MATH 135 Course Note

248 Chapter 36 Properties Of Complex Numbers

Example 2 For z 6= i define

w =z + i

z − iProve that w is a real number if and only if z is zero or purely imaginary.

Solution:

w is real ⇐⇒ w = w

⇐⇒ z + i

z − i=

(z + i

z − i

)⇐⇒ z + i

z − i=z − iz + i

⇐⇒ zz − 1 + (z + z)i = zz − 1− (z + z)i

⇐⇒ 2i(z + z) = 0

⇐⇒ z + z = 0

⇐⇒ 2<(z) = 0

⇐⇒ <(z) = 0

⇐⇒ z is zero or purely imaginary

36.3 Modulus

Definition 36.3.1

Modulus

The modulus of the complex number z = x+ yi is the non-negative real number

|z| = |x+ yi| =√x2 + y2

Example 3 The modulus of z = 2− 5i is |z| =√

(22) + (−5)2 =√

29.

Given two real numbers, say x1 and x2, we can write either x1 ≤ x2 or x2 ≤ x1. However,given two complex numbers, z1 and z2, we cannot meaningfully write z1 ≤ z2 or z2 ≤ z1.But since the modulus of a complex number is a real number, we can meaningfully write|z1| ≤ |z2|. The modulus gives us a means to compare the magnitude of two complexnumbers, but not compare the numbers themselves.

If =(z) = 0, then the modulus corresponds to the absolute values of real numbers.

Page 249: MATH 135 Course Note

Section 36.4 More Examples 249

Proposition 2 (Properties of Modulus (PM))

If z and w are complex numbers, then

1. |z| = 0 if and only if z = 0

2. |z| = |z|

3. zz = |z|2

4. |zw| = |z||w|

5. |z + w| ≤ |z|+ |w|. This is the triangle inequality.

Exercise 4 Prove each of the parts of the Properties of Modulus proposition.

36.4 More Examples

1. Find all z ∈ C which satisfy z = z2.

Solution: Let z = x + yi with x, y ∈ R. Then z = z2 gives x − yi = (x + yi)2 orx− yi = (x2 − y2) + 2xyi. Equating real and imaginary parts we have

x = x2 − y2

−y = 2xy

From the second equation we get

2xy + y = 0⇒ y(2x+ 1) = 0⇒ y = 0 or x =−1

2

If y = 0 then the first equation gives

x = x2 ⇒ x2 − x = 0⇒ x(x− 1) = 0⇒ x = 0 or x = 1

If x = −12 then the first equation gives

−1

2=

1

4− y2 ⇒ y2 =

3

4⇒ y = ±

√3

2

Thus, the solutions are

0, 1,−1

2+

√3

2i,−1

2−√

3

2i

Page 250: MATH 135 Course Note

250 Chapter 36 Properties Of Complex Numbers

36.5 Practice

1. Let z be a complex number. Prove that |z|n = |zn| for any positive integer n.

2. Find all z ∈ C which satisfy

(a) z2 + 2z + 1 = 0

(b) z2 + 2z + 1 = 0

(c) z2 =1 + i

1− i.

3. Let a, b, c ∈ C. Prove: If |a| = |b| = |c| = 1, then a+ b+ c =1

a+

1

b+

1

c.

4. Let z ∈ C, z 6= ±i. Prove thatz

1 + z2is real if and only if z is real or |z| = 1.

Page 251: MATH 135 Course Note

Chapter 37

Graphical Representations ofComplex Numbers

37.1 Objectives

The content objectives are:

1. Define complex plane, polar coordinates, polar form.

2. Convert between Cartesian and polar form.

3. Multiplication in polar form.

37.2 The Complex Plane

37.2.1 Cartesian Coordinates (x, y)

Definition 37.2.1

Complex Plane

The notation z = x + yi suggests a non-algebraic representation. Each complex numberz = x + yi can be thought of as a point (x, y) in a plane with orthogonal axes. Label oneaxis the real axis and the other axis the imaginary axis. The complex number z = x+yithen corresponds to the point (x, y) in the plane. This interpretation of the plane is calledthe complex plane or the Argand plane.

251

Page 252: MATH 135 Course Note

252 Chapter 37 Graphical Representations of Complex Numbers

Figure 37.2.1: The Complex Plane

Exercise 1 Plot the following points in the complex plane.

1. 4 + i

2. −2 + 3i

3. −2− i

37.2.2 Modulus

Recall that the modulus of the complex number z = x+ yi is the non-negative real number

|z| = |x+ yi| =√x2 + y2

There are a couple of geometric points to note about the modulus of z = x + yi. ThePythagorean Theorem is enough to prove that |z| is the distance from the origin to z inthe complex plane, and that the distance between z and w = u + vi is just |z − w| =√

(x− u)2 + (y − v)2.

Exercise 2 Sketch all of the points in the complex plane with modulus 1.

37.3 Polar Representation

There is another way to represent points in a plane which is very useful when working withcomplex numbers. Instead of beginning with the origin and two orthogonal axes, we beginwith the origin O and a polar axis which is a ray leaving from the origin. The point P (r, θ)is plotted so that the distance OP is r, and the counter clockwise angle of rotation fromthe polar axis, measured in radians, is θ.

Note that this allows for multiple representations since (r, θ) identifies the same point as(r, θ + 2πk) for any integer k.

The obvious problem is how to go from one to the other.

Page 253: MATH 135 Course Note

Section 37.4 Converting Between Representations 253

Figure 37.3.1: Polar Representation

37.4 Converting Between Representations

Simple trigonometry allows us to convert between polar and Cartesian coordinates.

Figure 37.4.1: Connecting Polar and Cartesian Representations

Given the polar coordinates (r, θ), the corresponding Cartesian coordinates (x, y) are

x = r cos θ

y = r sin θ

Given the Cartesian coordinates (x, y), the corresponding polar coordinates are determinedby

r =√x2 + y2

cos θ =x

r

sin θ =y

r

Page 254: MATH 135 Course Note

254 Chapter 37 Graphical Representations of Complex Numbers

Example 1 Here are points in standard form, Cartesian coordinates and polar coordinates.

Standard Form Cartesian Coordinates Polar Coordinates

−1 + i (−1, 1) (√

2, 3π/4)

−1−√

3i (−1,−√

3) (2, 4π/3)

1 (1, 0) (1, 0)

Exercise 3 For each of the following polar coordinates, plot the point and convert to Cartesian coordi-nates.

1. (1, 0)

2. (2, π/2)

3. (3, π)

4. (2, 7π/2)

5. (4, π/4)

6. (4, 4π/3)

Exercise 4 For each of the following Cartesian coordinates, plot the point and convert to polar coordi-nates.

1. (1, 0)

2. (0, 1)

3. (−1, 0)

4. (0,−1)

5. (1, 1)

6. (−1, 1)

7. (2,−2√

3)

From our earlier description of conversions, we can write the complex number

z = x+ yi

asz = r cos θ + ri sin θ = r(cos θ + i sin θ)

Page 255: MATH 135 Course Note

Section 37.4 Converting Between Representations 255

Definition 37.4.1

Polar Form

The polar form of a complex number z is

z = r(cos θ + i sin θ)

where r is the modulus of z and the angle θ is called an argument of z.

Example 2 The following are representations of complex numbers in both standard and polar form.

1. 1 = cos 0 + i sin 0

2. −1 + i =√

2

(cos

4+ i sin

4

)

3. −1−√

3i = 2

(cos

3+ i sin

3

)

One of the advantages of polar representation is that multiplication becomes very straight-forward.

Proposition 1 (Polar Multiplication of Complex Numbers (PMCN))

If z1 = r1(cos θ1 + i sin θ1) and z2 = r2(cos θ2 + i sin θ2) are two complex numbers in polarform, then

z1z2 = r1r2 (cos(θ1 + θ2) + i sin(θ1 + θ2))

Example 3

√2

(cos

4+ i sin

4

)· 2(

cos4π

3+ i sin

3

)= 2√

2

(cos

(3π

4+

3

)+ i sin

(3π

4+

3

))= 2√

2

(cos

(25π

12

)+ i sin

(25π

12

))= 2√

2(

cos( π

12

)+ i sin

( π12

))

Proof:

z1z2 = r1(cos θ1 + i sin θ1) · r2(cos θ2 + i sin θ2)

= r1r2 ((cos θ1 cos θ2 − sin θ1 sin θ2) + i(cos θ1 sin θ2 + sin θ1 cos θ2))

= r1r2 (cos(θ1 + θ2) + i sin(θ1 + θ2))

Page 256: MATH 135 Course Note

Chapter 38

De Moivre’s Theorem

38.1 Objectives

The content objectives are:

1. State and prove De Moivre’s Theorem and do examples.

2. Derive Euler’s Formula.

38.2 De Moivre’s Theorem

De Moivre’s Theorem dramatically simplifies exponentiation of complex numbers.

Theorem 1 (De Moivre’s Theorem (DMT))

If θ ∈ R and n ∈ Z, then

(cos θ + i sin θ)n = cosnθ + i sinnθ

Example 1 Consider the complex numberz = 1/

√2 + i/

√2

which, in polar form isz = cosπ/4 + i sinπ/4

By De Moivre’s Theorem,

z10 = (cosπ/4 + i sinπ/4)10 = cos 10π/4 + i sin 10π/4 = cosπ/2 + i sinπ/2 = i.

256

Page 257: MATH 135 Course Note

Section 38.2 De Moivre’s Theorem 257

Proof: We will prove DeMoivre’s Theorem using three cases.

1. n = 0

2. n > 0

3. n < 0

For the case n = 0, DeMoivre’s Theorem reduces to (cos θ + i sin θ)0 = cos 0 + i sin 0. Byconvention z0 = 1 so the left hand side of the equation is 1. Since cos 0 = 1 and sin 0 = 0,the right hand side also evaluates to 1.

For the case n > 0 we will use induction.

P (n): (cos θ + i sin θ)n = cosnθ + i sinnθ.

Base Case We verify that P (1) is true where P (1) is the statement

P (1): (cos θ + i sin θ)1 = cos 1θ + i sin 1θ.

This is trivially true.

Inductive Hypothesis We assume that the statement P (k) is true for some k ≥ 1.

P (k): (cos θ + i sin θ)k = cos kθ + i sin kθ.

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): (cos θ + i sin θ)k+1 = cos(k + 1)θ + i sin(k + 1)θ

(cos θ + i sin θ)k+1 = (cos θ + i sin θ)k(cos θ + i sin θ) (by separating out one factor)

= (cos kθ + i sin kθ)(cos θ + i sin θ) (by the Inductive Hypothesis)

= cos(k + 1)θ + i sin(k + 1)θ (Polar Multiplication)

Since P (k+1) is true, P (n) is true for all natural numbers n by the Principle of MathematicalInduction.

Lastly, for the case n < 0 we will use complex arithmetic. Since n < 0, n = −m for somem ∈ N.

(cos θ + i sin θ)n = (cos θ + i sin θ)−m

=1

(cos θ + i sin θ)m

=1

(cosmθ + i sinmθ)

= cosmθ − i sinmθ

= cos(−mθ) + i(sin(−mθ))= cosnθ + i sinnθ

Page 258: MATH 135 Course Note

258 Chapter 38 De Moivre’s Theorem

Corollary 2 If z = r(cos θ + i sin θ) and n is an integer,

zn = rn(cosnθ + i sinnθ)

38.3 Complex Exponentials

If you were asked to find a real-valued function y with the property that

dy

dx= ky and y = 1 when x = 0

for some constant k, you would choose

y = ekx

And if you were asked to find the derivative of f(θ) = cos θ + i sin θ where i was treated asany other constant you would almost certainly write

df(θ)

dθ= − sin θ + i cos θ

but thendf(θ)

dθ= − sin θ + i cos θ = i(cos θ + i sin θ) = if(θ)

and sodf(θ)

dθ= if(θ) and f(θ) = 1 when θ = 0

Definition 38.3.1

ComplexExponential

By analogy, we define the complex exponential function by

eiθ = cos θ + i sin θ

As an exercise, prove the following.

Proposition 3 (Properties of Complex Exponentials (PCE))

eiθ · eiφ = ei(θ+φ)(eiθ)n

= einθ ∀n ∈ Z

The polar form of a complex number z can now be written as

z = reiθ

where r = |z| and θ is an argument of z.

Page 259: MATH 135 Course Note

Section 38.5 More Examples 259

Out of this arises one of the most stunning formulas in mathematics. Setting r = 1 andθ = π we get

eiπ = cosπ + i sinπ = −1 + 0i = −1

That iseiπ + 1 = 0

Who would have believed that e, i, π, 1 and 0 would have such a wonderful connection!

38.4 More Examples

1. This question asks you to compute (√

3 + i)4 in two ways. Write your answer instandard form.

(a) Use the Binomial Theorem.

(b) Use De Moivre’s Theorem.

Solution:

(a) Using the Binomial Theorem we have

(√

3 + y)4 =

4∑r=0

(4

r

)(√

3)4−rir

=

(4

0

)(√

3)4−0i0 +

(4

1

)(√

3)4−1i1 +

(4

2

)(√

3)4−2i2 +

(4

3

)(√

3)4−3i3 +

(4

4

)(√

3)4−4i4

= 9 + 4 · 3√

3i− 6 · 3− 4i√

3 + 1

= −8 + 8√

3i

(b) Using De Moivre’s Theorem we have First, write√

3 + i in polar form. The modulus

is r =

√√32

+ 12 = 2. An argument is π6 . Thus,

√3 + i = 2(cos π6 + i sin π

6 ). By DeMoivre’s Theorem (

2(

cosπ

6+ i sin

π

6

))4= 24

(cos

6+ i sin

6

)= 16

(cos

3+ i sin

3

)= 16

(−1

2+

√3i

2

)= −8 + 8

√3i

38.5 Practice

1. Compute (√

3 − 3i)4 twice: once using the Binomial Theorem and once using DeMoivre’s Theorem. Write your answer in standard form.

Page 260: MATH 135 Course Note

Chapter 39

Roots of Complex Numbers

39.1 Objectives

The content objectives are:

1. State and prove the Complex n-th Roots Theorem and do examples.

39.2 Complex n-th Roots

Definition 39.2.1

Complex Roots

If a is a complex number, then the complex numbers that solve

zn = a

are called the complex n-th roots. De Moivre’s Theorem gives us a straightforward wayto find complex n-th roots of a.

Theorem 1 (Complex n-th Roots Theorem (CNRT))

If r(cos θ + i sin θ) is the polar form of a complex number a, then the solutions to zn = aare

n√r

(cos

(θ + 2kπ

n

)+ i sin

(θ + 2kπ

n

))for k = 0, 1, 2, . . . , n− 1

The modulus n√r is the unique non-negative n-th root of r. This theorem asserts that any

complex number, including the reals, has exactly n different complex n-th roots.

260

Page 261: MATH 135 Course Note

Section 39.2 Complex n-th Roots 261

Example 1 Find all the complex fourth roots of −16.

Solution: We will use the Complex n-th Roots Theorem. First, we write −16 in polarform as

−16 = 16(cosπ + i sinπ)

Using the Complex n-th Roots Theorem the solutions are

4√

16

(cos

(π + 2kπ

4

)+ i sin

(π + 2kπ

4

))for k = 0, 1, 2, 3

= 2

(cos

4+kπ

2

)+ i sin

4+kπ

2

))for k = 0, 1, 2, 3

The four distinct roots are given below

When k = 0, z0 = 2(

cos(π

4

)+ i sin

(π4

))= 2

(1√2

+i√2

)=√

2 + i√

2

When k = 1, z1 = 2

(cos

(3π

4

)+ i sin

(3π

4

))= 2

(−1√

2+

i√2

)= −√

2 + i√

2

When k = 2, z2 = 2

(cos

(5π

4

)+ i sin

(5π

4

))= 2

(−1√

2+−i√

2

)= −√

2− i√

2

When k = 3, z3 = 2

(cos

(7π

4

)+ i sin

(7π

4

))= 2

(1√2

+−i√

2

)=√

2− i√

2

Graphing these solutions is illuminating.

Figure 39.2.1: The Fourth Roots of -16

Note that the solutions are uniformly distributed around a circle whose radius is 4√

16.

Page 262: MATH 135 Course Note

262 Chapter 39 Roots of Complex Numbers

Proof: As usual, when showing that a complete solution exists we work with two sets: theset S of solutions and the set T of specific representation of the solution. We then showthat S = T by mutual inclusion. Our two sets are

S = {z ∈ C | zn = a}

and

T =

{n√r

(cos

(θ + 2kπ

n

)+ i sin

(θ + 2kπ

n

))∣∣∣∣ k = 0, 1, 2, . . . , n− 1

}where a = r(cos θ + i sin θ).

We begin by showing that T ⊆ S. Let t = n√r cos

(θ + 2kπ

n

)be an element of T . Now

tn =(

n√r)n

cos

(θ + 2kπ

n

)n= r(cos(θ + 2kπ) + i sin(θ + 2kπ)) De Moivre’s Theorem

= r(cos θ + i sin θ) trigonometry

= a

Hence, t is a solution of zn = a, that is, t ∈ S.

Now we show that S ⊆ T . Let w = s(cosφ+ i sinφ) be an n-th root of a.Since a = r(cos θ + i sin θ) we have

wn = a

⇐⇒ (s(cosφ+ i sinφ))n = r(cos θ + i sin θ)

⇐⇒ sn(cosnφ+ i sinnφ) = r(cos θ + i sin θ) De Moivre’s Theorem

Now two complex numbers in polar form are equal if and only if their moduli are equal andtheir arguments differ by an integer multiple of 2π. So

sn = r ⇒ s = n√r

and

nφ− θ = 2πk ⇒ φ =θ + 2πk

n

where k ∈ Z. Hence, the n-th roots of a are of the form

n√r

(cos

(θ + 2kπ

n

)+ i sin

(θ + 2kπ

n

))for k ∈ Z

But this is k ∈ Z, not k = 0, 1, 2, . . . , n − 1. Since w is an n-th root of a, there exists aninteger k0 so that

w = n√r

(cos

(θ + 2k0π

n

)+ i sin

(θ + 2k0π

n

))If we can show that

w = n√r

(cos

(θ + 2k1π

n

)+ i sin

(θ + 2k1π

n

))

Page 263: MATH 135 Course Note

Section 39.3 Practice 263

if and only if k0 ≡ k1 (mod n) whenever r 6= 0, then w ∈ T . Now

k0 ≡ k1 (mod n)

⇐⇒ k0 − k1 = n` for some ` ∈ Z⇐⇒ 2πk0 − 2πk1 = 2πn` for some ` ∈ Z

⇐⇒ 2πk0n− 2πk1

n= 2π` for some ` ∈ Z

⇐⇒ θ + 2πk0n

− θ + 2πk1n

= 2π` for some ` ∈ Z

Exercise 1 An n-th root of unity is a complex number that solves zn = 1. Find all of the sixth rootsof unity. Express them in standard form and graph them in the complex plane.

Exercise 2 Find the square roots of −2i. Express them in standard form and graph them in the complexplane.

39.3 Practice

1. Find all of the cube roots of unity. Write them in standard form and plot the solutionsin the complex plane.

2. A complex number z is called a primitive n-th root of unity if zn = 1 and zk 6= 1 forall 1 ≤ k ≤ n− 1.

(a) For each n = 1, 2, 3, 6, list all the primitive n-th roots of unity. (You may expressyour answers in standard, polar form or exponential form.)

(b) Let z be a primitive n-th root of unity. Prove the following statements.

i. For any k ∈ Z, zk = 1 if and only if n | k.

ii. For any m ∈ Z, if gcd(m,n) = 1, then zm is a primitive n-th root of unity.

3. Give the coordinates of a

(a) square

(b) regular pentagon

(c) regular hexagon in the complex plane.

Page 264: MATH 135 Course Note

Chapter 40

Practice, Practice, Practice:Complex Numbers

40.1 Objectives

This class provides an opportunity to practice working with quantifiers and sets.

40.2 Worked Examples

Example 1 Calculate (−1 +√

3i)17.

Solution: The size of the exponent makes the use of the Binomial Theorem impractical sowe use De Moivre’s Theorem. The polar form of −1 +

√3i is

z = 2(cos 5π/3 + i sin 3π/3)

By De Moivre’s Theorem,

(−1 +√

3i)17 = 217(cos 5π/3 + i sin 5π/3)17

= 217(cos 85π/3 + i sin 85π/3)

= 217(cosπ/3 + i sinπ/3)

= 217(1 +√

3i)

264

Page 265: MATH 135 Course Note

Section 40.2 Worked Examples 265

Example 2 Find all the cube roots of i.

Solution: We will use the Complex n-th Roots Theorem. First, we write i in polar formas

i = cosπ/2 + i sinπ/2

Using the Complex n-th Roots Theorem the solutions are

cos

( π2 + 2kπ

3

)+ i sin

( π2 + 2kπ

3

)for k = 0, 1, 2

= cos

(π + 4kπ

6

)+ i sin

(π + 4kπ

6

)for k = 0, 1, 2

The three distinct roots are given below.

When k = 0, z0 = cos(π

6

)+ i sin

(π6

)=

√3

2+i

2

When k = 1, z1 = cos

(5π

6

)+ i sin

(5π

6

)=−√

3

2+i

2

When k = 2, z2 = cos

(3π

2

)+ i sin

(3π

2

)= −i

Example 3 Find all z ∈ C which satisfy z2 + 2z + 1 = 0.

Solution: Let z = x+ yi where x, y ∈ R. Then

z2 + 2z + 1 = 0⇒ (x2 − y2 + 2xyi) + 2(x− yi) + 1 = 0

or(x2 − y2 + 2x+ 1) + (2xy − 2y)i = 0

Equating real and imaginary parts we have

x2 − y2 + 2x+ 1 = 0

2xy − 2y = 0

From the second equation we get

2xy − 2y = 0⇒ 2y(x− 1) = 0⇒ y = 0 or x = 1

If y = 0 then the first equation gives

x2 + 2x+ 1 = 0⇒ x = −1

If x = 1 then the first equation gives

1− y2 + 2 + 1 = 0⇒ y2 = 4⇒ y = ±2

Thus, the solutions are−1, 1 + 2i, 1− 2i

Page 266: MATH 135 Course Note

Part VII

Factoring Polynomials

266

Page 267: MATH 135 Course Note

Chapter 41

An Introduction to Polynomials

41.1 Objectives

The content objectives are:

1. Define polynomial, coefficient, F[x], degree, zero polynomial, linear polynomial, quadraticpolynomial, cubic polynomial, equal, sum, difference, product, quotient, remainder, di-vides and factor.

2. Define operations on polynomials.

3. State the Division Algorithm for Polynomials.

4. Do examples.

41.2 Polynomials

Our number systems were developed in response to the need to find solutions to real poly-nomials. We are now able to solve all equations of the form

a2x2 + a1x+ a0 = 0

orxn − a0 = 0

whether the coefficients are real or complex. In fact, a great deal more is known.

Let F be a field. Roughly speaking, a field is a set of numbers that allows addition, subtrac-tion, multiplication and division. The rational numbers Q, the real numbers R, the complexnumbers C and the integers modulo a prime p, Zp, are all fields. The integers are not a fieldbecause we cannot divide 2 by 4 and get an integer. Since division is just multiplication byan inverse, Z6 is not a field since [3] has no inverse.

267

Page 268: MATH 135 Course Note

268 Chapter 41 An Introduction to Polynomials

Definition 41.2.1

Polynomial

A polynomial in x over the field F is an expression of the form

anxn + an−1x

n−1 + · · ·+ a1x+ a0

where all of the ai belong to F.

The ai are called coefficients. We use F[x] to denote the set of polynomials in x withcoefficients from F.

Example 1

1. x2 + 7x− 1 ∈ R[x]

2. x3 − 7ix+ (5− 2i) ∈ C[x]

3. [3]x5 + [2]x3 + [6] ∈ Z7[x]

Definition 41.2.2

Degree et al

If an 6= 0 in the polynomial

anxn + an−1x

n−1 + · · ·+ a1x+ a0

then the polynomial is said to have degree n. The zero polynomial has all of its coefficientszero and its degree is not defined. Polynomials of degree 1 are called linear polynomials,of degree 2, quadratic polynomials, and of degree 3 cubic polynomials.

41.3 Operations on Polynomials

We very frequently use f(x) to denote an element of F[x] and write

f(x) = anxn + an−1x

n−1 + · · ·+ a1x+ a0 =n∑i=0

aixi

Let f(x), g(x) ∈ F[x] where

f(x) = anxn + an−1x

n−1 + · · ·+ a1x+ a0 =

n∑i=0

aixi

g(x) = bnxn + bn−1x

n−1 + · · ·+ b1x+ b0 =

n∑i=0

bixi

Definition 41.3.1

Equal

The polynomials f(x) and g(x) are equal if and only if ai = bi for all i.

Polynomials can be added, subtracted and multiplied as algebraic expressions exactly asyou have done in high school.

Page 269: MATH 135 Course Note

Section 41.3 Operations on Polynomials 269

Definition 41.3.2

Sum

The sum of the polynomials f(x) and g(x) is defined as

f(x) + g(x) =

max(n,m)∑i=0

(ai + bi)xi

where deg(f(x)) = n, deg(g(x)) = m, and any “missing” terms have coefficient zero.

Example 2

1. In R[x], if f(x) = x2 + 7x− 1 and g(x) = 3x4 − x3 + 4x2 − x+ 5 thenf(x) + g(x) = 3x4 − x3 + 5x2 + 6x+ 4.

2. In C[x], if f(x) = x3 − 7ix+ (5− 2i) and g(x) = (4 + 3i)x+ (7 + 7i) thenf(x) + g(x) = x3 + (4− 4i)x+ (12 + 5i).

3. In Z7[x], if f(x) = [3]x5 + [2]x3 + [6] and g(x) = [2]x4 + [5]x3 + [2]x2 + [4] thenf(x) + g(x) = [3]x5 + [2]x4 + [2]x2 + [3].

Definition 41.3.3

Difference

The difference of the polynomials f(x) and g(x) is defined as

f(x)− g(x) =

max(n,m)∑i=0

(ai − bi)xi

where deg(f(x)) = n, deg(g(x)) = m, and any “missing” terms have coefficient zero.

Exercise 1 Find the difference of each of the pairs of polynomials given in Example 2.

The definition of the product of two polynomials looks more complicated than it is.

Definition 41.3.4

Product

The product of the polynomials f(x) and g(x) is defined as

f(x) · g(x) =

m+n∑i=0

cixi

where

ci = a0bi + a1bi−1 + · · ·+ ai−1b1 + aib0 =i∑

j=0

ajbi−j

Though the definition of multiplication looks complicated, it is just collecting all of theterms xi that we would get through long multiplication.

Page 270: MATH 135 Course Note

270 Chapter 41 An Introduction to Polynomials

Example 3 (Polynomial Multiplication)

In R[x], let f(x) = x2 + 7x− 1 and g(x) = 3x+ 2. We will compute the product f(x) · g(x)using long multiplication and see how it captures the definition of multiplication just given.

x2 + 7x − 1

× 3x + 2

2x2 + 14x − 2

3x3 + 21x2 − 3x

3x3 + 23x2 + 11x − 2

The x2 column simply displays the combinations of terms from f(x) and g(x) whose productgives x2, that is x2×2, 7x×3x and 0×−1, which is exactly what the definition would give.

Exercise 2 Find f(x)g(x) for the two polynomials given.

1. Let f(x) and g(x) be the real polynomials f(x) = 2x4 +6x3−x+4 and g(x) = x2 +3.

2. Let f(z) and g(z) be the complex polynomials f(z) = iz2 + (3− i)z + 2i andg(z) = −iz + (2− 2i).

Now we run into the same issue we had with the integers, division. Though it makes senseto say that x−3 divides x2−9 since x2−9 = (x−3)(x+ 3), what do we do when there is aremainder? Just as we had a division algorithm for integers, we have a division algorithmfor polynomials.

Proposition 1 (Division Algorithm for Polynomials (DAP))

If f(x) and g(x) are polynomials in F[x] and g(x) is not the zero polynomial, then thereexist unique polynomials q(x) and r(x) in F[x] such that

f(x) = q(x)g(x) + r(x) where deg r(x) < deg g(x) or r(x) = 0

Definition 41.3.5

Quotient,Remainder

The polynomial q(x) is called the quotient polynomial. The polynomial r(x) is called theremainder polynomial. If r(x) = 0, we say that g(x) divides f(x) or f(x) is a factorof g(x) and we write g(x) | f(x).

How do we find the quotient and remainder polynomials? Long division.

Page 271: MATH 135 Course Note

Section 41.3 Operations on Polynomials 271

Example 4 (Long Division of Polynomials over R)

What are the quotient and remainder polynomials when f(x) = 3x4 + x3 − 4x2 − x + 5 isdivided by g(x) = x2 + 1 in R[x]?

Before we begin, we would expect from the Division Algorithm for Polynomials a remainderpolynomial of degree at most one.

3x2 + x − 7

x2 + 1 3x4 + x3 − 4x2 − x + 5

3x4 + 3x2

x3 − 7x2 − x

x3 + x

− 7x2 − 2x + 5

− 7x2 − 7

− 2x + 12

Thus, the quotient polynomial is q(x) = 3x2 + x − 7 and the remainder polynomial isr(x) = −2x+ 12 and f(x) = q(x)g(x) + r(x).

Example 5 (Long Division of Polynomials over C)

What are the quotient and remainder polynomials whenf(z) = iz3 + (2 + 4i)z2 + (3− i)z + (40− 4i) is divided by g(z) = iz + (2− 2i) in C[x]?

From the Division Algorithm for Polynomials, we would expect a constant remainder.

z2 + 6z + (11 + 9i)

iz + (2− 2i) iz3 + (2 + 4i)z2 + (3− i)z + (40− 4i)

iz3 + (2− 2i)z2

6iz2 + (3− i)z6iz2 + (12− 12i)z

(−9 + 11i)z + (40− 4i)

(−9 + 11i)z + (40− 4i)

0

Thus, the quotient polynomial is q(z) = z2+6z+(11+9i) and the remainder is 0. Therefore,g(z) divides f(z).

Exercise 3 For each f(x) and g(x), find the quotient and remainder polynomials.

1. Let f(x) and g(x) be the real polynomials f(x) = 2x4 +6x3−x+4 and g(x) = x2 +3.

2. Let f(z) and g(z) be the complex polynomialsf(z) = iz3 + z2 − (1 + i)z + 10 and g(z) = z + 2i.

Page 272: MATH 135 Course Note

Chapter 42

Factoring Polynomials

42.1 Objectives

The content objectives are:

1. Define polynomial equation, solution and root.

2. State the Fundamental Theorem of Algebra.

3. State and prove the Rational Roots Theorem.

4. State and prove the Remainder Theorem and its corollaries.

5. State and prove the Conjugate Roots Theorem.

6. State and prove two propositions about factoring real polynomials.

42.2 Polynomial Equations

Definition 42.2.1

Polynomial Equation

A polynomial equation is an equation of the form

anxn + an−1x

n−1 + · · ·+ a1x+ a0 = 0

which will often be written as f(x) = 0. An element c ∈ F is called a root or zero of thepolynomial f(x) if f(c) = 0. That is, c is a solution of the polynomial equation f(x) = 0.

The history of mathematics is replete with exciting and sometimes bizarre stories of math-ematicians as they looked, in vain, for an algorithm that would find a root of an arbitrarypolynomial. We can now prove that no such algorithm exists. It is known though, that aroot exists for every complex polynomial. This was proved in 1799 by the brilliant mathe-matician Karl Friedrich Gauss.

Theorem 1 (Fundamental Theorem of Algebra (FTA))

For all complex polynomials f(z) with deg(f(z)) ≥ 1, there exists a z0 ∈ C so that f(z0) = 0.

272

Page 273: MATH 135 Course Note

Section 42.2 Polynomial Equations 273

Ironically, we can prove a root exists, we just can’t construct one in general. The proofof this fact and the Fundamental Theorem of Algebra are both demanding and are left forlater courses.

We can use the Division Algorithm for Polynomials to help find roots though. Recall

Proposition 2 (Division Algorithm for Polynomials (DAP))

If f(x) and g(x) are polynomials in F[x] and g(x) is not the zero polynomial, then thereexist unique polynomials q(x) and r(x) in F[x] such that

f(x) = q(x)g(x) + r(x) where deg r(x) < deg g(x) or r(x) = 0

We can use the Division Algorithm for Polynomials to prove a very useful theorem.

Proposition 3 (Remainder Theorem (RT))

The remainder when the polynomial f(x) is divided by (x− c) is f(c).

Example 1 Find the remainder when f(z) = 3z12 − 8iz5 + (4 + i)z2 + z + 2− 3i is divided by z + i.

Solution: One could do the painful thing and carry out long division. Another possibilityis to use the Remainder Theorem and compute f(−i).

f(−i) = 3(−i)12 − 8i(−i)5 + (4 + i)(−i)2 + (−i) + 2− 3i

= 3− 8i(−i) + (4 + i)(−1)− i+ 2− 3i

= 3− 8− 4− i− i+ 2− 3i

= −7− 5i

The remainder is −7− 5i.

Proof: By the Division Algorithm for Polynomials, there exist unique polynomials q(x)and r(x) such that

f(x) = q(x)(x− c) + r(x) where deg r(x) < 1 or r(x) = 0

Therefore, the remainder r(x) is a constant (which could be zero) which we will write asr0. Hence

f(x) = q(x)(x− c) + r0

Substituting x = c into this equation gives f(c) = r0.

Corollary 4 (Factor Theorem 1 (FT 1))

The linear polynomial (x− c) is a factor of the polynomial f(x) if and only if f(c) = 0.

Equivalently,

Page 274: MATH 135 Course Note

274 Chapter 42 Factoring Polynomials

Corollary 5 (Factor Theorem 2 (FT 2))

The linear polynomial (x− c) is a factor of the polynomial f(x) if and only if c is a root ofthe polynomial f(x).

Induction, together with the Fundamental Theorem of Algebra and the Factor Theorems,allow us to prove the following very useful corollary.

Proposition 6 (Complex Polynomials of Degree n Have n Roots (CPN))

If f(z) is a complex polynomial of degree n ≥ 1, then f(z) has n roots and can be writtenas the product of n linear factors. The n roots and factors may not be distinct.

Exercise 1 Prove the proposition Complex Polynomials of Degree n Have n Roots.

How do we go about actually factoring polynomials? In general, this is hard to do. Thereare no formulas for roots if the polynomial has degree five or more. But if the polynomialhas integer coefficients, we have a good starting point.

Theorem 7 (Rational Roots Theorem (RRT))

Let f(x) = anxn+an−1x

n−1+ · · ·+a2x2+a1x+a0 be a polynomial with integer coefficients.

Ifp

qis a rational root with gcd(p, q) = 1, then p | a0 and q | an.

In order to find a rational root of f(x), we only need to examine a finite set of rationalnumbers, those whose numerator divides the constant term and those whose denominatordivides the leading coefficient. Note that the theorem only suggests those rational numbersthat might be roots. It does not guarantee that any of these numbers are roots.

Example 2 If possible, find a rational root of f(x) = 2x4 + x3 + 6x+ 3.

Solution: We will use the Rational Roots Theorem. The divisors of 2 are ±1 and ±2. Thedivisors of 3 are ±1 and ±3. Hence, the candidates for rational roots are

±1,±1

2,±3,±3

2

Now test each of these candidates.

x 1 −1 12

−12 3 −3 3

2−32

f(x) 12 −2 254 0 210 120 51

234

Thus, the only rational root is−1

2.

Page 275: MATH 135 Course Note

Section 42.2 Polynomial Equations 275

Proof: Ifp

qis a root of f(x) then

an

(p

q

)n+ an−1

(p

q

)n−1+ · · ·+ a2

(p

q

)2

+ a1

(p

q

)+ a0 = 0

Multiplying by qn gives

anpn + an−1p

n−1q + · · ·+ a2p2qn−2 + a1pq

n−1 + a0qn = 0

andanp

n = −q(an−1p

n−1 + · · ·+ a2p2qn−3 + a1pq

n−2 + a0qn−1)

Since all of the symbols in this equation are integers, both the right hand side and left handside are integers. Since q divides the the right hand side, q divides the left hand side, thatis

q | anpn

Since gcd(p, q) = 1 we can repeatedly use the proposition on Coprimeness and Divisibilityto show that q | an. In a similar way, we can show that p | a0.

Exercise 2 Is x+ 1 a factor of x10 + 1, of x9 + 1? When does x+ 1 divide (or not divide) x2n+ 1 for n apositive integer? When does x+ 1 divide (or not divide) x2n+1 + 1 for n a positive integer?

Exercise 3 Prove that if p is a prime, then n√p is irrational for any integer n > 1.

The next, very useful theorem is like a “two for one special”. If you find one complex rootof a real polynomial, you get another one for free.

Theorem 8 (Conjugate Roots Theorem (CJRT))

Let f(x) = anxn + an−1x

n−1 + · · ·+ a0 be a polynomial with real coefficients. If c ∈ C is aroot of f(x), then c ∈ C is a root of f(x).

Example 3 Let f(x) = x4 − x3 − 5x2 − x− 6. Given that i is a root of f(x), factor f(x).

Solution: Since f(x) is a polynomial with real coefficients, we can use the Conjugate RootsTheorem. Thus, i and −i are both roots and, by the Factor Theorem 2, (x− i) and (x+ i)are factors of f(x). The product of these two factors is x2 + 1. Dividing f(x) by x2 + 1yields x2 − x− 6 which factors as (x− 3)(x+ 2). Thus

f(x) = (x− i)(x+ i)(x− 3)(x+ 2)

Page 276: MATH 135 Course Note

276 Chapter 42 Factoring Polynomials

Proof: Since c is a root of f(x)

ancn + an−1c

n−1 + · · ·+ a1c+ a0 = 0

Taking the complex conjugate of both sides gives

ancn + an−1cn−1 + · · ·+ a1c+ a0 = 0

and using the properties of conjugates

an cn + an−1 c

n−1 + · · ·+ a1 c+ a0 = 0

Since a = a whenever a is real, we now have

an cn + an−1 c

n−1 + · · ·+ a1 c+ a0 = 0

that is,f(c) = 0

and so c is a root of f(x).

Exercise 4 If x+ (2 + i) is a factor of f(x) = x4 + 4x3 + 2x2 − 12x− 15, factor f(x) into products ofreal polynomials and complex polynomials of lowest degree.

The Conjugate Roots Theorem has a very useful corollary.

Corollary 9 (Real Quadratic Factors (RQF))

Let f(x) = anxn + an−1x

n−1 + · · · + a0 be a polynomial with real coefficients. If c ∈ C,=(c) 6= 0, is a root of f(x), then there exists a real quadratic factor of f(x) with c as a root.

Proof: Let c ∈ C, =(c) 6= 0, be a root of f(x). By the Conjugate Roots Theorem, c is alsoa root of f(x). Consider

q(x) = (x− c)(x− c) = x2 − (c+ c)x+ cc = x2 − 2<(c) + |c|2

where the last equality follows from Properties of Conjugates and Properties of Modulus.Since −2<(c) ∈ R and |c|2 ∈ R, q(x) is a real quadratic polynomial with c as a root.

This corollary is useful in characterizing the factorization of all real polynomials.

Theorem 10 (Real Factors of Real Polynomials (RFRP))

Let f(x) = anxn + an−1x

n−1 + · · · + a0 be a polynomial with real coefficients. Then f(x)can be written as a product of real linear and real quadratic factors.

Proof: Complex polynomials of degree n have n roots. Those roots which are real cor-respond to real linear factors. Those roots which are not real come in conjugate pairs(Conjugate Roots Theorem) and give rise to real quadratic polynomials (Real QuadraticFactors). Since real and not real roots exhaust all possible choices of roots, real linear andreal quadratic factors exhaust all possible types of factors.

Page 277: MATH 135 Course Note

Chapter 43

Practice, Practice, Practice:Polynomials

43.1 Objectives

This class provides an opportunity to practice factoring polynomials.

43.2 Worked Examples

Example 1 For each of the following, you are given several roots of a polynomial f(x). Find a polynomialof lowest degree in F[x] that has the given roots.

1. R[x]: 3 +√

2i, 5

Solution: Since we are looking for a polynomial in R[x], we can use the ConjugateRoots Theorem for complex roots. Hence, 3+

√2i 6∈ R will be paired with its conjugate

3 −√

2i. The product of the corresponding factors will produce a real quadratic.Hence,

f(x) = (x− (3 +√

2i))(x− (3−√

2i))(x− 5)

= (x2 − 6x+ 11)(x− 5)

= x3 − 11x2 + 41x− 55

2. C[x]: 3 +√

2i, 5

Solution: Since both 3 +√

2i and 5 are complex numbers, the corresponding linearfactors are in C[x] so

f(x) = (x− (3 +√

2i))(x− 5) = x2 + (−8 +√

2i)x+ (15 + 5√

2i)

3. R[x]: 1−√

5, 2i, 0

Solution: Since we are looking for a polynomial in R[x], we can use the ConjugateRoots Theorem for complex roots. The only root not in R is 2i so we need to pair this

277

Page 278: MATH 135 Course Note

278Chapter 43 Practice, Practice, Practice:

Polynomials

root with its conjugate −2i. The product of the corresponding factors will produce areal quadratic. Hence,

f(x) = (x− (1−√

5))(x− 2i)(x+ 2i)(x− 0)

= (x− (1−√

5))(x2 + 4)x

= (x− (1−√

5))(x3 + 4x)

= x4 + (−1 +√

5)x3 + 4x2 + 4(−1 +√

5)x

4. Z7[x]: [2], [1]

Solution: Both [2], [1] correspond to linear factors so

f(x) = (x− [2])(x− [1]) = x2 − [3]x+ [2] = x2 + [4]x+ [2]

Example 2 For each of the following polynomials f(x) ∈ F[x], factor f(x) into factors with degreeas small as possible over F[x]. Cite appropriate propositions to justify each step of yourreasoning.

1. f(x) = x2 − x− 6 ∈ Q[x]

Solution: The quadratic formula gives the roots 3 and −2. These are values in Q sothere are linear factors x− 3 and x+ 2 by Factor Theorem 2. Hence,

f(x) = (x− 3)(x+ 2)

2. f(x) = x2 − x+ 6 ∈ Q[x]

Solution: The quadratic formula gives only complex roots in this instance. Sincecomplex numbers do not belong to Q there are no linear factors in Q[x], hencef(x) = x2 − x+ 6 cannot be factored any further in Q[x].

3. f(x) = x2 − 3ix− 2 ∈ C[x]

Solution: Applying the quadratic formula gives two roots, i and 2i, hence

f(x) = x2 − 3ix− 2 = (x− i)(x− 2i)

4. f(x) = 2x3 − 3x2 + 2x+ 2 ∈ R[x]

Solution: Since all of the coefficients are integers, we can use the Rational RootsTheorem. The divisors of a0 are {±1,±2} and the divisors of an are {±1,±2} so theonly candidates for rational roots are

±1,±2,±1

2

Now test each of these candidates.

x 1 −1 2 −2 12

−12

f(x) 3 −5 10 −30 5/2 0

Page 279: MATH 135 Course Note

Section 43.2 Worked Examples 279

Long division producesf(x) = (2x+ 1)(x2 − 2x+ 2)

The quadratic formula gives two complex roots for x2 − 2x+ 2 so the quadratic doesnot factor any further.

5. f(x) = z4 + 27z ∈ C[x]

Solution: Since f(z) is a complex polynomial of degree four, it will have four linearfactors. Now f(z) = z(z3 + 27). Factoring z3 + 27 can be done with the aid of theComplex n-th Roots Theorem applied to z3 = −27. First, we write −27 in polar formas

−27 = 27(cosπ + i sinπ)

Using the Complex n-th Roots Theorem the solutions are

3√

27

(cos

(π + 2kπ

3

)+ i sin

(π + 2kπ

3

))for k = 0, 1, 2

= 3

(cos

3+

2kπ

3

)+ i sin

3+

2kπ

3

))for k = 0, 1, 2

The three distinct roots are given below

When k = 0, z0 = 3(

cos(π

3

)+ i sin

(π3

))= 3

(1

2+

√3

2i

)=

3

2+

3√

3

2i

When k = 1, z1 = 3 (cosπ + i sinπ) = −3

When k = 2, z2 = 3

(cos

(5π

3

)+ i sin

(5π

3

))= 3

(1

2+−√

3

2i

)=

3

2− 3√

3

2i

Thus,

f(x) = x(x+ 3)

(x−

(3

2+

3√

3

2i

))(x−

(3

2− 3√

3

2i

))

Page 280: MATH 135 Course Note

Chapter 44

Practice, Practice, Practice:Course Review

44.1 Objectives

This chapter provides some suggestions on starting a proof and provides an opportunity topractice using problems from throughout the course.

In all cases, justify your work by citing appropriate definitions and propositions.

This chapter continues on the next page. At this point of the development of the notes theprovided questions do not yet cover the whole course.

280

Page 281: MATH 135 Course Note

Section 44.3 Suggestions On How To Start A Proof 281

44.2 Suggestions On How To Start A Proof

1. Explicitly identify the hypothesis and the conclusion. If necessary, rewrite the state-ment so it is in the form

If A, then B.

2. Choose a basic approach.

• If B is of the form P (n) for a natural number n, consider induction.

• If B contains a negation or is one of only two alternatives, consider proving thecontrapositive or proceeding by contradiction. To use the contrapositive, provethe logically equivalent statement

If ¬B, then ¬A.

To use contradiction, prove the statement

If A ∧ ¬B, then a contradiction exists.

• If B contains the connective or, consider using elimination. To use proof byelimination with the statement

If A, then C ∨D.

prove the logically equivalent statement

If A ∧ ¬C, then D.

• The most common proof technique is Direct Proof. Assume that the hypothesisis true. Show that the conclusion is true.

3. Unless you are using induction or Direct Proof, the statement you are trying to provewill have been re-stated. Make sure that you identify the new hypothesis and the newconclusion.

4. Structure your proof around quantifiers and sets. Remember that quantifiers maybe implicit, that there may be quantifiers in the hypothesis and conclusion, and thatquantifiers may be nested, so several of the techniques below may appear in the sameproof. In all cases, identify the domain of the quantified variables.

• If an existential quantifier occurs in the hypothesis, use the Object Method.

• If an existential quantifier occurs in the conclusion, use the Construct Method.

• If a universal quantifier occurs, use the Select Method.

• To show that S ⊆ T , use the Select Method. Select a representative elements ∈ S and show that s ∈ T .

• To show two sets are equal, use mutual inclusion. That is, to show S = T ,show S ⊆ T and T ⊆ S.

5. Once you have chosen an approach and a basic structure for the proof, ask the fol-lowing questions.

• Have I seen this before? If so, try to use a similar approach.

• What mathematical fact would allow me to deduce the conclusion? Workingbackwards from the conclusion narrows the set of possibilities to examine.

• What mathematical fact can I deduce from what I already know? Workingforwards from the hypothesis allows you to generate a range of possible pathstowards the conclusion.

Page 282: MATH 135 Course Note

282 Chapter 44 Practice, Practice, Practice: Course Review

44.3 Exercises

1. For each of the following statements S,

(i) State the hypothesis.

(ii) State the conclusion.

(iii) State the contrapositive.

(iv) State the converse.

(v) Prove or disprove the statement.

(vi) Prove or disprove the converse.

(a) Let x be a real number. S: If x is positive, then x2 ≥ x.

(b) Let x and y be positive real numbers. S: If x2 ≤ y2, then x ≤ y.

(c) S: If a | bc and a - b, then a | c.(d) S: If 6ab− 5a+ ab3 is even, then a is even or b is odd.

(e) S: If p is a prime, then√p is irrational.

(f) S: If a ≤ n, then a does not divide n! + 1.

(g) Let a, b ∈ Z. S: If a | b, then a2 | b2.(h) Let x, y, z ∈ N. S: If gcd(x, y) = 1, then gcd(x, y, z) = 1.

(i) Let f(x) ∈ R[x] and c ∈ C. S: If f(c) = 0, then f(c) = 0.

2. For each of the following statements S,

(i) Identify each of the explicit quantifiers in S together with the associated variable,domain and open sentence.

(ii) For each explicit quantifier, identify which proof technique (Object, Select, Choose)would be associated with the quantifier.

(iii) Negate S. Recall that the negation of A⇒ B is A ∧ ¬B.

(iv) Only one of S or ¬S can be true. Identify which of S or ¬S is true and give aproof.

(v) Where possible, give a counter-example to the statement which is false.

(a) S: For all a ∈ Z, a > 0, gcd(a+ 1, a2) = 1.

(b) S: For all n ≡ 1 (mod 4), n2 + 2n+ 13 ≡ 0 (mod 16).

(c) S: For all z ∈ C, z 6= 0, there exists a z′ so that zz′ = 1.

(d) S: There exists a positive integer n so that for all positive integers m, n/m > 1.

(e) S: If a | b and a | c, then for every x, y ∈ Z, a | (bx+ cy).

(f) Let a, b, c be fixed integers. S: If there exist integers x and y so that a | (bx+cy),then a | b and a | c.

(g) Let a, b, c be fixed integers. S: If there exist integers x and y so that a | (bx+cy),then a | b or a | c.

(h) Let a, b, c be fixed integers. S: If for every choice of integers x and y, a | (bx+cy),then a | b and a | c.

Page 283: MATH 135 Course Note

Section 44.3 Exercises 283

(i) S: For every integer n and every integer k, 0 ≤ k ≤ n,(n

k

)=

(n+ 1

k + 1

)(j) S: For every odd integer n and every integer k, 0 ≤ k ≤ n, there exists an integer

h 6= k so that (n

k

)=

(n

h

)3. Prove or disprove each of the following statements.

(a) If n ≡ 1 (mod 6), then n2 + 2n is composite.

(b) If n is an integer and n ≥ 3, n3 − 1 is composite.

(c) Let w ∈ C and w 6= 1. If w is an n-th root of unity, then

1 + w + w2 + . . .+ wn−1 = 0

(d) If integers a and b are coprime, then the integers ab and a+ b are coprime.

Page 284: MATH 135 Course Note

Part VIII

Finding the Shortest Path

284

Page 285: MATH 135 Course Note

Chapter 45

The Shortest Path Problem

45.1 Objectives

The technique objectives are:

1. Abstract from a map to a graph.

2. Formulate an algorithm.

3. Extend plausible uses.

45.2 The Problem

Suppose you are living in downtown Toronto (the pink dot on the map on the next page) ona co-op work term and you want to escape the intense July heat by going to Sibbald PointProvincial Park (the blue dot on the map) to swim in Lake Simcoe. See Figure 45.2.1.

You could take Highway 404 past the 401, past the 407 up to the end of Highway 404, andthen take a minor road to Highway 48 and go north from there. But perhaps it would bebetter to take Lakeshore Drive to Highway 48 and go straight north.

Your task is to find an algorithm, a strategy, to find the shortest route between downtownToronto and Sibbald Point Provincial Park.

285

Page 286: MATH 135 Course Note

286 Chapter 45 The Shortest Path Problem

Figure 45.2.1: Sibbald Point Provincial Park

Page 287: MATH 135 Course Note

Section 45.3 Abstraction 287

45.3 Abstraction

Let’s focus on what’s important in the problem. Looking at the map there is, for ourpurpose, lots of information that is not important: colours, parking locations, where theGreen Belt is, towns not along the way. What is really important are locations where wemight change directions, routes between those locations, and distances. We’ll highlightimportant locations on the map as grey dots and connections between locations as solidteal lines. See Figure 45.3.1.

Figure 45.3.1: Locations and Connections

Page 288: MATH 135 Course Note

288 Chapter 45 The Shortest Path Problem

But since we don’t need the rest of the detail, let’s omit it and include only locations,connections and distances. See Figure 45.3.2.

120

30

60

45

20

25

20

10

10

1010

5

60

15

Figure 45.3.2: The Essentials

45.4 Algorithm

Draw a random map and attempt to discover an algorithm that will find the shortest routefrom one location to another. Compare your algorithm to those created by others. Whichalgorithms work? Which algorithms are efficient?

45.5 Extensions

This problem is set as minimal distances between two points. But perhaps instead ofdistance we could use time or cost. And instead of a person travelling we could havecouriers delivering packages, or electrical signals carrying phone calls. In fact, there aresurprising uses as well including managing cutting stock in steel mills and finding optimalschedules for construction projects.

Page 289: MATH 135 Course Note

Chapter 46

Paths, Walks, Cycles and Trees

46.1 Objectives

The technique objectives are:

1. Practice with proofs by contradiction.

2. Practice with proofs of uniqueness.

The content objectives are:

1. Define graph, walk, path, cycle, and tree.

2. Construct diagrams corresponding to graphs.

3. Observe: Any walk can be decomposed into at most one path and a collection of cycles.

4. Prove: There is a unique path between every pair of vertices in a tree.

46.2 The Basics

Definition 46.2.1

Graph

A graph G is a pair (V,E) where V is a finite, nonempty set, and E is a set of unorderedpairs of elements of V . The elements of V are called vertices and the elements of E callededges.

It is often very useful to represent a graph as a drawing where vertices correspond to pointsand edges correspond to lines between vertices. Graphs may be represented by more thanone diagram as illustrated in Example 1.

289

Page 290: MATH 135 Course Note

290 Chapter 46 Paths, Walks, Cycles and Trees

Example 1 Let G = (V,E) whereV = {1, 2, 3, 4, 5, 6, 7}

and

E = {{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 1}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}} .

1

6 3

2

5 4

71 632 54

7

Figure 46.2.1: Two representations of the same graph

Definition 46.2.2

Adjacent, Incident

If edge e = {u, v}, then we say that u and v are adjacent vertices, and that edge e isincident with vertices u and v. We can also say that the edge e joins u and v. Verticesadjacent to a vertex u are called neighbours of u.

A graph is completely specified by the pairs of vertices that are adjacent, and the onlyfunction of a line in the diagram is to indicate that two vertices are adjacent.

Definition 46.2.3

Walk

A walk W is a non-empty sequence of edges

W = {{v0, v1}, {v1, v2}, {v2, v3}, . . . , {vn−1, vn}} .

Since vi−1 and vi uniquely determine an edge e of a walk, we will usually just list thevertices. Thus

W = v0, v1, v2, v3, . . . , vn−1, vn.

Definition 46.2.4

Path

If v0 = s and vn = t in the walk W , we call W an st-walk. If no vertex in the walk isrepeated, that is, if v0, v1, v2, . . . , vn are all distinct, then W is called a path.

Definition 46.2.5

Cycle

If v0 = vn and v0, v1, v2, . . . , vn−1 are all distinct, then W is called a cycle.

Page 291: MATH 135 Course Note

Section 46.2 The Basics 291

1

6 3

2

5 4

7

Figure 46.2.2: The bold lines indicate the walk W = 1, 6, 7, 3, 4, 7, 3, 2.

1

6 3

2

5 4

7

Figure 46.2.3: The bold lines indicate the path P = 1, 6, 7, 3, 2

1

6 3

2

5 4

7

Figure 46.2.4: The bold lines indicate the cycle C = 7, 3, 4, 7

Note that the walk W = 1, 6, 7, 3, 4, 7, 3, 2 can be decomposed into the path P = 1, 6, 7, 3, 2and the cycle C = 7, 3, 4, 7. In fact, we can always perform this kind of decomposition forwalks but before we state the appropriate theorem, we need to define a few more terms.

Definition 46.2.6

Collection,Decomposed

By a collection we mean a family of objects where repetition is allowed. Let W be anst-walk. If s = t, we say that W can be decomposed into a collection C of cycles if, forevery edge e the number of times e occurs in W is the same as the number of times e occursin cycles of C. If s 6= t, we say that W can be decomposed into an st-path P and acollection C of cycles if, for every edge e the number of times e occurs in W is the same as

Page 292: MATH 135 Course Note

292 Chapter 46 Paths, Walks, Cycles and Trees

the number of times e occurs in P and the cycles of C.

We will state, but not prove, the following proposition.

Proposition 1 (Walk Decomposition (WD))

Let W be an st-walk.

1. If s = t, then W can be decomposed into a non-empty collection of cycles.

2. If s 6= t and a vertex is not repeated in W , then W is a path.

3. If s 6= t and a vertex is repeated in W , then W can be decomposed into a path and anon-empty collection of cycles.

You may wonder what the difference is between the definition of decomposition and theproposition Walk Decomposition. The definition allows for the possibility that some walkscannot be decomposed. The proposition states that all walks can be decomposed.

Definition 46.2.7

Connected

To say that a graph G is connected means that there is a path between any two vertices ofG. We will assume for this course that all of our graphs are connected, though in general,that is not a safe assumption.

46.3 Trees

A tree is a very special and incredibly useful kind of graph.

Definition 46.3.1

Tree

A tree is a connected graph with no cycles.

1

6 3

2

5 4

7

Figure 46.3.1: A tree

We will prove several propositions about trees starting with this one.

Page 293: MATH 135 Course Note

Section 46.3 Trees 293

Proposition 2 (Unique Paths in Trees (UPT))

There is a unique path between every pair of vertices in a tree.

We normally begin our proofs by explicitly identifying the hypothesis and the conclusion.Unique Paths in Trees is not in “If A, then B.” form, so let’s first restate it. Recall thatthe hypothesis is what we get to start with, and the conclusion is what we must show. Westart with a tree. Call it T . We must show that there is a unique path between every pairof vertices in T . Hence, we could restate Unique Paths in Trees as

Proposition 3 (Unique Paths in Trees (UPT))

If T is a tree, then there is a unique path between every pair of vertices in T .

Working forwards and backwards to prove this proposition will be problematic. So, it’s timefor a different technique, proof by contradiction. Normally, when we wish to prove that thestatement “A implies B” is true, we assume that A is true and show that B is true. Whatwould happen if B were true, but we assumed it was false and continued our reasoningbased on the assumption that B was false? Since a mathematical statement cannot be bothtrue and false, it seems likely we would eventually encounter a mathematically non-sensicalstatement. Then we would ask ourselves “How did we arrive at this nonsense?” and theanswer would have to be that our assumption that B was false was wrong and B is, in fact,true.

Proofs by contradiction have the following structure.

1. Assume that A is true.

2. Assume that B is false, or equivalently, assume that NOT B is true.

3. Reason forward from A and NOT B to reach a contradiction.

We will prove Unique Paths in Trees by contradiction.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Suppose that u and v are any two distinct vertices of T .

2. Since T is connected, there is at least one path connecting u to v.

3. Now suppose that there are two distinct uv-paths, P1 = u, x1, x2, . . . , xn−1, v andP2 = u, y1, y2, . . . , ym−1, v.

4. We can construct a walk W beginning with u and ending at u that consists of “walk-ing” from u to v in P1, then from v to u “backwards” in P2. More specifically,

W = u, x1, x2, . . . , xn, ym−1, ym−2, ym−3, . . . , y1, u.

5. By Part (1) of Proposition 1, W can be decomposed into a non-empty collection ofcycles.

Page 294: MATH 135 Course Note

294 Chapter 46 Paths, Walks, Cycles and Trees

6. But then the tree T contains cycles, contradicting the definition of a tree.

Analysis of Proof We will begin by explicitly identifying the hypothesis and the conclu-sion.

Hypothesis: T is a tree.

Conclusion: There is a unique path between every pair of vertices in T .

Core Proof Technique: Contradiction.

Preliminary Material: Definition of tree.

Sentence 1 Suppose that u and v are any two distinct vertices of T .

The conclusion contains a universal quantifier, every. Let’s first identify the compo-nents of the universal quantifier.

Quantifier: ∀Variable: vertices u and vDomain: vertices of the tree TOpen sentence: There is a unique path between u and v.

Since we are using a universal quantifier in the conclusion of the proposition, theauthor uses the Select Method.

Sentence 2 Since T is connected, there is at least one path connecting u to v.

Before the author can show that there is a unique path, the author must first showthat a path exists.

Sentence 3 Now suppose that there are two distinct uv-paths, P1 = u, x1, x2, . . . , xn−1, vand P2 = u, y1, y2, . . . , ym−1, v.

The author is negating the conclusion and so is going to use one of two techniques,Contradiction or Contrapositive. Since the author hasn’t indicated which, it is usefulto look ahead in the proof to find out. The last sentence of the proof makes it clearthat the author is using Contradiction.

Sentence 4 We can construct a walk W beginning with u and ending at u that consists of“walking” from u to v in P1, then from v to u “backwards” in P2. More specifically,

W = u, x1, x2, . . . , xn, ym−1, ym−2, ym−3, . . . , y1, u.

Sentence 5 By Part (1) of Proposition 1, W can be decomposed into a non-empty collec-tion of cycles.

The difficult part in proofs by contradiction is finding a contradiction. In Sentence4 the author constructs a walk and in Sentence 5 the author shows that the walkcontains cycles. But cycles don’t exist in trees and so

Sentence 6 But then the tree T contains cycles, contradicting the definition of a tree.

This is also an example of working with uniqueness.

Page 295: MATH 135 Course Note

Chapter 47

Trees

47.1 Objectives

The technique objectives are:

1. Practice with Induction.

The content objectives are:

1. Define degree.

2. Prove Two Vertices of Degree One.

3. Prove Number of Vertices in a Tree.

47.2 Properties of Trees

Definition 47.2.1

Degree

Let G be a graph. The number of edges incident with a vertex v is called the degree of vand is denoted by deg(v). In Figure 47.2.1, vertex a has degree 3 and vertex b has degree 2.

Proposition 1 (Two Vertices of Degree One (TVDO))

If T is a tree with at least two vertices, then T has at least two vertices of degree one.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Find a longest path P = w0w1w2 . . . wn in T , say between nodes u = w0 and v = wn.

2. Since any edge in the tree constitutes a path, P must contain at least one edge sou 6= v.

3. Thus, the vertex wn−1 in the path is adjacent to v but distinct from v.

295

Page 296: MATH 135 Course Note

296 Chapter 47 Trees

s

s

a

b

cd

e

f

g

h

i

Figure 47.2.1: Graph corresponding to Toronto - Sibbald Point map

4. If deg(v) > 1, there must be another vertex, w, distinct from wn−1 and adjacent to v.

5. If w is in P , then a cycle would exist but trees do not have cycles. Hence, w is not inP .

6. If w is not in P , then we could add edge {v, w} to P to get a path longer than P ,contradicting the assumption that P is a longest path in T .

7. Hence, deg(v) = 1.

8. Similarly, deg(u) = 1 and so two vertices of degree one exist in T .

Analysis of Proof We will begin by explicitly identifying the hypothesis and the conclu-sion.

Hypothesis: T is a tree with at least two vertices.

Conclusion: T has at least two vertices of degree one.

Core Proof Technique: Construction and Contradiction (three times!).

Preliminary Material: Definition of tree and of degree.

Page 297: MATH 135 Course Note

Section 47.2 Properties of Trees 297

Sentence 1 Find a longest path P = w0w1w2 . . . wn in T , say between nodes u = w0 andv = wn.

The conclusion contains an existential quantifier, has. Let’s first identify the compo-nents of the existential quantifier.

Quantifier: ∃Variable: Two vertices (unnamed)Domain: Vertices of the tree TOpen sentence: Both vertices have degree 1.

Since the proposition contains an existential quantifier in the conclusion, the authoruses the Construct Method. This sentence serves two purposes. First, it implicitlyidentifies the two objects that will be constructed, u and v. And second, it sets upthe contradictions that will be needed later.

Sentence 2 Since any edge in the tree constitutes a path, P must contain at least one edgeso u 6= v.

Given that the author intends to show that u and v are distinct vertices of degree one,the author must first establish that u 6= v. Also, the following argument will requirethat the path contain an edge.

Sentence 3 Thus, the vertex wn−1 in the path is adjacent to v but distinct from v.

The author is setting up the contradiction, though it is not at all clear from here howthat contradiction will be displayed.

Sentence 4 If deg(v) > 1, there must be another vertex, w, distinct from wn−1 and adja-cent to to v.

From the analysis of the first sentence, the author intends to show that v has degreeone. That means this sentence indicates the author is going to proceed by contradic-tion.

Sentence 5 If w is in P , then a cycle would exist but trees do not have cycles. Hence, wis not in P .

This is a miniature proof by contradiction of the statement “If deg(v) > 1 and wis adjacent to v, then w is not in P .” Sentence 5 begins with the negation of theconclusion and finds a contradiction quickly. If w is in P , then the walk constructedby taking the subpath from w to v in P and adding the edge {v, w} yields a cycle,but trees do not contain cycles by definition.

Sentence 6 If w is not in P , then we could add edge {v, w} to P to get a path longer thanP , contradicting the assumption that P is a longest path in T .

This is another miniature proof by contradiction, this time of the statement “Ifdeg(v) > 1 and w is adjacent to v, then w is in P .”

Sentence 7 Hence, deg(v) = 1.

Assuming that deg(v) > 1 leads to an adjacent vertex w being both in P and not inP , a contradiction. Since the author’s reasoning is correct, it must be the case thatthe assumption deg(v) > 1 is false. Since T is connected, deg(v) > 0 so deg(v) = 1.

Page 298: MATH 135 Course Note

298 Chapter 47 Trees

Sentence 8 Similarly, deg(u) = 1 and so two vertices of degree one exist in T .

Similarly is a useful but dangerous word in proofs. If the conditions really are similar,then using “similarly” spares tedious effort in checking the details. However, if theconditions are not similar, the use of “similarly” could be masking a fatal error.

In this case, the argument is identical when w1 replaces wn−1.

Proposition 2 (Number of Vertices in a Tree (NVT))

Let T = (V,E) be a tree. Then |V | = |E|+ 1.

Since V is an integer, we could consider all trees with one vertex, two vertices, three verticesand so on, this seems like a perfect case for induction. Let’s be very clear about what ourstatement P (n) is.

P (n): Let T = (V,E) be a tree with n vertices. Then n = |E|+ 1.

Now we can begin the proof.

Proof: Base Case We verify that P (1) is true where P (1) is the statement

P (1): Let T = (V,E) be a tree with one vertex. Then 1 = |E|+ 1.

This is equivalent to stating that |E| = 0. Since a tree with one vertex has no edges,the base case is true.

Inductive Hypothesis We assume that the statement P (k) is true for k ≥ 1.

P (k): Let T = (V,E) be a tree with k vertices. Then k = |E|+ 1.

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k+1): Let T = (V,E) be a tree with k+1 vertices. Then k+1 = |E|+1.

By Two Vertices of Degree One, we know that there is at least one vertex of degreeone in T . Let’s call such a vertex v. Since deg(v) = 1, v is adjacent to only one vertex,say u. Deleting the vertex v and the edge {u, v} creates a new tree T ′ where T ′ hask vertices and |E| − 1 edges. By our Inductive Hypothesis therefore,

k = (|E| − 1) + 1⇒ k = |E|.

But T has one more vertex and more edge than T ′ so

k + 1 = |E|+ 1

as required.

The result is true for n = k+1, and so holds for all n by the Principle of MathematicalInduction.

Page 299: MATH 135 Course Note

Chapter 48

Dijkstra’s Algorithm

48.1 Objectives

The content objectives are:

1. Be able to execute Dijkstra’s Algorithm.

48.2 Dijkstra’s Algorithm

Let’s look at a formal expression for solving the shortest path problem.

Algorithm 2 Dikstra’s Algorithm

Require: G = (V,E); w : E → R; w({u, v}) ≥ 0, ∀{u, v} ∈ E; and a designated node s.Ensure: T ′ = (V ′, E′) is a tree rooted at s of shortest paths from s to every other node;d : V → R gives the distance of a shortest path to v, ∀v ∈ V .{Initialize}d(s)← 0d(v)←∞, ∀v ∈ V, v 6= sV ′ ← {s}E′ ← ∅T ′ ← (V ′, E′)repeat

for every edge {u, v} ∈ E where u ∈ V ′ and v 6∈ V ′ doif d(v) < d(u) + w({u, v}) thend(v)← d(u) + w({u, v})

end ifend forChoose a y 6∈ V ′ so that d(y) = min{d(w) | w 6∈ V ′}For the y just chosen, choose {x, y} ∈ E where x ∈ V ′ and d(y) = d(x) + w({x, y})V ′ ← V ′ ∪ {y}E′ ← E′ ∪ {{x, y}}T ′ ← (V ′, E′)

until V = V ′

299

Page 300: MATH 135 Course Note

300 Chapter 48 Dijkstra’s Algorithm

We can think of the “Require” statement as the pre-conditions to the algorithm, or thehypothesis to a proposition. In this case, we require a graph with non-negative weights onthe edges, and a starting vertex s. We can think of the “Ensure” statement as the post-conditions to the algorithm or the conclusion of a proposition. In this case, the algorithmshould terminate with a tree of shortest paths rooted at s, and the distances of a shortestpath from s to each node.

Though our original problem talked about distances, the values we assign to the edges ofthe graph could also be time or capacity or costs. The convention is to call these valuesweights, which is why the function from the edges to the real numbers is named w.

Let’s watch the algorithm in operation. Our example appears in Figure 48.2.1.

s

b

a

d

cc

3

1

4 1

3

9 2

Figure 48.2.1: Graph G with weights

The initialization steps of the algorithm set the distance to s at 0, and the provisionaldistances to all other vertices at infinity. By abuse of notation, we will treat infinity as areal number. We will record distances as numeric labels in blue near the vertices. The setV ′ initially contains only s and E′ is empty. We will show the nodes in V ′ as bold circlesand the edges in E′ as bold lines. Note that at every stage of the algorithm, T ′ = (V ′, E′)is a tree of shortest paths to the vertices in V ′. See Figure 48.2.2

s

b

a

d

cc

3

1

4 1

3

9 2

0 ∞

Figure 48.2.2: After initialization

Now the algorithm examines each edge with one vertex in V ′ and one vertex not in V ′. Ifusing the edge creates a shorter path to a vertex not in V ′, then the provisional distance to

Page 301: MATH 135 Course Note

Section 48.2 Dijkstra’s Algorithm 301

that vertex is updated. Figure 48.2.3 shows the results of the update. Edges and distancesinvolved in the updates are shown in green. The infinite values previously assigned tovertices a, b and c have been crossed out.

s

b

a

d

cc

3

1

4 1

3

9 2

0

∞ 1 ∞ 9

∞ 3

Figure 48.2.3: First update of d

Continuing with the update, choose the vertex not in V ′ with the smallest provisionaldistance. In this iteration, the choice is b. Add b to V ′ and {s, b} to E′. This update isshown in Figure 48.2.4. The nodes in V ′ are shown as bold circles and the edges in E′ asbold lines. Note that T ′ = (V ′, E′) is a tree of shortest paths to the vertices in V ′.

s

b

a

d

cc

3

1

4 1

3

9 2

0

3

91

Figure 48.2.4: End of first iteration

We repeat this until V = V ′. Since V = {s, a, b, c, d} and V ′ = {s, b}, V 6= V ′ and so wecontinue. Again, the algorithm examines each edge with one vertex in V ′ and one vertexnot in V ′. If using the edge creates a shorter path to a vertex in V ′, then the provisionaldistance to that vertex is updated. Figure 48.2.5 shows the results of the update. Edgesand distances involved in the updates are shown in green.

Now choose the vertex not in V ′ with the smallest provisional distance. In this iteration,the choice is a. Add a to V ′ and {s, a} to E′. This update is shown in Figure 48.2.6. Thenodes in V ′ are shown as bold circles and the edges in E′ as bold lines. Again, note thatT ′ = (V ′, E′) is a tree of shortest paths to the vertices in V ′.

We repeat this until V = V ′. Since V = {s, a, b, c, d} and V ′ = {s, a, b}, V 6= V ′ and so we

Page 302: MATH 135 Course Note

302 Chapter 48 Dijkstra’s Algorithm

s

b

a

d

cc

3

1

4 1

3

9 2

0 3

9 41

∞ 5

Figure 48.2.5: Second update of d

s

b

a

d

cc

3

1

4 1

3

9 2

0 3

1 4

5

Figure 48.2.6: End of second iteration

continue. Again, the algorithm examines each edge with one vertex in V ′ and one vertexnot in V ′. If using the edge creates a shorter path to a vertex in V ′, then the provisionaldistance to that vertex is updated. In this iteration, no updates to provisional distancestook place. Figure 48.2.7 shows the results of the update. Edges and distances involved inthe updates are shown in green.

s

b

a

d

cc

3

1

4 1

3

9 2

0 3

1 4

5

Figure 48.2.7: Third update of d

Page 303: MATH 135 Course Note

Section 48.2 Dijkstra’s Algorithm 303

Now choose the vertex not in V ′ with the smallest provisional distance. In this iteration,the choice is c. Add c to V ′ and {b, c} to E′. This update is shown in Figure 48.2.8. Again,note that T ′ = (V ′, E′) is a tree of shortest paths to the vertices in V ′.

s

b

a

d

c

3

1

4 1

3

9 2

0 3

1 4

5

Figure 48.2.8: End of third iteration

We repeat this until V = V ′. Since V = {s, a, b, c, d} and V ′ = {s, a, b, c}, V 6= V ′ and sowe continue. Again, the algorithm examines each edge with one vertex in V ′ and one vertexnot in V ′. If using the edge creates a shorter path to a vertex in V ′, then the provisionaldistance to that vertex is updated. Figure 48.2.9 shows the results of the update.

s

b

a

d

c

3

1

4 1

3

9 2

0 3

1 4

5

Figure 48.2.9: Fourth update of d

Now choose the vertex not in V ′ with the smallest provisional distance. In this iteration,the choice is d. Add d to V ′. But now both and {b, d} and {c, d} match the condition to beadded to E′. Which one should be added or should both be added? It is only necessary tochoose one, say {b, d}. This update is shown in Figure 49.3.1. Again, note that T ′ = (V ′, E′)is a tree of shortest paths to the vertices in V ′.

Now, finally V = V ′ and the algorithm terminates.

Page 304: MATH 135 Course Note

304 Chapter 48 Dijkstra’s Algorithm

s

b

a

d

c

3

1

4 1

3

9 2

0 3

1 4

5

Figure 48.2.10: End of fourth iteration and termination of the algorithm

Exercise 1 Create a small random graph, say of 6 or 7 vertices, and run Dijkstra’s algorithm on yourgraph.

48.3 Certificate of Optimality

Based on our experiments when we began this section, the example we did together, andyour own examples, it seems that we have lots of empirical evidence that Dijkstra’s algorithmworks. But evidence is not a proof. Moreover, if a colleague were to provide us with a graph,edge weights and a proposed tree of shortest paths, it would be nice to have a certificateof optimality. Simply running the algorithm again might reproduce an existing error in thecomputer program that runs the algorithm.

Let’s consider the two objects the algorithm is supposed to produce.

1. A tree of shortest paths rooted at s.

2. A function d : V → R which gives the distance of a shortest path to v, for all v ∈ V .

We won’t prove that Dijkstra’s algorithm produces these two objects, though we will cer-tainly think about it. In the next lecture we will prove a theorem that allows us to certifythat the output of Dijkstra’s algorithm is, in fact, correct.

Let’s look at the algorithm more closely. Would we expect the algorithm to always producea tree? That is, is T ′ = (V ′, E′) a tree in every iteration? If there is some iteration wherea cycle is produced the T ′ is not a tree, and the end product will not be a tree because thealgorithm only adds edges. The algorithm never deletes edges.

The algorithm will have |V |−1 iterations because we add a vertex to V ′ at each iteration andV ′ begins with s. We also add an edge at each iteration so we end up with |V ′| = |E′|+ 1.The proposition Number Of Vertices In A Tree is suggestive but not conclusive. It saysthat for a tree T = (V,E), |V | = |E| + 1. It does not say that |V | = |E| + 1 implies thatthe graph (V,E) is a tree.

Let’s consider the construction of T ′. A tree is defined as a connected graph with no cyclesso let’s ask ourselves “Can the algorithm create a cycle in T ′?” Suppose that it did and the

Page 305: MATH 135 Course Note

Section 48.3 Certificate of Optimality 305

cycle occurred when the edge {u, v} was added. That means both u and v already had toexist in V ′, but the edge that is added always contains a vertex not in V ′. Hence, no cyclesexist in T ′. As for connectedness, this makes sense since, at each iteration an edge is addedto an already connected graph constructed in the previous iteration.

More problematic is guaranteeing that T ′ is a tree of shortest paths.

Let’s look at d more closely. Suppose {u, v} ∈ E′ and the path in E′ from s encounters ubefore it encounters v. Then d(u) = d(v) + w({u, v}). That is not a surprise. That is howthe algorithm adds edges to E′. Now look at the exercise that you just completed. Examineany edge at all in E, say {x, y}. My guess is that you will see d(y) ≤ d(x) + w({x, y}).

This is what will help us generate a certificate of optimality.

Page 306: MATH 135 Course Note

Chapter 49

Certificate of Optimality - Path

49.1 Objectives

The content objectives are:

1. Define weight, distance potentials, feasible distance potentials, equality edges and treeof shortest paths.

2. Use a certificate of optimality to test that a proposed solution is optimal.

3. Prove A Path Shorter Than A Walk.

4. Prove Feasible Potentials.

5. Prove Certificate of Optimality for a Path.

6. Prove Shortest Paths Give Feasible Potentials.

7. Prove Shortest Path Optimality.

8. Prove Trees of Shortest Paths.

49.2 Certificate of Optimality

Recall that a certificate consists of a theorem and data. If the data satisfy the hypothesisof the theorem, the theorem guarantees that the desired property holds.

The data will be a tree T and a function d : V → R, exactly what is produced by Dijkstra’salgorithm. Our task is to find a theorem that will say “If the data satisfy a certain property,then

1. T is a tree of shortest paths rooted at s.

2. d : V → R gives the distance of a shortest path to v, for all v ∈ V .”

306

Page 307: MATH 135 Course Note

Section 49.3 Weighted Graphs 307

49.3 Weighted Graphs

Suppose that G = (V,E) is a connected graph with weights w : E → R. Let us also supposethat w({u, v}) ≥ 0, for every edge of E.

Definition 49.3.1

Weight of a Walk

Let W = v0v1v2 . . . vn be a walk in G. We define the weight of W to be the sum of theweights of all arcs in W . If the edge {u, v} occurs more than once in W , its weight iscounted for each occurrence in W . More formally,

w(W ) =n−1∑i=0

w({vi, vi+1})

We have been using this definition implicitly. The distance of a trip from downtown Torontoto Sibbald Point Provincial Park is the sum of the distances of each part of the trip.Dijkstra’s algorithm also uses this definition implicitly.

Proposition 1 (A Path Shorter Than A Walk (PSTW))

Let G = (V,E) be a connected graph with non-negative real weights. Let W be an st-walkwith s 6= t. Then there exists an st-path with w(P ) ≤ w(W ).

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Part 3 of Walk Decomposition states that W can be decomposed into an st-path Pand a collection of cycles C1, C2, . . . , Cr.

2. Now

w(W ) = w(P ) +

r∑i=1

w(Ci).

3. Since w(Ci) ≥ 0 for all i = 1, 2, 3, . . . , r, w(P ) ≤ w(W ).

Analysis of Proof As usual, we will begin by explicitly identifying the hypothesis andthe conclusion.

Hypothesis: G = (V,E) is a connected graph with non-negative real weights. W isan st-walk with s 6= t.

Conclusion: There exists an st-path with w(P ) ≤ w(W ).

Core Proof Technique: Construct Method.

Preliminary Material: Definitions related to weighted graphs.

Sentence 1 Part 3 of Proposition 1 states that W can be decomposed into an st-path Pand a collection of cycles C1, C2, . . . , Cr.

The conclusion contains an existential quantifier so the author uses the ConstructMethod. Let’s first identify the components of the existential quantifier.

Page 308: MATH 135 Course Note

308 Chapter 49 Certificate of Optimality - Path

Quantifier: ∃Variable: A path PDomain: All paths in G = (V,E)Open sentence: w(P ) ≤ w(W )

The author must construct an st-path P and does so using Part 3 of Proposition WalkDecomposition. The author will now show that w(P ) ≤ w(W ).

Sentence 2 Now

w(W ) = w(P ) +r∑i=1

w(Ci).

This is the numeric implication of Walk Decmposition.

Sentence 3 Since w(Ci) ≥ 0 for all i = 1, 2, 3, . . . , r, w(P ) ≤ w(W ).

This is arithmetic.

The proof is very simple and relies very heavily on the fact that w(Ci) ≥ 0 for all i =1, 2, 3, . . . , r. What if the hypothesis “non-negative real weights” were simply “non-negativereal weights”?

Exercise 1 Show the necessity of “non-negative” in the hypothesis of a Path Shorter Than A Walk.That is, find a counter-example to the statement:

Let G = (V,E) be a connected graph with non-negative real weights. Let W be an st-walkwith s 6= t. Then there exists an st-path with w(P ) ≤ w(W ).

You might argue that this is irrelevant because you never encounter negative distances.This may be true of distances, but this is not true of costs. Subsidies and rebates do, infact, create negative cost edges in models.

Definition 49.3.2

Potentials, EqualityEdges

Let G = (V,E) be a connected graph with non-negative weights w : E → R and d : V → R.The components of d are called distance potentials. We say that distance potentials arefeasible when

d(u) + w({u, v}) ≥ d(v) for all uv ∈ E.

Edges for which d(u) + w({u, v}) = d(v) are called equality edges.

Page 309: MATH 135 Course Note

Section 49.3 Weighted Graphs 309

Proposition 2 (Feasible Potentials (FP))

Let G = (V,E) be a connected graph with non-negative weights w : E → R, d : V → Rbe feasible distance potentials and W an st-walk. Then w(W ) ≥ d(t) − d(s). Moreover,w(W ) = d(t)− d(s) if and only if every arc of W is an equality edge.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Suppose W = v0v1v2 . . . vk where s = v0 and t = vk.

2. The feasible distance potentials satisfy

d(v0) + w({v0, v1}) ≥ d(v1)

d(v1) + w({v1, v2}) ≥ d(v2)

d(v2) + w({v2, v3}) ≥ d(v3)

...

d(vk−1) + w({vk−1, vk}) ≥ d(vK)

3. Adding these inequalities together gives

d(v0) + d(v1) + d(v2) + . . .+ d(vk−1) + w({v0, v1}) + w({v1, v2}) + . . .+ w({vk−1, vk})≥d(v1) + d(v2) + d(v3) + . . .+ d(vk).

4. This simplifies tod(v0) + w(W ) ≥ d(vk)

orw(W ) ≥ d(t)− d(s).

5. Moreover, w(W ) ≥ d(t)−d(s) if and only if every inequality above holds with equality,that is, every edge in W is an equality edge.

This is a straightforward proof so no analysis is provided.

Theorem 3 (Certificate of Optimality for a Path (OPT P))

Let G = (V,E) be a connected graph with non-negative weights w : E → R and let sbe a designated vertex and let P be an st-path. If there exist feasible distance potentialsd : V → R such that every edge of P is an equality edge, then P is a shortest st-path.

Before we examine the proof, let’s see how the theorem works as part of the certificate. Re-call the tree and function d that resulted from our example of running Dijkstra’s algorithm.

Page 310: MATH 135 Course Note

310 Chapter 49 Certificate of Optimality - Path

s

b

a

d

c

3

1

4 1

3

9 2

0 3

1 4

5

Figure 49.3.1: Tree and d

The dark edges indicate the tree and the blue labels adjacent to the vertices give d. Observethe sd-path P = sbd. All of the hypotheses of Certificate of Optimality for a Path aresatisfied. G is a connected graph with non-negative weights. A vertex s has been designated.P = sbd is an sd-path. By examining each edge of G we can confirm that d are feasibledistance potentials. By examining each edge of P we can confirm that every edge of P is anequality edge. Hence, by the Certificate of Optimality for a Path, P is a shortest sd-path.

Now to the proof.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. By the first part of the conclusion of Feasible Potentials, every st-walk has weight atleast w(t)− w(s).

2. By the second part of the conclusion of Feasible Potentials, w(P ) = w(t)− w(s).

3. Since the weight of every walk W is bounded below by w(t)− w(s), and P is a paththat achieves that bound, P must be a shortest st-path.

Analysis of Proof We will begin by explicitly identifying the hypothesis and the conclu-sion.

Hypothesis: G = (V,E) is a connected graph with non-negative weightsw : E → R. s is a designated vertex and P is an st-path. There exist feasibledistance potentials d : V → R such that every edge of P is an equality edge.

Conclusion: P is a shortest st-path.

Core Proof Technique: Direct Proof. Existential quantifiers occur in the hypoth-esis so the Object Method is used.

Preliminary Material: Accumulated knowledge about weighted graphs.

Page 311: MATH 135 Course Note

Section 49.3 Weighted Graphs 311

Sentence 1 By the first part of the conclusion of Feasible Potentials, every st-walk hasweight at least w(t)− w(s).

Since is is a form of the existential quantifier, the hypothesis “P is an st-path” allowsthe author to assume the existence of P . What the author must show is not thatP exists, or that P is an st-path, but rather that P is a shortest st-path. The firstsentence of the proof places an upper bound on w(P ).

Sentence 2 By the second part of the conclusion of Feasible Potentials, w(P ) = w(t)−w(s).

The hypotheses of the current theorem include “There exist feasible distance potentialsd : V → R such that every edge of P is an equality edge.” The existential quantifier inthis hypothesis allows the author to assume the existence of feasible distance potentialsand equality edges. These are needed to invoke Feasible Potentials.

Sentence 3 Since the weight of every walk W is bounded below by w(t) − w(s), and P isa path that achieves that bound, P must be a shortest st-path.

Since no walk, and hence no path, can be shorter than w(t) − w(s), and w(P ) =w(t)− w(s), P must be a shortest st-path.

Proposition 4 (Shortest Paths Give Feasible Potentials (SPGFP))

Let G = (V,E) be a connected graph with non-negative weights w : E → R and a designatednode s. If d : V → R is defined as the length of a shortest path from s to v for all verticesin V , then d are feasible distance potentials.

Proof: (For reference purposes, each sentence of the proof is written on a separate line.)

1. By contradiction, suppose that d are not feasible distance potentials. Then thereexists {u, v} ∈ E such that d(u) + w({u, v}) < d(v).

2. Let P be a shortest su-path. By the definition of d, w(P ) = d(u).

3. Consider the walk W constructed by appending the edge {u, v} to the path P .

4. By a Path Shorter Than A Walk, there exists an sv-path P ′ with w(P ′) ≤ w(W ).

5. But w(W ) = w(P ) + w({u, v}) = d(u) + w({u, v}) < d(v).

6. But then w(P ′) < d(v) so d(v) cannot be the length of a shortest sv-path, a contra-diction.

Now we show that the converse of the certificate of optimality for paths also holds.

Theorem 5 (Feasible Distance Potentials and Equality Edges (FDPEE))

Let G = (V,E) be a connected graph with non-negative weights w : E → R and let s bea designated vertex. If P is a shortest st-path, then there exist feasible distance potentialsd : V → R such that every edge of P is an equality edge.

Page 312: MATH 135 Course Note

312 Chapter 49 Certificate of Optimality - Path

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Let d : V → R be defined as the length of a shortest path from s to v for all vertices inV . By Shortest Paths Give Feasible Potentials, these are feasible distance potentials.

2. Hence, w(P ) = d(t) = d(t)− 0 = d(t)− d(s).

3. But then Feasible Potentials implies that every edge of P is an equality edge.

Together, the theorem on the optimality of paths (Certificate of Optimality for Paths)and the existence of feasible distance potentials (Feasible Distance Potentials and EqualityEdges) gives

Theorem 6 (Shortest Path Optimality (SPO))

Let G = (V,E) be a connected graph with non-negative weights w : E → R and let sbe a designated vertex. P is a shortest st-path if and only if there exist feasible distancepotentials such that every edge of P is an equality edge.

49.4 Certificate of Optimality - Tree

We have dealt so far with paths, but Dijkstra’s algorithm produces a tree, not a path.Fortunately, similar theorems hold.

Theorem 7 (Trees of Shortest Paths (TSP))

Let G = (V,E) be a connected graph with non-negative weights w : E → R. Let s be adesignated vertex and let T be a spanning tree rooted at s. If there exist feasible distancepotentials such that every edge of T is an equality edge, then T is a tree of shortest pathsrooted at s.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Let us assume that there exist feasible distance potentials such that every edge of Tis an equality edge.

2. For every node v in V , there is an st-path in T that satisfies the hypotheses ofCertificate of Optimality for a Path.

3. Hence, T is a tree of shortest paths rooted at s.

The proposition Trees of Shortest Paths requires a spanning tree, feasible potentials andequality arcs. How do we know that these exist?

Page 313: MATH 135 Course Note

Section 49.4 Certificate of Optimality - Tree 313

Theorem 8 (Existence of Trees of Shortest Paths (ETSP))

Let G = (V,E) be a connected graph with non-negative weights w : E → R and let s be adesignated vertex. Then there exists a tree of shortest paths rooted at s.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. For every node v ∈ V , let P (v) be a shortest st-path in G and let d(v) = w(P (v)).

2. Since d(v) is the length of a shortest path to v, Shortest Paths Give Feasible Potentials,tells us that d is a set of feasible distance potentials.

3. We know from Feasible Distance Potentials and Equality Edges that every edge ina shortest sv-path is an equality arc. So, every edge of P (v) is an equality edge forevery v ∈ V .

4. LetE′ =

⋃v∈V

P (v).

5. The edges of E′ contain a path consisting of equality arcs from s to every v ∈ V .Delete from E′ enough edges to produce a tree T .

6. But then Trees of Shortest Paths applies and T is a tree of shortest paths rooted ats.

Page 314: MATH 135 Course Note

Part IX

An Introduction to Fermat’s LastTheorem

314

Page 315: MATH 135 Course Note

Chapter 50

Introduction to Primes

50.1 Objectives

The technique objectives are:

1. Practice with induction.

2. Practice with arguments of uniqueness.

The content objectives are:

1. Recall the definition of prime and composite.

2. Discover a proof by induction of the Prime Factorization Theorem.

50.2 Introduction to Primes

The second problem that the course focuses on is Fermat’s Last Theorem.

Theorem 1 (Fermat’s Last Theorem (FLT))

If n ≥ 3, then there are no solutions to

xn + yn = zn

where x, y and z are positive integers.

To make progress on this problem, we need to work with prime numbers. Recall ourdefinition of prime number.

Definition 50.2.1

Prime, Composite

An integer p > 1 is called a prime if its only divisors are 1 and p, and composite otherwise.

315

Page 316: MATH 135 Course Note

316 Chapter 50 Introduction to Primes

Example 1 The integers 2, 3, 5 and 7 are primes. The integers 4 = 2 × 2, 6 = 2 × 3 and 8 = 2 × 2 × 2are composite. Note, that by definition, 1 is not a prime.

We have already proved three propositions about primes, one of which is a consequence ofCoprimeness and Divisibility, and the other two were proved in the chapter on contradiction.

Proposition 2 (Primes and Divisibility (PAD))

If p is a prime and p | ab, then p | a or p | b.

Proposition 3 (Prime Factorization (PF))

If n is an integer greater than 1, then n can be written as a product of prime factors.

Proposition 4 (Infinitely Many Primes (INF P))

The number of primes is infinite.

We will prove Prime Factorization again, this time with induction.

50.3 Induction

Recall how induction, Strong Induction in this case, works.

Axiom 3 Principle of Strong Induction (POSI)

Let P (n) be a statement that depends on n ∈ P.

If

1. P (1), P (2), . . . , P (b), are true, and

2. P (1), P (2), . . . , P (k) are all true implies P (k + 1) is true

then P (n) is true for all n ∈ P.

Recall the three parts in a proof by strong induction.

Base Cases Verify that P (1), P (2), . . . , P (b) are all true.

Inductive Hypothesis Assume that P (i) is true for i = 1, 2, 3, . . . , k where k ≥ b.

Inductive Conclusion Using the assumption that P (1), P (2), . . . , P (k) are true,show that P (k + 1) is true.

Page 317: MATH 135 Course Note

Section 50.4 Fundamental Theorem of Arithmetic 317

We will use Strong Induction to prove

Proposition 5 (Prime Factorization (PF))

If n is an integer greater than 1, then n can be expressed as a product of prime factors.

First, we formulate our statement P (n) that relies on the integer n.

P (n): n can be expressed as a product of prime factors.

Now we can begin the proof.

Proof: Base Case We verify P (2). Recall that the base case does not need to start at 1.

P (2): 2 can be expressed as a product of prime factors.

This is trivially true – a prime written by itself is a product with one factor.

Inductive Hypothesis We assume that P (i) is true for i = 2, 3, . . . , k where k ≥ 2.

P (i): i can be expressed as a product of prime factors.

Inductive Conclusion Now show that the statement P (k + 1) is true.

P (k + 1): k + 1 can be expressed as a product of prime factors.

If k + 1 is prime, then k + 1 by itself is a product of prime factors. It is a productwith just one factor. In this case, P (k + 1) is true.

If k + 1 is composite, then we can write k + 1 = rs where 1 < r ≤ s < k + 1. Sincer and s are less than k + 1, they can be written as a product of prime factors by theinductive hypothesis. Hence, k + 1 is a product of prime factors and P (k + 1) is truein this case also.

The result is true for n = k + 1, and so holds for all n by the Principle of StrongInduction.

50.4 Fundamental Theorem of Arithmetic

In grade school you used prime numbers to write the prime factorization of any positiveinteger greater than one. You probably never worried about the possibility that there mightbe more than one way to do this. However, in some sets “prime” factorization is not unique.

Consider the set S = {a+ b√

5 | a, b ∈ Z}. In S, the number 4 = 4 + 0√

5 can be factoredin two different ways, 4 = 2× 2 and 4 = (

√5 + 1)(

√5− 1). Moreover, 2,

√5 + 1 and

√5− 1

are all prime numbers in S!

Since multiplication in the integers is commutative, the prime factorizations can be writtenin any order. For example 12 = 2 × 2 × 3 = 2 × 3 × 2 = 3 × 2 × 2. However, up to theorder of the factors, the factorization of integers is unique. This property is so basic it isreferred to as the Fundamental Theorem of Arithmetic. It is also referred to as the UniqueFactorization Theorem.

Page 318: MATH 135 Course Note

318 Chapter 50 Introduction to Primes

Theorem 6 (Fundamental Theorem of Arithmetic orUnique Factorization Theorem (UFT))

If n > 1 is an integer, then n can be written as a product of prime factors and, apart fromthe order of factors, this factorization is unique.

Observe that the conclusion contains two parts:

1. n can be written as a product of prime factors (which we proved earlier), and

2. apart from the order of factors, this factorization is unique.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. That n can be written as a product of prime factors follows from the propositionPrime Factorization.

2. Now suppose that n is factored into primes in two ways,

n = p1p2 . . . pk = q1q2 . . . q` (50.1)

where all of the p’s and q’s are primes.

3. Since p1 | n, p1 | q1q2 . . . q`.

4. By repeatedly applying the proposition Primes and Divisibility, p1 must divide one ofthe q’s. If necessary, rearrange the q’s so that p1 | q1.

5. Since q1 is prime, and p1 > 1, it must be the case that p1 = q1.

6. Dividing Equation 50.1 by p1 = q1 gives

p2p3 . . . pk = q2q3 . . . q` (50.2)

7. By continuing in this way, we see that each p must be paired off with one of the qsuntil there are no factors on either side.

8. Hence k = ` and, apart from the order of the factors, the two expressions for n arethe same.

Let’s perform an analysis of the proof. As usual, we begin with the hypothesis and theconclusion.

Hypothesis: n is an integer, n > 1

Conclusion: There are two parts.

1. n can be written as a product of prime factors, and

2. apart from the order of factors, this factorization is unique.

Page 319: MATH 135 Course Note

Section 50.5 Finding a Prime Factor 319

Core Proof Technique: Uniqueness

Preliminary Material: Primes and Divisibility

Sentence 1 That n can be written as a product of prime factors follows from the propositionPrime Factorization.

The first of the two parts of the conclusion is just the conclusion of a previous propo-sition.

Sentence 2 Now suppose that n is factored into primes in two ways,

n = p1p2 . . . pk = q1q2 . . . q`

where all of the p’s and q’s are primes.

This is a classic use of the Uniqueness Method. We assume that there are two rep-resentations of the same object, and show that the two representations are, in fact,identical. One representation of n is the product p1p2 . . . pk and the second represen-tation is the product q1q2 . . . q`.

Sentences 3 – 5 Since p1 | n, p1 | q1q2 . . . q`. By repeatedly applying the propositionPrimes and Divisibility, p1 must divide one of the q’s. If necessary, rearrange the q’sso that p1 | q1. Since q1 is prime, and p1 > 1, it must be the case that p1 = q1.

The author shows that the two representations of n are equal by showing that theyhave identical factors. Here, the author demonstrates that p1 = q1.

Sentences 6 – 7 Dividing Equation 50.1 by p1 = q1 gives

p2p3 . . . pk = q2q3 . . . q`

By continuing in this way, we see that each p must be paired off with one of the qsuntil there are no factors on either side.

This continues the author’s plan of showing that the two representations of n areequal by showing that they have identical factors.

Sentence 8 Hence k = ` and, apart from the order of the factors, the two expressions forn are the same.

This is a typical conclusion to the Uniqueness Method. The two representations ofthe same object are identical.

50.5 Finding a Prime Factor

The previous proposition does not provide an algorithm for finding the prime factors of apositive integer n. The next proposition shows that we do not have to check all of the primefactors less than n, only those less than or equal to the square root of n.

Proposition 7 (Finding a Prime Factor (FPF))

An integer n > 1 is either prime or contains a prime factor less than or equal to√n.

Let’s begin by identifying the hypothesis and the conclusion.

Page 320: MATH 135 Course Note

320 Chapter 50 Introduction to Primes

Hypothesis: n is an integer and n > 1.

Conclusion: n is either prime or contains a prime factor less than or equal to√n.

Before we see a proof, let’s do an example.

Example 2 Is 73 a prime number?

Solution: Using Finding a Prime Factor , we can check for divisibility by primes less thanor equal to

√73. Now

√73 ≈ 8.544 so any possible prime factor must be less than or equal

to 8. The only candidates to check are 2, 3, 5 and 7. Since none of these divide 73, 73 mustbe prime.

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. Suppose that n is not prime.

2. Let p be the smallest prime factor of n.

3. Since n is composite we can write n = ab where a and b are integers such that1 < a, b < n.

4. Since p is the smallest prime factor, p ≤ a and p ≤ b and so p2 = p · p ≤ a · b = n.That is p ≤

√n.

Analysis of Proof Since or appears in the conclusion, we will use Proof By Elimination.The equivalent statement that is proved is:

If n is an integer greater than 1 and n is not prime, then n contains a primefactor less than or equal to

√n.

The word “a” should alert us to the presence of an existential quantifier. We couldreword the statement as

If n is an integer greater than 1 and n is not prime, then there exists aprime factor of n which is less than or equal to

√n.

This is the statement that will actually be proved.

Hypothesis: n is an integer greater than 1 and n is not prime.

Conclusion: There exists a prime factor of n which is less than or equal to√n.

Core Proof Technique: Construct Method

Sentence 1 Suppose that n is not prime.

This sentence tells that the author is going to use Proof by Elimination.

Sentence 2 Let p be the smallest prime factor of n.

The conclusion has an existential quantifier and so the author uses the ConstructMethod. The prime p will be the desired prime factor though it is not clear yet why“smallest” is important. The proposition on Prime Factorization guarantees us thata prime factor exists.

Page 321: MATH 135 Course Note

Section 50.6 Working With Prime Factorizations 321

Sentence 3 Since n is composite we can write n = ab where a and b are integers such that1 < a, b < n.

By the hypotheses of the restated proposition, n > 1 and n is not prime, so n iscomposite and can be factored.

Sentence 4 Since p is the smallest prime factor, p ≤ a and p ≤ b and so p2 = p · p ≤a · b = n. That is p ≤

√n.

This is where “smallest” is used. The conclusion follows from arithmetic and the factthat p is the smallest prime factor.

50.6 Working With Prime Factorizations

The next proposition, which we will state but not prove, gives us a means to list all of thedivisors of a positive integer.

Proposition 8 (Divisors From Prime Factorization (DFPF))

If a > 1 is an integer anda = pα1

1 pα22 · · · p

αkk

is the prime factorization of a into powers of distinct primes p1, p2, . . . , pk, then the positivedivisors of a are integers of the form

d = pd11 pd22 · · · p

dkk where 0 ≤ di ≤ αi for i = 1, 2, . . . , k

Example 3 (Using Divisors From Prime Factorization)

What are the prime factors of 72?

We will use Divisors From Prime Factorization. Since

72 = 2332

the positive divisors of a are integers of the form

d = 2d13d2 where 0 ≤ d1 ≤ 3 and 0 ≤ d1 ≤ 2

The possibilities are

2030 = 1 2130 = 2 2230 = 4 2330 = 82031 = 3 2131 = 6 2231 = 12 2331 = 242032 = 9 2132 = 18 2232 = 36 2332 = 72

Exercise 1 Using Divisors From Prime Factorization, list all of the positive factors of 45.

Page 322: MATH 135 Course Note

322 Chapter 50 Introduction to Primes

Exercise 2 How many positive divisors are there to the integer a whose prime factorization is

a = pα11 pα2

2 · · · pαkk

Proposition 9 (GCD From Prime Factorization (GCD PF))

Ifa = pα1

1 pα22 · · · p

αkk

andb = pβ11 p

β22 · · · p

β``

are the prime factorizations of a and b, where some of the exponents may be zero, then

gcd(a, b) = pd11 pd22 · · · p

dkk where di = min{αi, βi} for i = 1, 2, . . . , k

Example 4 (Using GCD From Prime Factorization)

What is gcd(24750, 434511)?

Since24750 = 213253111 = 21325370111190

and434511 = 3371112191 = 20335071112191,

gcd(24750, 434511) = 2min{1,0}3min{2,3}5min{3,0}7min{0,1}11min{1,2}19min{0,1}

= 20325071112190

= 7623

Though this method works well enough on small examples, it is much slower than theExtended Euclidean Algorithm for computing gcds.

Exercise 3 Use GCD PF to compute gcd(335174131, 5277131232).

Exercise 4 Use the definition of gcd to prove GCD From Prime Factorization.

50.7 More Examples

1. This question deals with prime factorizations.

(a) Write out the prime factorizations of 12936 and 16380.

Page 323: MATH 135 Course Note

Section 50.8 Problems 323

(b) Using part (a), determine gcd(12936, 16380).

(c) Use the Extended Euclidean Algorithm or the Euclidean Algorithm to verify thatyour answer in (b) is correct.

Solution:

(a)

12936 = 233172111

16380 = 22513271131

(b) gcd(12936, 16380) = 223171 = 84

(c)x y r q

1 0 16380 0

0 1 12936 0

1 −1 3444 1

−3 4 2604 3

4 −5 840 1

−15 19 84 3

154 −195 0 10

Indeed, 84 = gcd(12936, 16380).

50.8 Problems

1. Prove that if p <= n, then p does not divide n! + 1.

2. Let n >= 0. What is the power of 2 in the prime factorization of (2n)! ? Prove thatyou have the correct value.

3. Note that k divides n! +k for each k <= n. Use this fact to show that, for all positiveintegers m, there exist consecutive primes which are at least m apart.

Page 324: MATH 135 Course Note

Chapter 51

Introduction to Fermat’s LastTheorem

51.1 Objectives

The content objectives are:

1. Provide an historical introduction.

2. Define gcd(x, y, z), trivial solutions, Pythagorean triple and primitive Pythagoreantriple.

3. State Extending Coprimeness.

4. Read a proof of Multiples of Pythagorean Triples.

5. Discover a proof of Relative Primeness of Pythagorean Triples.

6. Read a proof of Parity of Primitive Pythagorean Triples.

7. State Decomposition of n-th Powers.

51.2 History of Fermat’s Last Theorem

Pierre de Fermat (1601 (?) – 1635) was a brilliant French mathematician. It was his habitto make notes in the margins of his books and one such note is famous. Fermat possesseda copy of Bachet’s translation of Diophantus’ Arithmetica. Problem II.8 of the Arithmeticareads

Partition a given square into two squares.

Diophantus did not require the squares to be integers so we might write Problem II.8 as

For what positive rational numbers x, y and z is the equation

x2 + y2 = z2

satisfied?

324

Page 325: MATH 135 Course Note

Section 51.2 History of Fermat’s Last Theorem 325

Adjacent to Problem II.8, and in the margin of his copy of Arithmetica, Fermat wrote(translated)

It is impossible to separate a cube into two cubes, or a fourth power into twofourth powers, or in general, any power higher than the second, into two likepowers. I have discovered a truly marvellous proof of this, which this margin istoo narrow to contain.

Fermat was asserting

Theorem 1 (Fermat’s Last Theorem)

If n ≥ 3, thenxn + yn = zn

has no solutions when x, y and z are positive integers.

No proof was ever published by Fermat, or found among his notes after his death. It seemsvery unlikely that he did have a proof and it was not until Andrew Wiles’ publications in1994 that the Theorem, conjecture really, was proved. Fermat did prove the case n = 4, aswe shall do.

First though, we will clarify our language. Clearly there are solutions to xn+ yn = zn. Onesolution is x = y = z = 0, another solution is x = 0, y = z.

Definition 51.2.1

Trivial

We will say that any solution to xn + yn = zn for which at least one of x, y or z is zero, istrivial.

So we restate Fermat’s Last Theorem as

Theorem 2 (Fermat’s Last Theorem)

If n ≥ 3, thenxn + yn = zn

has no non-trivial integer solutions.

Our starting point will be a much more familiar problem.

x2 + y2 = z2 (51.1)

You will recognize this as the equation of the Pythagorean Theorem. Our task is to identifyall positive integer solutions to Equation 51.1.

Page 326: MATH 135 Course Note

326 Chapter 51 Introduction to Fermat’s Last Theorem

51.3 Pythagorean Triples

We begin with some definitions.

Definition 51.3.1

Pythagorean Triple

A Pythagorean triple is an ordered triple of non-zero integers (x, y, z) such thatx2 + y2 = z2.

Equivalently, a Pythagorean triple is a non-trivial solution to x2 + y2 = z2.

Now we expand our definition of gcd.

Definition 51.3.2

Greatest CommonDivisor

Let a, b and c be integers, not all zero. An integer d > 0 is the greatest common divisorof a, b and c, written gcd(a, b, c), if and only if

1. d | a, d | b and d | c (this captures the common part of the definition), and

2. if e | a and e | b and e | c then e ≤ d (this captures the greatest part of the definition).

We leave the proof of the following very useful lemma as an exercise.

Lemma 3 (Extending Coprimeness (EC))

If x, y and z are integers, not all zero, and gcd(x, y) = 1, then gcd(x, y, z) = 1.

Definition 51.3.3

Primitive Triple

A Pythagorean triple (x, y, z) is said to be primitive if gcd(x, y, z) = 1.

Example 1 Both (6, 8, 10) and (3, 4, 5) are Pythagorean triples. However

• (6, 8, 10) is not a primitive Pythagorean triple since gcd(6, 8, 10) = 2 6= 1.

• (3, 4, 5) is a primitive Pythagorean triple since gcd(6, 8, 10) = 1.

Proposition 4 (Multiples of Pythagorean Triples (MPT))

Let d = gcd(x, y, z). The triple (x, y, z) is a Pythagorean triple if and only if (x1, y1, z1) is

a Pythagorean triple where x1 =x

d, y1 =

y

dand z1 =

z

d.

Example 2 (6, 8, 10) is a Pythagorean triple since 62+82 = 102. Since gcd(6, 8, 10) = 2, by the Multiplesof Pythagorean Triples, (3, 4, 5) is a Pythagorean triple.

Also, if (3, 4, 5) is a Pythagorean triple, then (3d, 4d, 5d) is a Pythagorean triple.

Page 327: MATH 135 Course Note

Section 51.3 Pythagorean Triples 327

This is a simple “if and only if” proof that can be proved using a chain of “if and only if”statements.

Proof:

(x, y, z) is a Pythagorean triple

⇐⇒ x2 + y2 = z2 (defn of Pythagorean triple)

⇐⇒ x2

d2+y2

d2=z2

d2(divide by d2)

⇐⇒ x21 + y21 = z21 (substitution)

⇐⇒ (x1, y1, z1) is a Pythagorean triple (defn of Pythagorean triple)

Take ten minutes to prove the following proposition and then compare your proof with theproof that follows.

Proposition 5 (Relative Primeness of Pythagorean Triples (RPPT))

If (x, y, z) is a primitive Pythagorean triple, then gcd(x, y) = gcd(x, z) = gcd(y, z) = 1.

Proof: We will show that gcd(x, y) = 1. The other pairs are similar. Suppose to thecontrary that gcd(x, y) = d > 1. Then there exists a prime p so that p | d. Since p | x andp | y, p | (x2 + y2) by the Divisibility of Integer Combinations. Since x2 + y2 = z2, p | z2and so p | z by Primes and Divisibility. But then gcd(x, y, z) ≥ p > 1 which contradicts thehypothesis that (x, y, z) is a primitive Pythagorean triple.

The next proposition identifies a very simple but useful attribute of primitive Pythagoreantriples.

Proposition 6 (Parity of Primitive Pythagorean Triples (PPPT))

If (x, y, z) is a primitive Pythagorean triple, then one of the integers x or y is even and theother is odd.

First, notice that this implies that z is odd. (Why?) Second, let’s check this against ourexperience.

Example 3 (Parity of Primitive Pythagorean Triples)

1. In the primitive Pythagorean triple (3, 4, 5), 3 is odd and 4 is even.

2. The Pythagorean triple (6, 8, 10) has no odd elements, but the proposition does notapply to the Pythagorean triple (6, 8, 10) since it is not primitive.

3. In the primitive Pythagorean triple (8, 15, 17), 8 is even and 15 is odd.

Let’s walk through a proof of this proposition.

Page 328: MATH 135 Course Note

328 Chapter 51 Introduction to Fermat’s Last Theorem

Proof: (For reference, each sentence of the proof is written on a separate line.)

1. We will proceed by contradiction using two cases: x and y are both even, and x andy are both odd.

2. Consider the first case. Suppose that x and y are both even.

3. But then gcd(x, y) = 2 6= 1 which contradicts the Relative Primeness of PythagoreanTriples.

4. Consider the second case. Suppose that x and y are both odd.

5. This implies that x2 ≡ 1 (mod 4) and y2 ≡ 1 (mod 4) which in turn implies

z2 = x2 + y2 ≡ 2 (mod 4)

6. But this is impossible since the square of any integer can only be congruent to 0 or 1modulo 4.

7. Since the two integers cannot both be even or odd, exactly one must be even and onemust be odd.

As usual, we will begin our analysis by identifying the hypothesis, conclusion, core prooftechniques and preliminary material.

Hypothesis: x, y and z are a primitive Pythagorean triple.

Conclusion: One of the integers x or y is even and the other is odd.

Core Proof Technique: There are only three possible cases: x and y are both even, x andy are both odd or x and y have opposite parity. The first two cases will be eliminatedleaving the third as the only possible outcome. Each of the first two cases is dealt withusing contradiction. The use of contradiction several times within a proof is common.

Preliminary Material: primitive Pythagorean triple, congruences

Let’s examine each collection of sentences.

Sentence 1. We will proceed by contradiction eliminating two cases: x and y are both even,and x and y are both odd.

The author indicates the plan of the proof, always a good idea. There are only threepossible cases: x and y are both even, x and y are both odd or x and y have oppositeparity. The author will disprove the first two cases using contradiction, hence byelimination leaving only opposite parity.

Sentence 2. Consider the first case. Suppose that x and y are both even.

This sentence begins the first of the two embedded proofs by contradiction.

Page 329: MATH 135 Course Note

Section 51.3 Pythagorean Triples 329

Sentence 3. But then gcd(x, y) = 2 6= 1 which contradicts the Relative Primeness ofPythagorean Triples.

To invoke the Relative Primeness of Pythagorean Triples we should make sure thatthe hypothesis of RPPT is satisfied. All that is required is that “x, y and z are aprimitive Pythagorean triple”, which is assured from the hypothesis of the propositionwe are proving.

Sentence 4. Consider the second case. Suppose that x and y are both odd.

This sentence begins the second of the two embedded proofs by contradiction.

Sentence 5. This implies that x2 ≡ 1 (mod 4) and y2 ≡ 1 (mod 4) which in turn implies

z2 = x2 + y2 ≡ 2 (mod 4)

Sentence 6. But this is impossible since the square of any integer can only be congruentto 0 or 1 modulo 4.

This part of proof is quite different from the earlier part. Since any odd integer a canbe written in the form 2t+ 1, a2 has the form 4t2 + 4t+ 1 which is congruent to1 (mod 4). Thus z2 = x2 +y2 ≡ 1 + 1 ≡ 2 (mod 4). But how could this be? If z wereodd, z2 ≡ 1 (mod 4), and if z were even, z2 ≡ 0 (mod 4).

Sentence 7. Since the two integers cannot both be even or odd, exactly one must be evenand one must be odd.

Since the cases of x and y both even or x and y both odd have been eliminated, allthat remains is that x and y have opposite parity.

REMARK

If (x, y, z) is a Pythagorean triple, we will assume as a convention that x is even and y isodd.

We conclude with a small proposition that is very useful. The proof appears in the Ap-pendix.

Proposition 7 (Decomposition of n-th Powers (DNP))

If a, b, c ∈ N and ab = cn and gcd(a, b) = 1, then there exist integers a1 and b1 so thata = an1 and b = bn1 .

Example 4 Consider 592, 704 which is just 843. With n = 3, c = 84, a = 64 and b = 9261, thehypotheses of the proposition are satisfied. Hence, there exist integers a1 and b1 so thata = 64 = an1 and b = 9261 = bn1 . So a1 = 4 and b1 = 21, and 43213 = 843.

Notice that our choice of a and b satisfied gcd(a, b) = 1. With a = 8 = 23 and b = 74088 =423, even though ab = cn is still true, the proposition does not apply since gcd(a, b) 6= 1

Page 330: MATH 135 Course Note

Chapter 52

Characterization of PythagoreanTriples

52.1 Objectives

The content objectives are:

1. State and prove the Characterization of Pythagorean Triples theorem.

2. Illustrate the theorem.

52.2 Pythagorean Triples

We are now able to characterize all non-trivial, primitive Pythagorean triples. The proofin this section follows that done by David Burton in Elementary Number Theory, SeventhEdition.

Theorem 1 (Characterization of Pythagorean Triples (CPT))

The complete set of non-trivial, primitive solutions to

x2 + y2 = z2

is given by

x = 2st

y = s2 − t2

z = s2 + t2

for integers s > t > 0 such that gcd(s, t) = 1 and s 6≡ t (mod 2).

Let’s understand what the theorem is saying. Every choice of s and t satisfying integerss > t > 0 such that gcd(s, t) = 1 and s 6≡ t (mod 2) does produce a non-trivial, primitivePythagorean triple and these are the only non-trivial, primitive Pythagorean triples.

330

Page 331: MATH 135 Course Note

Section 52.2 Pythagorean Triples 331

The table below lists some primitive Pythagorean triples arising from small values of s andt.

s t x y z2st s2 − t2 s2 + t2

2 1 4 3 53 2 12 5 134 1 8 15 174 3 24 7 255 2 20 21 295 4 40 9 41

Before we read the proof, let’s do some analysis. The expression “complete set” obviouslyindicates that we are working with sets. So, the first step is to identify which sets are usedand what their relationship is.

One set is the collection of primitive Pythagorean triples and can be defined by

S = {(x, y, z) | x, y, z ∈ N, x2 + y2 = z2, gcd(x, y, z) = 1, 2 | x}

Note that the use of N is equivalent to non-trivial, that gcd(x, y, z) = 1 is equivalent toprimitive and 2 | x follows our convention that in a primitive Pythagorean triple, x is evenand y and z are odd. The other set is the collection of triples determined by formula andcan be defined by

T = {(x, y, z) |x, y, z ∈ N, s, t ∈ N,x = 2st, y = s2 − t2, z = s2 + t2,

s > t, gcd(s, t) = 1, s 6≡ t (mod 2)}

The Characterization of Pythagorean Triples theorem asserts that S = T . We would expectthe proof to show that S = T by showing that S ⊆ T and T ⊆ S, though this is doneimplicitly.

As we work through the proof be sure to identify

1. where S and T appear in the proof,

2. where each of the elements that define set membership are satisfied,

3. where each of the elements that define set membership are used.

Page 332: MATH 135 Course Note

332 Chapter 52 Characterization of Pythagorean Triples

Proof: Let (x, y, z) be a primitive Pythagorean triple. Since x is even and y and z are odd,z − y and z + y are even. Suppose z − y = 2u and z + y = 2v. Then

u =z − y

2and v =

z + y

2

andv − u = y and v + u = z

and the equation x2 + y2 = z2 may be rewritten as

x2 = z2 − y2 = (z − y)(z + y)

Dividing the preceding equation by 4 gives(x2

)2=

(z − y

2

)(z + y

2

)= uv

We claim that gcd(u, v) = 1. Suppose this were not so and gcd(u, v) = d > 1. Thend | (v− u) and d | (v+ u). But v− u = y and v+ u = z so d | y and d | z which contradictsthe fact that y and z are relatively prime. Now we can use our proposition on Decomposingn-th Powers to conclude that u and v are perfect squares. Hence, for some natural numberss and t

u = t2

v = s2

Using these values of u and v produces

z = v + u = s2 + t2

y = v − u = s2 − t2

x2 = (z − y)(z + y) = 4s2t2 ⇒ x = 2st

We can safely assume s > t, otherwise we simply switch values. We claim that gcd(s, t) = 1.If d > 1 were a common factor of s and t, d would be a common factor of y and zcontradicting the fact that gcd(y, z) = 1. Finally, if s and t are both even or both odd, theny and z are even, a contradiction. Hence, exactly one of s and t is odd, the other is even.Symbolically, s 6≡ t (mod 2).

Conversely, let the natural numbers s and t satisfy s > t, gcd(s, t) = 1, s 6≡ t (mod 2).Using the provided formulas for x, y and z we have

x2 + y2 = (2st)2 + (s2 − t2)2 = (s2 + t2)2 = z2

so x, y and z are a Pythagorean triple.

To see that the triple is non-trivial, we must show that x, y and z are all positive. Sinces, t > 0, x = 2st > 0 and z = s2 + t2 > 0. Since s > t, y = s2 − t2 > 0.

To see that the triple is primitive, assume that gcd(x, y, z) = d > 1 and let p be any primedivisor of d. Since one of s and t is odd and the other is even, z is odd. Since p | z, p 6= 2.From p | y and p | z, we know that p | (z + y) and since z + y = 2s2, p | 2s2. Hence, p | s.Similarly, p | t. But then p is a common factor of s and t contradicting gcd(s, t) = 1. Sinceno such p can exist, gcd(x, y, z) = 1 and x, y and z are a primitive triple.

Page 333: MATH 135 Course Note

Chapter 53

Fermat’s Theorem for n = 4

53.1 Objectives

The content objectives are

1. State and prove: The Diophantine equation x4 + y4 = z2 has no non-trivial solution.

2. State and prove: The Diophantine equation x4 + y4 = z4 has no non-trivial solution.

3. Show a reduction of FLT to If p is an odd prime, then the Diophantine equationxp + yp = zp has no non-trivial solution.

53.2 n = 4

Having completely resolved the case of Pythagorean triples, we can now turn our attentionto the one instance of FLT proved by Fermat. Actually, we will prove a slightly strongerresult and the case n = 4 will follow as a corollary. The approach in this section mostlyfollows Elementary Number Theory, Seventh Edition by David Burton.

Theorem 1 (FLT, Strong Version of n = 4)

The Diophantine equation x4 + y4 = z2 has no non-trivial solution.

333

Page 334: MATH 135 Course Note

334 Chapter 53 Fermat’s Theorem for n = 4

The proof is demanding but it has a straightforward structure.

1. This is a proof by contradiction. It assumes the existence of a “minimal” solution x0,y0, z0 to x4 + y4 = z2.

2. Using x0, y0, z0 the author constructs a non-trivial primitive Pythagorean triple.

3. Using the Characterization of Pythagorean Triples the author finds various algebraicexpressions involving s and t.

4. The author uses these algebraic expressions to construct another non-trivial primitivePythagorean triple.

5. Lastly, the author uses this triple to construct a solution x1, y1, z1 to x4 + y4 = z2

which is “smaller” than x0, y0, z0, hence a contradiction.

Proof: By way of contradiction, suppose there exists a positive integer solution to x4+y4 =z2. Of all such solutions, choose any one in which z is smallest. Call this solution x0,y0, z0. We may also assume that gcd(x0, y0) = 1. (Why?) This in turn implies thatgcd(x0, y0, z0) = 1. (Why?)

Since x0, y0, z0 is a solution we know

x40 + y40 = z20

which we can rewrite as (x20)2

+(y20)2

= z20

But that means that x20, y20 and z0 are non-trivial primitive solutions of a2 + b2 = c2 so we

can make use of the Characterization of Pythagorean Triples. In particular, we know thatone of x20 and y20 is even. We can assume that x20 is even, hence x0 is even, and that thereexist integers s and t so that s > t > 0 and gcd(s, t) = 1 and s 6≡ t (mod 2) satisfying

x20 = 2st

y20 = s2 − t2

z0 = s2 + t2

Since s 6≡ t (mod 2), exactly one of s and t are even. Suppose s is even and t is odd. Nowconsider the equation y20 = s2 − t2 modulo 4. Because y20 is odd,

y20 = s2 − t2 ⇒ 1 ≡ 0− 1 (mod 4)⇒ 1 ≡ 3 (mod 4)

which is impossible. Therefore s is odd and t is even so we write t = 2r. Then

x20 = 2st⇒ x20 = 4sr ⇒(x0

2

)2= sr

Now gcd(s, t) = 1 implies that gcd(s, r) = 1 (why?) and so we can use the propositionon Decomposing n-th Powers. Since (x0/2)2 is a perfect square, s and r must be perfectsquares and we can write s = z21 and r = w2

1 for positive integers z1 and w1.

Rewrite y20 = s2 − t2 ast2 + y20 = s2

Page 335: MATH 135 Course Note

Section 53.3 Reducing the Problem 335

Because gcd(s, t) = 1 implies gcd(s, t, y0) = 1, the triple t, y0, s is a primitive Pythagoreantriple and we can use the Characterization of Pythagorean Triples again. With t even, theCharacterization of Pythagorean Triples assures us of the existence of integers u and v sothat u > v > 0 and gcd(u, v) = 1 and u 6≡ v (mod 2) satisfying

t = 2uv

y0 = u2 − v2

s = u2 + v2

Now, observe that

uv =t

2= r = w2

1

and so by the proposition on Decomposing n-th Powers, u and v are perfect squares. Supposeu = x21 and v = y21 where x1 and y1 are positive integers. But then

s = u2 + v2 ⇒ z21 =(x21)2

+(y21)2

and soz21 = x41 + y41

That is, x1, y1, z1 is a solution to x4 + y4 = z2. Since z1 and t are positive

0 < z1 ≤ z21 = s ≤ s2 < s2 + t2 = z0

That is,z1 < z0

But recall that x0, y0, z0 is a solution to x4 + y4 = z2 with the smallest possible value of z.But x1, y1, z1 is a solution to x4 + y4 = z2 with a smaller value of z!

The case n = 4 of Fermat’s Last Theorem follows immediately.

Corollary 2 The Diophantine equation x4 + y4 = z4 has no positive integer solution.

Proof: If x0, y0, z0 were a positive integer solution of x4 + y4 = z4, then x0, y0, z20 would

be a positive integer solution to x4 + y4 = z2, contradicting the previous theorem.

53.3 Reducing the Problem

It is not necessary to consider every exponent of xn + yn = zn to prove Fermat’s LastTheorem.

If n > 2, then n is either a power of 2 or divisible by an odd prime p. In the first case,n = 4k for some k ≥ 1 and the equation xn + yn = zn can be rewritten as(

xk)4

+(yk)4

=(zk)4

We have just seen that this equation has no positive integer solution.

Page 336: MATH 135 Course Note

336 Chapter 53 Fermat’s Theorem for n = 4

In the second case, n = pk for some k ≥ 1 and the equation xn + yn = zn can be rewrittenas (

xk)p

+(yk)p

=(zk)p

If it could be shown that up + vp = wp has no solution, then there would be no solutionof the form u = xk, v = yk, w = zk and so there would be no solution to xn + yn = zn.Therefore, Fermat’s Last Theorem reduces to

Theorem 3 (Fermat’s Last Theorem – Reduced)

If p is an odd prime, then the Diophantine equation

xp + yp = zp

has no non-trivial solutions.

53.4 History

For a very interesting documentary on the solution of FLT, please seehttp://video.google.com/videoplay?docid=8269328330690408516

Page 337: MATH 135 Course Note

Chapter 54

Problems Related to FLT

54.1 Objectives

1. Read a proof of Squares From the Difference of Quartics

2. Read a proof of a proposition on the area of Pythagorean triangles.

54.2 x4 − y4 = z2

From x4 + y4 = z2, we turn to a closely related Diophantine equation, x4 − y4 = z2. Ourproof is very similar to that of the Strong Version of FLT for n = 4. The approach in thissection mostly follows Elementary Number Theory, Seventh Edition by David Burton.

Proposition 1 (Squares From the Difference of Quartics (SFDQ))

The Diophantine equation x4 − y4 = z2 has no non-trivial solutions.

Proof: Suppose that there exists a non-trivial solution to x4−y4 = z2. Of all such solutionsx0, y0, z0, choose any one in which x0 is smallest. Choosing x0 as small as possible forcesx0 to be odd. (Why?)

We now show that we can also assume that gcd(x0, y0) = 1. Suppose gcd(x0, y0) = d > 1.Then writing dx1 = x0 and dy1 = y0 and substituting into x4−y4 = z2 we get d4(x41−y41) =z20 . So d4 | z20 , hence d2 | z0. Thus z0 = d2z1 for some integer z1. But then

d4x41 − d4y41 = d4z21

so x1, y1, z1 is a non-trivial solution to x4 − y4 = z2 with 0 < x1 < x0 contradicting ourchoice of a minimal x0.

If the equation x40 − y40 = z20 is written in the form(x20)2 − (y20)2 = z20

thenz20 +

(y20)2

=(x20)2

337

Page 338: MATH 135 Course Note

338 Chapter 54 Problems Related to FLT

and we see that (z0, y20, x

20) constitute a primitive Pythagorean triple.

From here there are two cases: y0 odd and y0 even. Consider the case where y0 is odd. TheCharacterization of Pythagorean Triples asserts that there exist integers s and t so thats > t > 0 and gcd(s, t) = 1 and s 6≡ t (mod 2) satisfying

z0 = 2st (this is forced from y0 odd)

y20 = s2 − t2

x20 = s2 + t2

Observe thats4 − t4 = (s2 + t2)(s2 − t2) = x20y

20 = (x0y0)

2

so s, t, x0y0 is a positive solution to x4 − y4 = z2. But

0 < s <√s2 + t2 = x0

which contradicts the minimality of x0 so y0 cannot be odd.

Now consider the case where y0 is even. The Characterization of Pythagorean Triples assertsthat there exist integers s and t so that s > t > 0 and gcd(s, t) = 1 and s 6≡ t (mod 2)satisfying

y20 = 2st (this is forced from y0 even)

z0 = s2 − t2

x20 = s2 + t2

Because of the symmetry of expressions for s and t, we may assume that s is even and t isodd. Consider the relation

y20 = 2st

Since gcd(s, t) = 1 and s is even, we know that gcd(2s, t) = 1. This allows us to invoke theproposition on Decomposing n-th Powers. That is, 2s and t are each squares of positiveintegers, say 2s = w2 and t = v2. Because w must be even, set w = 2u to get s = 2u2.Therefore

x20 = s2 + t2 = 4u4 + v4

and so (2u2, v2, x0) form a Pythagorean triple. Since gcd(2u2, v2) = gcd(s, t) = 1,gcd(2u2, v2, x0) = 1 and so the Pythagorean triple is primitive. The Characterizationof Pythagorean Triples asserts that there exist integers a and b so that a > b > 0 andgcd(a, b) = 1 and a 6≡ b (mod 2) satisfying

2u2 = 2ab

v2 = a2 − b2

x0 = a2 + b2

Now 2u2 = 2ab implies u2 = ab which implies, by the proposition on Decomposing n-thPowers, that a and b are perfect squares. Say a = c2 and b = d2. And here we use a patternwe have seen before. Since

v2 = a2 − b2 = c4 − d4

c, d, v is a positive integer solution to x4 − y4 = z2. But

0 < c =√a < a2 + b2 = x0

Page 339: MATH 135 Course Note

Section 54.3 Pythagorean Triangles 339

contradicting the minimality of x0. Hence, y0 cannot be even.

Since the integer y0 cannot be either odd or even, it must be the case that our assumptionthat there is a non-trivial solution is incorrect.

This proposition has an unexpected use in a statement about the areas of Pythagoreantriangles.

54.3 Pythagorean Triangles

Definition 54.3.1

PythagoreanTriangle

A Pythagorean triangle is a right triangle whose sides are of integral length.

The familiar 3 − 4 − 5 triangle is an example of a Pythagorean triangle. In the margin ofhis copy of Diophantus’ Arithmetica, Fermat stated and proved a proposition equivalent tothe following.

Proposition 2 The area of a Pythagorean triangle can never be equal to a perfect square.

Here, perfect square means the square of an integer.

Proof: We will proceed by contradiction. Consider a Pythagorean triangle ABC wherethe hypotenuse has length z and the other two sides have lengths x and y, so that

x2 + y2 = z2 (54.1)

The area of 4ABC is (1/2)xy and if this were a square we could write (1/2)xy = u2. Thisgives

2xy = 4u2 (54.2)

Now Equation (54.1) plus Equation (54.2) gives

x2 + y2 + 2xy = z2 + 4u2 ⇒ (x+ y)2 = z2 + 4u2

and Equation (54.1) minus Equation (54.2) gives

x2 + y2 − 2xy = z2 − 4u2 ⇒ (x− y)2 = z2 − 4u2

Now multiply these last two equations together to get

(x+ y)2(x− y)2 = (z2 + 4u2)(z2 − 4u2)⇒(x2 − y2

)2= z4 − 16u4

or (x2 − y2

)2= z4 − (2u)4

But we know by our proposition on the Squares From the Difference of Quartics that nonon-trivial solution to this equation is possible, hence a contradiction.

Page 340: MATH 135 Course Note

Chapter 55

Practice, Practice, Practice:Primes and Non-LinearDiophantine Equations

55.1 Objectives

This class provides an opportunity to practice working with primes and non-linear Dio-phantine Equations.

55.2 Practice

1. (Burton, Elementary Number Theory) From the examples we have done in class, itmay seem that all non-linear Diophantine equations have no non-trivial solutions.This is not so, as the following example demonstrates.

(a) Use the Binomial Theorem to expand (n2 + 1)3.

(b) Show that x2 +y2 = z3 has infinitely many positive integer solutions. (Hint: Forany n ≥ 2, let x = n(n2 − 3) and y = 3n2 − 1.)

2. Joseph Louis Lagrange (1736 – 1813) was a brilliant French mathematician whoworked mostly in the 18th century. He worked on the Sum of Squares problem, thatis: What is the smallest value of n such that every positive integer can be written asthe sum of not more than n squares?

(a) The integer 18 can be written as the sum of three squares, 18 = 42 + 12 + 12.Show that all of the integers between 11 and 20 can be written as the sum of atmost four squares.

(b) Prove that if a and b are both the sum of two squares, then ab is the sum of twosquares.

(c) Prove that if p is a prime of the form 4k + 3, then p cannot be a sum of twosquares.

(d) Prove that an integer n can be represented as the difference of two squares if andonly if n is not of the form 4k + 2.

340

Page 341: MATH 135 Course Note

Section 55.2 Practice 341

3. Let (x, y, z) be a primitive Pythagorean triple.

(a) Prove that exactly one of x or y is divisible by 3.

(b) Prove that xy is divisible by 12.

4. (Burton, Elementary Number Theory) Prove each of the following statements.

(a) If n ≥ 3 is an odd integer, then(n2 − 1

2, n,

n2 + 1

2

)is a Pythagorean triple.

(b) If n ≥ 3 is an even integer, then(n,n2

4− 1,

n2

4+ 1

)is a Pythagorean triple.

(c) If n ≡ 2 (mod 4), then there is no primitive Pythagorean triple (x, y, z) in whichx or y equals n.

(d) If n 6≡ 2 (mod 4), then there is a primitive Pythagorean triple (x, y, z) in whichx or y equals n.

(e) For all integers n ≥ 3, there is a Pythagorean triple (not necessarily primitive)having n as one of its members.

5. For each of the following statements, determine whether the statement is true or false.For true statements give a proof. For false statements, give a counter-example.

(a) If n ∈ N, then n = p + a2 for some p which is either a prime or 1, and somea ≥ 0.

(b) If p is a prime of the form 3n+ 1, then p is of the form 6m+ 1.

(c) If n is an odd integer, then gcd(n, n+ 2) = 1.

(d) If n ∈ N and n > 1, then n4 − 4 is composite.

(e) If n ∈ N and n > 1, then n4 + 4 is composite.

(f) If n > 4 is composite, then n divides (n− 1)!.

(g) The sum of two consecutive odd primes has at least three prime divisors, notnecessarily distinct.

6. Let a < b < c, where a ∈ N and b and c are odd primes. Prove that if a | (3b+2c) anda | (2b + 3c) then a = 1 or a = 5. Give examples to show that both of these valuesfor a are possible.

Page 342: MATH 135 Course Note

Chapter 56

Appendix

Proposition 1 (Decomposing n-th Power (DNP))

If ab = cn and gcd(a, b) = 1, then there exist integers a1 and b1 so that a = an1 and b = bn1 .

Proof: Without loss of generality, we may assume that a > 1 and b > 1. If

a = pk11 pk22 · · · p

krr

b = qj11 qj22 · · · q

jss

are the prime factorizations of a and b, then no px can occur among the qy otherwise thegcd(a, b) > 1. As a result, the prime factorization of ab is

ab = pk11 pk22 · · · p

krr q

j11 q

j22 · · · q

jss

Let us suppose that c can be factored into primes as

c = ul11 ul22 · · ·u

ltt

Then ab = cn can be written as

pk11 pk22 · · · p

krr q

j11 q

j22 · · · q

jss = unl11 unl22 · · ·u

nltt

This implies that each px and qy equals some uh and that the corresponding exponents areequal. That is kx = nlh (or jy = nlh). This implies that all of the exponents of the px andqy are divisible by n. Thus, we can choose

a = pk1/n1 p

k2/n2 · · · pkr/nr

b = qj1/n1 q

j2/n2 · · · qjs/ns

and a = an1 and b = bn1 as needed.

342