You are on page 1of 342

Reading, Discovering and Writing Proofs

Version 0.2.6

Steven
c Furino

August 27, 2012


Contents

I Introduction 11

1 In the beginning 12
1.1 What Makes a Mathematician a Mathematician? . . . . . . . . . . . . . . . 12
1.2 How The Course Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Why do we reason formally? . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Reading and Lecture Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.4.1 Lecture Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.4.2 Reading Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Our First Proof 18


2.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2 The Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3 Implications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.4 Our First Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3 Discovering Proofs 26
3.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.2 Discovering a Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Reading A Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4 The Division Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

II Foundations 33

4 Truth Tables 34
4.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.2 Truth Tables as Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.3 Truth Tables to Evaluate Logical Expressions . . . . . . . . . . . . . . . . . 36
4.4 Contrapositive and Converse . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.5 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.6 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

5 Introduction to Sets 41
5.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2 Describing a Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3 Set Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.3.1 Venn Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4 Comparing Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4.1 Sets of Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4.2 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

2
Section 0.0 CONTENTS 3

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

6 More on Sets 50
6.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2 Showing Two Sets Are Equal . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

III Proof Techniques 53

7 Quantifiers 54
7.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.2 Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.3 The Object Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.4 The Construct Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.5 The Select Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.6 Sets and Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.7 A Non-Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

8 Nested Quantifiers 65
8.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.2 Onto (Surjective) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.2.1 Definition of Function . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.2.2 Definition of Onto (Surjective) . . . . . . . . . . . . . . . . . . . . . 66
8.2.3 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8.2.4 Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
8.2.5 A Difficult Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
8.3 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
8.3.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
8.3.2 Reading A Limit Proof . . . . . . . . . . . . . . . . . . . . . . . . . 73
8.3.3 Discovering a Limit Proof . . . . . . . . . . . . . . . . . . . . . . . . 75
8.3.4 A Harder Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

9 Practice, Practice, Practice: Quantifiers and Sets 80


9.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
9.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

10 Simple Induction 84
10.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
10.2 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
10.2.1 Summation Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
10.2.2 Product Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.2.3 Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.3 Introduction to Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
10.4 Principle of Mathematical Induction . . . . . . . . . . . . . . . . . . . . . . 87
10.4.1 Why Does Induction Work? . . . . . . . . . . . . . . . . . . . . . . . 88
10.4.2 Two Examples of Simple Induction . . . . . . . . . . . . . . . . . . . 88
10.4.3 A Different Starting Point . . . . . . . . . . . . . . . . . . . . . . . . 90
10.5 An Interesting Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.6 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4 Chapter 0 CONTENTS

11 Strong Induction 96
11.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
11.2 Strong Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
11.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

12 Binomial Theorem 102


12.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
12.2 Binomial Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
12.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
12.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

13 Negation 107
13.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
13.2 Negating Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
13.3 Negating Statements with Quantifiers . . . . . . . . . . . . . . . . . . . . . 109
13.3.1 Counterexamples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
13.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

14 Contradiction 113
14.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
14.2 How To Use Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
14.2.1 When To Use Contradiction . . . . . . . . . . . . . . . . . . . . . . . 114
14.2.2 Reading a Proof by Contradiction . . . . . . . . . . . . . . . . . . . 114
14.2.3 Discovering and Writing a Proof by Contradiction . . . . . . . . . . 115

15 Contrapositive 118
15.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
15.2 The Contrapositive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
15.2.1 When To Use The Contrapositive . . . . . . . . . . . . . . . . . . . . 118
15.3 Reading a Proof That Uses the Contrapositive . . . . . . . . . . . . . . . . 118
15.3.1 Discovering and Writing a Proof Using The Contrapositive . . . . . 120

16 Uniqueness 122
16.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
16.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
16.3 Showing X = Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
16.4 Finding a Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
16.5 The Division Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

17 Elimination 128
17.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
17.2 When to Use the Elimination Method . . . . . . . . . . . . . . . . . . . . . 128
17.3 How to Use the Elimination Method . . . . . . . . . . . . . . . . . . . . . . 128
17.4 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
17.5 Writing and Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

IV Securing Internet Commerce 132

18 The Greatest Common Divisor 133


18.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
18.2 Greatest Common Divisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Section 0.0 CONTENTS 5

18.3 Certificate of Correctess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137


18.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
18.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

19 The Extended Euclidean Algorithm 141


19.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
19.2 The Extended Euclidean Algorithm (EEA) . . . . . . . . . . . . . . . . . . 141
19.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

20 Properties Of GCDs 146


20.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
20.2 Some Useful Propositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
20.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

21 Linear Diophantine Equations:


One Solution 153
21.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
21.2 Linear Diophantine Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 153
21.2.1 Finding One Solution to ax + by = c . . . . . . . . . . . . . . . . . . 154

22 Linear Diophantine Equations:


All Solutions 158
22.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
22.2 Finding All Solutions to ax + by = c . . . . . . . . . . . . . . . . . . . . . . 158
22.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
22.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

23 Congruence 165
23.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
23.2 Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
23.2.1 Definition of Congruences . . . . . . . . . . . . . . . . . . . . . . . . 165
23.3 Elementary Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
23.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

24 Congruence and Remainders 171


24.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
24.2 Congruence and Remainders . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
24.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
24.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

25 Modular Arithmetic 176


25.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
25.2 Modular Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
25.2.1 [0] Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
25.2.2 [1] Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
25.2.3 Identities and Inverses in Zm . . . . . . . . . . . . . . . . . . . . . . 179
25.2.4 Subtraction in Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
25.2.5 Division in Zm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
25.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

26 Fermats Little Theorem 181


26.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6 Chapter 0 CONTENTS

26.2 Fermats Little Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


26.3 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
26.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

27 Linear Congruences 187


27.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
27.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
27.3 Extending Equivalencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
27.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
27.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

28 Chinese Remainder Theorem 193


28.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
28.2 An Old Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
28.3 Chinese Remainder Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 194
28.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
28.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

29 Practice, Practice, Practice: Congruences 199


29.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
29.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
29.3 Preparing for RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

30 The RSA Scheme 206


30.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
30.2 Private Key Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
30.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
30.2.2 Substitution Cipher . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
30.2.3 Looking for Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
30.2.4 Vigenere Ciphers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
30.3 Why Public Key Cryptography? . . . . . . . . . . . . . . . . . . . . . . . . 212
30.4 Implementing RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
30.4.1 Setting up RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
30.4.2 Sending a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
30.4.3 Receiving a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
30.4.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
30.5 Does M = R? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
30.6 How Secure Is RSA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

V Bijections and Counting 218

31 Injections and Bijections 219


31.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
31.2 One-to-one (Injective) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
31.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
31.2.2 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
31.2.3 Discovering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
31.2.4 A Difficult Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
31.3 Bijections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
31.4 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Section 0.0 CONTENTS 7

32 Counting 225
32.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
32.2 African Shepherds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
32.3 What Does It Mean To Count? . . . . . . . . . . . . . . . . . . . . . . . . . 226
32.4 Showing That A Bijection Exists . . . . . . . . . . . . . . . . . . . . . . . . 226
32.5 Finite Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

33 Cardinality of Infinite Sets 232


33.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
33.2 Infinite Sets Are Weird . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
33.3 Infinite Sets are Even Weirder Than You Thought . . . . . . . . . . . . . . 234
33.4 Not All Infinite Sets Have The Same Cardinality . . . . . . . . . . . . . . . 235

34 Practice, Practice, Practice: Bijections and Cardinality 237


34.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
34.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

VI Complex Numbers and Eulers Formula 239

35 Complex Numbers 240


35.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
35.2 Different Equations Require Different Number Systems . . . . . . . . . . . . 240
35.3 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
35.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

36 Properties Of Complex Numbers 246


36.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
36.2 Conjugate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
36.3 Modulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
36.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
36.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

37 Graphical Representations of Complex Numbers 251


37.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
37.2 The Complex Plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
37.2.1 Cartesian Coordinates (x, y) . . . . . . . . . . . . . . . . . . . . . . . 251
37.2.2 Modulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
37.3 Polar Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
37.4 Converting Between Representations . . . . . . . . . . . . . . . . . . . . . . 253

38 De Moivres Theorem 256


38.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
38.2 De Moivres Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
38.3 Complex Exponentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
38.4 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
38.5 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

39 Roots of Complex Numbers 260


39.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
39.2 Complex n-th Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
39.3 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
8 Chapter 0 CONTENTS

40 Practice, Practice, Practice:


Complex Numbers 264
40.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
40.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

VII Factoring Polynomials 266

41 An Introduction to Polynomials 267


41.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
41.2 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
41.3 Operations on Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . 268

42 Factoring Polynomials 272


42.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
42.2 Polynomial Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

43 Practice, Practice, Practice:


Polynomials 277
43.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
43.2 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

44 Practice, Practice, Practice: Course Review 280


44.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
44.2 Suggestions On How To Start A Proof . . . . . . . . . . . . . . . . . . . . . 281
44.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

VIII Finding the Shortest Path 284

45 The Shortest Path Problem 285


45.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
45.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
45.3 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
45.4 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
45.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

46 Paths, Walks, Cycles and Trees 289


46.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
46.2 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
46.3 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

47 Trees 295
47.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
47.2 Properties of Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

48 Dijkstras Algorithm 299


48.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
48.2 Dijkstras Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
48.3 Certificate of Optimality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Section 0.0 CONTENTS 9

49 Certificate of Optimality - Path 306


49.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
49.2 Certificate of Optimality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
49.3 Weighted Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
49.4 Certificate of Optimality - Tree . . . . . . . . . . . . . . . . . . . . . . . . . 312

IX An Introduction to Fermats Last Theorem 314

50 Introduction to Primes 315


50.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
50.2 Introduction to Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
50.3 Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
50.4 Fundamental Theorem of Arithmetic . . . . . . . . . . . . . . . . . . . . . . 317
50.5 Finding a Prime Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
50.6 Working With Prime Factorizations . . . . . . . . . . . . . . . . . . . . . . 321
50.7 More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
50.8 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

51 Introduction to Fermats Last Theorem 324


51.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
51.2 History of Fermats Last Theorem . . . . . . . . . . . . . . . . . . . . . . . 324
51.3 Pythagorean Triples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

52 Characterization of Pythagorean Triples 330


52.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
52.2 Pythagorean Triples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

53 Fermats Theorem for n = 4 333


53.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
53.2 n = 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
53.3 Reducing the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
53.4 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336

54 Problems Related to FLT 337


54.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
54.2 x4 y 4 = z 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
54.3 Pythagorean Triangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

55 Practice, Practice, Practice:


Primes and Non-Linear Diophantine Equations 340
55.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
55.2 Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

56 Appendix 342
Preface

These notes are the script for the online lectures of MATH 135 at the University of Waterloo
in 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 suggestions
to Steven Furino at scfurino@uwaterloo.ca

10
Part I

Introduction

11
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 dont normally consider a
bookkeeper as a mathematician. Others might think of geometry and answer that someone
who works with shapes is a mathematician. But architects work with shapes and we dont
normally consider architects as mathematicians. Still others might answer that people who
use formulas are mathematicians. But engineers work with formulas and we dont normally
consider engineers as mathematicians. A more insightful answer would be that people who
find patterns and provide descriptions and evidence for those patterns are mathematicians.
But scientists search for and document patterns and we dont normally consider scientists
as 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 this
before, do not worry. The course will provide you with techniques that will help, and we
will 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 for
the 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 for
proof. The first problem resolves a very important practical commercial problem. The
second 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
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 over
iTunes? Have you ever done your banking over the web? How do you make sure
that your credit card number and personal information are not intercepted by bad
guys? Number theory allows us to enable secure web transactions. And that theory
is 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 very


unusual number because it has the property that i2 = 1. is a very unusual
number even if it is common. It is the unique ratio of the circumference of a circle
to its diameter. Why should that ratio be unique? One is the basis of the natural
numbers, hence the integers, hence the rationals. Zero is a difficult number and was
only accepted into the mathematics of western Europe because of the influence of
Hindu and Islamic scholars. Why should all of these numbers be connected in so
simple and elegant a form?

How do we factor polynomials? You have factored integers into a product of prime
numbers. There is also a need in mathematics to factor polynomials, expressions like
ax4 + 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 proof
displayed 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 quickest
route on Google maps? How does a courier company route your package? All of these
tasks are completed using a shortest path algorithm. And how do we know we have
found the shortest path? Proof.

How many positive integer solutions are there to xn + y n = z n where n is an inte-


ger greater than or equal to three? This is one of the most famous problems in the
history of mathematics and it took over 350 years to solve. It was first conjectured
by the French mathematician Pierre de Fermat in 1637 and was only solved in 1995
by 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 some
foundational mathematics such as logical expressions and sets, and, most importantly, we
must learn how to recognize and use proof techniques.
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 know
enough 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 will
have encountered the number i which has the special property that i2 = 1. But
then,
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 Whats a real num-
ber? We would probably say that any number written as a decimal expansion is a
real number and any two different expansions represent different numbers. But then
what 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 also
gives us 0 so the sum is zero.
z }| { z }| { z }| { z }| {
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 successive
pairs of terms give 0 so the sum is 1.
z }| { z }| { z }| { z }| {
1 1 + 1 1 + 1 1 + 1 1 + 1 + . . .

Or suppose we wanted to resolve Zenos paradox. Zeno was a famous ancient Greek
philosopher who posed the following problem. Suppose the Greek hero Achilles was
going to race against a tortoise and suppose, in recognition of the slowness of the
tortoise, that the tortoise gets a 100m head start. By the time Achilles has run half
the distance between he and the tortoise, the tortoise has moved ahead. And now
again, by the time Achilles has run half the remaining distance between he and the
tortoise, the tortoise has moved ahead. No matter how fast Achilles runs, the tortoise
will always be ahead! You might object that your eyes see Achilles pass the tortoise,
but what is logically wrong with Zenos argument?
Section 1.3 Why do we reason formally? 15

To make better commercial decisions. Building pipelines is expensive. And lots of


pipelines 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 access
through national or state parks), and supply chain constraints (access to concrete and
steel) is very important. How do pipeline builders prove that the route they have
chosen 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 think
rationally 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 led
to 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. But
to hear the poetry of mathematics, one must first understand the language.
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 Fermats 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 DeMoivres 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
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, an
online 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
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 fully


and correctly presented, there is no ambiguity and no doubt about its correctness.
However, understanding a proof requires understanding the language. This course will help
you 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
Section 2.2 The Language 19

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

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

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

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 not
sufficient. Discovering your own proof requires not only technique but also under-
standing, creativity, intuition and experience. This course will help with the technique
and experience. Understanding, creativity, and intuition come with time. Talent helps
of course.

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

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

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


Statement

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 4P QR.

These are statements only if we have an appropriate value for x in the first sentence and
appropriate instances of 4ABC and 4P QR in the second sentence. For example, if x is
the number 5, then the sentence 5 > 0 is a statement since the sentence is true. If x is
the 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 the
English word algebra, then the sentence algebra > 0 is not a statement since the sentence
is neither true nor false. Sentences like the two above are called open sentences.
20 Chapter 2 Our First Proof

Definition 2.2.2 An open sentence is a sentence that


Open Sentence
contains one or more variables, where

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

where the sentence is either true or false whenever values from the respective domains
of 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 chosen
and 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 the
values of the variables always come from a suitable domain.

2.3 Implications

Definition 2.3.1 The most common type of statement we will prove is an implication. Implications have
Implication the 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

or
A implies B
and is written symbolically as
AB

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

In the statement A implies B, A is a statement which may be true or false. B is a


statement which may be true or false. A implies B is also a statement which may be true
or false.

Definition 2.3.3 The statement A is called the hypothesis. The statement B is called the conclusion.
Hypothesis,
Conclusion
Section 2.4 Our First Proof 21

REMARK
To prove the implication A implies B, you assume that A is true and you use this
assumption to show that B is true. Statement A is what you start with. Statement B is
where you must end up.
To use the implication A implies B, you must first establish that A is true. After you
have 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 An integer m divides an integer n, and we write m | n, if there exists an integer k so that
Divisibility n = km.
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 our
experience 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 an
integer 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 A proposition is a true statement that has been proved by a valid argument.
Proposition

REMARK
You will encounter several variations on the word proposition. A theorem is a particularly
significant 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 follows
almost 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 we
derive 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 to
understand the proof.
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 of


Divisibility allows us to conclude that 3 | 42 (a | c).
Now you might immediately know that 3 | 42. The strength of this proposition is that it
works for any integers a, b, c that satisfy the condition a | b and b | c, not just for the
particular 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 an


integer 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 habits
of writing for professional audiences. Many proofs share the following properties which can
be frustrating for students.

1. Proofs are economical. That is, a proof includes what is needed to verify the truth of
a 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 the
omitted 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 no
statements write No explicit hypothesis. At the end of the proof, you should be
able to identify where each part of the hypothesis has been used.

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

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

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

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

Lets analyze the proof of the Transitivity of Divisibility in detail because it will give us
some sense of how to analyze proofs in general. First, observe that If a | b and b | c, then
a | c. is an open sentence, and that the domains for the variables a, b and c are specified
in the first sentence, Let a, b and c be integers.
Professional mathematicians do all of these things implicitly but for the first part of this
course, we will do these things explicitly.
We will do a line by line analysis, so to make our work easier, we will write each sentence
on 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.

Lets 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 we
can use for other proofs. Lastly, recall that the author is proving an implication. The
author assumes that the hypothesis is true, and uses the hypothesis to demonstrate that
the 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 integer
n, 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 definition
of 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.


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 the
definition apply to the a, sr and c of the proof. It is important to note that sr is an
integer, 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 hypothesis
was used. It is obvious where a | b and b | c were used. The hypothesis a, b and c are
integers 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.
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 there
are some tips that may be useful, and as we go on through the course, you will learn specific
techniques. 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, lets begin with a numeric example.

26
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, 3
divides any integer combination of 6 and 27. You might say, Thats obvious. Just take a
common 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 hypothesis
and the conclusion. Lets 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 hypothesis
is true, and then demonstrate that the conclusion is true. This straightforward approach
is called Direct Proof. However, in actually discovering a proof we do not need to work
only forwards from hypothesis. We can work backwards from the conclusion and meet
somewhere in the middle. When writing the proof we must ensure that we begin with the
hypothesis 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 backwards
from. 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. Lets record this statement as
part 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?


28 Chapter 3 Discovering Proofs

The answer is not obvious so lets turn to working forwards from the hypothesis. In this
case 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 Transitivity
of Divisibility and once in the prior example. Just as was done in the proof of the Transitivity
of Divisibility, I can use a | b and the definition of divisibility to assert that

There exists an integer r such that b = ra.

and Ill 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? Lets look again at the last sentence. There is a bx + cy in the last
sentence and an algebraic expression for b and c in the first two sentences. Substituting
gives
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 integers
gives integers, k is an integer. Hence, there exists an integer k so that bx + cy = ak. That
is, a | (bx + cy).
We are done. Almost. We have discovered a proof but this is rough work. We must now
write a formal proof. Just like any other writing, the amount of detail needed in expressing
your thoughts depends upon the audience. A proof of a statement targeted at an audience
of professional specialists in algebra will not look the same as a proof targeted at a high
school audience. When you approach a proof, you should first make a judgement about the
audience. Write for your peers. That is, write your proof so that you could hand it to a
classmate and expect that they would understand the proof.
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 an
integer 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 that
a | (bx + cy).

Note that this proof does not reflect the discovery process, and it is a Direct Proof. It
begins with the hypothesis and ends with the conclusion.
Before we leave this proposition, lets consider the significance of the hypothesis x and y
are integers. Suppose, as in our numeric example, a = 3, b = 6 and c = 27. If we choose
x = 3/2 and y = 1/4, ax + by = 45/4 which is not even an integer! This simple example
emphasizes 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 if


q 6= 0, |q| 1. Hence, |b| = |qa| = |q||a| |a|.

Lets 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.


30 Chapter 3 Discovering Proofs

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

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 definition
of 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 cannot
be 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 or
q 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 and a complete proof is available in the appendix. [Incomplete: Add to appendix.]
Lets see some examples before a few remarks.
Section 3.5 Practice 31

Example 2 (Division Algorithm)

a=qb+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 really
an algorithm since it doesnt provide a finite sequence of steps that will construct q
and r.

It turns out that the Division Algorithm is remarkably useful. To see how, we must first
define 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 with
the 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.


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) contains
a 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 32
is even, 32 - ((a2 + 3)(a2 + 7)).
(b) Let a = 1. Then 32|((a2 +3)(a2 +7)), but a is not even. This is a counterexample
to 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.
Part II

Foundations

33
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 particularly
the 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 A statement is a sentence which is either true or false.


Statement

Definition 4.2.2 All of the statements we need to prove will be compound statements, that is, statements
Compound, composed of several individual statements called component statements.
Component

For example, the compound statement

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

contains three component statements

a | b,
b | c, and
a|c

Suppose we let X be the statement a | b and Y be the statement b | c and Z be the


statement a | c. Then our original statement

34
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 truth
value of the compound statement X and Y imply Z. And that is where truth tables come
in. Truth tables contain all possible values of the component statements and determine the
truth value of the compound statement.
Truth tables can be used to define the truth value of a statement or evaluate the truth
value 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 The simplest definition is that of NOT A, written A.


NOT
A A
T F
F T

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

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

Definition 4.2.4 The definition of A AND B, written A B, is


AND
A B AB
T T T
T F F
F T F
F F F

Definition 4.2.5 The definition of A OR B, written A B, is


OR
A B AB
T T T
T F T
F T T
F F F

This is an opportune moment to highlight the difference between mathematical language


and the English language. If you are visiting a friend and your friend offers you coffee or
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. In
mathematics, or is inclusive.

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


Implies
A B AB
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 false
hypothesis result in a true statement? The basic idea is that if one is allowed to assume an
hypothesis 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 The definition of A if and only if B, written A B or A iff B, is


If and Only If
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 compound
statement separately and then evaluating the larger statement. Consider the following truth
table which shows the truth values of (AB) for all possible combinations of truth values of
the component statements A and B. (Brackets serve the same purpose in logical expressions
as 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
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 statement
A B is true. Since the negation of a true statement is false, (A B) is false, which
appears in the last column of the first row. Take a minute to convince yourself that each of
the 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 truth
value 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 Two compound statements are logically equivalent if they have the same truth values for
Logically all combinations of their component statements. We write S1 S2 to mean S1 is logically
equivalent equivalent to S2 .

REMARK
Equivalent statements are enormously useful in proofs. Suppose you wish to prove S1 but
are having difficulty. If there is a simpler statement S2 and S1 S2 , then you can prove S2
instead. In proving S2 , you will have proved S1 as well.
38 Chapter 4 Truth Tables

Example 3 Construct a single truth table for (A B) and (A) (B). Are these statements logically
equivalent?
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 DeMorgans Laws.

Proposition 1 (De Morgans Laws (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 is
particularly 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).
Section 4.5 Contrapositive and Converse 39

4.4 Contrapositive and Converse

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

Definition 4.4.1 The statement B A is called the contrapositive of A B.


Contrapositive

We can use truth tables to show that A B B A.

A B AB B A B A
T 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 that
A B B A.

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

Definition 4.4.2 The statement B A is called the converse of A B.


Contrapositive
We can use truth tables to show that A B 6 B A.

A B AB BA
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 that
A B 6 B A.

REMARK
It is a common mistake for beginning mathematicians to assume that A B and B A
are 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). The
contrapositive 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.
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 BC 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 (AB)(AC) are
identical, 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 Laws
hold. 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 Laws
hold. 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 the


form of a truth table.

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


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 A set is a collection of objects. The objects that make up a set are called its elements (or
Set, Element members).

Sets can contain any type of object. Since this is a math course, we frequently use sets of
numbers. 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 is
not 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 An integer p > 1 is called a prime if its only positive divisors are 1 and p; otherwise it is
Prime called composite.

41
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 are
defined by a rule. In these cases, we employ set-builder notation which makes use of a
defining property of the set. For example, the set of all real numbers between 1 and 2
inclusive could be written as
{x R | 1 x 2}
The part of the description following the bar (|) is the defining property of the set. Some
authors 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 integers
Q rational numbers, { pq | p, q Z, q 6= 0}
Q irrational numbers
R real numbers
C complex numbers {x + yi | x, y R}

Computer scientists begin counting at 0 so the notation N used in a computer science


context 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 describing
the 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] is
defined as the set
{x R | a x b}
Section 5.2 Describing a Set 43

Definition 5.2.3 A set A is called a subset of a set B, and is written A B, if every element of A belongs
Subset to B. Symbolically, we write

A B means x A x B

or equivalently
A 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 A set A is called a proper subset of a set B, and written A B, if every element of A
Proper Subset belongs 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 A set A is called a superset of a set B, and written A B, if every element of B belongs
Superset to A. A B is equivalent to B A.

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

Definition 5.2.6 As before, a set A is called a proper superset of a set B, and written A B, if every
Proper Subset element 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 Saying that two sets A and B are equal, and writing A = B, means that A and B have
Set Equality exactly 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
44 Chapter 5 Introduction to Sets

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

Definition 5.2.9 When we discuss sets, we are often concerned with subsets of some implicit or specified set
Universal Set U , called the universal set. In our work on divisibility and greatest common divisors, we
will be concerned with integers as the universal set, even when we dont explicitly say so.

Definition 5.2.10 Relative to a universal set U , the complement of a subset A of U , written A, is the set of
Set Complement all 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 Lastly, the cardinality of a set A, written |A|, is the number of elements in the set.
Cardinality

Example 6 For example, if A = {1, 2, 3, 4}, then |A| = 4. Heres 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
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 least
two 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 of
the 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 The union of two sets A and B, written A B, is the set of all elements belonging to either
Union set 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, the
element can belong to A, B or both A and B.

Definition 5.3.2 The intersection of two sets A and B, written A B, is the set of all elements belonging
Intersection to both set A and set B. Symbolically we write

A B = {x | x A AND x B} = {x | (x A) (x B)}
46 Chapter 5 Introduction to Sets

Definition 5.3.3 The difference of two sets A and B, written A B (or A \ B), is the set of all elements
Difference belonging 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 equal
to twelve. Let T be the set of integers divisible by three, F be the set of integers divisible
by 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}


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.

w
A B
b

d
e
a c

Figure 5.3.1: Venn Diagram

[Incomplete: Add schematic Venn diagrams for intersection, union, disjoint,


subset, superset, complement]

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 care
in 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
b b2 4ac
x=
2a
2. Let a, b, c R, a 6= 0 and b2 4ac 0. Then

b b2 4ac
x=
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 second
sentence only asserts that x = (b b2 4ac)/2a are solutions, not that they are the
complete solution. 2
In the language of sets, if S is the complete solution to ax + 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.
48 Chapter 5 Introduction to Sets

This point can be confusing. Statements about solutions are often implicitly divided into
two sets: the set S of all solutions and a set T of proposed solutions. One must be careful
to determine whether the statement is equivalent to S = T or T S. Phrases like the
solution or complete solution or all solutions indicate S = T . Phrases like a solution or are
solutions indicate T S.
Similar confusion arises when showing that sets have more than one representation. For
example, a circle centred at the origin O is often defined geometrically as the set of points
equidistant from O. Others define a circle algebraically in the Cartesian plane as the set of
points satisfying x2 + y 2 = 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 must
show S T or S = T . In fact, the second task is usually just two instances of the first
task: 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 show
that it belongs to T . Symbolically
S T means x S x T
or equivalently
S T means For all x S, x T
The element chosen must be completely generic and could, if forced, be instantiated as any
element 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) sin x.

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) sin x. (We could write S more
symbolically 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 all
integers n, we know that f (n) = 0. Now, the defining property of S is that a real
number x belongs to S if f (x) = 0. Since f (n) = 0, n S. This is equivalent to: if
n T then n S, or equivalently, T S. Now consider x = 1. The value x = 1 is
a solution to (x2 1) sin x = 0 and so belongs to S, but it is not an integer multiple
of , 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 .
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 the
following pairs of sets.

(a) A = {n Z : n | 30} and B = {n Z : n | 42}


(b) A = {x R | sin x = 0, 2 x 2} and
B = {x R | cos x = 0, 2 x 2}
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

Lets take a look at two proofs of the same statement about sets. The first uses a chain of
if 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
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 the


definition 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. If
x A, then by the definition of union, x A (B C). If x 6 A, then by the definition of
union and the fact that x A B, x B. Similarly, x C. But then, by the definition
of 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 if
statements or mutual inclusion? Though some of the choice is personal style, the choice is
primarily determined by the reversibility of each step in the proof. A chain of if and only
if statements only works if each step in the chain is reversible. Thats pretty unusual. Most
of 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
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 U
AND 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 union
x U S OR x U T . If x U S, then by the definition of set intersection
x U AND x S. But then x U and x S T so x U (S T ). If
x 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 ).
Part III

Proof Techniques

53
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, for
every, for any. The first four are all examples of the existential quantifier there is and
the final four are all examples of the universal quantifier for all. The word existence is
used 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 of
objects 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 the
English 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
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. Lets begin with something we have already seen.

Example 1

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


Quantifier:
Variable: k
Domain: Z
Open 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: x
Domain: R
Open sentence: f (x) = 0
This is a good point to illustrate the influence of the domain. Suppose in this example
we 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 changing
the domain can change the truth value of the statement. In practice, the domain is
often not explicitly stated and is inferred from context.
56 Chapter 7 Quantifiers

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


Quantifier:
Variable: n
Domain: {n Z | n > 5}
Open sentence: 2n > n2

The sentence might appear as 2n > n2 for all integers n > 5. The order is different
but the meaning is the same.

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

Quantifier:
Variable: an angle
Domain: R, inferred from the context
Open sentence: sin() = 1
Note that in this example, the domain is implicit. Note also that there can be many
objects, many angles , which satisfy the statement.

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

Quantifier:
Variable:
Domain: R, inferred from context
Open sentence: sin2 () + cos2 () = 1

6. If f is continuous on [a, b] and differentiable on (a, b) and f (a) = f (b), then there
exists a real number c (a, b) such that f 0 (c) = 0.
The conclusion of this implication uses an existential quantifier. The hypothesis and
the 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 0 (c) = 0.

For the conclusion, the parts of the quantified statement are given below.
Quantifier:
Variable: c
Domain: (a, b) R
Open sentence: f 0 (c) = 0

It takes practice to become fluent in reading and writing statements that use quantifiers.
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. Suppose
that we must prove A implies B and A uses an existential quantifier. That is, A 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 assume that
the 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 statement
P (x) is true.

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

For example, lets 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 an


integer 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 isnt obvious yet. But recall the
definition of divisibility.

An integer m divides an integer n, and we write m | n, if there exists an integer


k so that n = km.

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

Quantifier:
Variable: k
Domain: Z
Open sentence: n = km
58 Chapter 7 Quantifiers

How would the Object Method work? Consider the statement a | b. It uses an implicit
existential quantifier. Since a | b occurs in the hypothesis, we assume the existence of an
integer, say r, so that ra = b. And if you return to examine our proof of Transitivity of
Divisibility, this is precisely what appears in the first sentence of the proof. Similarly, the
Object 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 that
the 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 core
proof 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 and
the requirement of the Construct Method, we should construct a k and then show that k is
an integer and that 8k = n2 1. We can record this as a proof in progress.
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? Lets start with the hypothesis, n is of the form 4` + 1
for 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 product
of integers is an integer and the sum of integers is an integer, k is an integer. It is also clear
from 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 .


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 use
the Construct Method.

Preliminary Material: Elementary trigonometry

Since we are working with a quantifier, lets 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 look
like
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 object
satisfies the open sentence.

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


Proof: Consider = . Clearly, [0, 2]. Since
4
1 1
sin = sin = and cos = cos =
4 2 4 2
sin = cos as required.
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 statement
looks 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 that
whenever 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 member
of S. Note that if the the set S is empty, we proceed no further. The statement is
vacuously 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).

Lets begin by identifying the four parts of the quantified statement.

Quantifier:
Variable: n
Domain: odd integers
Open sentence: 4 | (n2 + 4n + 3)

Now we select a representative mathematical object from the set. Lets call the odd integer
that we selected n0 . We could certainly call it n. I am using n0 to emphasize that we have
selected a representative element. Now we must show that 4 | (n20 + 4n0 + 3). This much is
already 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.)


62 Chapter 7 Quantifiers

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


n20 + 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 integer m. Substituting
n0 = 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 set
being used.
Also, quantifiers frequently appear in the defining property of a set. For example, the set
of 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.


Section 7.7 A Non-Proof 63

7.7 A Non-Proof

Making mistakes is easy. Lets take a look at a proof which is not a proof. Lets find out
why it fails.

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

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

1
1. Let n be any integer with n > .
log2 (r)
1
2. It then follows that < log2 (r).
n
1
3. Hence 2 n < 2log2 (r) = r.

Analysis of Proof Lets 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.


1
Conclusion: There is an integer n such that 2 n < 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 Construct
Method. The four parts of the quantifier are:
Quantifier:
Variable: n
Domain: Z
1
Open sentence: 2n < r
In the first sentence of the proof, the author constructs an integer n. Later in the
proof, 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 and
we can certainly find an integer greater than any given real number.
1
Sentence 2 It then follows that n < log2 (r).
Here the author takes the reciprocal of n > 1/ log2 (r).
1
Sentence 3 Hence 2 n < 2log2 (r) = r.
Use the left and right sides of n1 < 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? Lets look again at Sentence 2. Here we
used the statement
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 that
the statement is false. Consider the case a = 2 and b = 4. 2 < 4 but 41 2
1
. 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. That
will make log2 (r) negative and hence 1/ log2 (r) negative. Choose n = 1. Now Sentence 1 is
satisfied but Sentence 2 fails.
Can you think of any way to correct the proposition or the proof?
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 Let S and T be two sets. A function f from S to T , denoted by f : S T , is a rule that
Function, Domain, assigns to each element s S a unique element f (s) T . The set S is called the domain
Codomain, Value of the function and the set T is called the codomain. The element f (s) is called the value
of the function f at s.

65
66 Chapter 8 Nested Quantifiers

Definition 8.2.2 The set of values of the function is called the image of f and is denoted by f (S). The set
Image f (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 mean
codomain, we will avoid the word range entirely.

Example 1 The familiar function sin x 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 than
or equal to x. For example,

1. b3.14c = 3.

2. b3.99c = 3.

3. b3.14c = 4. Since the floor of x is the largest integer less than or equal to x, 3
cannot 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 Let S and T be two sets. A function f : S T is onto (or surjective) if and only if for
Onto, Surjective every 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 that
the definition contains two quantifiers. Lets carefully parse the definition beginning with
the universal quantifier For every. Recall that we must identify the quantifier, variable,
domain and open sentence.

Quantifier:
Variable: y
Domain: T
Open 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 of
this quantifier.

Quantifier:
Variable: x
Domain: S
Open sentence: f (x) = y
Section 8.2 Onto (Surjective) Functions 67

REMARK
Because the existential quantifier is nested within the universal quantifier, this definition
is an example of nested quantifiers. There are really two basic principles for working
with 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 a
larger integer y. This is a true statement. Now lets make a small modification. We will
just 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 than
all integers. A very different, and false, statement.
Lets return to the definition of onto. We should be able to determine the structure of any
proof that a function is onto. Lets keep the definition in mind.

Let S and T be two sets. A function f : S T is onto (or surjective) if and


only 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.
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

Lets 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 + b
is 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.

Lets 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 defining
property 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 uses
the 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 R
so that f (x) = y).
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 author
uses 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 to
construct a suitable object. Note also that the choice of x depends on y so it is not
surprising 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 to
emphasize 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, lets 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 get p


x= y3
Since we want x [1, 2], we will choose the positive square root. Lets update the proof in
progress.
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.


70 Chapter 8 Nested Quantifiers

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

4y7

Subtracting three gives


1y34
Now taking the positive square root gives
p
1 y32

and since x = y 3 we have
1x2
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. Now p
4y 71y341 y321x2

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 are
not named and the steps in the arithmetic are not explicitly justified. These are left to the
reader.

Proof: Let y [4, 7]. Consider x = y 3. Now
p
4y 71y341 y321x2

Since
f (x) = x2 + 3 = ( y 3)2 + 3 = y
p

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 same
proof would work. But it doesnt. Consider the choice y = 0 R. What value of x maps to
0? 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.
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, whose
proof may be intimidating the first time you see it, states that the composition of onto
functions 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 we
need 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 are
associated with the functions f and g. The third occurs in the conclusion and is associated
with the function f g. That is the one that interests us right now. The definition of onto
begins with a universal qualifier. So we will use the Select Method applied to f g. Using
our 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 have
no idea what the functions f and g look like. But we have not made use of our hypotheses
at all so lets 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 a
t0 T so that f (t0 ) = y. Since t0 T and g : S T is onto, there exists an s0 S so that
g(s0 ) = t0 .
But what have we constructed? If we let x = s0 then we have an element that maps from
S to T and then from T to U for which f (g(s0 )) = y. Lets record these thoughts.
72 Chapter 8 Nested Quantifiers

Proof in Progress

1. Let y U .
2. Since f : T U is onto, there exists a t0 T so that f (t0 ) = y.
3. Since t0 T and g : S T is onto, there exists an s0 S so that g(s0 ) = t0 .
4. Hence, there exists s0 S so that f (g(s0 )) = f (t0 ) = 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, this
is 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 t0 T so that f (t0 ) = y. Since


t0 T and g : S T is onto, there exists an s0 S so that g(s0 ) = t0 . Hence, there exists
s0 S so that f (g(s0 )) = f (t0 ) = y.

8.3 Limits

8.3.1 Definition

Almost everyone who takes a calculus course encounters the notion of a limit. When we
write
lim f (x) = L
xa
we informally mean that we can make the values of f (x) arbitrarily close to L by taking
x sufficiently close to, but not equal to a. But formally we need to be more explicit about
what arbitrarily and sufficiently mean. That leads to the infamous definition of
a limit.

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

0 < |x a| < |f (x) L| <

Lets carefully parse the definition beginning with the universal quantifier For every.

Quantifier:
Variable:
Domain: real numbers > 0
Open 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 of
the quantifier.
Section 8.3 Limits 73

Quantifier:
Variable:
Domain: real numbers > 0
Open sentence: 0 < |x a| < |f (x) L| <

It is vitally important to observe that the open sentence is an implication. Because the
existential quantifier is nested within the universal quantifier, this definition is another
example of nested quantifiers.
We should take a minute here to think about x. The definition of limit began with the
expression The limit of f (x), as x approaches a so x is a real number. The implication
in 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 hypothesis
being 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! Well stay with the implication form because its
simpler.

8.3.2 Reading A Limit Proof

Before we begin our example, we should be able to determine the structure of any limit
proof. 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 Construct
Method identifies a mathematical object, shows that the object is within the appropriate
domain, and that the object satisfies the corresponding open sentence. The open sentence in
this 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 limit
proof 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. Most
texts 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 < |xa| < (). This is the hypothesis of the open sentence in the definition
of 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 (). Lets analyze a proof where someone
else has made the choice of () for us.
74 Chapter 8 Nested Quantifiers

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


lim mx + b = ma + b
xa

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, () = > 0.
|m|
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: limxa mx + b = ma + b.
Core Proof Technique: Nested quantifiers.
Preliminary Material: Definition of a limit. Notice how closely this proof follows
the proof in progress.

Sentence 1 Let > 0 be a real number.


The definition of limit begins with a universal quantifier so the first proof technique
is 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 the
Construct Method. This again follows the pattern of the proof structure. The con-

structed object is the real number () = . The author gives no indication why
|m|
that particular value was chosen or how it was derived.
Section 8.3 Limits 75


Sentence 3 Since > 0 and |m| > 0, () = > 0.
|m|
After an object is constructed, the Construct Method requires that the object be in
the 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 the
open sentence is 0 < |x a| < () and the conclusion is |f (x) L| < . The chain
of reasoning begins with the hypothesis, and after arithmetic manipulation, arrives at
the 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 , then


lim f (x) = 0
x0

We begin by explicitly identifying our hypothesis and conclusion.

Hypothesis: f (x) = x2

Conclusion: limx0 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. Since
we need
|x2 | <
we begin there and work backwards to get to 0 < |x| < (). Since |x2 | = x2 , we have

x2 <
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 squaring
the terms. A complete proof follows.

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

> 0. Now
0 < |x| < 0 < |x|2 < |x|2 < |x2 | <
as needed.

This proof was relatively easy, in part because a was 0. Lets consider a slightly more
complicated setting.

Proposition 7 If f (x) = x2 , then


lim f (x) = 9
x3

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.)
Section 8.3 Limits 77

Lets 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, we
took the square root, but the square root of |x2 9| will be hard to work with. Lets try
another 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 () = . But is a function of , not and x. Somehow we need to make a
|x + 3|
choice of that does not involve x. Lets be a little more careful about the range of values
x can take.
The notion of limit applies only when x is close to a, say |x a| < 1. In our particular case
this means |x 3| < 1. This implies
|x 3| < 1 1 < x 3 < 1 5 < x + 3 < 7
Lets 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 <
7
then

|x 3||x + 3| < 7 =
7
which is exactly what we need.

But now we have two restrictions, |x 3| < 1 and |x 3| < so it makes sense to choose
7
the smallest of the two as our .
n o
() = min 1,
7

This complicates our proof somewhat because we have two cases to check in the fifth step
of the proof. Here is a complete proof.
n o
Proof: Let > 0 be a real number. Consider the real number () = min 1, . Since
7
> 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
78 Chapter 8 Nested Quantifiers

as needed.

Now suppose that () = 7 then

0 < |x a| < () |x 3| < (hypothesis in definition of limit)
7

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

|(x 3)(x + 3)| < 7 (x + 3 < 7 from observation above)
7
|x2 9| <

as needed.

8.3.4 A Harder Proof

We will prove

2
Proposition 8 If f (x) = e1/x , then
lim f (x) = 0.
x0

You might object that the function is not even defined at 0, which is true. But the definition
of limxa f (x) does not require f to be defined at a. As usual, we begin by explicitly
identifying our hypothesis and conclusion.

2
Hypothesis: f (x) = e1/x

Conclusion: limx0 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.)
2 2
5. We show that |e1/x | < . (This is just |f (x)L| < with f (x) = e1/x 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. Since
we need
2
|e1/x | <
2
we begin there and work backwards to get to 0 < |x| < (). e1/x > 0 for all x so we do
not need the absolute value signs.
1
<
e 2
1/x
Section 8.4 Summary 79

2
Now divide by (we are using the hypothesis that 6= 0) and multiply by e1/x (we are
2
using the fact that e1/x > 0) to get the following.
1 2
< e1/x

Taking the natural log gives  
1 1
ln < 2
x
This is hopeful. We can invert the fractions to get
1
x2 <
ln(1/)

and since x2 > 0 we now have


1
0 < x2 <
ln(1/)
Taking square roots gives s
1
0 < |x| <
ln(1/)
And this is precisely the form we want. Our constructed delta is
s
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 though
details 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.
q
1
Proof: Let > 0. Since is small, we assume < 1. Consider = ln(1/) . Since < 1,
1/ > 1 which implies ln(1/) > 0 and so > 0. Now
s  
1 1 1 1 1 2 2
0 < |x| < 0<x < 2
ln < 2 < e1/x |e1/x | <
ln(1/) ln(1/) x

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.
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 there
is a real number y such that for every real number x, f (x) y.
Solution: We begin with the first quantifier
Quantifier:
Variable: y
Domain: R
Open sentence: for every real number x, f (x) y
which contains a nested quantifier
Quantifier:
Variable: x
Domain: R
Open sentence: f (x) y

A proof should use the Construct Method (for y) followed by


the Select Method (with x).

80
Section 9.2 Worked Examples 81

2. Saying that the function f of one real variable is continuous at the point x means
that for every real number > 0 there is a real number > 0 such that, for all real
numbers 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: y
Domain: {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 sin x = 0


Solution: This statement uses nested quantifiers. The first quantifier is an existential
quantifier
Quantifier:
Variable: x
Domain: [0, 2] R
Open sentence: for all a R, a sin x = 0
and the second quantifier is a universal quantifier.
Quantifier:
Variable: a
Domain: R
Open sentence: a sin x = 0
Corresponding to the existential quantifier and the nested universal quantifier, we
could use the Construct Method followed by the Select Method. The proof might
begin Consider x = . . . Let a R. We will show that x [0, 2] and that a sin x = 0
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 integer
a) and one implicit (divides).
The parts of the explicit quantifier are:
Quantifier:
Variable: a
Domain: Z
Open sentence: 2 | a(a + 1)
The parts of the implicit quantifier are:
Quantifier:
Variable: k
Domain: Z
Open 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 proof
might 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 use
the Construct Method. The parts of the quantifier are:
Quantifier:
Variable: k
Domain: Z
Open 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 so
that n > N implies |xn L| < .
1
Consider the sequence {xi } defined by xi = .
i

1. What are the first five terms in the sequence?


Solution:
1 1 1 1
1, , , ,
2 3 4 5
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 existential
quantifier.
(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 hypothesis
of this implication. The remainder of the proof demonstrates the conclusion.
(e) Hence, |xn L| < . To be completed.
1 1 1
Since xn = and L is zero, |xn L| < becomes < which implies < n. For
n n
1
our N we can choose any integer which is greater than . A complete proof is given

below.
1 1
Proof: Let > 0. For N , choose any integer which is greater than . Since N > ,

1
> . Now let n > N . Then
N

1 1 1
|xn L| = 0 = < <
n n N

as required.
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 you
may 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
X
i2
i=1

Definition 10.2.1 The notation


n
X
Summation xi
Notation
i=m
is called summation notation and it represents the sum
xm + xm+1 + xm+2 + + xn
P
The summation symbol, , is the upper case Greek letter sigma. The letter i is the index
of summation; the letter m is the lower bound of summation, and the letter n is the
upper bound of summation. The expression i = m under the summation symbol means
that 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
Section 10.2 Notation 85

Example 1
7
X
i2 = 32 + 42 + 52 + 62 + 72
i=3
3
X
sin(k) = sin(0) + sin() + sin(2) + sin(3)
k=0
n
X 1 1 1 1
2
= 1 + + + + 2
i 4 9 n
i=1

This notation is often generalized to an arbitrary logical condition, and the sum runs over
all values satisfying the condition.

Example 2 For example, the expression X


f (x)
xS

is the sum of f (x) over all elements x in the set S. The expression
X
d
d|n,d>0

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
X n
X
cxi = c xi where c is a constant
i=m i=m

2. Adding two sums


n
X n
X n
X
xi + yi = (xi + yi )
i=m i=m i=m

3. Subtracting two sums


n
X n
X n
X
xi yi = (xi yi )
i=m i=m i=m

4. Changing the bounds of the index of summation


n
X n+k
X
xi = xik
i=m i=m+k

The first three properties require indices with the same upper and lower bounds. The last
property allows us to change the bounds of the index of summation, which is often useful
when combining summation expressions.
86 Chapter 10 Simple Induction

10.2.2 Product Notation


P
Just asQsummation notation using is an algebraic shorthand for a sum, product notation
using is an algebraic shorthand for a product.

Definition 10.2.2 The notation


n
Y
Product Notation xi
i=m

is called product notation and it represents the product

xm xm+1 xm+2 xn
Q
The product symbol, , is the upper case Greek letter pi. The index i and the upper and
lower bounds m and n behave just as they do for sums.

Example 3 n        
Y 1 1 1 1 1
1 2 = 1 1 1 1 2
i 4 9 16 n
i=2

10.2.3 Recurrence Relations

You are accustomed to seeing mathematical expressions in one of two ways: iterative and
closed form. For example, the sum of the first n integers can be expressed iteratively as

1 + 2 + 3 + + n

or in closed form as
n(n + 1)
2
There is a third way.

Definition 10.2.3 A recurrence relation is an equation that defines a sequence of numbers and which is
Recurrence Relation generated 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 by
the recurrence relation fn = fn1 + fn2 . The first eight terms of the Fibonacci sequence
are 1, 1, 2, 3, 5, 8, 13, 21.
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 you
encounter 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 1


n
X n(n + 1)(2n + 1)
i2 = .
6
i=1

Often the clause For every integer n 1 is implied and does not actually appear in the
proposition, as in the following version of the same theorem.

n(n + 1)(2n + 1)
Proposition 3 The sum of the first n perfect squares is .
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 An axiom of a mathematical system is a statement that is assumed to be true. No proof
Axiom is given. From axioms we derive propositions and theorems.

Sometimes axioms are described as self-evident, though many are not. Axioms are defining
properties of mathematical systems. The Principle of Mathematical Induction is one such
axiom.
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. The
three 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 step
out completely.
Inductive Hypothesis Assume that P (k) is true for some integer k 1. It is best to
write out the statement P (k).
Inductive Conclusion Using the assumption that P (k) is true, show that P (k + 1) is
true. 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
X n(n + 1)(2n + 1)
i2 = .
6
i=1

Proof: We begin by formally writing out our inductive statement


n
X n(n + 1)(2n + 1)
P (n) : i2 = .
6
i=1
Section 10.4 Principle of Mathematical Induction 89

Base Case We verify that P (1) is true where P (1) is the statement
1
X 1(1 + 1)(2 1 + 1)
P (1) : i2 = .
6
i=1

As in most base cases involving equations, we can evaluate the expressions on the
left hand side and right hand side of the equals sign. The left hand side expression
evaluates to
X1
i2 = 12 = 1
i=1
and the right hand side expression evaluates to
1(1 + 1)(2 1 + 1)
= 1.
6
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.
k
X k(k + 1)(2k + 1)
P (k) : i2 = .
6
i=1

Inductive Conclusion Now we show that the statement P (k + 1) is true.


k+1
X (k + 1)((k + 1) + 1)(2(k + 1) + 1)
P (k + 1) : i2 = .
6
i=1

This is the difficult part. When working with equations, you can often start with the
more complicated expression and decompose it into an instance of P (k) with some
leftovers. Thats what we will do here.
k+1 k
!
X X
i2 = i2 + (k + 1)2

(partition into P (k) and other)
i=1 i=1
 
k(k + 1)(2k + 1)
+ (k + 1)2

= (use the inductive hypothesis)
6
k(k + 1)(2k + 1) + 6(k + 1)2
= (algebraic manipulation)
6
(k + 1) 2k 2 + 7k + 6

= (factor out k + 1, expand the rest)
6
(k + 1)(k + 2)(2k + 3)
= (factor)
6
(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 Mathematical
Induction.

Our next example does not have any equations.


90 Chapter 10 Simple Induction

Proposition 6 Let Sn = {1, 2, 3, . . . , n}. Then Sn has 2n subsets.

Lets 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 as
required.

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 subset
contains the element k+1, and the complement of A, A, in which every subset contains
the 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 + 1
is added. So, again by our inductive hypothesis, there are 2k subsets of A. Since
A and A are disjoint and together contain all of the subsets of Sk+1 , there must be
2k + 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 Mathematical
Induction.

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 show
that 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
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 that
in 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, lets 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): k 2 > 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 = k 2 + 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 uses
the fact that k > 0.
Since the result is true for n = k + 1, and so holds for all n by the Principle of Mathematical
Induction.

Here is another, similar example.

Proposition 8 For every integer n 5, 2n > n2 .

The statement P (n) is:

P (n): 2n > n2 .
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 > k 2

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, k 2 > 2k + 1 which follows from the previous
proposition.

2k+1 = 2 2k > 2 k 2 = k 2 + k 2 > k 2 + 2k + 1 = (k + 1)2

The result is true for n = k + 1, and so holds for all n by the Principle of Mathematical
Induction.

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 by


triominoes.

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 by


triominoes.

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 by


triominoes.
Section 10.6 An Interesting Example 93

Note that our inductive hypothesis covers every possible position for the empty square
within 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 be
covered 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. Well start by
placing one tile around the centre of the grid, not covering any of the 2k 2k subgrids
where the square is missing:

We can now view the grid as being made up of four 2k 2k subgrids, each with one
square missing. The Inductive Hypothesis tells us that each of these can be covered
by 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 the
Principle of Mathematical Induction.
94 Chapter 10 Simple Induction

10.6 Practice

1. Each of the following proofs by induction incorrectly prove a statement that is


actually 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 some
integer k 1. We must show that P (k + 1) is true, that is, k + 1 > k + 2. But
this follows immediately by adding one to both sides of k > k + 1. Since the
result is true for n = k + 1, it holds for all n by the Principle of Mathematical
Induction.

2. Prove the following statements by induction.

(a) For all n N,


n
X
(2i 1) = n2
i=1

(b) For all n N,


n
X n(n + 1)
i=
2
i=1

(c) For all n N,


n
X n(n + 1)(2n + 1)
i2 =
6
i=1

(d) For all n N,


n
X n2 (n + 1)2
i3 =
4
i=1

(e) For all n Z, n 0


n
X
2i = 2n+1 1
i=0

(f) For all r R, r 6= 1 and n N,


n
X 1 rn+1
ri =
1r
i=1

(g) For all n N,


n
X i 1
=1
(i + 1)! (n + 1)!
i=1

(h) For all r R, r 6= 1 and n N,


n
X 1 rn+1
ri =
1r
i=1
Section 10.6 Practice 95

(i) For all r R, r 6= 1 and n N,


n
X i n+2
i
=2 n
2 2
i=1

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 product


n  
Y 1
1 2
i
i=2

(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 = ln x.
dy d2 y d3 y d4 y
(a) Determine , , , .
dx dx2 dx3 dx4
dn y
(b) Conjecture an expression for .
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 2k1 (2k 1) is perfect.
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 doesnt work where it looks like it should. We then need to
change our approach a bit. The following example is similar to examples that weve done
earlier. 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 = xm1 + 6xm2 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 the
integer n. Lets 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
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 + 6xk1 (by the definition of the sequence)


k k
= 2 3 + 3 (2) + 6xk1 (by the Inductive Hypothesis)

Now two problems are exposed. The more obvious problem is what do we do with xk1 ?
The more subtle problem is whether we can even validly write the first line. When k + 1 = 2
we get
x2 = x1 + 6x0
and x0 is not even defined.
The basic principle that earlier instances imply later instances is sound. We need to
strengthen our notion of induction in two ways. First, we need to allow for more than
one base case so that we avoid the problem of undefined terms. Second, we need to allow
access to any of the statements P (1), P (2), P (3), ... , P (k) when showing that P (k + 1) is
true. This may seem like too strong an assumption but is, in fact, quite acceptable. This
practice 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 is
sometimes written as Assume that P (i) is true for i = 1, 2, 3, . . . , k, k b or Assume
that 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.
98 Chapter 11 Strong Induction

As a rule of thumb, use Strong Induction when the general case depends on more than one
previous case. Though we could use Strong Induction all the time, Simple Induction is often
easier.
Lets return to our previous proposition.

Proposition 2 Let the sequence {xn } be defined by x1 = 0, x2 = 30 and xm = xm1 + 6xm2 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 + 6xk1 (by the definition of the sequence)


k k k1 k1
= 2 3 + 3 (2) + 6(2 3 + 3 (2) ) (by the Inductive Hypothesis)
= 3k1 [2 3 + 6 2] + (2)k1 [3 (2) + 6 3] (expand and factor)
k1 k1
= 18 3 + 12 (2)
= 2 32 3k1 + 3 (2)2 (2)k1
= 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 Strong
Induction.
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 lets 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 the
next group of three integers by adding one to the preceding values of x. Since this is a case
where 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 table
above 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 Inductive


Hypothesis to assert the existence of positive integers x0 and y0 such that
3x0 + 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 Strong
Induction.
100 Chapter 11 Strong Induction

11.3 Practice

1. Each of the following proofs by induction incorrectly prove a statement that is


actually false. State what is wrong with each proof.

(a) For all n N, 1n1 = 2n1 .

Proof: Let P (n) be the statement: 1n1 = 2n1 .


When n = 1 we have 10 = 1 = 20 so P (1) is true. Assume that P (i) is true for
1 i k. That is, 1i1 = 2i1 for for 1 i k. We must show that P (k + 1) is
true, 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 1k1 = 2k1 .
Multiplying these two equations together gives 1k = 2k . Since the result is true
for 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 = 5xi1 for i 3. Then,


for all n N, xn = 3 5n1 .

Proof: Let P (n) be the statement: xn = 3 5n1 .


When n = 1 we have 3 50 = 3 = x1 so P (1) is true. Assume that P (k) is true
for some integer k 1. That is, xk = 3 5k1 for some integer k 1. We must
show that P (k + 1) is true, that is, xk+1 = 3 5k . Now

xk+1 = 5xk = 5(3 5k1 ) = 3 5k

as required. Since the result is true for n = k + 1, and so holds for all n by the
Principle of Mathematical Induction.

2. Prove the following statements by induction.

(a) A sequence {xn } is defined recursively by x1 = 8, x2 = 32 and xi = 2xi1 + 3xi2


for i 3. For all n N, xn = 2 (1)n + 10 3n1 .
(b) A sequence {tn } is defined recursively by tn = 2tn1 + n for all integers n > 1.
The first term is t1 = 2. For all n N, tn = 5 2n1 2 n for all integers
n 1.
(c) A sequence {xn } is defined by x1 = 11, x2 = 23 and xn = xn1 + 12xn2 for all
n 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 a
convex 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 angles
of a convex pentagon.
(c) Conjecture a value for the sum of the interior angles of a convex polygon with n
sides.
(d) Use induction to prove your conjecture.

4. The Fibonacci sequence is defined as the sequence {fn } where f1 = 1, f2 = i and


fi = fi1 + fi2 for i 3. Use induction to prove the following statements.
Section 11.3 Practice 101

(a) For all n N,  n


7
fn+1 <
4
(b) For n 2,
f1 + f2 + + fn1 = fn+1 1

1+ 5 1 5
(c) Let a = and b = . For all n N,
2 2
an bn
fn =
5
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 A binomial is the sum of two quantities, a + b for example.


Binomial

You have probably encountered the following powers of a binomial.

(a + b)2 = a2 + 2ab + b2
(a + b)3 = a3 + 3a2 b + 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.

If 0 b a, then the binomial coefficient ab is defined by



Definition 12.2.2
Binomial Coefficient  
a a!
=
b b!(a b)!

where 0! is defined to be 1 so that aa = 1.




102
Section 12.2 Binomial Theorem 103

Example 1  
6 6!
= 2!4! = 15
2
 
10 10!
= 1!9! = 10
1
 
a a!
= 0!a! = 1
0

The following proposition states an extremely useful property of binomial coefficients.

Proposition 1 (Sum of Binomials)


If 1 r n, then      
n+1 n n
= +
r r1 r

Proof:
   
n n n! n!
+ = +
r1 r (r 1)!(n r + 1)! r!(n r)!
n! r n! nr+1
= +
(r 1)!(n r + 1)! r r!(n r)! n r + 1
r(n!) + (n r + 1)(n!)
=
r!(n r + 1)!
(n + 1)(n!)
= (factor n! out in the numerator)
r!(n r + 1)!
(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,
n  
n
X n nr r
(x + y) = x y
r
r=0
104 Chapter 12 Binomial Theorem

Example 2
3  
3
X 3
(x + y) = x3r y r
r
r=0
       
3 30 0 3 31 1 3 32 2 3 33 3
= x y + x y + x y + x y
0 1 2 3
= x3 + 3x2 y + 3xy 2 + y 3

Example 3
3  
X
33
(2x 3) = (2x)3r (3)r = 8x3 36x2 + 54x 27
r
r=0

Proof: Let P (n) be the statement:


n  
n
X n nr r
(x + y) = x y .
r
r=0

Base Case We verify that P (1) is true where P (1) is the statement
1  
1
X 1 1r r
P (n) : (x + y) = x y .
r
r=0

Since
1      
X 1 1r r 1 10 0 1 11 1
x y = x y + x y = x + y = (x + y)1
r 0 1
r=0

the base case P (1) holds.

Inductive Hypothesis We assume that the statement P (k) is true for k 1.


k  
k
X k kr r
P (k) : (x + y) = x y .
r
r=0

Inductive Conclusion We now show that the statement P (k + 1) is true.


k+1  
k+1
X k + 1 k+1r r
P (k + 1) : (x + y) = x y .
r
r=0
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)
k   k  
! !
X k kr r X k kr r
=x x y +y x y
r r
r=0 r=0
(multiply the x and y through using Properties of Summation (a))
k   k  
! !
X k k+1r r X k kr r+1
= x y + x y
r r
r=0 r=0
(separate the first term from the left sum and the last term of the right sum)
  k   k1    
k k+1 X k k+1r r X k kr r+1 k k+1
= x + x y + x y + y
0 r r k
r=1 r=0
(change the bounds of summation using Properties of Summation (d))
  k   k    
k k+1 X k k+1r r X k kr+1 r k k+1
= x + x y + x y + y
0 r r1 k
r=1 r=1
(simplify first and last terms, add sums using Properties of Summation (b))
k    
k+1
X k k
=x + + xk+1r y r + y k+1
r r1
r=1
(use the Sum of Binomials)
k  
k+1
X k + 1 k+1r r
=x + x y + y k+1
r
r=1
(rewrite the first and last terms)
  k    
k + 1 k+1 X k + 1 k+1r r k + 1 k+1
= x + x y + y
0 r k+1
r=1
(finally, combine into a single sum)
k+1  
X k + 1 k+1r r
= x y
r
r=0

The result is true for n = k +1, and so holds for all n by the Principle of Mathematical
Induction.
106 Chapter 12 Binomial Theorem

12.3 More Examples

1. Expand
3 4
 
2x +
y

Solution:
 4 X 4    r
3 4 4r 3
2x + = (2x)
y r=0
r y
     1    2    3    4
4 4 4 3 3 4 2 3 4 1 3 4 3
= (2x) + (2x) + (2x) + (2x) +
0 1 y 2 y 3 y 4 y
3 2
96x 216x 216x 81
= 16x4 + + + 3 + 4
y y2 y y

2. What is the coefficient of the term containing x3 in the expansion of


 12
2 4
x +
x

Solution:  12
4
x2 +
x
The i-th term in the expansion is
   i  
12 2 12i
 4 12 i 243i
x = 4x
i x i

The term containing x3 corresponds to the term generated when i = 7. The coefficient is
 
12 7
4
7

12.4 Practice

1. Prove the following statements related to the Binomial Theorem.

(a)    
n n
=
k nk
(b) Using induction, prove that
 
n
is an integer for 0 r n
r
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 The negation of the statement A is the statement NOT A. Because statements cannot be
Negation both 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 another
NOT. For example,

107
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 DeMorgans Laws when we worked with truth tables. DeMorgans
Laws tell us how to negate statements containing AND and OR.

Proposition 1 (De Morgans Laws (DML))


If A and B are statements, then

1. (A B) (A) (B)

2. (A B) (A) (B)

REMARK
From DeMorgans 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 the
expression has been negated. The brackets are not needed because NOT precedes OR in
logical evaluation, but the brackets are useful to emphasize the change. Here is a specific
example.

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, DeMorgans Laws provide a specific rule when negating a
statement containing the word OR.

A: B OR C
NOT A: (NOT B) AND (NOT C)
Section 13.3 Negating Statements with Quantifiers 109

Note that the connecting word has changed from OR to AND and, again, each term in the
expression has been negated. As before, the brackets are not needed because NOT precedes
AND in logical evaluation, but the brackets are useful to emphasize the change. Here is an
example.

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.


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 in
each case place the NOT just before the open sentence. Repeat until there are no
quantifiers to the right of NOT.

Step 3 When all of the quantifiers are to the left of NOT, incorporate the NOT into the
open sentence.

Lets 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 prove
that a statement is false? In principle, this is relatively easy. To show that the statement
A is false, we only need to prove that the statement NOT A is true.
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, I
know that 0 [, ] and sin(x) = 1 6= 0. The number 0 is a counterexample.

Definition 13.3.1 In general, if we wish to prove that a universal statement A is false, we show that its
Counterexample negation, which is an existential statement, is true. The particular object which we use to
show 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, or
equivalently 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. To
show 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 (since


3 | 42) and the conclusion B is false, equivalently, NOT B is true. The values a = 3, b = 6
and c = 7 are a counterexample for S.
112 Chapter 13 Negation

13.4 Practice

1. Consider the following statement. For all a, b, c Z, there exists an integer solution
to ax2 + by 2 = 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 or
not f (x) = ex where f : R R is onto.

3. For each of the following statements, either prove the statement or disprove it using
a 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.
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 one
of the methods associated with quantifiers. There are times when this is difficult. A proof
by contradiction provides a new method.
Suppose that we wish to prove that the statement A implies B is true. We assume that A
is true. We must show that B is true. What would happen if B were true, but we assumed
it was false and continued our reasoning based on the assumption that B was false? Since a
mathematical statement cannot be both true and false, it seems likely we would eventually
encounter a mathematically non-sensical statement. Then we would ask ourselves How
did we arrive at this nonsense? and the answer would have to be that our assumption that
B was false was wrong and B is, in fact, true.

113
114 Chapter 14 Contradiction

REMARK
A proof by contradiction of the statement A implies B structures proofs in exactly this
way. 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 is
more 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 you
useful information. There are typically two instances when this is useful. The first instance
is when the statement B is one of only two alternatives. For example, if the conclusion B
is the statement f (x) = 0 then the only two possibilities are f (x) = 0 and f (x) 6= 0. NOT
B is the statement f (x) 6= 0 which could be useful to you. The second instance is when B
contains 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 product
consisting of one factor. The integers 4 = 2 2, 6 = 2 3 and 8 = 2 2 2 have been
factored 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 of
primes.

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.


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 a
product of primes.
The first sentence of a proof by contradiction usually gives the specific form of NOT
B that the author is going to work with. In this case, the author identifies that this is
a proof by contradiction by assuming the existence of an object which contradicts the
conclusion, 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 not
be obvious when first encountering the proof why the author would stipulate such a
condition, 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). But
the author has assumed that N is not a product of primes, hence N is composite and
can 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 be
written as a product of primes. In order to generate the contradiction, r and s must
be written as products of primes. If it were the case that N was not the smallest such
integer, it might be the case that neither r nor s could be written as a product of
primes.

Sentence 4 But then it follows that N = rs can be written as a product of primes, a


contradiction.
Since both r and s can be written as a product of primes, the product rs = N can
certainly be written as a product of primes. But this contradicts the assumption in
Sentence 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 an
integer which cannot be written as a product of primes is incorrect. That is, every integer
can 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 at
finding the path to a contradiction. Lets see how we might discover a proof to a famous
theorem 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
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 a


candidate for a proof by contradiction. Our first statement in a proof by contradiction is a
negation 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 the
finite 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 = p1 p2 p3 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 of
primes. 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 = p1 p2 p3 pn + 1.

4. Since N > pi for all i, N is not a prime.

5. To be completed.
Section 14.2 How To Use Contradiction 117

And this is where we can find our contradiction. N has no non-trivial factors since dividing
N by any of the pi leaves a remainder of 1. But that means N cannot be written as a
product of primes, which contradicts the previous proposition. The contradiction in this
proof 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 = p1 p2 p3 pn + 1.

4. Since N > pi for all i, N is not a prime.

5. Since N = pi q + 1 for each of the primes pi , no pi is a factor of N . Hence N cannot


be 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 . Consider
the integer N = p1 p2 p3 pn + 1. Since N > pi for all i, N is not a prime. But N = pi q + 1
for each of the primes pi , so no pi is a factor of N . Hence N cannot be written as a product
of primes, which contradicts our previous proposition.
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 The statement B A is called the contrapositive of A B.


Contrapositive

The logical equivalence between a statement and its contrapositive gives us another proof
technique. Instead of proving A implies B we prove NOT B implies NOT A using
any 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 A
or the statement NOT B gives you useful information. This is most likely to occur when
A or B contains a negation or is one of two possible choices. When both A and B contain
negations, 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
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)


= (4k 2 + 4k + 1 + 3)(4k 2 + 4k + 1 + 7)
= (4k 2 + 4k + 4)(4k 2 + 4k + 8)
= 4(k 2 + k + 1) 4(k 2 + k + 2)
= 16(k 2 + k + 1)(k 2 + k + 2)

4. Since one of k 2 + k + 1 or k 2 + k + 2 must be even, and the last line above shows that
a factor of 16 already exists disjoint from (k 2 + k + 1)(k 2 + 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 the
conclusion 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. The
provided proof would also be correct if this sentence was omitted. Correct, but less
easy 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 were
omitted? The clause If a is odd is NOT B so the author is using one of only two
proof techniques that begin this way, contradiction or contrapositive. Looking ahead
to the last line, we see that the author concludes with NOT A, so this is a proof of
the contrapositive. Had the author concluded with a contradiction, we would know
that this is a proof by contradiction.
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 the
contrapositive we would expect to see statements moving forward from the hypothesis
of 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(k 2 + k + 1)(k 2 + k + 2).


This is just arithmetic.

Sentence 4 Since one of k 2 +k +1 or k 2 +k +2 must be even, and the last line above shows
that a factor of 16 already exists disjoint from (k 2 + k + 1)(k 2 + 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 contrapositive
is 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 your
existing 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 A set S of real numbers is bounded if there is a real number M > 0 such that, for all
Bounded elements 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 is
not 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 the
contrapositive If T is bounded, then S is bounded. This gives us two statements in our
proof.
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
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 0 .

4. Hence, S is bounded. (This is just NOT A.)

Now the question becomes Where can we find such an M 0 ? If we use the definition of
bounded 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 > 0 such that, for all x T ,
|x| < M 0 .

3. To be completed.

4. For every x S, we have |x| < M 0 .

5. Hence, S is bounded. (This is just NOT A.)

Next, we need to connect the two sets and show that the M 0 of the set T is the same as the
M 0 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 0 .

Putting all of the statements together gives the following proof.

Proof: We will prove the contrapositive. Suppose that T is bounded. Hence, there exists
a real number M 0 > 0 such that, for all x T , |x| < M 0 . Let x S. Since S T , x T
and so |x| < M 0 . But then S is bounded as required.

Sometimes, the contrapositive can make an apparently difficult proof quite easy. Try the
following exercise.

Exercise 1 Let S and T be sets. Prove that if x 6 S T , then x 6 S or x 6 T .


Chapter 16

Uniqueness

16.1 Objectives

The technique objective is:

1. Learn how to prove an implication where a statement about uniqueness occurs in the
conclusion.

16.2 Introduction

You have already encountered statements that contain the adjective unique. Instead of the
word 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 0 (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
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 . Assume
that 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 . Assume
that 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 approaches
described in the previous section. In this case, we will assume the existence of two integers
k1 and k2 and show that k1 = k2 . But first, we need to show that at least one integer k
exists, 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.


124 Chapter 16 Uniqueness

2. Let k1 and k2 be integers such that b = k1 a and b = k2 a. (Note how closely this
follows the standard pattern. k1 corresponds to X. k2 corresponds to Y . Both come
from 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

k1 a = k2 a

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 = k1 a and b = k2 a. But then k1 a = k2 a and
dividing 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 = m1 x + b1 and y = m2 x + b2


exists. If m1 6= m2 , then there is a unique solution to the simultaneous linear equations
y = m1 x + b1 and y = m2 x + b2 .

As usual, we begin by explicitly identifying the hypothesis and conclusion.

Hypothesis: A solution to the simultaneous linear equations y = m1 x+b1 and y = m2 x+b2


exists. m1 6= m2 .

Conclusion: There is a unique solution to the simultaneous linear equations y = m1 x + b1


and y = m2 x + b2 .
Section 16.5 The Division Algorithm 125

The appearance of unique in the conclusion tells us to use one of the two approaches
described in the previous section. In this case, we will assume the existence of two distinct
points of intersection and derive a conclusion.
Proof in Progress

1. Suppose that y = m1 x + b1 and y = m2 x + 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 satisfy
the statement are a solution to the simultaneous linear equations y = m1 x + b1 and
y = m2 x + b2 .)
2. To be completed, hence a contradiction.

But now if we substitute (x1 , y1 ) and (x2 , y2 ) into y = m1 x + b1 we get


y1 = m1 x1 + b1 (16.1)
y2 = m1 x2 + b1 (16.2)
which implies that
y1 y2 = m1 (x1 x2 )
Similarly, substituting (x1 , y1 ) and (x2 , y2 ) into y = m2 x + 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
imply
y1 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 that
integers 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
126 Chapter 16 Uniqueness

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

1. Suppose that a = q1 b + r1 with 0 r1 < b. Also, suppose that a = q2 b + r2 with


0 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 .

Lets make sure that we understand every line of the proof.

Sentence 1 Suppose that a = q1 b + r1 with 0 r1 < b. Also, suppose that a = q2 b + r2


with 0 r2 < b and r1 6= r2 .
Since a statement about uniqueness appears in the conclusion, we would expect one
of the two uniqueness methods to be used. In fact, both are used. The assertion of
uniqueness applies to both q and r. Since the author writes r1 6= r2 , that is, there are
distinct values of r1 and r2 , we should look for a contradiction regarding r. But the
author does not assume distinct values of q and so we would expect that the author
will 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 argument
would hold identically if we made any other choice, so we will simply assume one of
the possibilities.

Sentence 3 Then 0 < r2 r1 < b and


This is a particularly important line. It comes, in part, from r1 < r2 by subtracting r1
from both sides (this gives 0 < r2 r1 ) and by remembering that the largest possible
value of r2 is b 1 and the smallest possible value of r1 is 0, so the largest possible
difference is b 1, thus r2 r1 < b

Sentence 4 (q1 q2 )b = r2 r1 .
This follows from equating a = q1 b + r1 and a = q2 b + 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
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 q
and 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 assumed
the existence of q1 and q2 and now has shown that they are, in fact, the same.
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,
ABC

17.3 How to Use the Elimination Method

We begin this section with a very important exercise.

Exercise 1 Prove that


A B C (A B) (A C) A B C

Lets interpret what these logical equivalences are telling us. The first equivalence says that
to prove A B C it is enough to prove A B or A C. We do not need to prove
both. And what if we cannot prove A B? The second equivalence tells us that we can
use 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, then
we are done. But if A B is false, then B must be false so we must show that C is true
when A is true and B is false.

128
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 for
the author to use the Elimination Method. The statements corresponding to A, B
and 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 Method
will be used.
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 in
the 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 x3 is only possible if x3 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

Lets discover a proof of the following statement.

Proposition 2 Let U be a universal set containing sets S and T . Then

ST ST

This may be mystifying. The word or does not appear. But lets rephrase the statement as

If x S T , then x S T

or
If 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 Elimination
Method.

Preliminary Material: Properties of sets.

Since we will use the Elimination Method, we will negate the first part of the conclusion
and establish the second part of the conclusion.
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 lets make use of the statement x 6 S. Since x 6 S, x S. Lets record what we have
done.
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 from


Sentence 3 that would imply that x S T , contradicting Sentence 2. So x cannot be in
T , which is exactly what we need.
Here is a complete proof. Notice that the author assumes that the reader can make the
transition from
ST ST
to
If 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 as
required.
Part IV

Securing Internet Commerce

132
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 Let a and b be integers, not both zero. An integer d > 0 is the greatest common divisor
Greatest Common of a and b, written gcd(a, b), if and only if
Divisor

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
134 Chapter 18 The Greatest Common Divisor

Definition 18.2.2 For a 6= 0, the definition implies that gcd(a, 0) = |a| and gcd(a, a) = |a|. We define gcd(0, 0)
gcd(0, 0) as 0. This may sound counterintuitive, since all integers are divisors of 0, but it is consistent
with gcd(a, 0) = |a| and gcd(a, a) = |a|.

Lets 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, then
gcd(a, b) = gcd(b, r).

Before we begin the proof, lets take a look at a numeric example.

Example 2 Suppose a = 72 and b = 30. Now 72 = 230+12 so the proposition GCD With Remainders
asserts that gcd(72, 30) = gcd(30, 12). And this is true. The gcd(72, 30) and gcd(30, 12) is
6.

How would we discover a proof for GCD With Remainders? Lets 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 a
suitable first question? How about How do we show that two integers are equal? There
are lots of possible answers: show that their difference is zero, their ratio is one, each is
less than or equal the other. However, here we are working with gcds rather than generic
integers 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 is
the only thing we have! A specific answer is less easy. Do we want to focus on gcd(a, b) or
gcd(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).


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 another
number? 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 first
sentence. 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 propositions
could we use? Transitivity of Divisibility doesnt seem to apply. How about using the
Divisibility 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 and
b by the Divisibility of Integer Combinations. That is, d | (a(1) + b(q)) so d | r. Lets
extend 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 of


Integer 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 the
definition 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 doesnt seem
to be anything obvious but ask Have I seen this anywhere before?. Yes, we have. In the
second part of the definition of gcd. But then you might ask Isnt that assuming what we
have to prove? Lets 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.
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 any
common 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 Integer
Combinations (again). Since a = qb + r, c | a. And now, since d = gcd(a, b) and c | a and
c | b, c d as needed. Lets 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 of


Integer 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 the
second 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 should
have an audience in mind. You actually have two audiences to keep in mind: your peers with
whom 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 if
you can. Also, proofs tend to work much more forwards than backwards because that helps
to emphasize the notion of starting with hypotheses and ending with the conclusion. Here
is 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 the
Divisibility 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 Integer
Combinations. 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 are
b = 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 discovery
process.
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 their
common 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,
lets compute gcd(1386, 322).

Example 3
Since 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. Youll need it soon.

Because mistakes happen when performing arithmetic by hand, and mistakes happen when
programming computers, it would be very useful if there were a way to certify that an
answer is correct. Think of a certificate of correctness this way. You are a manager. You
ask one of your staff to solve a problem. The staff member comes back with the proposed
solution and a certificate of correctness that can be used to verify that the proposed solution
is, in fact, correct. The certificate has two parts: a theorem which you have already proved
and which relates to the problem in general, and data which relates to this specific problem.
For example, heres 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 y
so that ax + by = d, then d = gcd(a, b).

Our certificate would consist of this theorem along with integers x and y. If our proposed
solution was d and d | a, d | b and ax + by = d, then we could conclude without doubt that
d = gcd(a, b).
138 Chapter 18 The Greatest Common Divisor

In Example 3 above, the proposed gcd of 1386 and 322 is 14. Our certificate of correctness
consists 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 conclude
that 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).

Lets do an analysis of the proof.

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

Hypothesis: d is a positive common divisor of the integers a and b. There exist


integers x and y so that ax + by = d.
Conclusion: d = gcd(a, b)
Core Proof Technique: Work forwards recognizing an existential quantifier in the
hypothesis.
Preliminary Material: Definition of gcd. An integer d > 0 is the gcd(a, b) if and
only 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 answering
the 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 of
the 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 and
c | b. The author must show c d.
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 author
assumes the existence of two integers x and y such that ax + by = d. The author does
not state this explicitly.
Having made this assumption, the author can use Sentence 3 to satisfy the hypotheses
of 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. Where
did the absolute vales signs go? From Sentence 4 we know that c | d and from the
hypothesis we know that d 6= 0 so Bounds by Divisibility implies that |c| |d|. From
the 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. Having
determined that c d, both parts of the definition of gcd are satisfied and so the
author 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 of
the 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 combination
of x and y, hence d | (3x + y).
Now suppose that c | x and c | (3x + y). Then c divides the integer combination
x(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).
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 + by 2 = c, then gcd(a, b) | c.


(b) If gcd(a, b) | c, then there exists an integer solution to ax2 + by 2 = c.

4. Two integers a and b are coprime if gcd(a, b) = 1. Consider the following proposition
and 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 separate
line.)

(i) Suppose b > a.


(ii) We can write b as a + 1.
(iii) Since 1(a + 1) 1(a) = 1, we know by the that
gcd(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 the
proposition or theorem precisely.
(d) Recall that propositions or theorems can only be invoked if their hypotheses are
satisfied. Show that all of the hypotheses of the proposition or theorem you
quoted in (c) are satisfied.
Chapter 19

The Extended Euclidean


Algorithm

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 only
d = gcd(a, b) but the data x and y for the certificate. Well begin with an example and
then formally state the algorithm.
First though, we need to know what the floor of a number is.

Definition 19.2.1 The floor of x, written bxc, is the largest integer less than or equal to x.
floor

Example 1

1. b9.713c = 9.

2. b9.025c = 9.

3. b9c = 9.

4. b9.713c = 10. Since the floor of x is the largest integer less than or equal to x, 9
cannot be the floor of 9.713 since 9 > 9.713.
 
7
5. = 3.
2

141
142 Chapter 19 The Extended Euclidean Algorithm

Lets compute gcd(1386, 322) using the EEA. We begin by creating four columns labelled
x, y, r (for remainder) and q (for quotient). We will construct a sequence of rows that will
tell us the gcd and provide a certificate. For the i-th row we will label the column entries
xi , yi , ri and qi . There is something very important to observe about the table. If we are
computing 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 the
third row we must first compute a quotient q3 using the formula
 
ri2
qi
ri1
Here we get    
r1 1386
q3 = = =4
r2 322
To construct the next row we use the formula

Rowi Rowi2 qi Rowi1

When i = 3 we get
Row3 Row1 q3 Row2
With q3 = 4 we get
Row3 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 compute
a quotient q4 using the formula  
ri2
qi
ri1
Here we get    
r2 322
q4 = = =3
r3 98
Section 19.2 The Extended Euclidean Algorithm (EEA) 143

To construct the next row we use the formula

Rowi Rowi2 qi Rowi1

When i = 4 we get
Row4 Row2 q4 Row3
With q4 = 3 we get
Row4 Row2 3 Row3
and so
x 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 and
y. The gcd d is the entry in the r column, x is the entry in the x column and y is the
entry in the y column. Hence, d = 14 (as before), and we can check the conditions of the
GCD Characterization Theorem to certify correctness. Since 14 | 1386 and 14 | 322 and
1386 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 y
after the EEA is complete. If a < b, simply swap their places in the algorithm. This works
because gcd(a, b) = gcd(b, a).
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).
ri2 = qi ri1 + ri where 0 ri < ri1 .
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 that
The 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 j k
qi rri1
i2

Rowi Rowi2 qi Rowi1


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. Lets record the
algorithm 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 integers
x and y so that ax + by = d.

A proof of the correctness of the EEA is available in the appendix. [Incomplete: Add to
appendix.]

Exercise 1 Earlier you computed the gcd of two numbers. Repeat that exercise using the EEA and
verify 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 certificate
that d is correct.
(b) Using part (a) , find d1 = gcd(231, 660) and provide a certificate that d1 is
correct.
(c) Using part (a) of this question, find d2 = gcd(231, 660) and provide a certifi-
cate that d2 is correct.
Section 19.3 More Examples 145

Solution:

(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 Characterization
Theorem together with d = 33 (d is positive and divides both 660 and 231), and
the integers 1 and 3 (since 660(1) + 231(3) = 33).
(b) Since gcd(231, 660) = gcd(231, 660), d1 = 33. Our certificate consists of the
GCD Characterization Theorem together with d1 = 33 (d1 is positive and divides
both 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 the
GCD Characterization Theorem together with d2 = 33 (d2 is positive and divides
both 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 that


1950(15) 770(38) = 10
Multiplying by 3 gives one particular solution, x0 = 45, y0 = 114 to
1950x 770y = 30. The complete solution is

x = 45 77n
y = 114 195n

for n Z.
Check: 1950x770y = 1950(4577n)770(114195n) = 1950(45)1950(77n)+
770(114) + 770(195n) = 1950(45) + 770(114) = 87750 + 87780 = 30.
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 Two integers a and b are coprime if gcd(a, b) = 1.


Coprime

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 in
the conclusion. You might object and ask Where? They are hidden - in the definition of
divides. Recall the definition. An integer m divides an integer n if there exists an integer k
so that n = km.
We treat an existential quantifier in the hypothesis differently from an existential quantifier
in the conclusion. Recall the following remarks from the chapter on quantifiers.

146
Section 20.2 Some Useful Propositions 147

REMARK
When proving that A implies B and A uses an existential quantifier, use the
Object Method.

1. Identify the four parts of the quantified statement there exists an x in the set S such
that P (x) is true.

2. Assume that a mathematical object x exists within the domain S so that the statement
P (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 the
Construct Method.

1. Identify the four parts of the quantified statement. there exists an x in the set S
such 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 and
Divisibility? 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 quantifier
in the hypothesis, and the Construct Method because of the existential quantifier in
the conclusion.

Preliminary Material: Definition of divides and gcd.

Lets work backwards from the conclusion by asking the question How do we show that
one integer divides another? We can answer with the definition of divisibility. We must
construct 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.
148 Chapter 20 Properties Of GCDs

The problem is that it is not at all clear what k should be. Lets work forwards from the
hypothesis.
Somehow we need an equation with a b alone on one side of the equality sign. We cant
start there but we can get an equation with a b. Since gcd(a, c) = 1, the EEA guarantees
that we can find integers x and y so that ax + cy = 1. We could multiply this equation by
b. Lets 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 that
ax + 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), wed be able to get a c and other stuff that we
could treat as our k. But the first term has no c. Or maybe it does. Since c | ab there
exists 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 that
ax + 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 that
ax + 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.
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 exist
integers x and y so that ax + cy = 1. Multiplying by b gives abx + cby = b. Since c | ab
there 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 use
the 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 with
ax + by = 1.

This proposition has similar elements to the one we just proved, so it wont be a surprise if
we 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 equivalence


of 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.


150 Chapter 20 Properties Of GCDs

In statement (1), there is an existential quantifier in the conclusion, so we would expect to


use the Construction Method. The problem is Where do we get x and y? In the previous
proof, we used the EEA and it makes sense to use it here as well. By the EEA and the
hypothesis 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 Object
Method and assume the existence of integers x and y so that ax + by = 1. Also, 1 | a and
1 | b. These are exactly the hypotheses of the GCD Characterization Theorem, so we can
conclude 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 that
ax + 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 so
that 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 the
Extended Euclidean Algorithm. Both assume integers a and b. The GCD Characterization
Theorem starts with an integer d where d | a, d | b and integers x and y so that ax + by = d
and concludes that d = gcd(a, b). The Extended Euclidean Algorithm computes a d so that
d = gcd(a, b), hence it produces a d so that d | a and d | b, and also computes integers x
and 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))


 
a b
Let a and b be integers. If gcd(a, b) = d 6= 0, then gcd , = 1.
d d

As we often do, lets get a sense of the proposition by using numeric examples.

 
a b a b
Example 1 First, observe that gcd , is meaningful. Since d | a and d | b, both and are
d d d d
integers.
Now gcd(18, 24) = 6. By the proposition Division by the GCD,
 
18 24
gcd , =1
6 6

which is exactly what we would expect from gcd(3, 4).


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 EEA
assures the existence of integers x and y so that ax + by = d. Dividing by d gives
a b
x+ y =1
d d
a b
Since 1 divides both and , the GCD Characterization Theorem implies that
  d d
a b
gcd , = 1.
d d

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 separate
line.)

(i) Since gcd(a, b) = 1, by there exist integers x and y such that


ax + 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 get
1 = (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) = 1
by .

(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 that
ax + by = 1 (1). Since c | a, there exists an integer k so that a = ck. Substituting
this 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.
152 Chapter 20 Properties Of GCDs

3. Let a, b Z. For each of the following statements, either prove the statement or
disprove 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).)
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 at
linear equations involving only integers.

Definition 21.2.1 Equations with integer co-efficients for which integer solutions are sought, are called
Diophantine Diophantine equations after the Greek mathematician, Diophantus of Alexandria, who
Equations studied such equations. Diophantine equations are called linear if each term in the equation
is 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 if
and only if a | b, and if a | b, then x = ab .
What about linear Diophantine equations with two variables?

ax + by = c

153
Chapter 21 Linear Diophantine Equations:
154 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, lets 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 integer
solutions.

2. Since gcd(33, 18) = 3, and 3 does divide 15, the second equation does have an integer
solution.

But how do we find a solution? Here are two simple steps that will allow us to find a
solution.

1. Use the Extended Euclidean Algorithm to find d = gcd(a, b) and x1 and y1 where

ax1 + by1 = d. (21.1)

c
2. Multiply Equation 21.1 by k = to get akx1 + bky1 = kd = c. A solution is x = kx1
d
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

hence
33 1 + 18 2 = 3
Section 21.2 Linear Diophantine Equations 155

c 15
Multiplying by k = = = 5 gives
d 3
33 5 + 18 10 = 15

so one particular solution is x = 5 and y = 10.


But are there more solutions? Thats where Part 2 of the Linear Diophantine Equation
Theorem 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 solution
x = 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.

c
7. Multiplying this equation by k = gives
d
akx1 + bky1 = kd = c

which, in turn, implies that x = kx1 and y = ky1 is a solution to ax + by = c.

Lets 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 the


hypothesis, so each will start with the Object Method. Though both statements
also 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 integer
solution 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 the
hypothesis of Statement 1. Moreover, the first statement uses an existential quantifier
in the hypothesis. The hypothesis of the first statement could be restated as
Chapter 21 Linear Diophantine Equations:
156 One Solution

there exists an integer solution x0 , y0 to the linear Diophantine equation


ax + by = c

The four parts are


Quantifier:
Variable: x0 , y0
Domain: Z
Open sentence: ax + by = c.
Since the existential quantifier occurs in the hypothesis, the author uses the Object
Method. The author assumes the existence of the corresponding objects (x0 , y0 ) in a
suitable 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 is
d | 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 that
an if and only if always consists of a statement and its converse. The hypothesis
of the converse is d | c. The definition of divides contains an existential quantifier
and 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 linear
Diophantine equation), so the author uses the Construct Method to build a suitable
solution. Here are the parts of the existential quantifier in the conclusion.

Quantifier:
Variable: x, y
Domain: Z
Open 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 so
that
ax1 + by1 = d.

The author is making use of a previously proved proposition.


c
Sentence 7 Multiplying this equation by k = gives
d
akx1 + bky1 = kd = c

which, in turn, implies that x = kx1 and y = ky1 is a solution to ax + by = c.


Section 21.2 Linear Diophantine Equations 157

This is where the solution is constructed, x = kx1 and y = ky1 , and where the
open sentence is verified. The author does not explicitly check that kx1 and kx2 are
integers, though we must when we analyse the proof.
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 all
of 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 linear
Diophantine equation ax + by = c, then the complete integer solution is
b a
x = x0 + n, y = y0 n, n Z.
d d

Before we discover a proof, lets make sure we understand the statement.

158
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 integer
solutions 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. Since
we 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 pairs
of integers we have found are solutions.

The expression complete integer solution in the statement of LDET 2 hides the use of
sets. Lets be explicit about what those sets are and what we need to do with them. There
are, 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}


b a
Proposed solution Let T = {(x, y) | x = x0 + n, y = y0 n, n Z}
d d

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 T
and T S. That is, at the risk of being repetitive, to establish that S = T we must show
two 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 that
S 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: s
Domain: S
Open sentence: sT
Chapter 22 Linear Diophantine Equations:
160 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 what
sets exist and how they are used. Lets return to the proof of LDET 2 where our sets are:

Complete solution Let S = {(x, y) | x, y Z, ax + by = c}


b a
Proposed solution Let T = {(x, y) | x = x0 + n, y = y0 n, n Z}
d d

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? We


must show that for all x T, x S. We certainly dont want to individually check every
element of T so we choose a representative element of T , one that could be replaced by any
element of T and the subsequent argument would hold. This is just the Select Method and
it provides our first statement.

b a
Let n0 Z. Then (x0 + n0 , y0 n0 ) T .
d d

To show that this element is in S we must show that the element satisfies the defining
property of S, that is, the element is a solution.
 
b  a 
ax + by = a x0 + n0 + b y0 n0
d d
ab ab
= ax0 + by0 + n0 n0
d d
= ax0 + by0
=c (by hypothesis, x = x0 and y = y0 is an integer solution)

And now we can conclude


b a
(x0 + n0 , y0 n0 ) S
d d

To show that S T we will need to recall the proposition Division by the GCD.

Proposition 2 (Division by the GCD)


 
a b
Let a and b be integers. If gcd(a, b) = d 6= 0, then gcd , =1
d d

Lets begin our analysis of S T . How do we show that S T ? We choose a representative


element in S and show that it is in T , that is, that it satisfies the defining property of T .
b a
Specifically, we must show that an arbitrary solution (x, y) has the form (x0 + n, y0 n).
d d
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. The
existence of (x0 , y0 ) is assured by the hypothesis. Lets do the obvious thing and substitute
both solutions into the equation.

ax + by = c
ax0 + by0 = c

Eliminating c and factoring gives

a(x x0 ) = b(y y0 )

a b
We know that d = gcd(a, b) is a common factor of a and b so and are both integers.
d d
Dividing the previous equation by d gives

a b
(x x0 ) = (y y0 ) (22.1)
d d
 
a b b a
Using Division by the GCD, gcd , = 1. Since divides (x x0 ) we know from
d d d d
Coprimeness and Divisibility that

b
(x x0 )
d

By the definition of divisibility, there exists an n Z so that

b b
x x0 = n x = x0 + n
d d

b
Substituting n for x x0 in Equation (22.1) yields
d
a
y = y0 n
d

So every solution is of the form

b a
(x, y) = (x0 + n, y0 n)
d d

and so

(x, y) T

A very condensed proof of Linear Diophantine Equation Theorem, Part 2 might look like
the following. Notice the lack of mention of sets.
Chapter 22 Linear Diophantine Equations:
162 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 linear
Diophantine equation ax + by = c, then the complete integer solution is
b a
x = x0 + n, y = y0 n, n Z.
d d

b a
Proof: Substitution shows that integers of the form x = x0 + n , y = y0 n, n Z are
d d
solutions.
Now, let (x, y) be an arbitrary solution and let (x0 , y0 ) be a particular solution to the linear
Diophantine equation ax + by = c. Then

ax + by = c
ax0 + by0 = c

Eliminating c and factoring gives a(x x0 ) = b(y y0 ) (1). Dividing


by d and using
b
Division by the GCD and Coprimeness and Divisibility we have (x x0 ). Hence, there
d
b a
exists an n Z so that x = x0 + n (2). Substituting (2) in (1) gives y = y0 n as
d d
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 the
linear Diophantine equation kx `y = c has infinitely many solutions in the positive
integers.

Proof: Since k and ` are coprime, gcd(k, `) = 1. By the EEA there exist integers x0 ,
y0 such that
kx0 + `y0 = 1
Equivalently
kx0 `(y0 ) = 1
Multiplying by c gives
k(cx0 ) `(cy0 ) = c
Section 22.4 Practice 163

so x = cx0 and y = cy0 is one particular solution to kx `y = c. By LDET 2, the


complete solution to kx `y = c is
x = cx0 `n
y = cy0 kn
where n Z.
Since k and ` are positive, if we choose n < 0 then nk and n` are positive. Since
we want
x = cx0 `n > 0 and y = cy0 kn > 0
we must have
cx0 cy0
n< and n <
` k
Thus
x = cx0 `n
y = cy0 kn
 cx0 cy0
for n < min ` , k 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 and
y 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 these
conditions 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 is
false.
(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 have
chosen 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}.
Chapter 22 Linear Diophantine Equations:
164 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 your
answer 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}.


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 dont have an
arithmetic of divisibility. Wouldnt it be nice if we could solve problems about divisibility
in 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, he
introduced congruences and provided a mechanism to treat divisibility with arithmetic.

Definition 23.2.1 Let m be a fixed positive integer. If a, b Z we say that a is congruent to b modulo m,
Congruent 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
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 work
with 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 relation
greater than fails reflexivity. The relation divides fails symmetry. The non-mathematical
relation 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)


Section 23.3 Elementary Properties 167

These may seem obvious but as the earlier examples showed, many relations do not have
these properties. So, a proof is needed. We will give a proof for all of them, and then an
analysis 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 so


that km = a b. But if km = a b, then (k)m = b a and so m | (b a). By the
definition 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 the
Divisibility of Integer Combinations, m | ((1)(a b) + (1)(b c)) so m | (a c). By
the definition of congruence, a c (mod m).

Analysis of Proof We will prove part 3 of the proposition Congruence Is An Equivalence


Relation.

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 I
show 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. And
a 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, a0 , b, b0 Z. If a a0 (mod m) and b b0 (mod m), then

1. a + b a0 + b0 (mod m)

2. a b a0 b0 (mod m)

3. ab a0 b0 (mod m)
168 Chapter 23 Congruence

This proposition allows us to perform substitutions of congruent values. We will discover a


proof 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 a0 (mod m) and b b0 (mod m)

Conclusion: ab a0 b0 (mod m)

Lets consider the question How do we show that two numbers are congruent to one
another? The obvious abstract answer is Use the definition of congruent. We may want
to 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 the
conclusion of part three involves the arithmetic operation of multiplication, and we dont
have multiplication properties for equivalence or divisibility, it makes sense to consider
either the third or fourth of the equivalent forms. There isnt much to separate them. Ill
choose the last form and see how it works. So, the answer to How do we show that two
numbers are congruent to one another? in the notation of this proof is We must find an
integer k so that ab = km + a0 b0 . Lets record that.
Proof in Progress

1. To be completed.

2. Since there exists k so that ab = km + a0 b0 , ab a0 b0 (mod m).

The problem is how to find k. There is no obvious way backwards here so lets start working
forward. The two hypotheses a a0 (mod m) and b b0 (mod m) can be restated in any
of their equivalent forms. Since we have already decided that we would work backwards
with the fourth form, it makes sense to use the same form working forwards. That gives
two statements.
Proof in Progress

1. Since a a0 (mod m), there exists an integer j such that a = mj + a0 (1).

2. Since b b0 (mod m), there exists an integer h such that b = mh + b0 (2).

3. To be completed.

4. Since there exists k so that ab = km + a0 b0 , ab a0 b0 (mod m).


Section 23.3 Elementary Properties 169

But now there seems to be a rather direct way to produce an ab and an a0 b0 which we want
for the conclusion. Just multiply equations (1) and (2) together. Doing that produces
ab = m2 jh + mjb0 + a0 mh + a0 b0 = (mjh + jb0 + a0 h)m + a0 b0
If we let k = mjh + jb0 + a0 h then k is an integer and satisfies the property we needed in
the last line of the proof, that is ab = km + a0 b0 . Lets record this.
Proof in Progress

1. Since a a0 (mod m), there exists an integer j such that a = mj + a0 (1).


2. Since b b0 (mod m), there exists an integer h such that b = mh + b0 (2).
3. Multiplying (1) by (2) gives ab = m2 jh+mjb0 +a0 mh+a0 b0 = (mjh+jb0 +a0 h)m+a0 b0 .
4. Since there exists k so that ab = km + a0 b0 , ab a0 b0 (mod m).

Lastly, we write a proof. Note that the reader of the proof is expected to be familiar with
the equivalent forms.

Proof: Since a a0 (mod m), there exists an integer j such that a = mj + a0 (1). Since
b b0 (mod m), there exists an integer h such that b = mh + b0 (2). Multiplying (1) by (2)
gives
ab = m2 jh + mjb0 + a0 mh + a0 b0 = (mjh + jb0 + a0 h)m + a0 b0 .
Since mjh + jb0 + a0 h is an integer, ab a0 b0 (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 been
given. It turns out that division is problematic. A statement of the form
ab ab0 (mod m) b b0 (mod m)
seems natural enough, simply divide by a. This works with the integer equation ab = ab0 .
But consider the case where m = 12, a = 6, b = 3 and b0 = 5. It is indeed true that
18 30 (mod 12)
and so
6365 (mod 12)
But dividing by 6 gives the clearly false statement
35 (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, lets look at an example.


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 and
so 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 sum
of 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 ar ar1 ar2 . . . a1 a0 . Then

n = 10r ar + 10r1 ar1 + 10r2 ar2 + . . . + 10a1 + a0


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 more
explicit.

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 assumes
that you do that whenever you read if and only if. Many if and only if proofs begin
with some preliminary material that will help both parts of the proof. For example, they
often introduce notation that will be used in both parts.
Lets look at a proof of the Congruent Iff Same Remainder proposition. Before we do an
analysis, make sure that you can identify

171
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 = q1 m + r1 , where 0 r1 < m

The Division Algorithm applied to b and m gives

b = q2 m + 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 and
a 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 = q1 m + r1 , where 0 r1 < m

The Division Algorithm applied to b and m gives

b = q2 m + 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 that


hm = a b. Hence

ab = (q1 q2 )m+(r1 r2 ) hm = (q1 q2 )m+(r1 r2 ) r1 r2 = m(hq1 +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


Section 24.2 Congruence and Remainders 173

Conversely, if a and b have the same remainder when divided by m, then r1 = r2


and 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 Statement


2 is left as an exercise.

Analysis of Proof In many if and only if statements one direction is much easier than
the 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 that


hm = 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). The
definition 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 ) from
the preliminary paragraph, substitutes hm for a b, isolates r1 r2 and factors out
an m from the remaining terms. Since h q1 + q2 is an integer, the author deduces
that 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. Lets take a minute to think
about why this statement is true. Sentence 2 provides m | (r1 r2 ). Now, what are
the possible values of r1 r2 ? Certainly r1 r2 can be zero but are there any other
possible 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 are
impossible 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 remainder
when 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.


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 following
example.

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 that
32 2 (mod 7) and 33 27 6 1 (mod 7). But then

347 345 32 (mod 7) arithmetic


3 15 2
(3 ) 3 (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 4
is the remainder when 347 is divided by 7. We only need to compute the remainder when
521 is divided by 7.
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 2271 3314 is divided by 7? Provide justification for your
work.
Solution: First, observe that 23 1 (mod 7) and 33 1 (mod 7) and so by the
proposition on the Properties of Congruence,

2271 3314 (23 )90 21 (33 )104 32 (1)90 21 (1)104 32 2 9 18 4 (mod 7)

Thus, by the proposition Congruent Iff Same Remainder, 2271 3314 has remainder 4
when 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 is
divisible by 9 if and only if d is divisible by 9.
Hint: Let the decimal representation of n be ar ar1 ar2 . . . a1 a0 . Then

n = 10r ar + 10r1 ar1 + 10r2 ar2 + . . . + 10a1 + a0


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 and
multiplicative 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 The congruence class modulo m of the integer a is the set of integers
Congruence Class
[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
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 to
you, remember that fractions are another example of where one number has infinitely many
representations. For example 1/2 = 2/4 = 3/6 = .

Definition 25.2.2 We define Zm to be the set of m congruence classes


Zm
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 going
on here.

1. Sets are being treated as individual numbers. Modular addition and multiplication
are being performed on congruence classes which are sets.

2. The addition and multiplication symbols on the left of the equals signs are in Zm and
those on the right are operations in the integers.

3. We are assuming that the operations are well-defined. That is, we are assuming
that these operations make sense even when there are multiple representatives of a
congruence 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, we
have addition and multiplication tables in Zm .
178 Chapter 25 Modular Arithmetic

Example 2 Addition and multiplication tables in Z4

+ [0] [1] [2] [3] [0] [1] [2] [3]


[0] [0] [1] [2] [3] [0] [0] [0] [0] [0]
[1] [1] [2] [3] [0] [1] [0] [1] [2] [3]
[2] [2] [3] [0] [1] [2] [0] [2] [0] [2]
[3] [3] [0] [1] [2] [3] [0] [3] [2] [1]

Note that all of the entries have representatives between 0 and 3. Even though there are
many representatives for each congruence class, we usually choose a representative between
0 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]


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 arithmetic
operations of addition and multiplication. In fact, subtraction is just addition of the inverse.
Now, whats an inverse? To answer that question we must first define an identity.

Definition 25.2.3 Given a set and an operation, an identity is, informally, something that does nothing.
Identity More formally, given a set S and an operation designated by , an identity is an element
e 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 the
identity 1.

The set of real valued functions with the operation of function composition has the
identity f (x) = x.

The set of integers modulo m with the operation of modular addition has the identity
[0].

Definition 25.2.4 The element b S is an inverse of a S if a b = b a = e.


Inverse

Example 4 Here are examples of inverses.

Under the operation of addition, the integer 3 has inverse 3 since 3 + (3) = (3) +
3 = 0.
3 4
Under the operation of multiplication, the rational number 4 has inverse 3 since
3 4 4 3
4 3 = 3 4 = 1.

Under the operation of function composition ln x has the inverse ex since ln(ex ) =
eln x = 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, we


typically denote the inverse of a by a1 . This does cause confusion. Many students interpret
180 Chapter 25 Modular Arithmetic

a1 as the reciprocal. This works for real or rational multiplication but fails in other contexts
like function composition. We will use a to mean the inverse of a under addition and a1
to mean the inverse under all other operations.

25.2.4 Subtraction in Zm

Lets 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 define
subtraction in Zm .

Definition 25.2.5 We will define subtraction as addition of the inverse. Thus


Subtraction
[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 for
Z5 we see that [2]1 = [3] since [2][3] = [6] = [1]. But what is the inverse of [2] in Z4 ? It
doesnt exist! Looking at the row containing [2] in the multiplication table for Z4 we cannot
find [1]. Unlike addition in Zm where every element has an additive inverse, it is not always
the case that a non-zero element in Zm has a multiplicative inverse.
We define division analogously to subtraction.

Definition 25.2.6 Division by a Zm is defined as multiplication by the multiplicative inverse of a Zm ,


Division assuming that the multiplicative inverse exists.

25.3 More Examples

1.
Chapter 26

Fermats Little Theorem

26.1 Objectives

The content objectives are:

1. State Fermats Little Theorem.

2. Read a proof of Fermats Little Theorem.

3. Read a proof to a corollary of Fermats Little Theorem.

4. Discover a proof to the Existence of Inverses in Zp .

26.2 Fermats Little Theorem

Pierre de Fermat proved a useful result called Fermats Little Theorem. This should not
be confused with one of the great conjectures, now theorem, of the last 400 years, Fermats
Last Theorem.

Theorem 1 (Fermats Little Theorem (F`T))


If p is a prime number that does not divide the integer a, then

ap1 1 (mod p)

Lets 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 without
the aid of a computer. However, by Fermats Little Theorem we know that

1828 1 (mod 29)

Take a minute to read the rather complicated proof.

181
182 Chapter 26 Fermats 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 is
not 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 these
integers 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)
p1
(p 1)!a (p 1)! (mod p)

6. Since gcd(p, (p 1)!) = 1, Congruences and Division (again) tells us that

ap1 1 (mod p)

Lets analyze the proof. As usual, we begin by identifying the hypothesis and the conclusion.

Hypothesis: p is a prime number. p - a.

Conclusion: ap1 1 (mod p)

Analysis of Proof This is the most complicated proof in the course so far, so we will be
very 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 distinct
modulo p.
The reason for this sentence is not at all obvious. The sentence is needed, but not
until 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 the
integers, 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 from
the integers under consideration, and that r 6= s. Since r and s are not the same, one
is less than the other. Without any loss of generality, we can assume r < s.
Section 26.2 Fermats Little Theorem 183

Sentence 3 Since gcd(a, p) = 1, Congruences and Division tells us that r s mod p, but
this 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, it must be the case that gcd(a, p) = 1. It is always useful
to identify where the hypotheses of a proposition are used in a proof. The hypotheses
of Fermats Little Theorem 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. The other is gcd(a, p) = 1. Invoking CD
gives r s mod p. But r and s are distinct, positive integers less than p, so this is not
possible. This concludes the 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 that
these 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 must
be the same modulo p.

Sentence 5 Multiplying these integers together gives

a 2a 3a (p 1)a 1 2 3 (p 1) (mod p)
p1
(p 1)!a (p 1)! (mod p)

This is another sentence whose purpose is not yet clear.

Sentence 6 Since gcd(p, (p 1)!) = 1, Congruences and Division (again) tells us that
ap1 1 (mod p).
The second of the congruences above is almost what we need. If we could divide out
the (p 1)! we would be done. But Congruences and Division allows us to do exactly
that.

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 ap1 1 (mod p). Multiplying both
sides 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).

Lets make sure we understand the proof.


184 Chapter 26 Fermats Little Theorem

Analysis of Proof There are two important items to note: the use of nested quantifiers
and 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 ap1 1 (mod p).


The author breaks up the proof into two parts depending on whether or not p divides
a. The author will need two distinct cases because the approach differs based on the
case. In the case where p does not divide a, the author uses Fermats 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 mod
p 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.
Lets 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 doesnt tell
us 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 instance
of 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 we


would expect to use the Select Method again.

3. There is an existential quantifier in the conclusion so we would expect to use the


Construct Method.

Together these give us the following.


Section 26.2 Fermats 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 Fermats Little Theorem. Now
Fermats Little Theorem uses congruences, not congruence classes. But we could restate
Fermats Little Theorem with congruence classes as

Theorem 4 (Fermats Little Theorem (F`T))


If p is a prime number that does not divide the integer a, then

[ap1 ] = [1] in Zp

Now an analogy to real numbers provides the final step. In the reals ap1 = a ap2 so why
not let [b] = [ap2 ]? 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] = [ap2 ].
4. To be completed.

Now we can invoke Fermats Little Theorem but first we need to make sure the hypotheses
are satisfied.
Proof in Progress

1. Let p be a prime number.


2. Let [a] be a non-zero element in Zp .
3. Consider [b] = [ap2 ].
4. Since [a] 6= [0] in Zp , p - a and so by F`T
[a][b] = [a][ap2 ] = [ap1 ] = [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] = [ap2 ].
Since [a] 6= [0] in Zp , p - a and so by Fermats Little Theorem
[a][b] = [a][ap2 ] = [ap1 ] = [1]
186 Chapter 26 Fermats Little Theorem

REMARK
In summary, if p is a prime number and [a] is any non-zero element in Zp , then

[a]1 = [ap2 ]

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 the
inverse 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] in
Z47 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 linear
Diophantine 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).
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 of


congruence. This allows us to solve new kinds of equations.

Definition 27.2.1 A relation of the form


Linear Congruence ax c (mod m)
is called a linear congruence in the variable x. A solution to such a linear congruence
is an integer x0 so that
ax0 c (mod m)

The problem for this lecture is to determine when linear congruences have solutions and
how to find them.
Recalling our table of statements equivalent to a b (mod m) we see that

187
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 to
ax + 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 equation
ax + my = c, then the complete integer solution is
m a
x = x0 + n, y = y0 n, n Z.
d d

But then, if x0 Z is one solution to ax c (mod m) the complete solution will be


m
x x0 (mod ) where d = gcd(a, m)
d
Lets think about why that is. If we reduce the solution given in LDET 2 above modulo
m m m
, then the term involving evaluates to 0 leaving x x0 (mod ).
d d d
Since the original problem was posed modulo m, we might like to give solutions modulo m.
m
In which case, x x0 (mod ) is equivalent to
d
m m m
x x0 , x0 + , x0 + 2 , , x0 + (d 1) (mod m)
d d d

m
Note that there are d = gcd(a, m) distinct solutions modulo m and one solution modulo .
d
We record this discussion as the following theorem.
Section 27.2 The Problem 189

Theorem 2 (Linear Congruence Theorem, Version 1, (LCT 1))


Let gcd(a, m) = d 6= 0.
The linear congruence
ax 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
m
x x0 (mod )
d
or, equivalently,
m m m
x x0 , x0 + , x0 + 2 , , x0 + (d 1) (mod m)
d d d

Another way of considering the same problem is to reframe it in Zm . Since

[a] = {x Z | x a (mod m)}

solving
ax 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
n h mi h mi h m io
[x0 ] , x0 + , x0 + 2 , , x0 + (d 1) in Zm
d d d
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


m a
the complete solution to ax + my = c is x = x0 + n, y = y0 n, n Z
d d
m
the complete solution to ax c (mod m) is x x0 (mod )
d
the complete solution to ax c (mod m) is
m m m
x x0 , x0 + , x0 + 2 , , x0 + (d 1) (mod m)
d d d
the complete solution to [a][x] = [c] in Zm is
n h mi h mi h m io
[x0 ] , x0 + , x0 + 2 , , x0 + (d 1) in Zm
d d d

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 the


Linear Congruence Theorem, Version 1.
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 of
our list of equivalencies, solving 3x 5 (mod 76) is equivalent to solving 3x + 76y = 5 and
that 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 original
equation, 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 that
solving
[13][x] = [1] in Z29
is equivalent to solving
13x + 29y = 1
and that we know how to do using the Extended Euclidean Algorithm.
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 original
equation, 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 the
inverse 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) is


different 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 the
same set of solutions.
Determine a simple condition on c and m for the hypothesis that makes this
proposition correct, and prove this proposition.
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 in
Nine 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. What
will be the number?

The word problem asks us to find an integer n that simultaneously satisfies the following
three linear congruences.

n2 (mod 3)
n3 (mod 5)
n2 (mod 7)

Before we solve this problem with three simultaneous linear congruences, we will begin with
two simultaneous congruences whose moduli are coprime.

193
194 Chapter 28 Chinese Remainder Theorem

28.3 Chinese Remainder Theorem

Example 1 Solve

n2 (mod 5)
n9 (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 and
we solved those in the previous chapter. Since gcd(5, 7) = 1, there is exactly one solution
modulo 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 to
n 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 the
simultaneous 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 m1 m2 )
Section 28.3 Chinese Remainder Theorem 195

Before we begin our discovery of a solution, lets 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 lets 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 and
construct a solution. There is nothing obvious from the statement of the theorem that will
help us, but we have already solved such a problem once in Example 1. Perhaps we could
mimic what we did there.
From the first linear congruence

The integer n satisfies n a1 (mod m1 ) if and only if

n = a1 + m1 x 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 + m 1 x a2 (mod m2 )
m 1 x 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 + m2 y for all y Z

If we set y = 0 we get x = b and hence n = a1 + m1 b is one particular solution.

Now lets consider the second part, a complete solution. Following on what we have done
above, an integer n satisfies the simultaneous congruences if and only if

n = a1 + m1 x
= a1 + m1 (b + m2 y)
= (a1 + m1 b) + m1 m2 y for all y Z

But these are the elements of exactly one congruence class modulo m1 m2 . That is, all of
the solutions belong to a single congruence class modulo m1 m2 . Therefore, if n = n0 is one
solution, the complete solution is

n n0 (mod m1 m2 )
196 Chapter 28 Chinese Remainder Theorem

Exercise 1 Using the analysis above, write a proof for the Chinese Remainder Theorem.

Exercise 2 Solve

n2 (mod 3)
n3 (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

x2 (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 to
n8 (mod 15)
We can check by substitution. If n = 15y + 8, then n 2 (mod 3) and n 3 (mod 5).

Exercise 3 Solve
n2 (mod 3)
n3 (mod 5)
n4 (mod 11)

Solution: The first two of the three linear congruences were solved above so we can replace
n2 (mod 3)
n3 (mod 5)
by
n8 (mod 15)
This reduces a problem of three linear congruences to a problem in two linear congruences.
n8 (mod 15)
n4 (mod 11)
We leave the remainder of the exercise to the reader.
Section 28.5 More Examples 197

The exercises above make it clear that we can solve more than two simultaneous linear
congruences 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 integers
a1 , 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 m1 m2 . . . mk )

You should ask yourself What happens if the moduli are not coprime? That investigation
is 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?

x3 (mod 7)
x5 (mod 12)

Solution: Since gcd(7, 12) = 1, we know by the Chinese Remainder Theorem that
a solution to this pair of linear congruences exists. Rewriting x 3 (mod 7) as
x = 7y + 3 (1) for y Z and substituting into the second linear congruence gives
7y + 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 in
Equation 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.


198 Chapter 28 Chinese Remainder Theorem

(a)
x7 (mod 11)
x5 (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:


 
n 2 (mod 12) n 5 (mod 12)
A: B:
n 10 (mod 18) n 11 (mod 18)
Determine which one has solutions and which one has no solutions. For the one
with solutions, give the complete solutions to the system. For the one with no
solutions, explain why no solutions exist.
(b) Let a1 , a2 be integers, and let m1 , m2 be positive integers. Consider the following
system of linear congruences

n a1 (mod m1 )
S:
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 m1 m2 ) iff x a (mod m1 ) and


x 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+(n1)) is called a Wolczuk of length n if every integer in the sequence
is divisible by some perfect square greater than 1. For example, (8, 9) is a Wolczuk of
length 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 of
length n.
Chapter 29

Practice, Practice, Practice:


Congruences

29.1 Objectives

The content objectives are:

1. Computational practice.

2. Preparing for RSA.

29.2 Worked Examples

Lets 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 mod
60 as a solution to 13x 1 (mod 60). Now 13x 1 (mod 60) is equivalent to the linear
Diophantine equation 13x+60y = 1 so we can use the EEA. (Note that we have interchanged
the 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
200 Chapter 29 Practice, Practice, Practice: Congruences

Though we have efficient means to solve linear congruences, we have no equivalent means
to 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 be
when 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 Fermats Little
Theorem 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 to
x47 + 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 Fermats
Little Theorem which implies that x4 1 (mod 5) and so

x47 x44 x3 (x4 )11 x3 111 x3 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)

is
x3 (mod 5)
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 are
relatively prime, maybe we could split the problem into two linear congruences and then
apply the Chinese Remainder Theorem. Unfortunately, the polynomial is not linear. Lets
see 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)


37 8 7
n + 10n + 14n + 1 5 (mod 7) (29.2)

Well, have we seen anything like these before? Indeed, we have. The previous example
solved congruences just like these. Well solve each of the polynomial congruences individ-
ually. As in the previous example, we can reduce terms and use Fermats Little Theorem
or its corollaries to simplify the congruence before substitution. Lets 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, otherwise
we have 1 0 (mod 5) by substitution in the preceding equation. Since 5 is a prime and
5 - n0 , we use Fermats Little Theorem to get n4 1 (mod 5). Hence

n37 n36 n (n4 )9 n 19 n n (mod 5)

and
n7 n4 n3 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
202 Chapter 29 Practice, Practice, Practice: Congruences

Hence, the only solution to

n37 + 10n8 + 14n7 + 1 5 (mod 5)

is
x2 (mod 5)
This is a linear congruence so that supports the idea of using the Chinese Remainder
Theorem. Now lets 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, we


can use Fermats Little Theorem to assert n6 1 (mod 7). This allows us to say

n37 n36 n (n6 )6 n 16 n n (mod 7)

and
n8 n6 n2 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)

is
n1 (mod 7)

But now we have two simultaneous linear congruences

n2 (mod 5)
n1 (mod 7)

Since the moduli are coprime, we know by the Chinese Remainder Theorem that a solution
exists. 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)
Section 29.2 Worked Examples 203

Solving this linear congruence gives

x4 (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 to
n 22 (mod 35)

Thus, the solution to


n37 + 10n8 + 14n7 + 1 5 (mod 5)
is
n 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 the
previous question. Observing that 165 = 3 5 11 and all three factors are relatively prime
as pairs, maybe we can split the problem into three linear congruences and then apply the
Chinese Remainder Theorem.
If n0 is a solution to
n3 127 (mod 165)
then n0 is a solution to

n3 127 1 (mod 3)
n3 127 2 (mod 5)
3
n 127 6 (mod 11)

Lets consider each of the three congruences separately. In the case n3 1 (mod 3) we
can use a corollary to Fermats Little Theorem. Since n3 n (mod 3) by Fermats Little
Theorem, n3 1 (mod 3) reduces to n 1 (mod 3) which is just the solution to the first
congruence.
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.
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 linear
congruences
n1 (mod 3)
n3 (mod 5)
n8 (mod 11)

Though these could be solved by eye (note that n 8 (mod 55) is a solution to the last
two) 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 linear
congruences.
n = 3(5y + 4) + 1 = 15y + 13 for all y Z
which is equivalent to
n 13 (mod 15)

Now we need to solve


n 13 (mod 15)
n8 (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 to
n 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).
Section 29.3 Preparing for RSA 205

REMARK
Lets 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 always


works but can be very slow.

Polynomial congruences may have many solutions.

One approach that sometimes works when the modulus is composite, is to break the
problem into parts, solve each of the parts, and then combine the partial solutions to
get 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, applying
Fermats Little Theorem to reduce exponents (which is why we need to use prime
factors), and then using observation, the Linear Congruence Theorem or a table
of values.
3. If the original problem has a solution, this process will give at least one linear
congruence for each factor. Use the Chinese Remainder Theorem to combine
these 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 will
look at next. In commercial practice the numbers chosen are large but here, choose numbers
small 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 so
n = 77.

2. Select an integer e so that gcd(e, (p 1)(q 1)) = 1 and 1 < e < (p 1)(q 1). I will
choose e = 13 which satisfies gcd(13, 60) = 1 and 1 < 13 < 60.

3. Solve
ed 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.


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 elses secret communications have
also been known for millenia. In the modern world, the need for secret communication is
much larger than it was even in the recent past. Certainly the traditional areas of military
and diplomatic continue, but the credit card, debit card and web transactions of modern
commerce, 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 two
parties, usually referred to as Alice (for person A) and Bob (for person B), to communicate
over an insecure channel so that an opponent, often called Oscar, cannot understand what
is being communicated. In wartime, a general (Alice) wishes to provide orders to a field
commander (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) provide
your 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. The
act 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. The
act of transforming the ciphertext to plaintext using the key is called deciphering or
decryption.

206
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 one
letter 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 the
plaintext, replace it with the letter below it to produce the ciphertext. For example, the
plaintext:
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 Churchills 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 it
with the letter above it to produce the plaintext.
Now suppose we had somehow gotten hold of this particular ciphertext and wanted to
reconstruct 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 possible
substitutions. 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 makes
our task much easier. Consider the following observations.
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 three
letter 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 are
more 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 but
not that many that end in the same letter and can precede the word THE. Two obvious
pairs 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 which
maps, 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 common
letter and that other letters like S, T, R, A, O , I are also common, though not as common
as E. We do know that S commonly ends words. Since P is both common and at the
end 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 way
to allowing us to break the code. Despite the vast numbers of possible keys, it did not
take us too long to make considerable progress.
Suppose that the sender of the message was more cautious and removed all of the spaces (or
randomly inserted characters into the spaces) and blocked all of the characters into groups
of 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 Bob
wish to eliminate patterns.
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 common
letter. S was common but not as common as E. Z is a rare letter. THE is a
very common three letter word. If we compute the relative frequency of the letters of the
alphabet in many reasonably long passages, a very consistent pattern of relatively frequency
occurs. The table below replicates a table by Beker and Piper [Incomplete: reference]
of percentages that each character appears in a collection of passages. The passages had all
punctuation 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:

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 frequencies
are 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
210 Chapter 30 The RSA Scheme

Now lets return to our ciphertext and see, even without spaces, if we can make progress.
In this particular case, its important to note that the passage is shorter than we would
like. 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. There
are many pairs and triples of letters that are relatively frequent, and this is unexpected
given 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 guess
that 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 continue
experimenting.

30.2.4 Vigenere Ciphers

Substitution ciphers have a grave weakness. Given any reasonably long ciphertext, patterns
of distribution can be used to break them. A Vigenere cipher is intended to make the
frequency distribution more uniform. Heres how it works. First, we treat the alphabet as
numbers 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 as
integers modulo 26. For encryption we add, character by character modulo 26, our key to
the message. For decryption we subtract, character by character modulo 26, our key from
the ciphertext. If the key is shorter than the message, we repeat the key. We assume that
all punctuation and spacing has been removed from the message text, and that the message
text is blocked into groups of five characters. For example, the source text (from Moby
Dick by Herman Melville )
CALL ME ISHMAEL
becomes the plaintext
CALLM EISHM AEL
We add the key
HERMAN
as follows
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 observe


that 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 samples
of 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.


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 that
you have already learned about, participants share a common key. This raises the problem
of how to distribute a large number of keys between users, especially if these keys need to
be changed frequently. For example, there are almost 200 countries in the world. If Canada
maintains an embassy in each country and allows Canadian embassies to communicate with
one another, the embassiesmust exchange a common key between each pair of embassies.
That means there are 200 2 = 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 decryption
key held secretly by each participant, and a public encryption key, derived from the private
key, which is shared in an open repository of some sort. For user A to send a private message
to user B, A would look up Bs public key, encrypt the message and send it to B. Since
B is the only person who possesses the secret key required for decryption, only B can read
the message.
Such an arrangement solves the key distribution problem. The public keys do not need to
be kept secret and only one per participant needs to be available. Thus, in our embassy
example 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 and
Adleman is an example of a commercially implemented public key scheme.
RSA is now widely deployed. The following protocols and products, which embed RSA, are
used by many of us daily. SSL (Secure Sockets Layer) is the most commonly used protocol
for secure communication over the web. It is frequently used to encrypt payment data
before sending that data to a server. PGP (Pretty Good Privacy) is used by individuals
and businesses to encrypt and authenticate messages. It was originally intended for email
messages and attachments but is now also used for encrypting files, folders or entire hard
drives. EMV (Europay, MasterCard and VISA) is a global standard for authenticating
credit and debit card transactions at point of sale (POS) or automated teller machines
(ATM).
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 the
same way we did with a Vigenere cipher, assign a number to each letter of the alphabet
and 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. Solve
ed 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 recipients public key (e, n).

2. Generate the integer message M so that 0 M < n.

3. Compute the ciphertext C as follows:

Me 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.


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 be
9026694843 0929817462 4847943076 6619417461
5791443937,
and let q be
7138718791 1693596343 0802517103 2405888327
6844736583
so n is
6443903609 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) is
6443903609 8539423089 8003779070 0502485677
1034536313 8360840952 3666750800 6340495008
2897684191 1341266752.
Choose e as
9573596212 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. Solve
ed 1 (mod (p 1)(q 1))
for an integer d where 1 < d < (p 1)(q 1). Solving this LDE gives d as
5587652122 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 recipients public key (e, n).

2. Generate the integer message M so that 0 M < n.


We will let M = 3141592653.
Section 30.5 Does M = R? 215

3. Compute the ciphertext C as follows:

Me C (mod n) where 0 C < n

Computing gives C
4006696554 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. C d R (mod n) where 0 R < n

then R = M .

The proof is long and can appear intimidating but, in fact, it is structurally straightforward
if we break it into pieces. The proof is done in four parts.
216 Chapter 30 The RSA Scheme

1. Write R as a function of M , specifically

R M M k(p1)(q1) (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 M M k(p1)(q1) (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)
e d
(M ) (mod n)
M ed (mod n)
1+k(p1)(q1)
M (mod n)
M M k(p1)(q1) (mod n)

Second, we will show that R M (mod p). Suppose that p - M . By Fermats Little
Theorem,
M p1 1 (mod p)
Hence

M k(p1)(q1) (M p1 )k(q1) (mod p)


1k(q1) (mod p)
1 (mod p)

Multiplying both sides by M gives

M M k(p1)(q1) M (mod p)

Since
R M M k(p1)(q1) (mod n) R M M k(p1)(q1) (mod p)
we have
RM (mod p)

Now suppose that p | M . But then M 0 (mod p) and so M M k(p1)(q1) 0 (mod p).
That is,
M M k(p1)(q1) M (mod p)
Again, since

R M M k(p1)(q1) (mod n) R M M k(p1)(q1) (mod p)


Section 30.6 How Secure Is RSA? 217

we have
RM (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 congruences
that have to be satisfied simultaneously.

RM (mod p)
RM (mod q)

Since gcd(p, q) = 1 we can invoke the Chinese Remainder Theorem and conclude that

RM (mod pq)

Since pq = n we have
RM (mod n)
Now, R and M are both integers congruent to each other modulo n, and both lie between
0 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 large
integers is difficult. Despite enormous efforts, both theoretically and computationally, no
efficient method of factoring has been discovered. In practice, the risk of successful attack
against an RSA user usually lies with implementation details, not in the underlying theory.
Part V

Bijections and Counting

218
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 Let S and T be two sets. A function f : S T is one-to-one (or injective) if and only if
One-to-one, for every x1 S and every x2 S, f (x1 ) = f (x2 ) implies that x1 = x2 .
Injective

Just as with onto functions, lets parse the definition beginning with the universal quan-
tifier For every. Recall that we must identify the quantifier, variable, domain and open
sentence.

Quantifier:
Variable: x1
Domain: S
Open 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 this
quantifier.

219
220 Chapter 31 Injections and Bijections

Quantifier:
Variable: x2
Domain: S
Open 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 appropriate
domain, 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 we
wish 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 we
wish to show that the open sentence is true, we must show the conclusion is true.

31.2.2 Reading

Lets work through an example. Notice how closely the proof follows the structure of a
one-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 + b
is 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.


Section 31.2 One-to-one (Injective) 221

Lets 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 defining
property 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 into
a single sentence. This works because both of the first two quantifiers in the definition
are universal quantifiers and so the author uses the Select Method twice. That is, the
author chooses elements (x1 and x2 ) in the domain (R). The author must now show
that 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 the
hypothesis. To prove an implication, we assume the hypothesis and demonstrate that
the 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, lets 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.


222 Chapter 31 Injections and Bijections

The obvious starting point is to write down f (x1 ) = f (x2 ) and see if algebraic manipulation
can 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 because
the domain is [1, 2] we are justified in taking the positive square root and concluding that
x1 = x2 . Here is a complete proof.

Proof: Let x1 , x2 [1, 2]. Suppose that f (x1 ) = f (x2 ). But then x21 + 3 = x22 + 3 and
so x21 = x22 . Since x1 , x2 [1, 2] we can take the positive square root of both sides to get
x1 = x2 .

Just as with onto functions, the choice of the domain and codomain for the function is
important. 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 easier
to see why by working with the contrapositive of f (x1 ) = f (x2 ) x1 = x2 . Recall that the
contrapositive is logically equivalent to the original statement. For one-to-one functions, we
can 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 if
for 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 case


that 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 that
x1 = x2 .
Section 31.3 Bijections 223

There are three instances of one-to-one in the proposition. Two occur in the hypothesis
and are associated with the functions f and g. The third occurs in the conclusion and is
associated with the function f g. Lets use the structure of a one-to-one proof as our
starting 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 lets follow our nose and
see 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 is
one-to-one, f (y1 ) = f (y2 ) implies y1 = y2 . In this case, y1 = g(x1 ) and y2 = g(x2 ). Now
back to g(x1 ) = g(x2 ). Since g is one-to-one, we know that x1 = x2 , which is exactly what
we 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 ). And
since 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 A function f : S T is bijective if and only if f is both surjective and injective.
Bijective

Example 1 We have already shown that for m 6= 0 and b a fixed real numbers, the function f : R R
defined by f (x) = mx + b is both surjective and injective. Hence, f is bijective.

Lets summarize the definitions related to functions.


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 that
f (s) = t.

f is injective if, for each element t T , there is at most one element s S so that
f (s) = t.

f is bijective if, for each element t T , there is exactly one element s S so that
f (s) = t.

Bijections are commonly used in calculus to identify invertible functions. Bijections are
used in linear algebra and group theory to show that two algebraic structures, which may
look 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. In
all 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 words
first letter. For example, f (mathematics) = m.
(b) Let f : N N be defined by X
f (n) = d
d|n

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.


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 boys
would be sent with their flocks of sheep and goats to the high pastures to allow the animals
to graze. The herd boys were uneducated, and very few knew how to count. So, how did
they know if they had the right number of animals at any given time? An animal might
get 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 a
very small bag that contained pebbles, one pebble for each animal. So, to count the
animals, they would simply match up a pebble against each animal they could see. If there
were more pebbles than animals, an animal was missing. If there were more animals than
pebbles, another animal had joined their flock, presumably from a nearby herd. If there
was 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 bag
and the set of animals in their flock. When we count by saying 1, 2, 3, . . . we are creating
a bijection between a subset of the integers and the set of objects we are counting. Now,
how do we formalize this idea?

225
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 the
set S. Now it is time to be clear about what that really means.

Definition 32.3.1 If there exists a bijection between the sets S and T , we say that the sets have the same
Cardinality cardinality 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 If there exists a bijection between a set S and Nn , we say that the number of elements
Number of in S is n, and we write |S| = n. Moreover, we also say that S is a finite set. If no bijection
Elements, Finite, exists between a set S and Nn , we say that S is an infinite set.
Infinite

This formal definition corresponds exactly to what herd boys do with pebbles, what children
do 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 extension
brings 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 the


following 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 Construct
Method. Lets begin by identifying the parts of the quantified sentence.

Quantifier:
Variable: f
Domain: all functions from S to T
Open sentence: f : S T is a bijection.
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 must
show that f is surjective and injective. So any proof that |S| = |T | which uses bijections
will 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 complete
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. Since a function is defined by unique values for elements
in the domain, we use either of the uniqueness methods. For example: Let s S 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 T . Consider s = to be completed. We show that


s 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 we
show 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 a
function, 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 the
same cardinality. We can use bijections to establish propositions which are simpler to work
with, and then use the propositions.

32.5 Finite Sets

We begin by proving two fundamental theorems about counting and sets for which you
probably already have an intuitive understanding but may never have proved.

Definition 32.5.1 Sets S and T are disjoint if S T = .


Disjoint
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 in
the room, and T is a set of n tables in the room, then the number of tables and chairs is
m + n.
Before we read a proof of the Cardinality of Disjoint Sets, it is important to keep two things
in mind. First, we are proving a statement about set cardinality, not a statement about
set equality. Second, to establish basic properties of set cardinality we must work with
bijections.
The intuitive idea underlying the proof is very simple. Count the first m elements in S, and
then continue counting the next n elements in T . As you will see, a formal proof is more
complicated. Note how closely the proof follows the structure described in the previous
section.

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-negative


integer m, and |S| = m.

2. Since T is a finite set, there exists a bijection g : T Nn for some non-negative


integer n, and |T | = n.

3. Construct a rule h : S T Nm+n as follows.



f (x) if x S
h(x) =
g(x) + m if x T

4. To show that h is a function, suppose there exist x S T and y1 , y2 Nm+n such


that h(x) = y1 and h(x) = y2 and y1 6= y2 . Because the sets S and T are disjoint, x
can 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. If
x 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 and
so 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 ). If


h(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.


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 |

Lets 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 is
similar.

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 drives
what we need to do. Sentence 3 constructs a rule h : S T Nm+n . How are we
going 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 signs
can be justified from the definition of N` or Sentences 1 and 2. The difficult part is
constructing h and then establishing that h is a bijection. Sentence 3 constructs a
mapping h : S T Nm+n as follows.

f (x) if x S
h(x) =
g(x) + m if x T

Notice that h is defined in terms of f and g. Note also that elements in the set S will
be mapped to the integers 1, 2, . . . , m and the elements in the set T will be mapped
to the integers m + 1, m + 2, . . . , m + n.
Having defined a mapping h, the author must still establish

h is a function
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 definition
of 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 of
surjective. 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 of
injective. 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 a
complicated mapping and then proving that it is a bijection. Thats sensible. What we can
do in this case is to use the Cardinality of Disjoint Sets by writing S T and T as the union
of disjoint sets.
Proof in Progress

1. S T = S (T S) where S and T S are disjoint sets. (Draw a Venn diagram to


make this clear.)

2. T = (S T ) (T S) where S T and T S are disjoint sets. (Draw a Venn diagram


to make this clear.)

3. To be completed.

But now that we have the unions of finite disjoint sets we can invoke the Cardinality of
Disjoint 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.


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. Take
a 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.
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 is
a 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 of
Intersecting 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
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|.

Lets be clear about what this proposition is saying. Even though the set of positive even
numbers is a proper subset of the set of natural numbers, and even though there are infinitely
many odd numbers excluded from the set even numbers, the cardinality of the sets of even
numbers and all natural numbers is the same!
How would we prove this? Two sets have the same cardinality if and only if there exists a
bijection between the two sets. So we can use the same proof structure that was used in
the 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 show
that 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 we
show 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 . . .

Lets 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 show
that 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 we
show that s1 = s2 to be completed.
5. Hence, f : N 2N is a bijection and |N| = |2N|.
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 is
a real shock to most people that the cardinality of the positive rational numbers and the
natural numbers is the same.

Proposition 3 (|Q>0 | = |N|)


Let n a o
Q>0 = a, b N, gcd(a, b) = 1

b
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 = 2i q where i is a non-negative integer
and 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 we
have 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) = 2a1 (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 equal
to a/b. Hence, t1 = f (a/b) = 2a1 (2b 1) = t2 , contradicting the assumption that
t1 6= t2 .
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 Natural


Numbers, t = 2i q 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 then
t = 20 (2b 1) and f (1/b) = t. If t is even then there exists a natural number a so
that t = 2a1 (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
2a1 (2b 1) = 2c1 (2d 1) (2a1 = 2c1 ) and (2b 1 = 2d 1)
(a = c) and (b = d)
a c
=
b 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 6 |(0, 1)|)


(|N| =
The set of natural numbers and the open interval (0, 1) of real numbers do not have the
same cardinality. That is, |N| =
6 |(0, 1)|

Proof: By way of contradiction, assume that |N| = |(0, 1)|. But then some bijection
f : N |(0, 1)| must exist. Write each element of |(0, 1)| as an infinite decimal and list all
of the real numbers in (0, 1) as follows.
f (1) = 0.a11 a12 a13 a14 . . .
f (2) = 0.a21 a22 a23 a24 . . .
f (3) = 0.a31 a32 a33 a34 . . .
..
.
f (n) = 0.an1 an2 an3 an4 . . .
..
.
Construct the real number c = 0.c1 c2 c3 c4 . . . as follows. For ci , choose any digit from
1, 2, 3, . . . , 8 with the property that ci 6= aii . The number c does not end in an infinite
sequence of 0s or 9s so has only one decimal representation (a subtlety that requires its
own explanation in another course). The real number c appears nowhere in the list since it
differs from f (i) in position i for every i.
But then f is not surjective, hence not bijective which contradicts our assumption.
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 another
infinite set?

Can there be infinite sets whose cardinality lies between that of other infinite sets of
distinct cardinalities?

How does one construct new infinite sets?

These are very interesting questions with even more interesting answers. Unfortunately, the
questions and answers will have to be left to another course.
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, or
bijection.

1. f : R R defined by f (x) = ex .
Solution: This function is not surjective. Consider the real number 1. Since
f (x) > 0 for all x R, there is no real number x0 so that f (x0 ) = 1. To show
that this function is injective, let x1 , x2 R and suppose that ex1 = ex2 . Taking the
natural log of both sides gives ln(ex1 ) = ln(ex2 ) which implies that x1 = x2 . Since f
is 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, +). Consider
x0 = ln y. Now x0 R and f (x0 ) = ex0 = eln y = y. To show that this function is
injective, let x1 , x2 R and suppose that ex1 = ex2 . Taking the natural log of both
sides gives ln(ex1 ) = ln(ex2 ) which implies that x1 = x2 . Since f is both surjective
and 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 Inverses
in Zp . To show that this function is surjective, let y Zp . Consider x0 = [3]1 y.
Now x0 Zp and f (x0 ) = [3]([3]1 y) = ([3][3]1 )y = y. To show that this function
is injective, let x1 , x2 Zp and suppose that [3]x1 = [3]x2 . Multiplying both sides
by [3]1 gives [3]1 ([3]x1 ) = [3]1 ([3]x2 ) which implies that x1 = x2 . Since f is both
surjective and injective, f is bijective.

237
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] for
i = 0, 1, 2, 3, 4, 5, 6, f is surjective. This function is not injective since 0 and 7 both
map 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 natural
number 2y1 has the y divisors 20 , 21 , 22 , . . . , 2y1 , f (2y1 ) = y so f is surjective.
This function is not injective since d(2) = d(3) = 2. Since f is not injective, it is not
bijective.

Example 2 Let S denote the set of all finite subsets of the natural numbers. Let D(n) denote the set of
all natural number divisors of n. Thus, D(12) = {1, 2, 3, 4, 6, 12}. Is the function f : N S
defined by D(n) a surjection?
Solution: D is not a surjection. Consider any set without the element 1, T = {2, 3} for
example. 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 a


bijection g : T U . By Proposition 5 in Section 31.2.4, g f : S U is a bijection from
S to U so |S| = |U |.
Part VI

Complex Numbers and Eulers


Formula

239
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 and
bones. Thus the natural numbers, N, were born. But it wouldnt be long before the
necessity of fractions became obvious. One animal to be shared by four people (we will
assume uniformly) meant that we had to develop the notion of 1/4. Though it would not
have 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 numbers
to include fractions, the rationals.
n a o
Q= a, b Z, b 6= 0

b
This is an overstatement historically, because recognition of zero and negative numbers
which are permitted in Q were very slow to come. But even these new numbers would not
help solve equations of the form
x2 = 2
which would arise naturally from isosceles right angled triangles. For this, the notion
of number had to be extended to include irrational numbers, which combined with the
rationals, give us the real numbers.

240
Section 35.3 Complex Numbers 241

Eventually, via Hindu and Islamic scholars, western mathematics began to recognize and
accept both zero and negative numbers. Otherwise, equations like

3x = 5x

or
2x + 4 = 0
have no solution. Thus, mathematicians recognized that

NZQR

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 A complex number z in standard form is an expression of the form x+yi where x, y R.
Complex Number 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 For a complex number z = x + yi, the real number x is called the real part and is written
Real Part, <(z) and the real number y is called the imaginary part and is written =(z).
Imaginary Part

So <(3 + 4i) = 3 and =(3 + 4i) = 4. If z is a complex number where =(z) = 0, we will treat
z as a real number and we will not write the term containing i. For example, z = 3 + 0i
will be treated as a real number and will be written z = 3. Thus

RC

and so
NZQRC

One has to wonder how much further the number system needs to be extended!

Definition 35.3.3 The complex numbers z = x + yi and w = u + vi are equal if and only if x = u and y = v.
Equality
242 Chapter 35 Complex Numbers

Definition 35.3.4 Addition is defined as


Addition
(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 is defined as


Multiplication
(a + bi) (c + di) = (ac bd) + (ad + cb)i

Example 3 Lets 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 their
strength. In the next example, note that the definition of multiplication coincides exactly
with 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. u2 v

5. u3
v
6. (write the solution in the form x + yi where x, y R)
u

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. u2 v = (3 + i)2 (2 7i) = (3 + i)((3 + i)(2 7i)) = (3 + i)(13 19i) = 58 44i


Section 35.3 Complex Numbers 243

5. u3 = (3 + i)3 = (3 + i)2 (3 + i) = (8 + 6i)(3 + i) = 18 + 26i

6.
v 2 7i 2 7i 3 i 1 23i 1 23
= = = = + i
u 3+i 3+i 3i 10 10 10

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 distributivity


that 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 z
with the property that z+(z) = 0. The additive inverse of z = x+yi is z = xyi.
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 inverse
of z, written z 1 , with the property that z z 1 = 1. The multiplicative inverse of
z = x + yi is z 1 = xxyi
2 +y 2 .

9. Distributivity: z (u + v) = z u + z v
244 Chapter 35 Complex Numbers

We will only prove the eighth property.

x yi
Proof: We only need to demonstrate that is well-defined and that
x2 + y 2
x yi
x + yi =1
x2 + y 2
x yi
Since z 6= 0, x2 + y 2 6= 0 and so is well-defined. Now we simply use complex
x2 + y 2
arithmetic.
x yi x2 + xy xy y 2 i2 x2 + y 2
x + yi 2 2
= 2 2
= 2 =1
x +y x +y x + y2
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


z 3 + 4i 3 + 4i 1 + 2i 5 + 10i
(b) = = = = 1 + 2i
u 1 2i 1 2i 1 + 2i 5
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 The complex conjugate of z = x + yi is the complex number


Conjugate
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
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 and
only if z = z.

Exercise 3 Let w and z be complex numbers in standard form. Prove that


 
1 1
=
w w

and hence z z


=
w w
248 Chapter 36 Properties Of Complex Numbers

Example 2 For z 6= i define


z+i
w=
zi
Prove 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
=
zi zi
z+i zi
=
zi z+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 The modulus of the complex number z = x + yi is the non-negative real number
Modulus p
|z| = |x + yi| = x2 + y 2

p
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 complex
numbers, but not compare the numbers themselves.
If =(z) = 0, then the modulus corresponds to the absolute values of real numbers.
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 = z 2 .


Solution: Let z = x + yi with x, y R. Then z = z 2 gives x yi = (x + yi)2 or
x yi = (x2 y 2 ) + 2xyi. Equating real and imaginary parts we have

x = x2 y 2
y = 2xy

From the second equation we get


1
2xy + y = 0 y(2x + 1) = 0 y = 0 or x =
2
If y = 0 then the first equation gives

x = x2 x2 x = 0 x(x 1) = 0 x = 0 or x = 1
1
If x = 2 then the first equation gives

1 1 2 2 3 3
= y y = y =
2 4 4 2
Thus, the solutions are
1 3 1 3
0, 1, + i, i
2 2 2 2
250 Chapter 36 Properties Of Complex Numbers

36.5 Practice

1. Let z be a complex number. Prove that |z|n = |z n | for any positive integer n.

2. Find all z C which satisfy

(a) z 2 + 2z + 1 = 0
(b) z 2 + 2z + 1 = 0
1+i
(c) z 2 = .
1i
1 1 1
3. Let a, b, c C. Prove: If |a| = |b| = |c| = 1, then a + b + c = + + .
a b c
z
4. Let z C, z 6= i. Prove that is real if and only if z is real or |z| = 1.
1 + z2
Chapter 37

Graphical Representations of
Complex 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 The notation z = x + yi suggests a non-algebraic representation. Each complex number
Complex Plane z = x + yi can be thought of as a point (x, y) in a plane with orthogonal axes. Label one
axis the real axis and the other axis the imaginary axis. The complex number z = x + yi
then corresponds to the point (x, y) in the plane. This interpretation of the plane is called
the complex plane or the Argand plane.

251
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
p
|z| = |x + yi| = x2 + y 2
There are a couple of geometric points to note about the modulus of z = x + yi. The
Pythagorean Theorem is enough to prove that |z| is the distance from the origin to z in
p complex plane, and that the distance between z and w = u + vi is just |z w| =
the
(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 with
complex numbers. Instead of beginning with the origin and two orthogonal axes, we begin
with 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 from
the polar axis, measured in radians, is .
Note that this allows for multiple representations since (r, ) identifies the same point as
(r, + 2k) for any integer k.
The obvious problem is how to go from one to the other.
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 determined
by
p
r = x2 + y 2
x
cos =
r
y
sin =
r
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 PolarCoordinates


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

as
z = r cos + ri sin = r(cos + i sin )
Section 37.4 Converting Between Representations 255

Definition 37.4.1 The polar form of a complex number z is


Polar Form
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

 
3 3
2. 1 + i = 2 cos + i sin
4 4

 
4 4
3. 1 3i = 2 cos + i sin
3 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 polar
form, then
z1 z2 = r1 r2 (cos(1 + 2 ) + i sin(1 + 2 ))

Example 3

   
3 3 4 4
2 cos + i sin 2 cos + i sin
4 4 3 3

    
3 4 3 4
= 2 2 cos + + i sin +
4 3 4 3

    
25 25
= 2 2 cos + i sin
12 12
   
= 2 2 cos + i sin
12 12

Proof:

z1 z2 = r1 (cos 1 + i sin 1 ) r2 (cos 2 + i sin 2 )


= r1 r2 ((cos 1 cos 2 sin 1 sin 2 ) + i(cos 1 sin 2 + sin 1 cos 2 ))
= r1 r2 (cos(1 + 2 ) + i sin(1 + 2 ))
Chapter 38

De Moivres Theorem

38.1 Objectives

The content objectives are:

1. State and prove De Moivres Theorem and do examples.

2. Derive Eulers Formula.

38.2 De Moivres Theorem

De Moivres Theorem dramatically simplifies exponentiation of complex numbers.

Theorem 1 (De Moivres Theorem (DMT))


If R and n Z, then

(cos + i sin )n = cos n + i sin n

Example 1 Consider the complex number


z = 1/ 2 + i/ 2
which, in polar form is
z = cos /4 + i sin /4
By De Moivres Theorem,

z 10 = (cos /4 + i sin /4)10 = cos 10/4 + i sin 10/4 = cos /2 + i sin /2 = i.

256
Section 38.2 De Moivres Theorem 257

Proof: We will prove DeMoivres Theorem using three cases.

1. n = 0

2. n > 0

3. n < 0

For the case n = 0, DeMoivres Theorem reduces to (cos + i sin )0 = cos 0 + i sin 0. By
convention z 0 = 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 = cos n + i sin n.

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 Mathematical
Induction.
Lastly, for the case n < 0 we will use complex arithmetic. Since n < 0, n = m for some
m N.

(cos + i sin )n = (cos + i sin )m


1
=
(cos + i sin )m
1
=
(cos m + i sin m)
= cos m i sin m
= cos(m) + i(sin(m))
= cos n + i sin n
258 Chapter 38 De Moivres Theorem

Corollary 2 If z = r(cos + i sin ) and n is an integer,

z n = rn (cos n + i sin n)

38.3 Complex Exponentials

If you were asked to find a real-valued function y with the property that
dy
= ky and y = 1 when x = 0
dx
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 as
any other constant you would almost certainly write
df ()
= sin + i cos
d
but then
df ()
= sin + i cos = i(cos + i sin ) = if ()
d
and so
df ()
= if () and f () = 1 when = 0
d

Definition 38.3.1 By analogy, we define the complex exponential function by


Complex
Exponential ei = cos + i sin

As an exercise, prove the following.

Proposition 3 (Properties of Complex Exponentials (PCE))

ei ei = ei(+)
 n
ei = 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.


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 is
ei + 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 in
standard form.

(a) Use the Binomial Theorem.


(b) Use De Moivres Theorem.

Solution:
(a) Using the Binomial Theorem we have
4  
4
X 4 4r r
( 3 + y) = ( 3) i
r=0
r
4 40 0 4 41 1 4 42 2 4 43 3 4 44 4
         
= ( 3) i + ( 3) i + ( 3) i + ( 3) i + ( 3) i
0 1 2 3 4

= 9 + 4 3 3i 6 3 4i 3 + 1

= 8 + 8 3i

(b) Using De
q Moivres Theorem we have First, write 3 + i in polar form. The modulus
2
is r = 3 + 12 = 2. An argument is 6 . Thus, 3 + i = 2(cos 6 + i sin 6 ). By De
Moivres Theorem
 
  4 4 4 4
2 cos + i sin = 2 cos + i sin
6 6 6 6
 
2 2
= 16 cos + i sin
3 3
!
1 3i
= 16 +
2 2

= 8 + 8 3i

38.5 Practice

1. Compute ( 3 3i)4 twice: once using the Binomial Theorem and once using De
Moivres Theorem. Write your answer in standard form.
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 If a is a complex number, then the complex numbers that solve
Complex Roots
zn = a

are called the complex n-th roots. De Moivres Theorem gives us a straightforward way
to 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 z n = a
are

    
n
+ 2k + 2k
r cos + i sin for k = 0, 1, 2, . . . , n 1
n n


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
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 polar
form as
16 = 16(cos + i sin )
Using the Complex n-th Roots Theorem the solutions are

    
4 + 2k + 2k
16 cos + i sin for k = 0, 1, 2, 3
4 4
    
k k
= 2 cos + + i sin + for k = 0, 1, 2, 3
4 2 4 2

The four distinct roots are given below



     
 1 i
When k = 0, z0 = 2 cos + i sin =2 + = 2+i 2
4 4 2 2

      
3 3 1 i
When k = 1, z1 = 2 cos + i sin =2 + = 2+i 2
4 4 2 2

      
5 5 1 i
When k = 2, z2 = 2 cos + i sin =2 + = 2i 2
4 4 2 2

      
7 7 1 i
When k = 3, z3 = 2 cos + i sin =2 + = 2i 2
4 4 2 2

Graphing these solutions is illuminating.

Figure 39.2.1: The Fourth Roots of -16


4
Note that the solutions are uniformly distributed around a circle whose radius is 16.
262 Chapter 39 Roots of Complex Numbers

Proof: As usual, when showing that a complete solution exists we work with two sets: the
set S of solutions and the set T of specific representation of the solution. We then show
that S = T by mutual inclusion. Our two sets are

S = {z C | z n = a}

and

      
n
+ 2k + 2k
k = 0, 1, 2, . . . , n 1
T = r cos + i sin
n n

where a = r(cos + i sin ).



 
+ 2k
We begin by showing that T S. Let t = n
r cos be an element of T . Now
n

n + 2k n

n
t = n r cos
n
= r(cos( + 2k) + i sin( + 2k)) De Moivres Theorem
= r(cos + i sin ) trigonometry
=a

Hence, t is a solution of z n = 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 (cos n + i sin n) = r(cos + i sin ) De Moivres Theorem

Now two complex numbers in polar form are equal if and only if their moduli are equal and
their arguments differ by an integer multiple of 2. So

sn = r s = n r

and
+ 2k
n = 2k =
n
where k Z. Hence, the n-th roots of a are of the form

    
n
+ 2k + 2k
r cos + i sin for k Z
n n

But this is k Z, not k = 0, 1, 2, . . . , n 1. Since w is an n-th root of a, there exists an


integer k0 so that

    
+ 2k0 + 2k0
w = n r cos + i sin
n n

If we can show that



    
n
+ 2k1 + 2k1
w= r cos + i sin
n n
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
2k0 2k1 = 2n` for some ` Z
2k0 2k1
= 2` for some ` Z
n n
+ 2k0 + 2k1
= 2` for some ` Z
n n

Exercise 1 An n-th root of unity is a complex number that solves z n = 1. Find all of the sixth roots
of 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 complex
plane.

39.3 Practice

1. Find all of the cube roots of unity. Write them in standard form and plot the solutions
in the complex plane.

2. A complex number z is called a primitive n-th root of unity if z n = 1 and z k 6= 1 for


all 1 k n 1.

(a) For each n = 1, 2, 3, 6, list all the primitive n-th roots of unity. (You may express
your 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, z k = 1 if and only if n | k.
ii. For any m Z, if gcd(m, n) = 1, then z m 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.
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 so
we use De Moivres Theorem. The polar form of 1 + 3i is

z = 2(cos 5/3 + i sin 3/3)

By De Moivres 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
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 form
as
i = cos /2 + i sin /2
Using the Complex n-th Roots Theorem the solutions are
   
2 + 2k 2 + 2k
cos + i sin for k = 0, 1, 2
3 3
   
+ 4k + 4k
= cos + i sin for k = 0, 1, 2
6 6

The three distinct roots are given below.


   
3 i
When k = 0, z0 = cos + i sin = +
6 6 2 2
   
5 5 3 i
When k = 1, z1 = cos + i sin = +
6 6 2 2
   
3 3
When k = 2, z2 = cos + i sin = i
2 2

Example 3 Find all z C which satisfy z 2 + 2z + 1 = 0.


Solution: Let z = x + yi where x, y R. Then

z 2 + 2z + 1 = 0 (x2 y 2 + 2xyi) + 2(x yi) + 1 = 0

or
(x2 y 2 + 2x + 1) + (2xy 2y)i = 0
Equating real and imaginary parts we have

x2 y 2 + 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 y 2 + 2 + 1 = 0 y 2 = 4 y = 2

Thus, the solutions are


1, 1 + 2i, 1 2i
Part VII

Factoring Polynomials

266
Chapter 41

An Introduction to Polynomials

41.1 Objectives

The content objectives are:

1. Define polynomial, coefficient, F[x], degree, zero polynomial, linear polynomial, quadratic
polynomial, 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

a2 x2 + a1 x + a0 = 0

or
xn 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 complex
numbers C and the integers modulo a prime p, Zp , are all fields. The integers are not a field
because we cannot divide 2 by 4 and get an integer. Since division is just multiplication by
an inverse, Z6 is not a field since [3] has no inverse.

267
268 Chapter 41 An Introduction to Polynomials

Definition 41.2.1 A polynomial in x over the field F is an expression of the form


Polynomial
an xn + an1 xn1 + + a1 x + 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 with
coefficients 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 If an 6= 0 in the polynomial


Degree et al
an xn + an1 xn1 + + a1 x + a0

then the polynomial is said to have degree n. The zero polynomial has all of its coefficients
zero 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


n
X
f (x) = an xn + an1 xn1 + + a1 x + a0 = ai xi
i=0

Let f (x), g(x) F[x] where


n
X
n n1
f (x) = an x + an1 x + + a1 x + a0 = ai xi
i=0
n
X
g(x) = bn xn + bn1 xn1 + + b1 x + b0 = bi xi
i=0

Definition 41.3.1 The polynomials f (x) and g(x) are equal if and only if ai = bi for all i.
Equal

Polynomials can be added, subtracted and multiplied as algebraic expressions exactly as


you have done in high school.
Section 41.3 Operations on Polynomials 269

Definition 41.3.2 The sum of the polynomials f (x) and g(x) is defined as
Sum
max(n,m)
X
f (x) + g(x) = (ai + bi )xi
i=0

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 then


f (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) then


f (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] then
f (x) + g(x) = [3]x5 + [2]x4 + [2]x2 + [3].

Definition 41.3.3 The difference of the polynomials f (x) and g(x) is defined as
Difference
max(n,m)
X
f (x) g(x) = (ai bi )xi
i=0

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 The product of the polynomials f (x) and g(x) is defined as
Product
m+n
X
f (x) g(x) = ci xi
i=0

where
i
X
ci = a0 bi + a1 bi1 + + ai1 b1 + ai b0 = aj bij
j=0

Though the definition of multiplication looks complicated, it is just collecting all of the
terms xi that we would get through long multiplication.
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 product
gives 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) = iz 2 + (3 i)z + 2i and
g(z) = iz + (2 2i).

Now we run into the same issue we had with the integers, division. Though it makes sense
to say that x 3 divides x2 9 since x2 9 = (x 3)(x + 3), what do we do when there is a
remainder? Just as we had a division algorithm for integers, we have a division algorithm
for 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 there
exist 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 The polynomial q(x) is called the quotient polynomial. The polynomial r(x) is called the
Quotient, remainder polynomial. If r(x) = 0, we say that g(x) divides f (x) or f (x) is a factor
Remainder of g(x) and we write g(x) | f (x).

How do we find the quotient and remainder polynomials? Long division.


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 is
divided by g(x) = x2 + 1 in R[x]?
Before we begin, we would expect from the Division Algorithm for Polynomials a remainder
polynomial of degree at most one.

3x2 + x 7
x2 + 1 3x4 + x3 4x2 x + 5
3x4 + 3x2
x3 7x2 x
x3 + x
2
7x 2x + 5
7x2 7
2x + 12

Thus, the quotient polynomial is q(x) = 3x2 + x 7 and the remainder polynomial is
r(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 when
f (z) = iz 3 + (2 + 4i)z 2 + (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) iz 3 + (2 + 4i)z 2 + (3 i)z + (40 4i)
iz 3 + (2 2i)z 2
6iz 2 + (3 i)z
6iz 2 + (12 12i)z
(9 + 11i)z + (40 4i)
(9 + 11i)z + (40 4i)
0

Thus, the quotient polynomial is q(z) = z 2 +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 polynomials
f (z) = iz 3 + z 2 (1 + i)z + 10 and g(z) = z + 2i.
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 A polynomial equation is an equation of the form


Polynomial Equation
an xn + an1 xn1 + + a1 x + a0 = 0

which will often be written as f (x) = 0. An element c F is called a root or zero of the
polynomial 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 arbitrary
polynomial. We can now prove that no such algorithm exists. It is known though, that a
root 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
Section 42.2 Polynomial Equations 273

Ironically, we can prove a root exists, we just cant construct one in general. The proof
of this fact and the Fundamental Theorem of Algebra are both demanding and are left for
later 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 there
exist 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) = 3z 12 8iz 5 + (4 + i)z 2 + z + 2 3i is divided by z + i.


Solution: One could do the painful thing and carry out long division. Another possibility
is 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 as
r0 . 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,
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 of
the 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 written
as 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. There
are no formulas for roots if the polynomial has degree five or more. But if the polynomial
has integer coefficients, we have a good starting point.

Theorem 7 (Rational Roots Theorem (RRT))


Let f (x) = an xn +an1 xn1 + +a2 x2 +a1 x+a0 be a polynomial with integer coefficients.
p
If is a rational root with gcd(p, q) = 1, then p | a0 and q | an .
q

In order to find a rational root of f (x), we only need to examine a finite set of rational
numbers, those whose numerator divides the constant term and those whose denominator
divides the leading coefficient. Note that the theorem only suggests those rational numbers
that 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. The
divisors of 3 are 1 and 3. Hence, the candidates for rational roots are
1 3
1, , 3,
2 2
Now test each of these candidates.
1 1 3 3
x 1 1 2 2 3 3 2 2
25 51 3
f (x) 12 2 4 0 210 120 2 4

1
Thus, the only rational root is .
2
Section 42.2 Polynomial Equations 275

p
Proof: If is a root of f (x) then
q
 n  n1  2  
p p p p
an + an1 + + a2 + a1 + a0 = 0
q q q q

Multiplying by q n gives

an pn + an1 pn1 q + + a2 p2 q n2 + a1 pq n1 + a0 q n = 0

and
an pn = q an1 pn1 + + a2 p2 q n3 + a1 pq n2 + a0 q n1


Since all of the symbols in this equation are integers, both the right hand side and left hand
side are integers. Since q divides the the right hand side, q divides the left hand side, that
is
q | an p n
Since gcd(p, q) = 1 we can repeatedly use the proposition on Coprimeness and Divisibility
to 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 a
positive 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 root
of a real polynomial, you get another one for free.

Theorem 8 (Conjugate Roots Theorem (CJRT))


Let f (x) = an xn + an1 xn1 + + a0 be a polynomial with real coefficients. If c C is a
root 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 Roots
Theorem. 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 + 1
yields x2 x 6 which factors as (x 3)(x + 2). Thus

f (x) = (x i)(x + i)(x 3)(x + 2)


276 Chapter 42 Factoring Polynomials

Proof: Since c is a root of f (x)

an cn + an1 cn1 + + a1 c + a0 = 0

Taking the complex conjugate of both sides gives

an cn + an1 cn1 + + a1 c + a0 = 0

and using the properties of conjugates

an cn + an1 cn1 + + a1 c + a0 = 0

Since a = a whenever a is real, we now have

an cn + an1 cn1 + + 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 of
real 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) = an xn + an1 xn1 + + 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 also
a 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) = an xn + an1 xn1 + + 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 Quadratic
Factors). Since real and not real roots exhaust all possible choices of roots, real linear and
real quadratic factors exhaust all possible types of factors.
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 polynomial
of 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 Conjugate
Roots
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 linear
factors 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 Conjugate
Roots Theorem for complex roots. The only root not in R is 2i so we need to pair this

277
Chapter 43 Practice, Practice, Practice:
278 Polynomials

root with its conjugate 2i. The product of the corresponding factors will produce a
real 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 degree
as small as possible over F[x]. Cite appropriate propositions to justify each step of your
reasoning.

1. f (x) = x2 x 6 Q[x]
Solution: The quadratic formula gives the roots 3 and 2. These are values in Q so
there 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. Since
complex numbers do not belong to Q there are no linear factors in Q[x], hence
f (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 Roots
Theorem. The divisors of a0 are {1, 2} and the divisors of an are {1, 2} so the
only candidates for rational roots are
1
1, 2,
2
Now test each of these candidates.
1 1
x 1 1 2 2 2 2

f (x) 3 5 10 30 5/2 0
Section 43.2 Worked Examples 279

Long division produces


f (x) = (2x + 1)(x2 2x + 2)
The quadratic formula gives two complex roots for x2 2x + 2 so the quadratic does
not factor any further.

5. f (x) = z 4 + 27z C[x]


Solution: Since f (z) is a complex polynomial of degree four, it will have four linear
factors. Now f (z) = z(z 3 + 27). Factoring z 3 + 27 can be done with the aid of the
Complex n-th Roots Theorem applied to z 3 = 27. First, we write 27 in polar form
as
27 = 27(cos + i sin )
Using the Complex n-th Roots Theorem the solutions are

    
3 + 2k + 2k
27 cos + i sin for k = 0, 1, 2
3 3
    
2k 2k
= 3 cos + + i sin + for k = 0, 1, 2
3 3 3 3

The three distinct roots are given below


    !
 1 3 3 3 3
When k = 0, z0 = 3 cos + i sin =3 + i = + i
3 3 2 2 2 2
When k = 1, z1 = 3 (cos + i sin ) = 3
     !
5 5 1 3 3 3 3
When k = 2, z2 = 3 cos + i sin =3 + i = i
3 3 2 2 2 2

Thus,
!! !!
3 3 3 3 3 3
f (x) = x(x + 3) x + i x i
2 2 2 2
Chapter 44

Practice, Practice, Practice:


Course Review

44.1 Objectives

This chapter provides some suggestions on starting a proof and provides an opportunity to
practice using problems from throughout the course.
In all cases, justify your work by citing appropriate definitions and propositions.
[Incomplete: This chapter continues on the next page. At this point of the
development of the notes, this chapter is incomplete and does not yet cover the
whole course.]

280
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 the
contrapositive or proceeding by contradiction. To use the contrapositive, prove
the 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 by
elimination 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 hypothesis
is true. Show that the conclusion is true.
3. Unless you are using induction or Direct Proof, the statement you are trying to prove
will have been re-stated. Make sure that you identify the new hypothesis and the new
conclusion.
4. Structure your proof around quantifiers and sets. Remember that quantifiers may
be implicit, that there may be quantifiers in the hypothesis and conclusion, and that
quantifiers may be nested, so several of the techniques below may appear in the same
proof. 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 element
s 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? Working
backwards from the conclusion narrows the set of possibilities to examine.
What mathematical fact can I deduce from what I already know? Working
forwards from the hypothesis allows you to generate a range of possible paths
towards the conclusion.
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 y 2 , 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 a
proof.
(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 0 so that zz 0 = 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.
Section 44.3 Exercises 283

(i) S: For every integer n and every integer k, 0 k n,


   
n n+1
=
k 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 n
=
k 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 + . . . + wn1 = 0

(d) If integers a and b are coprime, then the integers ab and a + b are coprime.
Part VIII

Finding the Shortest Path

284
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) on
a co-op work term and you want to escape the intense July heat by going to Sibbald Point
Provincial 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, and
then take a minor road to Highway 48 and go north from there. But perhaps it would be
better 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 downtown
Toronto and Sibbald Point Provincial Park.

285
286 Chapter 45 The Shortest Path Problem

Figure 45.2.1: Sibbald Point Provincial Park


Section 45.3 Abstraction 287

45.3 Abstraction

Lets focus on whats important in the problem. Looking at the map there is, for our
purpose, lots of information that is not important: colours, parking locations, where the
Green Belt is, towns not along the way. What is really important are locations where we
might change directions, routes between those locations, and distances. Well highlight
important locations on the map as grey dots and connections between locations as solid
teal lines. See Figure 45.3.1.

Figure 45.3.1: Locations and Connections


288 Chapter 45 The Shortest Path Problem

But since we dont need the rest of the detail, lets omit it and include only locations,
connections and distances. See Figure 45.3.2.

20

45

15

120

60
60

10

10
10 10 30
5
20

25

Figure 45.3.2: The Essentials

45.4 Algorithm

Draw a random map and attempt to discover an algorithm that will find the shortest route
from one location to another. Compare your algorithm to those created by others. Which
algorithms work? Which algorithms are efficient?

45.5 Extensions

This problem is set as minimal distances between two points. But perhaps instead of
distance we could use time or cost. And instead of a person travelling we could have
couriers delivering packages, or electrical signals carrying phone calls. In fact, there are
surprising uses as well including managing cutting stock in steel mills and finding optimal
schedules for construction projects.
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 A graph G is a pair (V, E) where V is a finite, nonempty set, and E is a set of unordered
Graph pairs of elements of V . The elements of V are called vertices and the elements of E called
edges.

It is often very useful to represent a graph as a drawing where vertices correspond to points
and edges correspond to lines between vertices. Graphs may be represented by more than
one diagram as illustrated in Example 1.

289
290 Chapter 46 Paths, Walks, Cycles and Trees

Example 1 Let G = (V, E) where


V = {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}} .

7
1 2

6 7 3
1 2 3 4 5 6

5 4

Figure 46.2.1: Two representations of the same graph

Definition 46.2.2 If edge e = {u, v}, then we say that u and v are adjacent vertices, and that edge e is
Adjacent, Incident incident with vertices u and v. We can also say that the edge e joins u and v. Vertices
adjacent to a vertex u are called neighbours of u.

A graph is completely specified by the pairs of vertices that are adjacent, and the only
function of a line in the diagram is to indicate that two vertices are adjacent.

Definition 46.2.3 A walk W is a non-empty sequence of edges


Walk
W = {{v0 , v1 }, {v1 , v2 }, {v2 , v3 }, . . . , {vn1 , vn }} .

Since vi1 and vi uniquely determine an edge e of a walk, we will usually just list the
vertices. Thus
W = v0 , v1 , v2 , v3 , . . . , vn1 , vn .

Definition 46.2.4 If v0 = s and vn = t in the walk W , we call W an st-walk. If no vertex in the walk is
Path repeated, that is, if v0 , v1 , v2 , . . . , vn are all distinct, then W is called a path.

Definition 46.2.5 If v0 = vn and v0 , v1 , v2 , . . . , vn1 are all distinct, then W is called a cycle.
Cycle
Section 46.2 The Basics 291

1 2

6 7 3

5 4

Figure 46.2.2: The bold lines indicate the walk W = 1, 6, 7, 3, 4, 7, 3, 2.

1 2

6 7 3

5 4

Figure 46.2.3: The bold lines indicate the path P = 1, 6, 7, 3, 2

1 2

6 7 3

5 4

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, 2


and the cycle C = 7, 3, 4, 7. In fact, we can always perform this kind of decomposition for
walks but before we state the appropriate theorem, we need to define a few more terms.

Definition 46.2.6 By a collection we mean a family of objects where repetition is allowed. Let W be an
Collection, st-walk. If s = t, we say that W can be decomposed into a collection C of cycles if, for
Decomposed every edge e the number of times e occurs in W is the same as the number of times e occurs
in cycles of C. If s 6= t, we say that W can be decomposed into an st-path P and a
collection C of cycles if, for every edge e the number of times e occurs in W is the same as
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 a


non-empty collection of cycles.

You may wonder what the difference is between the definition of decomposition and the
proposition Walk Decomposition. The definition allows for the possibility that some walks
cannot be decomposed. The proposition states that all walks can be decomposed.

Definition 46.2.7 To say that a graph G is connected means that there is a path between any two vertices of
Connected G. 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 A tree is a connected graph with no cycles.


Tree

1 2

6 7 3

5 4

Figure 46.3.1: A tree

We will prove several propositions about trees starting with this one.
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 lets first restate it. Recall that
the hypothesis is what we get to start with, and the conclusion is what we must show. We
start with a tree. Call it T . We must show that there is a unique path between every pair
of 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, its time
for a different technique, proof by contradiction. Normally, when we wish to prove that the
statement A implies B is true, we assume that A is true and show that B is true. What
would happen if B were true, but we assumed it was false and continued our reasoning
based on the assumption that B was false? Since a mathematical statement cannot be both
true and false, it seems likely we would eventually encounter a mathematically non-sensical
statement. Then we would ask ourselves How did we arrive at this nonsense? and the
answer 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 , . . . , xn1 , v and
P2 = u, y1 , y2 , . . . , ym1 , 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 , ym1 , ym2 , ym3 , . . . , y1 , u.

5. By Part (1) of Proposition 1, W can be decomposed into a non-empty collection of


cycles.
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. Lets first identify the compo-
nents of the universal quantifier.
Quantifier:
Variable: vertices u and v
Domain: vertices of the tree T
Open sentence: There is a unique path between u and v.
Since we are using a universal quantifier in the conclusion of the proposition, the
author 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 show
that a path exists.

Sentence 3 Now suppose that there are two distinct uv-paths, P1 = u, x1 , x2 , . . . , xn1 , v
and P2 = u, y1 , y2 , . . . , ym1 , v.
The author is negating the conclusion and so is going to use one of two techniques,
Contradiction or Contrapositive. Since the author hasnt indicated which, it is useful
to look ahead in the proof to find out. The last sentence of the proof makes it clear
that 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 , ym1 , ym2 , ym3 , . . . , 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 Sentence
4 the author constructs a walk and in Sentence 5 the author shows that the walk
contains cycles. But cycles dont 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.


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 Let G be a graph. The number of edges incident with a vertex v is called the degree of v
Degree and 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 = w0 w1 w2 . . . 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 so
u 6= v.

3. Thus, the vertex wn1 in the path is adjacent to v but distinct from v.

295
296 Chapter 47 Trees

s i

f b
e

d
c

Figure 47.2.1: Graph corresponding to Toronto - Sibbald Point map

4. If deg(v) > 1, there must be another vertex, w, distinct from wn1 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 in
P.

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.
Section 47.2 Properties of Trees 297

Sentence 1 Find a longest path P = w0 w1 w2 . . . wn in T , say between nodes u = w0 and


v = wn .
The conclusion contains an existential quantifier, has. Lets first identify the compo-
nents of the existential quantifier.
Quantifier:
Variable: Two vertices (unnamed)
Domain: Vertices of the tree T
Open sentence: Both vertices have degree 1.
Since the proposition contains an existential quantifier in the conclusion, the author
uses the Construct Method. This sentence serves two purposes. First, it implicitly
identifies the two objects that will be constructed, u and v. And second, it sets up
the contradictions that will be needed later.

Sentence 2 Since any edge in the tree constitutes a path, P must contain at least one edge
so 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 require
that the path contain an edge.

Sentence 3 Thus, the vertex wn1 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 how
that contradiction will be displayed.

Sentence 4 If deg(v) > 1, there must be another vertex, w, distinct from wn1 and adja-
cent to to v.
From the analysis of the first sentence, the author intends to show that v has degree
one. 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, w
is not in P .
This is a miniature proof by contradiction of the statement If deg(v) > 1 and w
is adjacent to v, then w is not in P . Sentence 5 begins with the negation of the
conclusion and finds a contradiction quickly. If w is in P , then the walk constructed
by 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 than
P , contradicting the assumption that P is a longest path in T .
This is another miniature proof by contradiction, this time of the statement If
deg(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 in
P , a contradiction. Since the authors reasoning is correct, it must be the case that
the assumption deg(v) > 1 is false. Since T is connected, deg(v) > 0 so deg(v) = 1.
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 the
conditions are not similar, the use of similarly could be masking a fatal error.
In this case, the argument is identical when w1 replaces wn1 .

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 vertices
and so on, this seems like a perfect case for induction. Lets be very clear about what our
statement 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 degree
one in T . Lets 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 0 where T 0 has
k 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 0 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 Mathematical
Induction.
Chapter 48

Dijkstras Algorithm

48.1 Objectives

The content objectives are:

1. Be able to execute Dijkstras Algorithm.

48.2 Dijkstras Algorithm

Lets look at a formal expression for solving the shortest path problem.

Algorithm 2 Dikstras Algorithm


Require: G = (V, E); w : E R; w({u, v}) 0, {u, v} E; and a designated node s.
Ensure: T 0 = (V 0 , E 0 ) 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) 0
d(v) , v V, v 6= s
V 0 {s}
E0
T 0 (V 0 , E 0 )
repeat
for every edge {u, v} E where u V 0 and v 6 V 0 do
if d(v) < d(u) + w({u, v}) then
d(v) d(u) + w({u, v})
end if
end for
Choose a y 6 V 0 so that d(y) = min{d(w) | w 6 V 0 }
For the y just chosen, choose {x, y} E where x V 0 and d(y) = d(x) + w({x, y})
V 0 V 0 {y}
E 0 E 0 {{x, y}}
T 0 (V 0 , E 0 )
until V = V 0

299
300 Chapter 48 Dijkstras Algorithm

We can think of the Require statement as the pre-conditions to the algorithm, or the
hypothesis to a proposition. In this case, we require a graph with non-negative weights on
the 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 algorithm
should terminate with a tree of shortest paths rooted at s, and the distances of a shortest
path from s to each node.
Though our original problem talked about distances, the values we assign to the edges of
the graph could also be time or capacity or costs. The convention is to call these values
weights, which is why the function from the edges to the real numbers is named w.
Lets watch the algorithm in operation. Our example appears in Figure 48.2.1.

3
s a

1
9 2

b c
3

4 1

Figure 48.2.1: Graph G with weights

The initialization steps of the algorithm set the distance to s at 0, and the provisional
distances to all other vertices at infinity. By abuse of notation, we will treat infinity as a
real number. We will record distances as numeric labels in blue near the vertices. The set
V 0 initially contains only s and E 0 is empty. We will show the nodes in V 0 as bold circles
and the edges in E 0 as bold lines. Note that at every stage of the algorithm, T 0 = (V 0 , E 0 )
is a tree of shortest paths to the vertices in V 0 . See Figure 48.2.2

0
3
s a

1
9 2

b c
3

4 1

Figure 48.2.2: After initialization

Now the algorithm examines each edge with one vertex in V 0 and one vertex not in V 0 . If
using the edge creates a shorter path to a vertex not in V 0 , then the provisional distance to
Section 48.2 Dijkstras Algorithm 301

that vertex is updated. Figure 48.2.3 shows the results of the update. Edges and distances
involved in the updates are shown in green. The infinite values previously assigned to
vertices a, b and c have been crossed out.

0
3
s a 3

1
9 2

1 b c 9
3

4 1

Figure 48.2.3: First update of d

Continuing with the update, choose the vertex not in V 0 with the smallest provisional
distance. In this iteration, the choice is b. Add b to V 0 and {s, b} to E 0 . This update is
shown in Figure 48.2.4. The nodes in V 0 are shown as bold circles and the edges in E 0 as
bold lines. Note that T 0 = (V 0 , E 0 ) is a tree of shortest paths to the vertices in V 0 .

0 3
3
s a

1
9 2

1 b c 9
3

4 1

Figure 48.2.4: End of first iteration

We repeat this until V = V 0 . Since V = {s, a, b, c, d} and V 0 = {s, b}, V 6= V 0 and so we


continue. Again, the algorithm examines each edge with one vertex in V 0 and one vertex
not in V 0 . If using the edge creates a shorter path to a vertex in V 0 , then the provisional
distance to that vertex is updated. Figure 48.2.5 shows the results of the update. Edges
and distances involved in the updates are shown in green.
Now choose the vertex not in V 0 with the smallest provisional distance. In this iteration,
the choice is a. Add a to V 0 and {s, a} to E 0 . This update is shown in Figure 48.2.6. The
nodes in V 0 are shown as bold circles and the edges in E 0 as bold lines. Again, note that
T 0 = (V 0 , E 0 ) is a tree of shortest paths to the vertices in V 0 .
We repeat this until V = V 0 . Since V = {s, a, b, c, d} and V 0 = {s, a, b}, V 6= V 0 and so we
302 Chapter 48 Dijkstras Algorithm

0 3
3
s a

1
9 2

1 b c 94
3

4 1

Figure 48.2.5: Second update of d

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
5

Figure 48.2.6: End of second iteration

continue. Again, the algorithm examines each edge with one vertex in V 0 and one vertex
not in V 0 . If using the edge creates a shorter path to a vertex in V 0 , then the provisional
distance to that vertex is updated. In this iteration, no updates to provisional distances
took place. Figure 48.2.7 shows the results of the update. Edges and distances involved in
the updates are shown in green.

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
5

Figure 48.2.7: Third update of d


Section 48.2 Dijkstras Algorithm 303

Now choose the vertex not in V 0 with the smallest provisional distance. In this iteration,
the choice is c. Add c to V 0 and {b, c} to E 0 . This update is shown in Figure 48.2.8. Again,
note that T 0 = (V 0 , E 0 ) is a tree of shortest paths to the vertices in V 0 .

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
5

Figure 48.2.8: End of third iteration

We repeat this until V = V 0 . Since V = {s, a, b, c, d} and V 0 = {s, a, b, c}, V 6= V 0 and so


we continue. Again, the algorithm examines each edge with one vertex in V 0 and one vertex
not in V 0 . If using the edge creates a shorter path to a vertex in V 0 , then the provisional
distance to that vertex is updated. Figure 48.2.9 shows the results of the update.

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
5

Figure 48.2.9: Fourth update of d

Now choose the vertex not in V 0 with the smallest provisional distance. In this iteration,
the choice is d. Add d to V 0 . But now both and {b, d} and {c, d} match the condition to be
added to E 0 . Which one should be added or should both be added? It is only necessary to
choose one, say {b, d}. This update is shown in Figure 49.3.1. Again, note that T 0 = (V 0 , E 0 )
is a tree of shortest paths to the vertices in V 0 .
Now, finally V = V 0 and the algorithm terminates.
304 Chapter 48 Dijkstras Algorithm

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
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 Dijkstras algorithm on your
graph.

48.3 Certificate of Optimality

Based on our experiments when we began this section, the example we did together, and
your own examples, it seems that we have lots of empirical evidence that Dijkstras algorithm
works. 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 certificate
of optimality. Simply running the algorithm again might reproduce an existing error in the
computer program that runs the algorithm.
Lets 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 wont prove that Dijkstras 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 certify
that the output of Dijkstras algorithm is, in fact, correct.
Lets look at the algorithm more closely. Would we expect the algorithm to always produce
a tree? That is, is T 0 = (V 0 , E 0 ) a tree in every iteration? If there is some iteration where
a cycle is produced the T 0 is not a tree, and the end product will not be a tree because the
algorithm only adds edges. The algorithm never deletes edges.
The algorithm will have |V |1 iterations because we add a vertex to V 0 at each iteration and
V 0 begins with s. We also add an edge at each iteration so we end up with |V 0 | = |E 0 | + 1.
The proposition Number Of Vertices In A Tree is suggestive but not conclusive. It says
that for a tree T = (V, E), |V | = |E| + 1. It does not say that |V | = |E| + 1 implies that
the graph (V, E) is a tree.
Lets consider the construction of T 0 . A tree is defined as a connected graph with no cycles
so lets ask ourselves Can the algorithm create a cycle in T 0 ? Suppose that it did and the
Section 48.3 Certificate of Optimality 305

cycle occurred when the edge {u, v} was added. That means both u and v already had to
exist in V 0 , but the edge that is added always contains a vertex not in V 0 . Hence, no cycles
exist in T 0 . As for connectedness, this makes sense since, at each iteration an edge is added
to an already connected graph constructed in the previous iteration.
More problematic is guaranteeing that T 0 is a tree of shortest paths.
Lets look at d more closely. Suppose {u, v} E 0 and the path in E 0 from s encounters u
before it encounters v. Then d(u) = d(v) + w({u, v}). That is not a surprise. That is how
the algorithm adds edges to E 0 . Now look at the exercise that you just completed. Examine
any 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.
Chapter 49

Certificate of Optimality - Path

49.1 Objectives

The content objectives are:

1. Define weight, distance potentials, feasible distance potentials, equality edges and tree
of 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 hypothesis
of 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 Dijkstras
algorithm. 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
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 suppose
that w({u, v}) 0, for every edge of E.

Definition 49.3.1 Let W = v0 v1 v2 . . . vn be a walk in G. We define the weight of W to be the sum of the
Weight of a Walk weights of all arcs in W . If the edge {u, v} occurs more than once in W , its weight is
counted for each occurrence in W . More formally,
n1
X
w(W ) = w({vi , vi+1 })
i=0

We have been using this definition implicitly. The distance of a trip from downtown Toronto
to Sibbald Point Provincial Park is the sum of the distances of each part of the trip.
Dijkstras 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-walk
with 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 P


and a collection of cycles C1 , C2 , . . . , Cr .
2. Now
r
X
w(W ) = w(P ) + w(Ci ).
i=1

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 and
the conclusion.

Hypothesis: G = (V, E) is a connected graph with non-negative real weights. W is


an 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 P


and a collection of cycles C1 , C2 , . . . , Cr .
The conclusion contains an existential quantifier so the author uses the Construct
Method. Lets first identify the components of the existential quantifier.
308 Chapter 49 Certificate of Optimality - Path

Quantifier:
Variable: A path P
Domain: 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 Walk
Decomposition. The author will now show that w(P ) w(W ).

Sentence 2 Now
r
X
w(W ) = w(P ) + w(Ci ).
i=1

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-negative
real 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-walk
with 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, in
fact, create negative cost edges in models.

Definition 49.3.2 Let G = (V, E) be a connected graph with non-negative weights w : E R and d : V R.
Potentials, Equality The components of d are called distance potentials. We say that distance potentials are
Edges feasible 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.
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 R
be 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 = v0 v1 v2 . . . 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(vk1 ) + w({vk1 , vk }) d(vK )

3. Adding these inequalities together gives

d(v0 ) + d(v1 ) + d(v2 ) + . . . + d(vk1 ) + w({v0 , v1 }) + w({v1 , v2 }) + . . . + w({vk1 , vk })


d(v1 ) + d(v2 ) + d(v3 ) + . . . + d(vk ).

4. This simplifies to
d(v0 ) + w(W ) d(vk )
or
w(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 s
be a designated vertex and let P be an st-path. If there exist feasible distance potentials
d : V R such that every edge of P is an equality edge, then P is a shortest st-path.

Before we examine the proof, lets see how the theorem works as part of the certificate. Re-
call the tree and function d that resulted from our example of running Dijkstras algorithm.
310 Chapter 49 Certificate of Optimality - Path

0 3
3
s a

1
9 2

1 b c 4
3

4 1

d
5

Figure 49.3.1: Tree and d

The dark edges indicate the tree and the blue labels adjacent to the vertices give d. Observe
the sd-path P = sbd. All of the hypotheses of Certificate of Optimality for a Path are
satisfied. 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 feasible
distance potentials. By examining each edge of P we can confirm that every edge of P is an
equality 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 at
least 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 path
that 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 weights


w : E R. s is a designated vertex and P is an st-path. There exist feasible
distance 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.
Section 49.3 Weighted Graphs 311

Sentence 1 By the first part of the conclusion of Feasible Potentials, every st-walk has
weight at least w(t) w(s).
Since is is a form of the existential quantifier, the hypothesis P is an st-path allows
the author to assume the existence of P . What the author must show is not that
P exists, or that P is an st-path, but rather that P is a shortest st-path. The first
sentence 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 potentials
d : V R such that every edge of P is an equality edge. The existential quantifier in
this hypothesis allows the author to assume the existence of feasible distance potentials
and 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 is
a 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 designated
node s. If d : V R is defined as the length of a shortest path from s to v for all vertices
in 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 there
exists {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 0 with w(P 0 ) w(W ).

5. But w(W ) = w(P ) + w({u, v}) = d(u) + w({u, v}) < d(v).

6. But then w(P 0 ) < 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 be
a designated vertex. If P is a shortest st-path, then there exist feasible distance potentials
d : V R such that every edge of P is an equality edge.
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 in
V . 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 Equality
Edges) gives

Theorem 6 (Shortest Path Optimality (SPO))


Let G = (V, E) be a connected graph with non-negative weights w : E R and let s
be a designated vertex. P is a shortest st-path if and only if there exist feasible distance
potentials such that every edge of P is an equality edge.

49.4 Certificate of Optimality - Tree

We have dealt so far with paths, but Dijkstras 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 a
designated vertex and let T be a spanning tree rooted at s. If there exist feasible distance
potentials such that every edge of T is an equality edge, then T is a tree of shortest paths
rooted 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 T
is an equality edge.

2. For every node v in V , there is an st-path in T that satisfies the hypotheses of


Certificate 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 and
equality arcs. How do we know that these exist?
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 a
designated 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 in
a shortest sv-path is an equality arc. So, every edge of P (v) is an equality edge for
every v V .

4. Let [
E0 = P (v).
vV

5. The edges of E 0 contain a path consisting of equality arcs from s to every v V .


Delete from E 0 enough edges to produce a tree T .

6. But then Trees of Shortest Paths applies and T is a tree of shortest paths rooted at
s.
Part IX

An Introduction to Fermats Last


Theorem

314
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 Fermats Last Theorem.

Theorem 1 (Fermats Last Theorem (FLT))


If n 3, then there are no solutions to

xn + y n = z n

where x, y and z are positive integers.

To make progress on this problem, we need to work with prime numbers. Recall our
definition of prime number.

Definition 50.2.1 An integer p > 1 is called a prime if its only divisors are 1 and p, and composite otherwise.
Prime, Composite

315
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 2


are composite. Note, that by definition, 1 is not a prime.

We have already proved three propositions about primes, one of which is a consequence of
Coprimeness 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.
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 product


with 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. Since
r and s are less than k + 1, they can be written as a product of prime factors by the
inductive hypothesis. Hence, k + 1 is a product of prime factors and P (k + 1) is true
in this case also.
The result is true for n = k + 1, and so holds for all n by the Principle of Strong
Induction.

50.4 Fundamental Theorem of Arithmetic

In grade school you used prime numbers to write the prime factorization of any positive
integer greater than one. You probably never worried about the possibility that there might
be 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 factored

in 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 written
in any order. For example 12 = 2 2 3 = 2 3 2 = 3 2 2. However, up to the
order of the factors, the factorization of integers is unique. This property is so basic it is
referred to as the Fundamental Theorem of Arithmetic. It is also referred to as the Unique
Factorization Theorem.
318 Chapter 50 Introduction to Primes

Theorem 6 (Fundamental Theorem of Arithmetic or


Unique Factorization Theorem (UFT))
If n > 1 is an integer, then n can be written as a product of prime factors and, apart from
the 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 proposition
Prime Factorization.

2. Now suppose that n is factored into primes in two ways,

n = p1 p2 . . . pk = q1 q2 . . . q` (50.1)

where all of the ps and qs are primes.

3. Since p1 | n, p1 | q1 q2 . . . q` .

4. By repeatedly applying the proposition Primes and Divisibility, p1 must divide one of
the qs. If necessary, rearrange the qs 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

p2 p3 . . . pk = q2 q3 . . . q` (50.2)

7. By continuing in this way, we see that each p must be paired off with one of the qs
until there are no factors on either side.

8. Hence k = ` and, apart from the order of the factors, the two expressions for n are
the same.

Lets perform an analysis of the proof. As usual, we begin with the hypothesis and the
conclusion.

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.
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 proposition
Prime 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 = p1 p2 . . . pk = q1 q2 . . . q`

where all of the ps and qs 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 p1 p2 . . . pk and the second represen-
tation is the product q1 q2 . . . q` .

Sentences 3 5 Since p1 | n, p1 | q1 q2 . . . q` . By repeatedly applying the proposition


Primes and Divisibility, p1 must divide one of the qs. If necessary, rearrange the qs
so 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 they
have identical factors. Here, the author demonstrates that p1 = q1 .

Sentences 6 7 Dividing Equation 50.1 by p1 = q1 gives

p2 p3 . . . pk = q2 q3 . . . q`

By continuing in this way, we see that each p must be paired off with one of the qs
until there are no factors on either side.
This continues the authors plan of showing that the two representations of n are
equal by showing that they have identical factors.

Sentence 8 Hence k = ` and, apart from the order of the factors, the two expressions for
n are the same.
This is a typical conclusion to the Uniqueness Method. The two representations of
the same object are identical.

50.5 Finding a Prime Factor

The previous proposition does not provide an algorithm for finding the prime factors of a
positive integer n. The next proposition shows that we do not have to check all of the prime
factors 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.

Lets begin by identifying the hypothesis and the conclusion.


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, lets do an example.

Example 2 Is 73 a prime number?


Solution: Using
Finding
a Prime Factor , we can check for divisibility by primes less than
or 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 must
be 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 that
1 < 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 prime

factor less than or equal to n.
The word a should alert us to the presence of an existential quantifier. We could
reword the statement as
If n is an integer greater than 1 and n is not prime, then there exists a

prime 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 Construct
Method. 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 that
a prime factor exists.
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 that
1 < a, b < n.
By the hypotheses of the restated proposition, n > 1 and n is not prime, so n is
composite 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 fact
that 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 the
divisors of a positive integer. A proof is available in the Appendix. [Incomplete: Add
proof.]

Proposition 8 (Divisors From Prime Factorization (DFPF))


If a > 1 is an integer and
a = p1 1 p2 2 pk k
is the prime factorization of a into powers of distinct primes p1 , p2 , . . . , pk , then the positive
divisors of a are integers of the form

d = pd11 pd22 pdkk 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 = 23 32

the positive divisors of a are integers of the form

d = 2d1 3d2 where 0 d1 3 and 0 d1 2

The possibilities are

20 30 = 1 21 30 = 2 22 30 = 4 23 30 = 8
20 31 = 3 21 31 = 6 22 31 = 12 23 31 = 24
20 32 = 9 21 32 = 18 22 32 = 36 23 32 = 72

Exercise 1 Using Divisors From Prime Factorization, list all of the positive factors of 45.
322 Chapter 50 Introduction to Primes

Exercise 2 How many positive divisors are there to the integer a whose prime factorization is

a = p1 1 p2 2 pk k

Proposition 9 (GCD From Prime Factorization (GCD PF))


If
a = p1 1 p2 2 pk k
and
b = p1 1 p2 2 p` `
are the prime factorizations of a and b, where some of the exponents may be zero, then

gcd(a, b) = pd11 pd22 pdkk where di = min{i , i } for i = 1, 2, . . . , k

Example 4 (Using GCD From Prime Factorization)


What is gcd(24750, 434511)?
Since
24750 = 21 32 53 111 = 21 32 53 70 111 190
and
434511 = 33 71 112 191 = 20 33 50 71 112 191 ,

gcd(24750, 434511) = 2min{1,0} 3min{2,3} 5min{3,0} 7min{0,1} 11min{1,2} 19min{0,1}


= 20 32 50 71 112 190
= 7623

Though this method works well enough on small examples, it is much slower than the
Extended Euclidean Algorithm for computing gcds.

Exercise 3 Use GCD PF to compute gcd(33 51 74 131 , 52 77 131 232 ).

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.


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 that
your answer in (b) is correct.

Solution:

(a)

12936 = 23 31 72 111
16380 = 22 51 32 71 131

(b) gcd(12936, 16380) = 22 31 71 = 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 that
you have the correct value.

3. Note that k divides n! + k for each k <= n. Use this fact to show that, for all positive
integers m, there exist consecutive primes which are at least m apart.
Chapter 51

Introduction to Fermats Last


Theorem

51.1 Objectives

The content objectives are:

1. Provide an historical introduction.

2. Define gcd(x, y, z), trivial solutions, Pythagorean triple and primitive Pythagorean
triple.

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 Fermats Last Theorem

Pierre de Fermat (1601 (?) 1635) was a brilliant French mathematician. It was his habit
to make notes in the margins of his books and one such note is famous. Fermat possessed
a copy of Bachets translation of Diophantus Arithmetica. Problem II.8 of the Arithmetica
reads

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 + y 2 = z 2

satisfied?

324
Section 51.2 History of Fermats 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 two
fourth powers, or in general, any power higher than the second, into two like
powers. I have discovered a truly marvellous proof of this, which this margin is
too narrow to contain.

Fermat was asserting

Theorem 1 (Fermats Last Theorem)


If n 3, then
xn + y n = z n
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 seems
very unlikely that he did have a proof and it was not until Andrew Wiles publications in
1994 that the Theorem, conjecture really, was proved. Fermat did prove the case n = 4, as
we shall do.
First though, we will clarify our language. Clearly there are solutions to xn + y n = z n . One
solution is x = y = z = 0, another solution is x = 0, y = z.

Definition 51.2.1 We will say that any solution to xn + y n = z n for which at least one of x, y or z is zero, is
Trivial trivial.

So we restate Fermats Last Theorem as

Theorem 2 (Fermats Last Theorem)


If n 3, then
xn + y n = z n
has no non-trivial integer solutions.

Our starting point will be a much more familiar problem.

x2 + y 2 = z 2 (51.1)

You will recognize this as the equation of the Pythagorean Theorem. Our task is to identify
all positive integer solutions to Equation 51.1.
326 Chapter 51 Introduction to Fermats Last Theorem

51.3 Pythagorean Triples

We begin with some definitions.

Definition 51.3.1 A Pythagorean triple is an ordered triple of non-zero integers (x, y, z) such that
Pythagorean Triple x2 + y 2 = z 2 .

Equivalently, a Pythagorean triple is a non-trivial solution to x2 + y 2 = z 2 .


Now we expand our definition of gcd.

Definition 51.3.2 Let a, b and c be integers, not all zero. An integer d > 0 is the greatest common divisor
Greatest Common of a, b and c, written gcd(a, b, c), if and only if
Divisor

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 A Pythagorean triple (x, y, z) is said to be primitive if gcd(x, y, z) = 1.


Primitive Triple

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
x y z
a Pythagorean triple where x1 = , y1 = and z1 = .
d d d

Example 2 (6, 8, 10) is a Pythagorean triple since 62 +82 = 102 . Since gcd(6, 8, 10) = 2, by the Multiples
of 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.
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 + y 2 = z 2 (defn of Pythagorean triple)
x2 y2 z2
+ 2 = 2 (divide by d2 )
d2 d d
x21 + y12 = z12 (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 the
proof 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 the
contrary that gcd(x, y) = d > 1. Then there exists a prime p so that p | d. Since p | x and
p | y, p | (x2 + y 2 ) by the Divisibility of Integer Combinations. Since x2 + y 2 = z 2 , p | z 2
and so p | z by Primes and Divisibility. But then gcd(x, y, z) p > 1 which contradicts the
hypothesis that (x, y, z) is a primitive Pythagorean triple.

The next proposition identifies a very simple but useful attribute of primitive Pythagorean
triples.

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 the
other is odd.

First, notice that this implies that z is odd. (Why?) Second, lets check this against our
experience.

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 not
apply 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.

Lets walk through a proof of this proposition.


328 Chapter 51 Introduction to Fermats 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 and
y 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 Pythagorean


Triples.

4. Consider the second case. Suppose that x and y are both odd.

5. This implies that x2 1 (mod 4) and y 2 1 (mod 4) which in turn implies

z 2 = x2 + y 2 2 (mod 4)

6. But this is impossible since the square of any integer can only be congruent to 0 or 1
modulo 4.

7. Since the two integers cannot both be even or odd, exactly one must be even and one
must be odd.

As usual, we will begin our analysis by identifying the hypothesis, conclusion, core proof
techniques 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 and
y are both odd or x and y have opposite parity. The first two cases will be eliminated
leaving the third as the only possible outcome. Each of the first two cases is dealt with
using contradiction. The use of contradiction several times within a proof is common.

Preliminary Material: primitive Pythagorean triple, congruences

Lets 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 three
possible cases: x and y are both even, x and y are both odd or x and y have opposite
parity. The author will disprove the first two cases using contradiction, hence by
elimination 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.
Section 51.3 Pythagorean Triples 329

Sentence 3. But then gcd(x, y) = 2 6= 1 which contradicts the Relative Primeness of


Pythagorean Triples.
To invoke the Relative Primeness of Pythagorean Triples we should make sure that
the hypothesis of RPPT is satisfied. All that is required is that x, y and z are a
primitive Pythagorean triple, which is assured from the hypothesis of the proposition
we 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 y 2 1 (mod 4) which in turn implies

z 2 = x2 + y 2 2 (mod 4)

Sentence 6. But this is impossible since the square of any integer can only be congruent
to 0 or 1 modulo 4.
This part of proof is quite different from the earlier part. Since any odd integer a can
be written in the form 2t + 1, a2 has the form 4t2 + 4t + 1 which is congruent to
1 (mod 4). Thus z 2 = x2 + y 2 1 + 1 2 (mod 4). But how could this be? If z were
odd, z 2 1 (mod 4), and if z were even, z 2 0 (mod 4).

Sentence 7. Since the two integers cannot both be even or odd, exactly one must be even
and one must be odd.
Since the cases of x and y both even or x and y both odd have been eliminated, all
that 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 is
odd.

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 that
a = an1 and b = bn1 .

Example 4 Consider 592, 704 which is just 843 . With n = 3, c = 84, a = 64 and b = 9261, the
hypotheses of the proposition are satisfied. Hence, there exist integers a1 and b1 so that
a = 64 = an1 and b = 9261 = bn1 . So a1 = 4 and b1 = 21, and 43 213 = 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
Chapter 52

Characterization of Pythagorean
Triples

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 proof
in this section follows that done by David Burton in Elementary Number Theory, Seventh
Edition.

Theorem 1 (Characterization of Pythagorean Triples (CPT))


The complete set of non-trivial, primitive solutions to

x2 + y 2 = z 2

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).

Lets understand what the theorem is saying. Every choice of s and t satisfying integers
s > t > 0 such that gcd(s, t) = 1 and s 6 t (mod 2) does produce a non-trivial, primitive
Pythagorean triple and these are the only non-trivial, primitive Pythagorean triples.

330
Section 52.2 Pythagorean Triples 331

The table below lists some primitive Pythagorean triples arising from small values of s and
t.

s t x y z
2st s2 t2 s2 + t2
2 1 4 3 5
3 2 12 5 13
4 1 8 15 17
4 3 24 7 25
5 2 20 21 29
5 4 40 9 41

Before we read the proof, lets do some analysis. The expression complete set obviously
indicates that we are working with sets. So, the first step is to identify which sets are used
and 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 + y 2 = z 2 , 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 to


primitive and 2 | x follows our convention that in a primitive Pythagorean triple, x is even
and y and z are odd. The other set is the collection of triples determined by formula and
can 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 expect


the proof to show that S = T by showing that S T and T S, though this is done
implicitly.
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.
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
zy z+y
u= and v =
2 2
and
v u = y and v + u = z
and the equation x2 + y 2 = z 2 may be rewritten as

x2 = z 2 y 2 = (z y)(z + y)

Dividing the preceding equation by 4 gives


 x 2  z y   z + y 
= = uv
2 2 2

We claim that gcd(u, v) = 1. Suppose this were not so and gcd(u, v) = d > 1. Then
d | (v u) and d | (v + u). But v u = y and v + u = z so d | y and d | z which contradicts
the fact that y and z are relatively prime. Now we can use our proposition on Decomposing
n-th Powers to conclude that u and v are perfect squares. Hence, for some natural numbers
s 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) = 4s2 t2 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 z
contradicting the fact that gcd(y, z) = 1. Finally, if s and t are both even or both odd, then
y 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 + y 2 = (2st)2 + (s2 t2 )2 = (s2 + t2 )2 = z 2

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. Since
s, 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 prime
divisor 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. Since
no such p can exist, gcd(x, y, z) = 1 and x, y and z are a primitive triple.
Chapter 53

Fermats Theorem for n = 4

53.1 Objectives

The content objectives are

1. State and prove: The Diophantine equation x4 + y 4 = z 2 has no non-trivial solution.

2. State and prove: The Diophantine equation x4 + y 4 = z 4 has no non-trivial solution.

3. Show a reduction of FLT to If p is an odd prime, then the Diophantine equation


xp + y p = z p has no non-trivial solution.

53.2 n=4

Having completely resolved the case of Pythagorean triples, we can now turn our attention
to the one instance of FLT proved by Fermat. Actually, we will prove a slightly stronger
result and the case n = 4 will follow as a corollary. The approach in this section mostly
follows Elementary Number Theory, Seventh Edition by David Burton.

Theorem 1 (FLT, Strong Version of n = 4)


The Diophantine equation x4 + y 4 = z 2 has no non-trivial solution.

333
334 Chapter 53 Fermats 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 + y 4 = z 2 .

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 algebraic
expressions involving s and t.

4. The author uses these algebraic expressions to construct another non-trivial primitive
Pythagorean triple.

5. Lastly, the author uses this triple to construct a solution x1 , y1 , z1 to x4 + y 4 = z 2


which is smaller than x0 , y0 , z0 , hence a contradiction.

Proof: By way of contradiction, suppose there exists a positive integer solution to x4 +y 4 =


z 2 . 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 that
gcd(x0 , y0 , z0 ) = 1. (Why?)
Since x0 , y0 , z0 is a solution we know

x40 + y04 = z02

which we can rewrite as 2 2


x20 + y02 = z02

But that means that x20 , y02 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 that
one of x20 and y02 is even. We can assume that x20 is even, hence x0 is even, and that there
exist integers s and t so that s > t > 0 and gcd(s, t) = 1 and s 6 t (mod 2) satisfying

x20 = 2st
y02 = 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. Now
consider the equation y02 = s2 t2 modulo 4. Because y02 is odd,

y02 = 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


 x 2
0
x20 = 2st x20 = 4sr = sr
2
Now gcd(s, t) = 1 implies that gcd(s, r) = 1 (why?) and so we can use the proposition
on Decomposing n-th Powers. Since (x0 /2)2 is a perfect square, s and r must be perfect
squares and we can write s = z12 and r = w12 for positive integers z1 and w1 .
Rewrite y02 = s2 t2 as
t2 + y02 = s2
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 Pythagorean


triple and we can use the Characterization of Pythagorean Triples again. With t even, the
Characterization of Pythagorean Triples assures us of the existence of integers u and v so
that u > v > 0 and gcd(u, v) = 1 and u 6 v (mod 2) satisfying

t = 2uv
y0 = u2 v 2
s = u2 + v 2

Now, observe that


t
= r = w12
uv =
2
and so by the proposition on Decomposing n-th Powers, u and v are perfect squares. Suppose
u = x21 and v = y12 where x1 and y1 are positive integers. But then
2 2
s = u2 + v 2 z12 = x21 + y12

and so
z12 = x41 + y14
That is, x1 , y1 , z1 is a solution to x4 + y 4 = z 2 . Since z1 and t are positive

0 < z1 z12 = s s2 < s2 + t2 = z0

That is,
z1 < z0
But recall that x0 , y0 , z0 is a solution to x4 + y 4 = z 2 with the smallest possible value of z.
But x1 , y1 , z1 is a solution to x4 + y 4 = z 2 with a smaller value of z!

The case n = 4 of Fermats Last Theorem follows immediately.

Corollary 2 The Diophantine equation x4 + y 4 = z 4 has no positive integer solution.

Proof: If x0 , y0 , z0 were a positive integer solution of x4 + y 4 = z 4 , then x0 , y0 , z02 would


be a positive integer solution to x4 + y 4 = z 2 , contradicting the previous theorem.

53.3 Reducing the Problem

It is not necessary to consider every exponent of xn + y n = z n to prove Fermats Last


Theorem.
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 + y n = z n can be rewritten as
 4   4  4
xk + yk = zk

We have just seen that this equation has no positive integer solution.
336 Chapter 53 Fermats Theorem for n = 4

In the second case, n = pk for some k 1 and the equation xn + y n = z n can be rewritten
as  p  p  p
xk + y k = z k

If it could be shown that up + v p = wp has no solution, then there would be no solution


of the form u = xk , v = y k , w = z k and so there would be no solution to xn + y n = z n .
Therefore, Fermats Last Theorem reduces to

Theorem 3 (Fermats Last Theorem Reduced)


If p is an odd prime, then the Diophantine equation

xp + y p = z p

has no non-trivial solutions.

53.4 History

For a very interesting documentary on the solution of FLT, please see


http://video.google.com/videoplay?docid=8269328330690408516
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 y 4 = z 2

From x4 + y 4 = z 2 , we turn to a closely related Diophantine equation, x4 y 4 = z 2 . Our


proof is very similar to that of the Strong Version of FLT for n = 4. The approach in this
section mostly follows Elementary Number Theory, Seventh Edition by David Burton.

Proposition 1 (Squares From the Difference of Quartics (SFDQ))


The Diophantine equation x4 y 4 = z 2 has no non-trivial solutions.

Proof: Suppose that there exists a non-trivial solution to x4 y 4 = z 2 . Of all such solutions
x0 , y0 , z0 , choose any one in which x0 is smallest. Choosing x0 as small as possible forces
x0 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 y 4 = z 2 we get d4 (x41 y14 ) =
z02 . So d4 | z02 , hence d2 | z0 . Thus z0 = d2 z1 for some integer z1 . But then

d4 x41 d4 y14 = d4 z12

so x1 , y1 , z1 is a non-trivial solution to x4 y 4 = z 2 with 0 < x1 < x0 contradicting our


choice of a minimal x0 .
If the equation x40 y04 = z02 is written in the form
2 2
x20 y02 = z02

then 2 2
z02 + y02 = x20

337
338 Chapter 54 Problems Related to FLT

and we see that (z0 , y02 , x20 ) constitute a primitive Pythagorean triple.
From here there are two cases: y0 odd and y0 even. Consider the case where y0 is odd. The
Characterization of Pythagorean Triples asserts that there exist integers s and t so that
s > t > 0 and gcd(s, t) = 1 and s 6 t (mod 2) satisfying

z0 = 2st (this is forced from y0 odd)


y02 2
=s t 2

x20 = s2 + t2

Observe that
s4 t4 = (s2 + t2 )(s2 t2 ) = x20 y02 = (x0 y0 )2
so s, t, x0 y0 is a positive solution to x4 y 4 = z 2 . But
p
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 asserts
that there exist integers s and t so that s > t > 0 and gcd(s, t) = 1 and s 6 t (mod 2)
satisfying

y02 = 2st (this is forced from y0 even)


2 2
z0 = s t
x20 = s2 + t2

Because of the symmetry of expressions for s and t, we may assume that s is even and t is
odd. Consider the relation
y02 = 2st
Since gcd(s, t) = 1 and s is even, we know that gcd(2s, t) = 1. This allows us to invoke the
proposition on Decomposing n-th Powers. That is, 2s and t are each squares of positive
integers, say 2s = w2 and t = v 2 . Because w must be even, set w = 2u to get s = 2u2 .
Therefore
x20 = s2 + t2 = 4u4 + v 4
and so (2u2 , v 2 , x0 ) form a Pythagorean triple. Since gcd(2u2 , v 2 ) = gcd(s, t) = 1,
gcd(2u2 , v 2 , x0 ) = 1 and so the Pythagorean triple is primitive. The Characterization
of Pythagorean Triples asserts that there exist integers a and b so that a > b > 0 and
gcd(a, b) = 1 and a 6 b (mod 2) satisfying

2u2 = 2ab
v 2 = a2 b2
x0 = a2 + b2

Now 2u2 = 2ab implies u2 = ab which implies, by the proposition on Decomposing n-th
Powers, that a and b are perfect squares. Say a = c2 and b = d2 . And here we use a pattern
we have seen before. Since
v 2 = a2 b2 = c4 d4
c, d, v is a positive integer solution to x4 y 4 = z 2 . But

0 < c = a < a2 + b2 = x0
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 assumption
that there is a non-trivial solution is incorrect.

This proposition has an unexpected use in a statement about the areas of Pythagorean
triangles.

54.3 Pythagorean Triangles

Definition 54.3.1 A Pythagorean triangle is a right triangle whose sides are of integral length.
Pythagorean
Triangle
The familiar 3 4 5 triangle is an example of a Pythagorean triangle. In the margin of
his copy of Diophantus Arithmetica, Fermat stated and proved a proposition equivalent to
the 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 where


the hypotenuse has length z and the other two sides have lengths x and y, so that

x2 + y 2 = z 2 (54.1)

The area of 4ABC is (1/2)xy and if this were a square we could write (1/2)xy = u2 . This
gives
2xy = 4u2 (54.2)
Now Equation (54.1) plus Equation (54.2) gives

x2 + y 2 + 2xy = z 2 + 4u2 (x + y)2 = z 2 + 4u2

and Equation (54.1) minus Equation (54.2) gives

x2 + y 2 2xy = z 2 4u2 (x y)2 = z 2 4u2

Now multiply these last two equations together to get


2
(x + y)2 (x y)2 = (z 2 + 4u2 )(z 2 4u2 ) x2 y 2 = z 4 16u4

or 2
x2 y 2 = z 4 (2u)4
But we know by our proposition on the Squares From the Difference of Quartics that no
non-trivial solution to this equation is possible, hence a contradiction.
Chapter 55

Practice, Practice, Practice:


Primes and Non-Linear
Diophantine 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, it
may 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 + y 2 = z 3 has infinitely many positive integer solutions. (Hint: For
any n 2, let x = n(n2 3) and y = 3n2 1.)

2. Joseph Louis Lagrange (1736 1813) was a brilliant French mathematician who
worked mostly in the 18th century. He worked on the Sum of Squares problem, that
is: What is the smallest value of n such that every positive integer can be written as
the 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 at
most four squares.
(b) Prove that if a and b are both the sum of two squares, then ab is the sum of two
squares.
(c) Prove that if p is a prime of the form 4k + 3, then p cannot be a sum of two
squares.
(d) Prove that an integer n can be represented as the difference of two squares if and
only if n is not of the form 4k + 2.

340
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 n2 + 1
 
, n,
2 2

is a Pythagorean triple.
(b) If n 3 is an even integer, then

n2 n2
 
n, 1, +1
4 4

is a Pythagorean triple.
(c) If n 2 (mod 4), then there is no primitive Pythagorean triple (x, y, z) in which
x or y equals n.
(d) If n 6 2 (mod 4), then there is a primitive Pythagorean triple (x, y, z) in which
x 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 some


a 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, not
necessarily distinct.

6. Let a < b < c, where a N and b and c are odd primes. Prove that if a | (3b + 2c) and
a | (2b + 3c) then a = 1 or a = 5. Give examples to show that both of these values
for a are possible.
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 pkr r


b = q1j1 q2j2 qsjs

are the prime factorizations of a and b, then no px can occur among the qy otherwise the
gcd(a, b) > 1. As a result, the prime factorization of ab is

ab = pk11 pk22 pkr r q1j1 q2j2 qsjs

Let us suppose that c can be factored into primes as

c = ul11 ul22 ultt

Then ab = cn can be written as

pk11 pk22 pkr r q1j1 q2j2 qsjs = unl1 nl2 nlt


1 u2 ut

This implies that each px and qy equals some uh and that the corresponding exponents are
equal. That is kx = nlh (or jy = nlh ). This implies that all of the exponents of the px and
qy are divisible by n. Thus, we can choose
k /n k /n
a = p1 1 p2 2 pkr r /n
j /n j /n
b = q11 q22 qsjs /n

and a = an1 and b = bn1 as needed.

342

You might also like