0% found this document useful (0 votes)
6 views290 pages

Transition

The document titled 'A Transition to Advanced Mathematics' by Darrin Doud and Pace P. Nielsen serves as a comprehensive guide for students transitioning into higher-level mathematics. It covers foundational topics such as set theory, logic, proof techniques, and mathematical induction, structured in a detailed format with exercises for practice. The content is organized into sections that build upon each other, facilitating a deeper understanding of advanced mathematical concepts.

Uploaded by

ikonibo0510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views290 pages

Transition

The document titled 'A Transition to Advanced Mathematics' by Darrin Doud and Pace P. Nielsen serves as a comprehensive guide for students transitioning into higher-level mathematics. It covers foundational topics such as set theory, logic, proof techniques, and mathematical induction, structured in a detailed format with exercises for practice. The content is organized into sections that build upon each other, facilitating a deeper understanding of advanced mathematical concepts.

Uploaded by

ikonibo0510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 290

A Transition to

Advanced Mathematics

Darrin Doud and Pace P. Nielsen


Darrin Doud Pace P. Nielsen
Department of Mathematics Department of Mathematics
Brigham Young University Brigham Young University
Provo, UT 84602 Provo, UT 84602
[email protected] [email protected]

Copyright c 2019, 2022, 2024

Version: 1.04
Date: August 9, 2024
Contents

Preface vii

I Set Theory 1
1 Sets, subsets, and set operations . . . . . . . . . . . . . . . . . . . 2
1.A What is a set? . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.B Naming sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.C Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.D Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.E Power sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.F Unions and intersections . . . . . . . . . . . . . . . . . . . . 9
1.G Complements and differences . . . . . . . . . . . . . . . . . 10
1.H Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 Products of sets and indexed sets . . . . . . . . . . . . . . . . . . . 13
2.A Cartesian products . . . . . . . . . . . . . . . . . . . . . . . 13
2.B Indices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

II Logic 21
3 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.A What is a statement? . . . . . . . . . . . . . . . . . . . . . 22
3.B Logical connectives . . . . . . . . . . . . . . . . . . . . . . . 22
3.C Logical equivalences . . . . . . . . . . . . . . . . . . . . . . 28
3.D Tautologies and contradictions . . . . . . . . . . . . . . . . 30
3.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4 Open sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.A Open sentences . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.B Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.C Implication and open sentences . . . . . . . . . . . . . . . . 38
4.D The meaning of implication . . . . . . . . . . . . . . . . . . 39
4.E Translating between English and symbolic logic . . . . . . . 40
4.F Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5 Multiple quantifiers and negating sentences . . . . . . . . . . . . . 43
5.A Statements with multiple quantifiers . . . . . . . . . . . . . 43
5.B Negating statements . . . . . . . . . . . . . . . . . . . . . . 45
5.C Greatest and least elements . . . . . . . . . . . . . . . . . . 47

i
ii CONTENTS

5.D Chart of negation rules . . . . . . . . . . . . . . . . . . . . 49


5.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

III Basic Proof Techniques 51


6 Direct proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.A Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.B Trivial proofs . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.C Vacuous proofs . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.D Outline of a direct proof . . . . . . . . . . . . . . . . . . . . 55
6.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7 Contrapositive proof . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.A What is the contrapositive? . . . . . . . . . . . . . . . . . . 58
7.B Division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.C More terminology for implications . . . . . . . . . . . . . . 62
7.D Biconditional . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8 Proof by cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.A Introductory examples . . . . . . . . . . . . . . . . . . . . . 64
8.B Congruence . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8.C Absolute values . . . . . . . . . . . . . . . . . . . . . . . . . 69
8.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
9 Proof by contradiction . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.A Basic technique and examples . . . . . . . . . . . . . . . . . 72
9.B Proof by contradiction for implications . . . . . . . . . . . . 72
9.C Irrationality proofs . . . . . . . . . . . . . . . . . . . . . . . 74
9.D Advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
9.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
10 Proofs in set theory . . . . . . . . . . . . . . . . . . . . . . . . . . 76
10.A Proving set membership . . . . . . . . . . . . . . . . . . . . 76
10.B Proving inclusion of sets . . . . . . . . . . . . . . . . . . . . 76
10.C Proving equality . . . . . . . . . . . . . . . . . . . . . . . . 77
10.D Laws for sets . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
11 Existence proofs and counterexamples . . . . . . . . . . . . . . . . 81
11.A Constructive existence proofs . . . . . . . . . . . . . . . . . 81
11.B Nonconstructive existence proofs . . . . . . . . . . . . . . . 82
11.C Uniqueness . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
11.D Counterexamples and disproof . . . . . . . . . . . . . . . . 84
11.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
12 Set proofs in logic . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
12.A Implications involving set statements . . . . . . . . . . . . . 87
12.B Do we always work directly? . . . . . . . . . . . . . . . . . . 88
12.C Set proofs with Cartesian products . . . . . . . . . . . . . . 89
12.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
CONTENTS iii

IV Proof by Induction 91
13 Mathematical induction . . . . . . . . . . . . . . . . . . . . . . . . 92
13.A The principle of mathematical induction . . . . . . . . . . . 92
13.B Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
14 More examples of induction . . . . . . . . . . . . . . . . . . . . . . 101
14.A Starting induction somewhere else . . . . . . . . . . . . . . 101
14.B Many base cases . . . . . . . . . . . . . . . . . . . . . . . . 105
14.C Proof of generalized induction . . . . . . . . . . . . . . . . . 105
14.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
15 Strong induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
15.A The definition of strong induction . . . . . . . . . . . . . . . 108
15.B Strong induction by example . . . . . . . . . . . . . . . . . 108
15.C More examples of strong induction . . . . . . . . . . . . . . 111
15.D Formalizing strong induction . . . . . . . . . . . . . . . . . 112
15.E Where to start? . . . . . . . . . . . . . . . . . . . . . . . . . 113
15.F Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
16 The Binomial Theorem . . . . . . . . . . . . . . . . . . . . . . . . 118
16.A Binomial coefficients and Pascal’s triangle . . . . . . . . . . 118
16.B Proof of the Binomial Theorem . . . . . . . . . . . . . . . . 121
16.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

V Theory of the Integers 125


17 Divisibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
17.A Divisibility and common divisors . . . . . . . . . . . . . . . 126
17.B The division algorithm . . . . . . . . . . . . . . . . . . . . . 127
17.C Computing the GCD . . . . . . . . . . . . . . . . . . . . . . 129
17.D The Euclidean algorithm . . . . . . . . . . . . . . . . . . . . 131
17.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
18 The extended Euclidean algorithm . . . . . . . . . . . . . . . . . . 133
18.A The GCD as a linear combination . . . . . . . . . . . . . . . 133
18.B Calculating the GCD as a linear combination . . . . . . . . 134
18.C Relative primality . . . . . . . . . . . . . . . . . . . . . . . 137
18.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
19 Prime numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
19.A Definition of prime numbers . . . . . . . . . . . . . . . . . . 140
19.B Divisibility by primes . . . . . . . . . . . . . . . . . . . . . 141
19.C The infinitude of primes . . . . . . . . . . . . . . . . . . . . 144
19.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

VI Relations 147
20 Properties of relations . . . . . . . . . . . . . . . . . . . . . . . . . 148
20.A What is a relation? . . . . . . . . . . . . . . . . . . . . . . . 148
20.B Properties of relations on a set A . . . . . . . . . . . . . . . 150
20.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
iv CONTENTS

21 Equivalence relations . . . . . . . . . . . . . . . . . . . . . . . . . 155


21.A Definition and examples . . . . . . . . . . . . . . . . . . . . 155
21.B Equivalence classes . . . . . . . . . . . . . . . . . . . . . . . 157
21.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
22 Equivalence classes and partitions . . . . . . . . . . . . . . . . . . 160
22.A Properties of equivalence classes . . . . . . . . . . . . . . . 160
22.B Partitions and equivalence classes . . . . . . . . . . . . . . . 161
22.C Transversals of equivalence relations . . . . . . . . . . . . . 164
22.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
23 Integers modulo n . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
23.A Review of integer congruence . . . . . . . . . . . . . . . . . 168
23.B Congruence classes modulo n . . . . . . . . . . . . . . . . . 168
23.C Operations on Zn . . . . . . . . . . . . . . . . . . . . . . . . 170
23.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

VII Functions 175


24 Relations and functions . . . . . . . . . . . . . . . . . . . . . . . . 176
24.A Finding domains and images . . . . . . . . . . . . . . . . . 176
24.B Rules and well-definedness . . . . . . . . . . . . . . . . . . . 178
24.C Defining functions . . . . . . . . . . . . . . . . . . . . . . . 183
24.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
25 Function notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
25.A Codomains . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
25.B Inverse notation . . . . . . . . . . . . . . . . . . . . . . . . 188
25.C Images and preimages . . . . . . . . . . . . . . . . . . . . . 188
25.D Proving equality between functions . . . . . . . . . . . . . . 190
25.E Piecewise defined functions . . . . . . . . . . . . . . . . . . 191
25.F Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
26 Injective and surjective functions . . . . . . . . . . . . . . . . . . . 196
26.A Injective functions . . . . . . . . . . . . . . . . . . . . . . . 196
26.B Surjective functions . . . . . . . . . . . . . . . . . . . . . . 199
26.C Bijective functions . . . . . . . . . . . . . . . . . . . . . . . 203
26.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
27 Composition of functions . . . . . . . . . . . . . . . . . . . . . . . 205
27.A Defining function composition . . . . . . . . . . . . . . . . . 205
27.B Composition of injective and surjective functions . . . . . . 208
27.C Inverse relations and inverse functions . . . . . . . . . . . . 209
27.D Composition of inverse functions . . . . . . . . . . . . . . . 211
27.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
28 Additional facts about functions . . . . . . . . . . . . . . . . . . . 213
28.A Functions between finite sets . . . . . . . . . . . . . . . . . 213
28.B Partitions and pasting functions . . . . . . . . . . . . . . . 214
28.C Characteristic functions . . . . . . . . . . . . . . . . . . . . 216
28.D Restrictions of functions . . . . . . . . . . . . . . . . . . . . 217
CONTENTS v

28.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

VIII Cardinality 219


29 Definitions regarding cardinality . . . . . . . . . . . . . . . . . . . 220
29.A How do we measure the size of sets? . . . . . . . . . . . . . 220
29.B Basic results and a picture . . . . . . . . . . . . . . . . . . . 222
29.C Definition of countable sets . . . . . . . . . . . . . . . . . . 222
29.D Subsets of countable sets . . . . . . . . . . . . . . . . . . . . 224
29.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
30 More examples of countable sets . . . . . . . . . . . . . . . . . . . 226
30.A Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
30.B Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
30.C Rational numbers . . . . . . . . . . . . . . . . . . . . . . . 227
30.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
31 Uncountable sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
31.A How big is R? . . . . . . . . . . . . . . . . . . . . . . . . . . 231
31.B Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
32 Injections and cardinalities . . . . . . . . . . . . . . . . . . . . . . 236
32.A Injections vs. bijections . . . . . . . . . . . . . . . . . . . . 236
32.B How big is P(N)? . . . . . . . . . . . . . . . . . . . . . . . 238
32.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
33 The Schröder–Bernstein Theorem . . . . . . . . . . . . . . . . . . 241
33.A Sketching the proof using genealogy . . . . . . . . . . . . . 241
33.B Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
33.C Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

IX Introduction to Analysis 247


34 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
34.A What are sequences, exactly? . . . . . . . . . . . . . . . . . 248
34.B Arithmetic sequences . . . . . . . . . . . . . . . . . . . . . . 249
34.C Geometric sequences . . . . . . . . . . . . . . . . . . . . . . 250
34.D Sequences and their limits . . . . . . . . . . . . . . . . . . . 250
34.E Divergence . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
34.F One more limit trick . . . . . . . . . . . . . . . . . . . . . . 254
34.G Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
35 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
35.A What is a series? . . . . . . . . . . . . . . . . . . . . . . . . 258
35.B Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
36 Limits of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
36.A Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
36.B Limit definition . . . . . . . . . . . . . . . . . . . . . . . . . 266
36.C Examples of limits . . . . . . . . . . . . . . . . . . . . . . . 267
36.D Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
37 Continuity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
vi CONTENTS

37.A Defining continuity . . . . . . . . . . . . . . . . . . . . . . . 271


37.B Building new functions from old . . . . . . . . . . . . . . . 272
37.C Limit laws . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
37.D Continuity of polynomials . . . . . . . . . . . . . . . . . . . 275
37.E Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Preface

This book is intended as the text for the Math 290 (Fundamentals of Mathematics)
class at Brigham Young University. It covers several fundamental topics in advanced
mathematics, including set theory, logic, proof techniques, number theory, relations,
functions, and cardinality. These topics are prerequisites for most advanced mathe-
matics classes, and it seems worthwhile to have a specific course in which they can
be learned by students.
The prerequisites for understanding this material are surprisingly light. Typically,
only a small amount of college algebra (manipulating simple algebraic expressions)
and knowledge of decimal expansions and prime numbers are needed; most other
necessary material is covered in the text. The book is designed for a semester-long
class; each section contains an appropriate amount of material for an hour long lecture.
The exercise sets at the end of each section give problems for the students to use to
practice the techniques learned in the section, and to develop their understanding of
the material. At BYU there are typically 42 class days in a typical semester; we have
included 36 sections in this book. This allows a few days for instructors to review for
exams or cover additional topics of their choice.
We are often asked if we will produce a solutions manual for the exercises. For
this particular course, a solutions manual is probably not a great benefit to the
student. Unlike most mathematics courses that students will have before studying
this material, the exercises in this book often do not have a single correct answer.
Indeed, as the student progresses further into the book, most of the problems ask
for proofs (or disproofs) of statements. Much of the learning in a course such as this
comes from the struggle to produce a proof, rather than studying the techniques used
by someone else to give a proof. Hence, providing a solutions manual would negate
a necessary aspect of the course. In addition, a solutions manual would be of very
little help in verifying the correctness of a proof, since there are many different ways
to prove almost any given statement, all equally correct.
One aspect of a proof is that it should be a convincing argument that a statement
is correct. Students should consider their solutions of proof-type problems to be aimed
at an audience of students at their level; if they are unsure if they have given a valid
proof, then their goal has not been met.
In addition, it is important to note that most of the solutions to exercises in the
book will involve much more writing than is usual in previous mathematics classes.
In order to adapt to this increase in writing, students may need to change the way
they think about problems.

vii
viii PREFACE

One additional topic that instructors may want to include in a course based on this
book is writing mathematics using LATEX. This is an important skill for mathemati-
cians, engineers, scientists, and mathematics educators. Because technology moves
quickly, we have not included instructional material on LATEX in this text; an internet
search can easily find a plethora of such material. In our courses, we typically spend
one to two class days instructing students on the use of LATEX, as well as giving a
number of assignments to help students develop their skills in LATEX.
We thank the many BYU students and instructors who have worked through
preliminary versions of this textbook. They have discovered many typographical and
other errors, which have been eliminated. Should a reader discover any additional
errors in the text, please inform us, so that we can correct them in future printings.

Darrin Doud
Pace P. Nielsen
Chapter I

Set Theory

There is surely a piece of divinity in us, something that was before the elements, and
owes no homage unto the sun. Sir Thomas Browne

One of the benefits of mathematics comes from its ability to express a lot of
information in very few symbols. Take a moment to consider the expression
d
sin(θ).

It encapsulates a large amount of information. The notation sin(θ) represents, for
any right triangle with angle θ, the ratio of the opposite side to the hypotenuse. The
differential operator d/dθ represents a limit, corresponding to a tangent line, and so
forth.
Similarly, sets are a convenient way to express a large amount of information.
They give us a language we will find convenient in which to do mathematics. This is
no accident, as much of modern mathematics can be expressed in terms of sets.

1
2 CHAPTER I. SET THEORY

1 Sets, subsets, and set operations


1.A What is a set?
A set is simply a collection of objects. The objects in the set are called the elements.
We often write down a set by listing its elements. For instance, the set S = {1, 2, 3}
has three elements. Those elements are 1, 2, and 3. There is a special symbol, ∈,
used to express the idea that an element belongs to a set. For instance, we write
1 ∈ S to mean that “1 is an element of S.”
For the set S = {1, 2, 3}, we have 1 ∈ S, 2 ∈ S, and 3 ∈ S. We can write this
more quickly as: 1, 2, 3 ∈ S. We can express the fact that 4 is not an element of S
by writing 4 ∈
/ S.
Example 1.1. Fix P to be the set {16, −5, 2, 6, 9}. Is 6 ∈ P ? Yes! Is 5 ∈ P ? No, so
we write 5 ∈
/ P. 4
The order of the elements in a set does not matter, so we could have written
S = {1, 2, 3} as S = {1, 3, 2}, or as S = {3, 2, 1}. If an element is repeated in a set,
we do not count the multiplicity. Thus {1, 2, 3, 1} is the same set as S = {1, 2, 3}.
We say that two sets are equal when they have exactly the same elements.
Not all sets consist of numbers. For instance T = {a, b, c, d} is a set whose elements
are the letters a, b, c, d. Sets may have words, names, symbols, and even other sets as
elements.
Example 1.2. Suppose we want to form the set of Jesus’ original twelve apostles.
This would be the set
Apostles = {Peter, James, John the beloved, . . . , Judas Iscariot}.
We put the 3 dots in the middle to express the fact that there are more elements that
we have not listed (perhaps to save time and space). 4

The Last Supper, ca. 1520, by Giovanni Pietro Rizzoli.

The next example is a set with another set as an element.


1. SETS, SUBSETS, AND SET OPERATIONS 3

Example 1.3. Fix S = {1, 5, {4, 6}, 3}. This set has four elements. We have
1, 5, 3, {4, 6} ∈ S, but 4 ∈
/ S. However, 4 ∈ {4, 6} and {4, 6} ∈ S. 4

It can be confusing when sets are elements of other sets. You might ask why
mathematicians would allow such confusion! It turns out that this is a very useful
thing to allow; just like when moving, the moving truck (a big box) has boxes inside
of it, each containing other things.

Advice 1.4. You can think of sets as boxes with objects inside. So we could
view the set {1, 5, {4, 6}, 3} from the previous example as the following box,
which contains another box:

1 5 4 6 3

1.B Naming sets


We’ve seen that capitalized Roman letters can be used to give names to sets. Some
sets are used so often that they are represented by special symbols. Here are a couple
of examples.
• The set of natural numbers is the set

N = {1, 2, 3, . . .}.

This is the first example we’ve given of an infinite set, i.e., a set with infinitely
many elements.
• The set of integers is

Z = {. . . , −3, −2, −1, 0, 1, 2, 3, 4, . . .}.

The dots represent the fact that we are leaving elements unwritten in both
directions. We use the fancy letter “Z” because the word “integer” in German
is “Zahlen.”
Some sets are constructed using rules. For example, the set of even integers can
be written as
{. . . , −4, −2, 0, 2, 4, . . .}
but could also be written in the following ways:

(1.5) {2x : x ∈ Z}
(1.6) {x ∈ Z : x is an even integer}
(1.7) {x : x = 2y for some y ∈ Z}.
4 CHAPTER I. SET THEORY

We read the colon as “such that,” so (1.5) is read as “the set of elements of the form
2x such that x is an integer.” Writing sets with a colon is called set-builder notation.
Notice that
{x ∈ Z : 2x + 1}
doesn’t make any sense, since “2x + 1” is not a condition on x.
Here are a few more examples. The set of prime numbers is

{2, 3, 5, 7, 11, 13, . . .} = {x ∈ N : x is prime}.

Similarly, Apostles = {x : x was one of the original 12 apostles of Jesus}.


With set-builder notation, we can list a few more very important sets.
• The set of rational numbers is

Q = {a/b : a, b ∈ Z and b 6= 0}.

Note that there is no problem with the fact that different fractions can represent
the same rational number, such as 1/2 = 2/4. Repetitions do not matter in
sets. We will occasionally need the fact that we can always write a rational
number as a fraction a/b in lowest terms: i.e., so that a and b have no common
factor larger than 1. We will prove this in Section 18 (see Exercise 18.6).
• The set of real numbers is

R = {x : x has a decimal expansion}.



So we have π = 3.14159√. . . ∈ R, 3 = 3.00000 . . . ∈ R, and 2 ∈ R. Later in
this book we will prove 2 ∈ / Q.
• The set of complex numbers is

C = {a + bi : a, b ∈ R, i2 = −1}.

Is 3 a complex number? Yes, because we can take a = 3 and b = 0. So we have


3 ∈ N, 3 ∈ Z, 3 ∈ Q, 3 ∈ R, and 3 ∈ C!

Example 1.8. Which of the named sets does π = 3.14159 . . . belong to? We have
π ∈ R and π ∈ C. On the other hand, since 3 < π < 4 we have π ∈
/ N and π ∈
/ Z. It
is true, but much harder to show, that π ∈
/ Q. 4

There is one more set we will give a special name.


• The empty set is the set with no elements. We write it as ∅ = { }.

Warning 1.9. The empty set is not nothing. It has no elements, but the empty
set is something. Namely, it is “the set with nothing in it.”
Thinking in terms of boxes, we can think of the empty set as an empty box.
The box is something even if it has nothing in it.
The symbol ∅ does not mean nothing. It means { }.
1. SETS, SUBSETS, AND SET OPERATIONS 5

Example 1.10. Sometimes we want the empty set to be an element of a set. For
instance, we might take
S = {∅}.
The set S has a single element, namely ∅. We could also write S = {{ }}. In terms of
boxes, S is the box containing an empty box. Note that not all sets have the empty
set as an element. 4

A box with an empty box inside, representing {∅}.

1.C Subsets
In many activities in life we don’t focus on all the elements of a set, but rather on
subcollections. To give just a few examples:
• The set of all phone numbers is too large for most of us to handle. The subcol-
lection of phone numbers of our personal contacts is much more manageable.
• If we formed the set of all books ever published in the world, this set would be
very large (but still finite!). However, the subcollection of books we have read
is much smaller.
• If we want to count how many socks we own, we could use elements of the
integers Z, but since we cannot own a negative number of socks, a more natural
set to use would be the subcollection of nonnegative integers

Z≥0 = {0, 1, 2, 3, . . .}.

A subcollection of a set is called a subset. When A is a subset of B we write


A ⊆ B and if it is not a subset we write A * B. There are a couple different ways to
think about the concept of A being a subset of B.

Option 1: To check that A is a subset of B, we check that every element of A also


belongs to B.
Example 1.11. (1) Fix A = {1, 5, 6} and B = {1, 5, 6, 7, 8}. Is A a subset of B?
Yes, because we can check that each of A’s three elements, 1, 5, and 6, belongs
to B.
(2) Fix A = {6, 7/3, 9, π} and B = {1, 2, 6, 7/3, π, 10}. Is A ⊆ B? No, because
9 ∈ A but 9 ∈
/ B. So we write A * B.
(3) Fix A = N and B = Z. Is A ⊆ B? Yes, every natural number is an integer.
(4) Is Z a subset of N? No, because Z has the element −1, which doesn’t belong
to N. 4
6 CHAPTER I. SET THEORY

Option 2: To check that A is a subset of B, we check that we can form A by throwing


out some of the elements of B.
Example 1.12. (1) Fix A = {1, 5, 6} and B = {1, 5, 6, 7, 8}. Is A a subset of B?
Yes, because we can throw away 7 and 8 from B to get A.
(2) Fix A = {6, 7/3, 9, π} and B = {1, 2, 6, 7/3, π, 10}. Is A a subset of B? No,
because as we throw away elements of B, we can never get 9 inside.
(3) Fix A = N and B = Z. Is A a subset of B? Yes, because we can throw away
the negative integers and 0 to get the natural numbers.
(4) Is Z a subset of N? No, because we cannot get −1 by throwing away elements
from N. 4
When we write A ⊆ B, the little line segment at the bottom of “⊆” means that
there is possible equality. (Just like x ≤ y means that x is less than or equal to y.)
Sometimes we do not want to allow equality. We use the following terminology in
this case.

Definition 1.13. If A ⊆ S and A 6= S, we say that A is a proper subset of S,


and we write A ( S.

Note that the symbol ( is different from *. If A ( B, then A is a subset of B


that is not equal to B, while if A * B, then A is not a subset of B.
Example 1.14. We have {1, 2} ( {1, 2, 3}. Of course {1, 2} ⊆ {1, 2, 3} is also
true. 4

Warning 1.15. Some authors use ⊂ instead of ⊆. Other authors use ⊂ instead
of (. Thus, there can be a lot of confusion about what ⊂ means, which is one
reason why we will avoid that notation in this book!

Warning 1.16. Many students learning about subsets get confused about the
difference between being an element and being a subset. Consider your music
library as a set. The elements are the individual songs. Playlists, which are
collections of some of the songs, are subsets of your library.

Example 1.17. The elements of C are complex numbers like 3+6i or −2.7−5.9i. The
subsets of C are sets of complex numbers like {5.4 − 7.3i, 9 + 0i, −2.671 + 9.359i}. 4
Example 1.18. (1) Fix T = {1, 2, 3, 4, 5}. Is 2 an element or a subset of T ? It
is an element, since it lives inside T . It is not a subset, since it isn’t a set of
elements of T .
(2) Fix U = {−5, 6, 7, 3}. Is {6} an element or a subset of U ? It is not an element
of U , since the set {6} isn’t in its list of elements. It is a subset because it is a
box whose elements come from U .
1. SETS, SUBSETS, AND SET OPERATIONS 7

(3) Fix X = {{6}, {7, 8}, {5, 8}}. Is 7 an element or a subset of X? Neither! It is
not one of the three elements listed in X, and it is not a box of elements in X
either.
Is {7, 8} an element or a subset of X? It is an element, since it is one of the
three listed elements. It is not a subset, even though it is a box, since it has
elements that don’t belong to X.
(4) Fix Y = {5, {5}}. Is {5} an element or a subset of Y ? It is both! It is an
element, since it is the second element listed inside Y . It is also a subset of Y ,
since it is a box containing the first element of Y . 4
It can be useful to construct sets satisfying certain properties in relation to one
another. In the following example we show how this can be done.
Example 1.19. We will find three sets A, B, C satisfying the following conditions:
(1) A ⊆ B,
(2) A ∈ C, and
(3) C ⊆ B with C 6= B (i.e., C ( B).
One method to solve this problem is to start with the simplest sets possible and
modify them as needed. So let’s start with
A = { }, B = { }, C = { }.
We see that condition (1) is fulfilled, but condition (2) is not. To force condition (2)
to be true, we must make A an element of C. Thus, our new sets are
A = { }, B = { }, C = {A}.
Condition (1) still holds, and condition (2) is now true. However, condition (3) doesn’t
hold. To make (3) true, we need B to have all the elements of C and at least one
more. So we take
A = { }, B = {A, 1}, C = {A}.
We double-check that all of the conditions hold (which they do), and so we have our
final answer. 4

1.D Cardinality
The number of elements in a set is called its cardinality. For instance, if we take
S = {1, 2, 3}, there are 3 elements. We write |S| = 3 to denote the fact that S has
cardinality 3. Note that |∅| = 0 but |{∅}| = 1. A set is finite if its cardinality is either
0 or a natural number, and it is infinite otherwise. In a later section in the book, we
will talk about a better way to define cardinality for infinite sets.
Example 1.20. If T = {5, {6, 7, 8}, {3}, 0, ∅}, the cardinality is |T | = 5. 4
In mathematics, we sometimes use the same symbols for two different things. The
meaning of the symbols must be deduced from their context. For instance, if we
write |−3.392| this is certainly not the cardinality of a set, but instead it is probably
referring to the absolute value of a number. In the next example, we use | · | in two
different ways.
8 CHAPTER I. SET THEORY

Example 1.21. If T = {x ∈ Z : |x| < 4}, what is |T |?


(Hint: It is bigger than 4.) 4

1.E Power sets


In this subsection we define the power set and give some examples.

Definition 1.22. Let S be a set. The power set of S is the new set P(S) whose
elements are the subsets of S. In other words, A ∈ P(S) exactly when A ⊆ S.

The next example determines the power set of a small set S.


Example 1.23. Can we list all of the subsets of S = {1, 2, 3}? If we think about
subsets as “boxes containing only elements of S”, we just have to list all possibilities.
They are as follows:

P(S) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.

Why is the empty set one of the subsets? Is it really a box containing only elements
of S? Yes, its elements (there are none!) all belong to S. Thinking about it in terms
of “throwing away” elements of S, we threw all of them away.
Why is S ⊆ S? Because S is a box containing only elements of S. Thinking in
terms of “throwing away” elements, we threw away none of the elements. 4
If S is a finite set, we can determine the size of the power set |P(S)| from |S|.

Theorem 1.24. If |S| = n, then |P(S)| = 2n .

Here is a sketch of why this is true. To form a subset of S, for each element in S we
choose to keep or throw away that element. Thus, there are 2 choices for each element.
Since there are n elements, this gives 2n options.
Example 1.25. For the set S = {1, 2, 3} we have |S| = 3. Thus the power set has
cardinality |P(S)| = 23 = 8. This is exactly the number of elements we listed in
Example 1.23. 4
Example 1.26. How many elements will the power set of U = {1, ∅} have? The set
U has two elements, so there should be 22 = 4 subsets. They can be listed as:

P(U ) = {∅, {1}, {∅}, U }.

Which of these are proper subsets of U ? (All of them except U itself.) 4


Example 1.27. List three elements of P(N), each having different cardinality, and
one being infinite.
Here is one possible answer: {1, 7}, {67, 193, 91948}, and {2, 4, 6, 8, 10, . . .}. There
are many other correct choices. 4
1. SETS, SUBSETS, AND SET OPERATIONS 9

1.F Unions and intersections


There are multiple ways to modify sets. When there are two sets S and T , we can
put them together to form a new set called the union, and we write

S ∪ T = {x : x ∈ S or x ∈ T }.

This is the set of elements that belong to S or T or both of them. (When we use the
word “or” in this book, we will almost always use the inclusive meaning.) Pictorially,
we can view this set using a Venn diagram as follows.

S T

Figure 1.28: The union of S and T .

Similarly, given two sets S and T we can form the set of elements that belong to
both of them, called the intersection, and we write

S ∩ T = {x : x ∈ S and x ∈ T }.

The Venn diagram is the following.

S T

Figure 1.29: The intersection of S and T .

Example 1.30. Fix A = {1, 6, 17, 35} and B = {1, 5, 11, 17}. Then

A ∪ B = {1, 5, 6, 11, 17, 35}, A ∩ B = {1, 17}. 4

Example 1.31. Find sets P, Q with |P | = 7, |Q| = 9, and |P ∩ Q| = 5. How big is


|P ∪ Q|?
10 CHAPTER I. SET THEORY

We start by fixing P to be the easiest possible set with 7 elements, namely fix
P = {1, 2, 3, 4, 5, 6, 7}. Since Q must share 5 of these elements, but have 9 elements
total, we could write Q = {1, 2, 3, 4, 5, 8, 9, 10, 11}.
For the example we constructed, we have P ∪ Q = {x ∈ N : x ≤ 11}, so
|P ∪Q| = 11. If we chose other sets P and Q, could |P ∪Q| be different? (Answer: No.
The given numbers determine the cardinality of each piece in the Venn diagram.) 4

1.G Complements and differences


Let S and T be sets. The difference of T and S is

T − S = {x : x ∈ T and x ∈
/ S}.

The Venn diagram is as follows.

S T

Figure 1.32: The difference of T and S.

Example 1.33. Fix S = {1, 2, 3, 4, 5, 6, 7} and fix T = {6, 7, 8, 9}. We find that
T − S is the set
T − S = {8, 9}.
Notice that we do not need to worry about those elements of S that do not belong to
T . We only have to take away the part the two sets share. So T − S = T − (S ∩ T ).
Also notice that S − T = {1, 2, 3, 4, 5}, which is different from T − S. 4

Example 1.34. Let A and B be sets. Assume |A| = 16 and |B| = 9. If |A ∩ B| = 2,


what are |A − B| and |B − A|?
There are only two elements that A and B share, thus |A−B| = 14 and |B−A| = 7.
Can you now figure out |A ∪ B|? (Hint: Draw the Venn diagram.) 4

Occasionally we will be working inside some set U , which we think of as the


universal set for the problem at hand. For instance, when solving quadratic equations,
such as x2 − x + 2 = 0, your universal set might be the complex numbers C.
Given a subset S of the universal set U , we write S = U − S, and call this the
complement of S (in the universal set U ). The Venn diagram follows.
1. SETS, SUBSETS, AND SET OPERATIONS 11

Figure 1.35: The complement of a set S inside a universal set U .

Example 1.36. Fix U = N, and fix P = {2, 3, 5, 7, . . .}, which is the set of primes.
What is P ? This is the set of composite numbers and 1, or in other words we have
P = {1, 4, 6, 8, 9, . . .}. 4

1.H Exercises
Exercise 1.1. Each of the following sets is written in set-builder notation. Write the
set by listing its elements. Also state the cardinality of each set.
(a) S1 = {n ∈ N : 5 < |n| < 11}.
(b) S2 = {n ∈ Z : 5 < |n| < 11}.
(c) S3 = {x ∈ R : x2 + 2 = 0}.
(d) S4 = {x ∈ C : x2 + 2 = 0}.
(e) S5 = {t ∈ Z : t5 < 1000}. (This one is slightly tricky.)

Exercise 1.2. Rewrite each of the following sets in the form


{x ∈ S : some property on x},
just as we did in (1.6) above, by finding an appropriate property.
(a) A1 = {1, 3, 5, 7, 9, . . .} where S = N.
(b) A2 = {1, 8, 27, 64, . . .} where S = N.
(c) A3 = {−1, 0} where S = {−1, 0, 1}.

Exercise 1.3. Write the following sets in set-builder notation.


(a) A = {. . . , −10, −5, 0, 5, 10, 15, . . .}.
(b) B = {. . . , −7, −2, 3, 8, 13, 18, . . .}.
(c) C = {1, 16, 81, 256, . . .}.
(d) D = {. . . , 1/4, 1/2, 1, 2, 4, 8, 16, . . .}.

Exercise 1.4. Give specific examples of sets A, B, and C satisfying the following
conditions (in each part, separately):
(a) A ∈ B, B ∈ C, and A ∈ / C.
(b) A ∈ B, B ⊆ C, and A * C.
(c) A ( B, B ∈ C, and A ∈ C.
(d) A ∩ B ⊆ C, A * C, and B * C.
(e) A ∩ C = ∅, A ⊆ B, and |B ∩ C| = 3.
12 CHAPTER I. SET THEORY

Exercise 1.5. Fix A = {1, 2}. Find P(A), and then find P(P(A)). What are the
cardinalities of these three sets?
Exercise 1.6. Let a, b ∈ R with a < b. We define four interval notations, as follows:
The closed interval [a, b] is the set {x ∈ R : a ≤ x ≤ b}.
The open interval (a, b) is the set {x ∈ R : a < x < b}.
One type of half-open interval [a, b) is the set {x ∈ R : a ≤ x < b}, and another
type of half-open interval (a, b] is the set {x ∈ R : a < x ≤ b}.
Consider the closed intervals P = [3, 7], Q = [7, 9] and R = [−3, 8]. Give simple
descriptions of the following sets (using interval notation, when possible).
(a) P ∩ Q.
(b) P ∪ Q.
(c) P − Q.
(d) Q − P .
(e) (R ∩ P ) − Q.
(f) (Q ∪ P ) ∩ R.
(g) Q ∪ (P ∩ R).
Exercise 1.7. Consider the following blank Venn diagram for the three sets A, B, C.

B C

For each of the following sets, copy the Venn diagram above, and then shade in the
named region:
(a) A − (B ∩ C).
(b) A − (B − C).
(c) B − (A − C).
(d) (B ∩ C) ∩ (B ∪ A).
(e) (A − B) ∪ (A − C).
Exercise 1.8. Two sets S and T are disjoint if they share no elements. In other
words S ∩ T = ∅. Which of the following sets are disjoint? Give reasons.
(a) The set of odd integers and the set of even integers.
(b) The natural numbers and the complex numbers.
(c) The prime numbers and the composite numbers.
(d) The rational numbers and the irrational numbers (i.e., real numbers that are
not rational).
Exercise 1.9. Find some universal set U and subsets S, T ⊆ U , such that |S −T | = 3,
|T − S| = 1, |S ∪ T | = 6, and |S| = 2. (Write each of U , S, and T by listing their
elements.)
2. PRODUCTS OF SETS AND INDEXED SETS 13

2 Products of sets and indexed sets


2.A Cartesian products
Sets are unordered lists of elements. There are situations where order matters. For
instance, you probably don’t want to put your shoes on before your socks. To give a
more mathematical example, if we square a number and then take its cosine, that is
not the same as first taking the cosine and then squaring:

cos(x2 ) 6= (cos(x))2 .

There are other situations where we want to keep things ordered. We will write (x, y)
for the ordered pair where x occurs first and y occurs second. Thus (x, y) 6= (y, x)
even though {x, y} = {y, x}. Also, an element can be repeated in an ordered list,
such as (1, 1), while sets do not count repetitions.
There is a very nice notation for sets of ordered pairs.

Definition 2.1. Let S and T be two sets. The Cartesian product of these sets
is the new set
S × T = {(s, t) : s ∈ S, t ∈ T }.
This is the set of all ordered pairs such that the first entry comes from S and
the second entry comes from T . We will often refer to S × T just as the product
of S and T .

We will now give an example of how to find simple Cartesian products.

Example 2.2. Fix S = {1, 2, 3} and T = {1, 2}. What is S × T ? It is the set
{(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2)}. Notice that 3 can occur as a first coordinate
since 3 ∈ S, but not as a second coordinate since 3 ∈ / T.
While the order matters inside an ordered pair, we could have listed the elements
of S × T in a different order since S × T is itself just a set (and order is irrelevant in
sets). So we could have written

S × T = {(1, 2), (2, 2), (3, 1), (1, 1), (2, 1), (3, 2)}.

However,
S × T 6= T × S = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}. 4

You might notice that in the previous example we have |S×T | = 6 = 3·2 = |S|·|T |.
This is not an accident. In fact, the following is true, although we do not as yet have
the tools to prove it.

Proposition 2.3. Let A and B be finite sets, with |A| = m and |B| = n. Then
A × B is a finite set, with |A × B| = mn.
14 CHAPTER I. SET THEORY

Sets do not need to be finite in order to act as components in products.

Example 2.4. Fix A = N and fix B = {0, 1}. What are the elements of A × B?
They are listed in the set as

A × B = {(1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1), . . .} = {(n, 0), (n, 1) : n ∈ N}.

Is A × B the same set as B × A? No, they have different elements. For instance,
(1, 0) ∈ A × B, but (1, 0) ∈
/ B × A since 0 ∈
/ A. 4

In each of the previous examples, we took the Cartesian product of two different
sets. If we take the product of a set with itself, we sometimes write A2 = A × A. The
following example is one of the most useful products of a set with itself.

Example 2.5. The set R2 = R × R is called the Cartesian plane. We view elements
in this set as points {(x, y) : x, y ∈ R}.

The Cartesian plane, R × R

The set S × T in Example 2.2 is a subset of R × R. We can graph it as follows:


y

{1, 2, 3} × {1, 2}
2. PRODUCTS OF SETS AND INDEXED SETS 15

Similarly, the set A × B from Example 2.4 is graphed as:


y

···

x· · ·

N × {0, 1}

We can now describe more complicated sets. For instance


{(x, y) ∈ R × R : y = 3x + 1}
is a line. The set R2 − {(0, 0)} is the punctured plane (the plane with the origin
removed). Can you describe a simple parabola? 4
The following example addresses the question: What do we do if one of the sets
has no elements?
Example 2.6. We determine {1, 2, 3} × ∅. Elements of this set are ordered pairs
of the form (a, b), with a ∈ {1, 2, 3} and b ∈ ∅. Thus, there are no possible choices
for the second coordinate b, and so {1, 2, 3} × ∅ = ∅. Note that 3 · 0 = 0, and so
Proposition 2.3 works in this case too. 4
Just as with ordered pairs, we can form the set of ordered triples
A × B × C = {(a, b, c) : a ∈ A, b ∈ B, c ∈ C}.
We can similarly form ordered quadruples, ordered quintuples, and so forth. The
next subsection will give us the tools necessary to talk about even more complicated
constructions.

2.B Indices
When we have a large number of sets, rather than writing them using different letters
of the alphabet
A, B, C, D, . . . , Z
it can be easier to use subscripts
A1 , A2 , A3 , A4 , . . . , A26 .
This notation is extremely powerful for the following reasons:
16 CHAPTER I. SET THEORY

• The notation tells us how many sets we are working with, using a small number
of symbols. For instance, if we write A1 , A2 , . . . , A132 , we know that there are
exactly 132 sets. (Try writing them down using different letters of the alphabet!)
• We can even talk about an infinite number of sets A1 , A2 , A3 , . . .. Notice that
the subscripts all come from the set N. We refer to N as the index set for this
collection.
• Using indices we can form complicated unions, intersections, and Cartesian
products.
Example 2.7. Fix A1 = {1, 2, 4}, A2 = {−3, 1, 5, 9}, and A3 = {1, 6, 10}. We find
3
[
Ai = A1 ∪ A2 ∪ A3 = {−3, 1, 2, 4, 5, 6, 9, 10}
i=1

and
3
\
Ai = A1 ∩ A2 ∩ A3 = {1}.
i=1
Those who have seen summation notation
X 3
i2 = 12 + 22 + 32
i=1

will recognize where this notation comes from. 4


Can we form infinite unions and intersections? This is actually a common occur-
rence.
Example 2.8. Fix B1 = {1, −1}, B2 = {2, −2}, B3 = {3, −3}, and so forth. In other
words Bn = {n, −n} for each n ∈ N. (Notice that while the subscripts come from N,
the elements of the sets Bn come from Z.)
The union is the set of elements that belong to at least one of the sets; thus,
[∞
Bn = {. . . , −3, −2, −1, 1, 2, 3, . . .} = Z − {0}.
n=1

The intersection is the set of elements that belong to every one of the sets; thus,

\
Bn = { } = ∅. 4
n=1

There is an alternative way to write intersections and unions, using index sets.
For instance, using the notation in the previous two examples, we could also write
3
\ \
Ai = A1 ∩ A2 ∩ A3 = Ai
i=1 i∈{1,2,3}

and ∞
[ [
Bn = Bn .
n=1 n∈N
There is nothing to limit our index set, so we can make the following broad definition.
2. PRODUCTS OF SETS AND INDEXED SETS 17

Definition 2.9. Let I be any set, and let Si be a set for each i ∈ I. We put
[
Si = {x : x belongs to Si for some i ∈ I},
i∈I

and when I is nonempty


\
Si = {x : x belongs to Si for each i ∈ I}.
i∈I

The next example shows, once again, how mathematics has the uncanny ability
to express information in varied subjects using very simple notation.
Example 2.10. Fix A = {a,b,c,d, . . . , z}, which is the “lowercase English alphabet
set.” This set has twenty-six elements. Fix V = {a,e,i,o,u}, which is the “standard
vowel set.” Notice that V ( A.
Given α ∈ A, we fix Wα to be the set of words in the English language containing
the letter α. Note that α is a dummy variable, standing in for an actual element of
A. For instance, if α = x then we have
Wx = {xylophone, existence, axiom, . . .},
while if α = t then we have
Wt = {terminator, atom, attribute, . . .}.
Each set of words Wα is a subset of the universal set of all words in the English
language.
Try to answer
T the following questions:
(1) What is α∈V Wα ?
(2) Is that set
S empty?
(3) What is α∈V Wα ?
(4) Is that set empty?
Here are the answers. (Look at them only after you have your own!)
(1) This is the set of words that contain every standard vowel.
(2) It isn’t empty, since it contains words like “sequoia,” “evacuation,” etc.
(3) This is the set of words with no standard vowels. (Don’t forget that there is a
bar over the union.)
(4) It isn’t empty, since it contains words like “why,” “tsktsk,” etc. 4
We finish with one more difficult example.
S
Example 2.11. We determine x∈[1,2] [x, 2] × [3, x + 3].
First, to get a footing on this problem, we try to understand what happens for
certain values of x. The smallest possible x value in the union is when x = 1.
There we get that [x, 2] × [3, x + 3] = [1, 2] × [3, 4]. This is the set of ordered pairs
{(x, y) ∈ R2 : 1 ≤ x ≤ 2 and 3 ≤ y ≤ 4}. This is just a box in the plane. Its graph
is the first graph below.
18 CHAPTER I. SET THEORY

y y

x x

[1, 2] × [3, 4] {2} × [3, 5]

The largest possible x value in the union is when x = 2. There we get that
[x, 2] × [3, x + 3] = [2, 2] × [3, 5]. Notice that [2, 2] = {2} is just a single point. Now
{2} × [3, 5] is a line segment in the plane, where the x-value is 2 and the y-values
range from 3 to 5. Its graph is the second graph above.
If we consider the intermediate value x = 1.5, we get the box [1.5, 2] × [3, 4.5],
graphed below on the left.

y y

x x

[
[1.5, 2] × [3, 4.5] ([x, 2] × [3, x + 3])
x∈[1,2]

Taking the union over all x ∈ [1, 2], we get the region graphed above on the right,
boxed in by the lines x = 1, y = 3, x = 2, and y = x + 3.
4

2.C Exercises
Exercise 2.1. Sketch each of the following sets in the Cartesian plane R2 .
(a) {1, 2} × {1, 3}.
(b) [1, 2] × [1, 3].
(c) (1, 2] × [1, 3]. (Hint: If an edge is missing, use a dashed, rather than solid, line
for that edge.)
(d) (1, 2] × {1, 3}.
2. PRODUCTS OF SETS AND INDEXED SETS 19

Exercise 2.2. Fix A = {s, t} and B = {0, 9, 7}. Write the following sets by listing
all of their elements.
(a) A × B.
(b) B × A.
(c) A2 .
(d) B 2 .
(e) ∅ × A.

Exercise 2.3. For each of the following sentences, state whether it is “True” or
“False,” and provide a reason for your answer.
(a) If |A| = 3 and |B| = 4, then |A × B| = 7.
(b) It is always true that A × B = B × A when A and B are sets.
(c) Assume I is T a nonemptyS indexing set, and let Si be a set for each i ∈ I; we
always have i∈I Si ⊆ i∈I Si .
(d) There exist distinct sets S1 , S2 , S3 , . . ., each of which is infinite, but

\
Si
i=1

has exactly one element.


(e) The set A4 consists of ordered triples from A.

Exercise 2.4. Using the notations from Example 2.10, write the following sets (pos-
sibly using intersections or unions).
(a) The set of words containing all four of the letters “a,w,x,y.”
(b) The set of words not containing any of the letters “s,t,u.”
(c) The set of words containing both of the letters “p,r” but not containing any of
the standard vowels. (Is this set empty?)

Exercise 2.5. For each number r ∈ R, consider the “parabola shifted by r” defined
as:
Pr = {(x, y) ∈ R2 : y = x2 + r}.
Give simple descriptions of the following sets. Your descriptions should not refer to
the dummy variable “r” or use any unions or intersections. Also graph the sets in
the Cartesian
S plane.
(a) Sr∈R Pr .
(b) Sr>0 Pr .
(c) Tr6=0 Pr .
(d) Tr∈R Pr .
(e) r>0 Pr .
(When we write r > 0 we simply mean that we have restricted the dummy variable
r to the subset of positive reals. Similarly, r 6= 0 means that we have restricted r to
the subset of nonzero real numbers.)
20 CHAPTER I. SET THEORY
Chapter II

Logic

I am convinced that the act of thinking logically cannot possibly be natural to the hu-
man mind. If it were, then mathematics would be everybody’s easiest course at school
and our species would not have taken several millennia to figure out the scientific
method. Neil deGrasse Tyson

At higher levels, mathematics is about proving theorems. A study of logic is


central to any endeavor involving proof. In this chapter, we introduce the study of
logic, beginning with the basic building blocks (statements) and the different ways of
connecting them (logical connectives).
Of particular significance will be the study of implication. Many important the-
orems in mathematics are stated as implications. For instance, the Mean Value
Theorem in calculus is:
If a function f is continuous on a closed interval [a, b] and differentiable on the
open interval (a, b), then there is some c ∈ (a, b) such that

f (b) − f (a)
f 0 (c) = .
b−a

This is an implication; if a certain condition is true, then some result is implied


and can be inferred to be true.
In addition to logical connectives, this chapter will introduce quantifiers, which are
also very common in mathematical writing. As an example, the Mean Value Theorem
(stated above) includes the quantified phrase “there is some c ∈ (a, b).” Proper
understanding and use of quantifiers is essential to reading and writing mathematics.

21
22 CHAPTER II. LOGIC

3 Statements
3.A What is a statement?

Definition 3.1. A statement is a declarative sentence that has a truth value.

By a declarative sentence we mean a sentence that makes an assertion. This


assertion can in fact be false; in that case we say that the statement is false. Examples
of statements include the following:
• The number 3 is larger than the number 2.
• The sun is blue.
• There are exactly 100,000 words in this book.
• The number 7 is an odd integer.
• Birds are mammals.
Each of these statements has a truth value. The first and fourth statements are true,
the second and fifth are false, and the third can be determined to be true or false by
counting the words in this book. Whether we know the truth value of a sentence is
irrelevant when deciding whether the sentence is a statement; what is important is
that the truth value exists.
Often in mathematics it is desirable to use symbols to denote objects. If we wish
to use a symbol to stand for a statement, we will often use the letters P , Q, or R
(although any symbol could be used). Since many mathematical statements involve
an equals sign, we will not use an equals sign to describe a statement being assigned
to a symbol; instead, we will use a colon. Hence, if we write

P : 2 is an even number,

we are stating that the symbol P will stand for the statement “2 is an even number.”
(Note that in the display above, the sentence “2 is an even number” does not end
with a period, since it is part of a larger sentence. Sentences should always end in
periods when not being quoted or included in larger sentences.)
Sentences that are not statements could include questions (“What is the color of
the sky?”), commands (“Solve the equation!”), or opinions (“Chocolate ice cream is
the best!”). Moreover, words that don’t actually form sensible sentences do not have
truth values (“Try apples is”). In addition, sentences that involve variables, such
as “x is greater than 2,” are not statements, unless the variables are given specific
values. (We will talk more about sentences containing variables in the next section.)

3.B Logical connectives


Given several statements, we will often want to combine them in ways to create more
complex statements. There are a number of different operations that can be used to
combine or modify statements.
3. STATEMENTS 23

Definition 3.2. Let P and Q be statements. The conjunction of P and Q,


written
P ∧ Q,
is a statement that is true if both P and Q are true, and false otherwise.

When reading the symbols P ∧ Q, we will say “P and Q.”

Example 3.3. If we have the statements:

P : 2 is an even number,

and
Q: 5 is an even number,
then the statement P ∧ Q would be

2 is an even number and 5 is an even number.

This is a false statement, since Q is false. 4

Definition 3.4. Let P and Q be statements. The disjunction of P and Q,


written
P ∨ Q,
is a statement that is true if P is true, or if Q is true, or if both are true; it is
false otherwise.

When reading the symbols P ∨ Q, we will say “P or Q.”

Example 3.5. For the statements P and Q in Example 3.3, P ∨ Q would be the
statement
2 is an even number or 5 is an even number.
In this case P ∨ Q is true, since P is true. 4

Warning 3.6. If both P and Q are true, then P ∨ Q is true. This is not the
way the word “or” is usually interpreted in the English language. For instance,
if I say to my daughter “You may have an ice cream cone or you may have a
candy bar,” I typically do not mean that she can have both. Thus, P ∨ Q really
means “either P or Q or both,” but that is too wordy for common use, so we
just say “P or Q”.
24 CHAPTER II. LOGIC

Definition 3.7. Let P be a statement. The negation of P , written

¬P,

is a statement that is true if P is false, and false if P is true.

The symbols ¬P may be read as “not P .” If we wish to express the meaning behind
¬P we might say “it is not the case that P holds,” or “P is false.”

Example 3.8. If we have the statement

P : 2 is an even number

(which is a true statement), then ¬P would be the statement

it is not the case that 2 is an even number

or, in other words,


2 is not an even number,
which is a false statement. 4

Example 3.9. Let’s negate the statement

P : It is raining in London.

You probably do not know whether this statement is true or false. Nevertheless we
can still negate the sentence. The negation is

¬P : It is not raining in London. 4

Advice 3.10. To see that the meaning of the negation of P is the same as “P
is false” consider two cases.
If P is true, the statement “P is false” is then false. Hence, it has the opposite
truth value as P .
If, on the other hand, P is false, then the statement “P is false” is a true
statement, so again, it has the opposite truth value as P .
Often, it is easier to understand (or maybe just shorter to say) “P is false”
than to say “it is not the case that P .” However, inserting the phrase “it is not
the case that” at the beginning of a sentence P has the advantage that it will
generally form a grammatically correct sentence when combined with the words
comprising P .
3. STATEMENTS 25

Warning 3.11. Typically, if we are asked to negate a statement, the intent


is to write a statement that will have the opposite truth value to the original
statement, regardless of whether the original statement is known to be true or
false. For instance, if asked to negate the statement

P : 2 is an even number

(which is true), it would not be correct to write

¬P : The sun is blue

(which is false), because the fact that these two statements have opposite truth
values depends on knowing the truth values of each statement. A correct nega-
tion of the statement P would be the statement

¬P : 2 is not an even number.

The next concept that we define is one of the most important in mathematics.

Definition 3.12. Let P and Q be statements. Then we construct a new state-


ment, written
P ⇒ Q,
that is true unless P is true and Q is false.
A statement of the form P ⇒ Q is called an implication or a conditional
statement. In the implication P ⇒ Q, the statement P is called the premise and
Q is called the conclusion.

We read P ⇒ Q as either “P implies Q,” or as “if P , then Q.”


Example 3.13. Fix P to be the statement “2 is an even number” and fix Q to be the
statement “5 is an even number,” as in Example 3.3. Then the new sentence P ⇒ Q
is the statement

if 2 is an even number, then 5 is an even number,

which is false, since P is true and Q is false. On the other hand, the sentence Q ⇒ P
is the statement

if 5 is an even number, then 2 is an even number,

which is true, since the premise is false. 4


Remark 3.14. To better understand why the symbol ⇒ is defined as it is, we can
think of an implication as a promise, or a contract. Suppose I tell my daughter:

If you clean your room, then you will get ice cream.
26 CHAPTER II. LOGIC

This is an implication, with the premise being the statement


P : You clean your room
and the conclusion being the statement
Q: You will get ice cream.
We now examine this statement to find out under what conditions I am telling the
truth.
First, if my daughter cleans her room and I let her have ice cream, then I have
told the truth and kept my promise. In other words, if P is true and Q is true, then
P ⇒ Q is true.
Second, if my daughter cleans her room and I do not let her have ice cream, then
I have lied. In other words, if P is true and Q is false, then P ⇒ Q is false (a lie).
Third, if my daughter does not clean her room and I let her have ice cream anyway
(perhaps because she did some other duty to deserve the ice cream), then I have not
lied, so my statement is true. I am under no obligation to give her ice cream, but I
do so anyway. Hence, if P is false and Q is true, then P ⇒ Q is true.
Finally, if my daughter does not clean her room and I do not let her have ice
cream, then I have not lied; she did not fulfill the premise of the implication, so I
did not fulfill the conclusion. If P is false and Q is false, the implication P ⇒ Q is
true. N

Warning 3.15. Many students have difficulty with the idea that the statement
P ⇒ Q should be true when P is false and Q is true. It can help to think of
P ⇒ Q as meaning “whenever P is true, Q must also be true, but if P is false,
anything can happen.”

We define one additional way to combine statements, called the biconditional,


below.

Definition 3.16. Let P and Q be statements. The biconditional of P and Q,


written
P ⇔ Q,
is a statement that is true if P and Q have the same truth value, and false
otherwise.

We read P ⇔ Q as “P if and only if Q.” We can also think of it as meaning that P


is true exactly when Q is true.
Example 3.17. Suppose P is the statement “2 is an even integer” and Q is the
statement “5 is an even integer.” Then P ⇔ Q is the statement
2 is an even integer if and only if 5 is an even integer.
This is a false statement, since P is true and Q is false. 4
3. STATEMENTS 27

In a sense that we will see later, P ⇔ Q is the same as saying that P ⇒ Q and
Q ⇒ P.
We have discussed a number of ways to combine and modify statements to form
more complex statements. We next introduce terminology to describe the general
situation.

Definition 3.18. A logical connective is a symbol that represents a way to


convert an ordered list of statements into a new statement whose truth value
depends only on the truth values (in the same order) of the original statements.

Examples of logical connectives are ∧, ∨, ¬, ⇒, and ⇔. (Other connectives exist;


“exclusive or” is one example.) We summarize the definitions of these symbols in
Table 3.19. In this table, we have a column for each of P , Q, ¬P , P ∧ Q, P ∨ Q,
P ⇒ Q, and P ⇔ Q. We have a row for each possible combination of truth values
of P and Q, and the entries in each row indicate the truth value of the statement at
the top of the column.

P Q ¬P P ∧Q P ∨Q P ⇒Q P ⇔Q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

Table 3.19: Truth values for common connectives.

Extremely complicated statements can be built by using multiple logical connec-


tives. For instance, consider
((P ∨ Q) ∧ (R ∨ (¬S))) ⇒ (P ∧ R).
The component statements P , Q, R, and S, when combined using the logical con-
nectives, form a new statement. It is convenient to consider the letters as variables,
ranging over all possible statements. With this understanding, we have the following
definition.

Definition 3.20. A logical formula is an expression constructed from a set of


variables (that range over statements) using logical connectives.

We may drop the word “logical” when talking about logical formulas, if it is clear
that the variables are ranging over statements.
Example 3.21. Let P , Q, R, and S be variables (ranging over statements). Then
the new expression
(P ∧ (Q ⇒ R)) ∨ (¬(P ⇒ (R ∧ S)))
is a logical formula. (We can drop parentheses in formulas when they are unneeded,
like those around ¬(P ⇒ (R ∧ S)). Hereafter we may do so.) 4
28 CHAPTER II. LOGIC

Example 3.22. The logical formula P ∧ Q represents many statements, depending


on which statements we plug in for the variables P and Q. For example, it represents
“2 is even and 5 is even” by fixing P to be the statement “2 is even” and fixing Q to
be the statement “5 is even.” 4

3.C Logical equivalences


In some cases, we will wish to show that two logical formulas are essentially the same.
We make this notion precise with the following definition.

Definition 3.23. Two logical formulas are logically equivalent if they have the
same truth value regardless of the values of the variables. If R and S are formulas
that are logically equivalent, we write R ≡ S.

The following example will give two formulas that are logically equivalent, and we
show how to prove this equivalence.

Example 3.24. Let P and Q be variables (ranging over statements). The expressions

R: ¬(P ∧ Q)

and
S: (¬P ) ∨ (¬Q)
are logical formulas with variables P and Q. As we plug in statements for the vari-
ables, each of these formulas becomes its own statement with its own truth value.
From the definition of logical connectives, these truth values only depend on the
truth values of the plugged in sentences, not on the sentences themselves.
The table below is called a truth table. It captures every possible combination of
truth values.

P Q P ∧ Q ¬(P ∧ Q) ¬P ¬Q (¬P ) ∨ (¬Q)


T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

We notice immediately that the two boldface columns have identical truth values.
This shows that the formulas R and S are logically equivalent, or, in symbols, that
¬(P ∧ Q) ≡ (¬P ) ∨ (¬Q). 4

When constructing a truth table it is useful to organize the rows in such a way that
you can be sure that all possible combinations of truth values are in fact represented.
If there are n variables, there will be 2n rows. One convenient way to organize them
is to write each variable as a label for a column of the truth table (just as we did in
3. STATEMENTS 29

the previous two tables). For the last variable (the rightmost one), put alternating
truth values of T and F in the column, until there are 2n of them.
For the second to the last variable, fill the corresponding column with alternating
blocks of two Ts and Fs, until all the entries have been filled. Continue from right
to left, doubling the sizes of the blocks, until for the leftmost variable, you write just
one block of Ts and one block of Fs.
In this way, you can (in a systematic way) be certain that all possible combinations
of truth values are written. An example of how this is to be done with three variables
is given below in Example 3.26.
Note that a truth table can have as many columns as is convenient to work out
the truth values arising from a formula in which we are interested; typically, we will
include a column for each intermediate step.
A number of logical equivalences are important enough to be given standard
names.

Theorem 3.25. Let P , Q, and R be variables (ranging over statements).


(1) ¬(¬P ) ≡ P (Double negation),
(2) ¬(P ∧ Q) ≡ (¬P ) ∨ (¬Q) (De Morgan’s law),
(3) ¬(P ∨ Q) ≡ (¬P ) ∧ (¬Q) (De Morgan’s law),
(4) P ⇒ Q ≡ (¬Q) ⇒ (¬P ) (Contrapositive),
(5) P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R) (Distributivity),
(6) P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) (Distributivity),
(7) P ∧ (Q ∧ R) ≡ (P ∧ Q) ∧ R (Associativity),
(8) P ∨ (Q ∨ R) ≡ (P ∨ Q) ∨ R (Associativity),
(9) P ∧ Q ≡ Q ∧ P (Commutativity),
(10) P ∨ Q ≡ Q ∨ P (Commutativity).

Each of the logical equivalences in Theorem 3.25 can be demonstrated by constructing


a truth table. For example, (2) is proved in Example 3.24.
Example 3.26. We prove 3.25(7) by forming the appropriate truth table.

P Q R P ∧Q (P ∧ Q) ∧ R Q∧R P ∧ (Q ∧ R)
T T T T T T T
T T F T F F F
T F T F F F F
T F F F F F F
F T T F F T F
F T F F F F F
F F T F F F F
F F F F F F F

Because the two boldface columns match, the corresponding statements are logi-
cally equivalent. 4
30 CHAPTER II. LOGIC

3.D Tautologies and contradictions


As mentioned before, given a formula, when we plug in statements for its variables,
then the formula becomes its own statement with its own truth value. On rare
occasions the truth value of that new statement does not depend on what we plugged
in for the variables. We give such formulas special names.

Definition 3.28. A logical formula that becomes a false statement for every
possible combination of values of its variables is called a contradiction.

Example 3.29. Let P be a variable (ranging over statements). The formula

P ∧ ¬P

becomes false, regardless of what statement is plugged in for P . (Try it! Form the
truth table to see that this formula always becomes false. The truth table should
have two rows.) 4

Definition 3.30. A logical formula that becomes a true statement for every
possible combination of values of its variables is called a tautology.

Example 3.31. Let P be a variable. Then the formula

P ⇒P

is a tautology. (Try it by forming the truth table!) 4

Example 3.32. Let P and Q be variables. The formula

(P ∧ (P ⇒ Q)) ⇒ Q

is a tautology. This can be seen from the following truth table.

P Q P ⇒ Q P ∧ (P ⇒ Q) (P ∧ (P ⇒ Q)) ⇒ Q
T T T T T
T F F F T
F T T F T
F F T F T

This particular tautology is so useful it has a name: modus ponens. 4

Remark 3.33. All contradictions are logically equivalent to each other. Similarly,
all tautologies are logically equivalent to each other. (Can you see why?) N
3. STATEMENTS 31

3.E Exercises
Exercise 3.1. Determine whether each of the given sentences is a statement. If it is,
indicate its truth value (if you can).
(a) The number 0 is an even integer.
(b) Fix x = 2.
(c) If 2 is an even integer.
(d) Either 2 is even or 4 is odd.
(e) George Washington had seven children.
Exercise 3.2. Let P , Q, and R be variables. Construct a truth table showing the
possible combinations of truth values for each of the following formulas:
(a) (P ∧ Q) ⇒ P .
(b) P ⇒ (P ∨ Q).
(c) (¬(P ⇒ Q)) ∧ (¬P ).
(d) (P ∨ Q) ∧ R.
(e) P ∨ (Q ∧ R).
Exercise 3.3. Let P , Q, and R be variables. Use truth tables to prove the given
logical equivalences.
(a) ¬(P ∧ Q) ≡ (¬P ) ∨ (¬Q).
(b) P ⇒ Q ≡ (¬P ) ∨ Q.
(c) (P ∨ Q) ⇒ R ≡ (P ⇒ R) ∧ (Q ⇒ R)
Exercise 3.4. Let P , Q, and R be variables. In each case, determine whether the
two given formulas are logically equivalent.
(a) ¬(P ⇒ Q) and P ∧ (¬Q).
(b) (P ∧ Q) ⇒ R and P ⇒ ((¬Q) ∨ R).
(c) P ⇒ (Q ∨ R) and (P ∧ ¬Q) ⇒ R.
(d) (P ∨ Q) ⇒ R and ((¬R) ∧ P ) ⇒ (¬Q).
(e) P ⇔ Q and (P ⇒ Q) ∧ (Q ⇒ P ).
Exercise 3.5. Let P , Q, and R be variables. Identify each of the following statements
as a tautology, a contradiction, or neither.
(a) ((P ⇒ Q) ∧ (¬Q)) ⇒ (¬P ).
(b) ((P ∨ Q) ∧ (¬P )) ⇒ Q.
(c) (P ⇒ Q) ⇒ (P ⇒ R).
(d) ((¬Q) ⇒ ¬P ) ∧ (P ∧ ¬Q).
Exercise 3.6. Let P and Q be variables.
(a) Prove that the formula P ⇒ Q is not logically equivalent to Q ⇒ P .
(b) The formula Q ⇒ P is called the converse of P ⇒ Q. Find two statements such
that if they are plugged in for P and Q (respectively), then P ⇒ Q becomes
true but Q ⇒ P becomes false. For the specific statements plugged in for P
and Q in your example, state their truth values.
Exercise 3.7. The following exercise shows that the biconditional can be a useful
logical connective (if you are ever lost in grue infested woods):
32 CHAPTER II. LOGIC

After getting lost in the woods, you stumble upon a path. As you follow the path
it comes to a fork, and a grue blocks your way. There is a sign that reads:

This grue either always tells the truth or always lies. You may ask the
grue a single question. If you ask any more than that, then it will eat you.

You are positive that one of the paths leads home and the other leads to certain
death. Explain why asking the grue the question

Is the statement “the left path is the way home if and only if you are a
truth teller” true?

can help you decide which path to take. (Note that the question is not “Is the left
path the way home?” Also note that the grue’s answer might be a lie.)
4. OPEN SENTENCES 33

4 Open sentences
4.A Open sentences
In many cases, we wish to write a sentence whose truth value depends on variables,
where the variables can take on many different values. Typically, we want each
variable to take on values in some specific set. We call each such set of values the
domain of the corresponding variable.

Definition 4.1. An open sentence is a declarative sentence containing one or


more variables such that when all of the variables are assigned values in their
respective domains, the resulting sentence has a truth value.

Some authors do not explicitly write all open variables that occur in an open
sentence. We will always specify all open variables.

Example 4.2. Let x and y be variables, both with the same domain R. We may
define the open sentence
P (x, y): x > y.

With this definition we see that P (2, 3) is false (since the statement 2 > 3 is false),
P (5, 2) is true, and so on. Note that if we try to plug in a value for x or y outside the
domain, the resulting sentence may be meaningless. For instance, P (apples, oranges)
is meaningless since the sentence “apples > oranges” makes no sense (you can’t
compare apples and oranges). 4

Open sentences are very common throughout mathematics. They can express
quite important and general principles. Here are some examples.

Example 4.3. Fix S to be the set of triangles, and let x be a variable whose domain
is the set S. Then we have an open sentence

P (x): The sum of the (interior) angles of x is 180◦ .

The open sentence P (x) happens to be true for any choice of x ∈ S. This fact is a
very famous (and very old) theorem.
Again taking x to be a variable with domain S, we may write the open sentence

Q(x): One of the angles of x is a right angle.

In this case, it is not true that Q(x) holds for each x ∈ S; instead, Q(x) is true exactly
when x is a right triangle. 4
34 CHAPTER II. LOGIC

Warning 4.4. An open sentence is much like a function from calculus. It can
be thought of as a rule in which, when we replace the variable (or variables)
with elements of the domain, we obtain truth values. Even if an open sentence
is true for each value of the variable, it is not a statement. For instance, if we
let x be a variable with domain equal to the real numbers, the open sentence

P (x): x2 > −1

is true for each possible value of x. Nevertheless, it is not a statement. It is


still a rule that assigns a truth value to every real number. Compare this to the
constant function defined by the rule

f (x) = 2

from algebra. The function f is not equal to the number 2; rather it is a rule
that associates to each value of x the number 2.

We can use logical connectives to combine open sentences similar to how we com-
bine statements. The result of combining open sentences with any of the logical
connectives ∧, ∨, ¬, ⇒, or ⇔ is again an open sentence. This open sentence obtains
a truth value when each of the variables in the component open sentences are given
values. Once these values are fixed, each of the component open sentences becomes a
statement, and the truth value of the new sentence can be evaluated from the truth
values of the components.

Example 4.5. Let x be a variable with domain the set of all triangles, and define
the following open sentences:

P (x): The sum of the angles of x is 180◦

and
Q(x): One of the angles of x is a right angle.
Then, if we plug in a specific right triangle t in place of x, the statement P (t) ∧ Q(t)
is true; however, if we take x to be an equilateral triangle e (so that it cannot be a
right triangle), the statement P (e) ∧ Q(e) is false (since Q(e) is false). 4

Example 4.6. Let x be a variable with domain the set of real numbers. We define
two open sentences:
P (x): x > 3, Q(x): x < 5.
Consider the following open sentences:
(1) P (x) ∧ Q(x),
(2) P (x) ∨ Q(x),
(3) P (x) ⇒ Q(x),
(4) P (x) ⇔ Q(x),
(5) ¬P (x) ∧ ¬Q(x).
4. OPEN SENTENCES 35

Below, we write the set of places these statements are true. Try it for yourself before
looking at the answers.
We will work out (3) in detail. Remember that for a given value of x, we have
P (x) ⇒ Q(x) ≡ ¬P (x) ∨ Q(x).
We know that ¬P (x) is true when x ∈ (−∞, 3]. Also Q(x) is true when x ∈ (−∞, 5).
Thus, ¬P (x) ∨ Q(x) is true when x ∈ (−∞, 3] ∪ (−∞, 5) = (−∞, 5).

All Answers:
(1) (3, 5),
(2) R,
(3) (−∞, 5),
(4) (3, 5),
(5) ∅. 4
Remark 4.7. The previous example demonstrates why logical equivalence is so use-
ful. We know that
P (x) ⇒ Q(x) ≡ ¬P (x) ∨ Q(x)
even before we know the value of x, hence before we know the truth value of P (x)
or Q(x). Thus, we can simplify some open sentences, before we even know what the
components say. N

4.B Quantifiers
We have seen expressions like “for all x ∈ S” several times. Such expressions are
common enough that we create a symbol to communicate such information quickly.

Definition 4.8. Let x be a variable whose domain contains the set S, and let
P (x) be an open sentence. The universal quantification of P (x) over S, written

∀x ∈ S, P (x),

is a statement that is true if P (x) is true for each choice of x ∈ S, and it is false
if P (x) is false for at least one choice of x ∈ S.

The symbol ∀ is read as any of the following (depending on context): “for all”, “for
every”, “for any”, and “for each”. Thus, one may read the statement ∀x ∈ S, P (x)
as “for each x in S, P (x) holds.”
Example 4.9. Fix S to be the set of all triangles, and let x be a variable whose
domain is the set S. Fix P (x) to be the open sentence
P (x): The sum of the angles of x is 180◦ .
Then the statement “∀x ∈ S, P (x)” means “for any x in the set of triangles, the sum
of the angles of x is 180◦ .” We may simplify this a bit by reducing it to the sentence
36 CHAPTER II. LOGIC

“the sum of the angles of any triangle is 180◦ ” without changing the meaning. We
note that, in this case, the statement ∀x ∈ S, P (x) is a true statement. 4
Example 4.10. Again letting x be a variable with domain S equal to the set of all
triangles, we will fix Q(x) to be the open sentence

Q(x): One of the angles of x is a right angle.

If we examine the statement ∀x ∈ S, Q(x), we find that it is false, since it is not


the case that all triangles contain a right angle; for example, none of the angles in
an equilateral triangle are right angles. However, if we fix T to be the subset of S
consisting of right triangles, then the statement ∀x ∈ T, Q(x) is a true statement. 4
We call the symbol ∀ the universal quantifier; the expression ∀x ∈ S, P (x) makes
the assertion that the open sentence P (x) is universally true for any x in the domain
S. There is another quantifier, ∃, called the existential quantifier.

Definition 4.11. Let x be a variable whose domain contains the set S, and let
P (x) be an open sentence. The existential quantification of P (x) over S, written

∃x ∈ S, P (x),

is a statement that is true if P (x) is true for at least one choice of x ∈ S, and it
is false if P (x) is false for each choice of x ∈ S.

The statement ∃x ∈ S, P (x) reads as “there exists some x in S such that P (x).”
Example 4.12. Let x be a variable with domain R, and fix P (x) to be the open
sentence
P (x): x2 = 2.
Then the statement ∃x ∈ R, P√(x) is a true statement, because there is at least one
choice of x ∈ R, namely x = 2, for which √ P (x) is a true statement (in fact there
are two choices, since we could take x = − 2 as well).
On the other hand, the statement ∃x ∈ Z, P (x) is false, since there are no integers
x such that P (x) is a true statement. 4
Example 4.13. Let A and B be sets, and let x be a variable with domain A. We
will use quantifiers to describe some relationships between the sets A and B.
Suppose that the statement

∀x ∈ A, x ∈ B

is true. This means that every element of A is an element of B. This is what it means
to say that A ⊆ B.
Suppose that the statement

∀x ∈ A, x ∈
/B
4. OPEN SENTENCES 37

is true. In other words, every element of A is not an element of B. Then we know that
A and B have no elements in common; they are disjoint. In other words, A ∩ B = ∅.
Suppose that the statement

∃x ∈ A, x ∈ B

is true. In other words, there is at least one element in A that is also in B. This tells
us that A ∩ B 6= ∅; so, A and B are not disjoint. 4

Note that, in the case of open sentences with multiple variables, we can define
quantification in a way similar to Definitions 4.8 and 4.11. In this case, we may need
multiple quantifiers in order to turn the open sentence into a statement. In general,
one quantifier will be needed for each distinct variable in the open sentence. As an
example, if we let x and y be variables with the domain R, and if we fix P (x, y) to
be the open sentence
P (x, y): x > y,
then the sentence ∀x ∈ R, P (x, y) is not a statement, because it still has a variable
that has not been specified or quantified (namely y). In order to make it a statement
we may quantify y; we could say ∀y ∈ R, ∀x ∈ R, P (x, y), which means that

for any real number y and for any real number x, it holds that x > y.

Note that this is a false statement, since taking y = 2 and x = 1 gives 1 > 2.

Example 4.14. Suppose we wish to express the statement “every even integer is a
sum of two odd integers” in symbolic logic. We can do this using multiple quantifiers.
Denote the set of even integers by Even, and denote the set of odd integers by Odd.
The statement
∀x ∈ Even, ∃y ∈ Odd, ∃z ∈ Odd, x = y + z
then means that for each even integer x, there is an odd integer y and there is an odd
integer z such that x = y + z. In other words, any even integer x is the sum of two
odd integers, y and z. (This is true.) 4

Example 4.15. Suppose we wish to express the statement “every positive real num-
ber has a positive square root” in symbolic logic. Denote the set of positive real
numbers by R>0 . We might write

∀x ∈ R>0 , ∃y ∈ R>0 , x = y 2 .

Interpreted, this means that for each positive real number x, there exists a positive
real number y such that x = y 2 . In other words, y is a positive real square root of
the positive real number x. 4

We will return to a much more detailed discussion of multiple quantifiers in the


next section. They are quite important and appear in many parts of mathematics.
38 CHAPTER II. LOGIC

4.C Implication and open sentences


If we have two open sentences P (x) and Q(x), and we join them with ⇒, we have
seen that the resulting sentence P (x) ⇒ Q(x) is again an open sentence. In order to
make a statement of it, we may either plug an element from the domain in for x or
use one of the two quantifiers ∀ or ∃.
Statements of the form
∀x ∈ S, P (x) ⇒ Q(x)
are so commonplace that there are multiple ways to express them. Here are some
common ways this is done.
• Given x ∈ S, if P (x), then Q(x).
• Let x ∈ S. If P (x), then Q(x).
• If x is an arbitrary element of S satisfying P (x), then Q(x).
• If x is an element of S satisfying P (x), then Q(x).
• If P (x), then Q(x).
The last bulleted option can only be used when the domain S of x is understood.
However, it could be confused with the (unquantified) open sentence

P (x) ⇒ Q(x),

and so in general it is best to quantify statements in some way. (Similar considerations


hold for the biconditional.) It is best practice to always use some word signifying
the universal scope of the quantifier ∀, such as: “arbitrary”, “any”, “every”, “all”,
“given”, and “let” (as in the above bulleted list). (The words we associate with ∃
are: “for some”, “exists”, “fix”, etc.)
If we talk about the open sentence P (x) ⇒ Q(x), it is clear that no quantifier is
intended (since the quantified version of the sentence would be a statement not an
open sentence).

Example 4.16. Fix P (x) to be the open sentence

P (x): x is even

and fix Q(x) to be the open sentence

Q(x): x − 2 is even

(with the domain of x being the integers in both cases). If we wish to write the
quantified statement
∀x ∈ Z, P (x) ⇒ Q(x),
we may write the following:

If an (arbitrary) integer x is even, then x − 2 is even.

Notice that no explicit quantifier is stated, but the quantifier is nevertheless under-
stood.
4. OPEN SENTENCES 39

Similarly the biconditional

an integer x is even if and only if x − 2 is even

means
∀x ∈ Z, P (x) ⇔ Q(x),
even though we didn’t use the words “for any x ∈ Z.” 4

Example 4.17. Inclusion of sets can be understood through implication.


Let A and B be subsets of a universal set U . Let x be a variable with domain U ,
and assume that
∀x ∈ U, x ∈ A ⇒ x ∈ B
is true. Since the implication must be true for any element of U , we see that whenever
x ∈ A, it must be the case that x ∈ B. (When x ∈ / A, we know nothing about whether
it is in B.) This is exactly what it means to say that A ⊆ B. Hence, the statement
A ⊆ B can be interpreted (in terms of symbolic logic) as the statement above.
Occasionally the universal set U is understood from context, and we will write
∀x, x ∈ A ⇒ x ∈ B. More simply, A ⊆ B could be written as ∀x ∈ A, x ∈ B,
without the use of implication or a universal set U . 4

4.D The meaning of implication


We now discuss what it means for a statement of the form

∀x ∈ S, P (x) ⇒ Q(x)

to be true.
We first examine how it could be false. We see that the only way for it to be false
is for there to be one or more values of x for which P (x) is true and Q(x) is false.
Therefore, in order for the statement ∀x ∈ S, P (x) ⇒ Q(x) to be true, it must be
the case that for each x ∈ S, either P (x) is false or Q(x) is true (or both). Another
way to put this is that whenever P (x) is true, it must happen that Q(x) is also true.
In other words, if we know that P (x) is true, then Q(x) must be true. Hence, for any
given x ∈ S we have “if P (x), then Q(x).”
There are a number of different ways of writing a sentence with the same meaning
as “if P , then Q.” Some of them are:

If P , then Q.
P implies Q.
P only if Q.
Q if P .
P is sufficient for Q.
Q is necessary for P .
Whenever P is true, then Q is true.
40 CHAPTER II. LOGIC

For example, if we say “P is sufficient for Q,” this has the meaning that P being
true is sufficient for us to conclude that Q is true. In other words, “if P is true, then
Q is true.”
You should think about the meaning of the other phrases above, and satisfy your-
self that they each have the same meaning as P ⇒ Q.
Another sentence that can be expressed in several different ways in English is
P ⇔ Q. Some of the ways that it can be expressed are:

P if and only if Q.
P is equivalent to Q.
P is necessary and sufficient for Q.
P holds exactly when Q holds.

4.E Translating between English and symbolic logic


We now give some examples of translating statements from English to symbolic logic.

Example 4.18. The statement “if a real number is not zero, then its square is not
zero” can be written as
∀x ∈ R, x 6= 0 ⇒ x2 6= 0.
Another way of interpreting this symbolic logic statement in English would be “every
nonzero real number has a nonzero square” or “a nonzero real number has a nonzero
square.” 4

Example 4.19. The statement “the square of any rational number is a rational
number” might be written
∀x ∈ Q, x2 ∈ Q. 4

Example 4.20. The statement “there is a rational solution of the equation x2 + 2x +


1 = 0” can be translated into symbolic logic as

∃x ∈ Q, x2 + 2x + 1 = 0. 4

Example 4.21. One way of translating “every real solution of the equation x3 −x = 0
is rational” into symbolic logic is as

∀x ∈ R, x3 − x = 0 ⇒ x ∈ Q. 4

Example 4.22. We can translate the statement

∀x ∈ R, x2 = 2 ⇒ x ∈
/Q

into English as “every real number whose square is 2 is not rational.” Alternatively,
we could say “given an arbitrary real number x, if x2 = 2, then x is not rational.” 4
4. OPEN SENTENCES 41

Example 4.23. The statement “a real number x has a real square root if it is
positive” might be interpreted in symbolic logic as

∀x ∈ R, x is positive ⇒ x has a real square root.

Or, we could be even more detailed and write

∀x ∈ R, (x > 0 ⇒ ∃y ∈ R, x = y 2 ),

which includes an interpretation of the phrase “has a real square root.” 4

Example 4.24. One way to write the statement “every even integer greater than
3 can be written as a sum of two primes” in symbolic logic is first to define the set
P = {prime numbers in N}. Then we can write

∀x ∈ Z, (((x is even) ∧ (x > 3)) ⇒ (∃y ∈ P, ∃z ∈ P, x = y + z)).

Alternatively, we could fix E to be the set of even integers, and write

∀x ∈ E, (x > 3 ⇒ ∃y ∈ P, ∃z ∈ P, x = y + z).

Another alternative would be to fix F = {x ∈ Z : x > 3 and x is even}, which is the


set of even integers greater than 3, and write

∀x ∈ F, ∃y ∈ P, ∃z ∈ P, x = y + z. 4

4.F Exercises
Exercise 4.1. Let x be a variable with domain Z. Define the open sentences

P (x): x > 1,
Q(x): x2 < 16, and
R(x): x + 1 is even.

For each of the following open sentences, describe the subset of Z (by listing its
elements or by using set-builder notation without mentioning the symbols P , Q, and
R) where that open sentence is true.
(a) P (x) ∧ Q(x).
(b) Q(x) ∧ R(x).
(c) (Q(x) ∨ ¬P (x)) ∧ ¬R(x).
(d) (P (x) ⇒ Q(x)) ⇒ R(x). (Hint: Simplify using logical equivalences.)

Exercise 4.2. For each x ∈ {1, 2, 3, 4, 5, 6}, write down the truth value of
3x + 5
R(x): If x is an odd integer, then is an odd integer,
2
and then state whether you believe “∀x ∈ Z, R(x)” is true or false.
42 CHAPTER II. LOGIC

Exercise 4.3. For each x ∈ {1, 2, 3, 4, 5, 6}, write down the truth value of

S(x): If x is an even integer, then 3x + 5 is an odd integer,

and then state whether you believe “∀x ∈ Z, S(x)” is true or false.

Exercise 4.4. Let A and B be two subsets of a universal set U . Write a symbolic
logic interpretation of the statement A = B. Explicitly write out any quantifiers
involved in the statement. (It is possible to do this with no reference to U .)

Exercise 4.5. Translate the following English sentences into symbolic logic. Explic-
itly write any quantifiers that are implied.
(a) There is an integer strictly between 4 and 6.
(b) The square of any odd integer is odd.
(c) If the square of an integer is odd, then the original integer is odd.
(d) If a real number is not rational, then it is not equal to 0.
(e) The sum of two rational numbers is rational.
(f) The square of any real number is a nonnegative real number.
(g) There is an integer solution to the equation x2 − 5x + 6 = 0.
(h) Every real solution to x2 − 5x + 6 = 0 is an integer.

Exercise 4.6. Translate the following symbolic logic statements into English.
(a) ∃x ∈ R, x2 = 2.
(b) ∀x ∈ Z, (x is even) ⇔ (x2 is even).
(c) ∀x ∈ R, (x > 1) ⇒ (x3 > 1).
(d) ∀x ∈ R, (x2 − 2x + 1 = 0) ⇒ (x = 1).
(e) ∃x ∈ Q, 2x3 − x2 + 2x − 1 = 0.
(f) ∀x ∈ R, ∃y ∈ Z, ∃z ∈ [0, 1), x = y + z.
5. MULTIPLE QUANTIFIERS AND NEGATING SENTENCES 43

5 Multiple quantifiers and negating sentences


5.A Statements with multiple quantifiers
Statements involving multiple quantifiers are quite common in mathematics. For such
statements, it is important to understand how the quantifiers interact and to be able
to analyze the truth values of the statements. We begin with two examples that
demonstrate that the order in which quantifiers occur is important.
Example 5.1. Fix P (x, y) to be the open sentence x > y with the domain of both x
and y being the real numbers. We examine the quantified statement

∀x ∈ R, ∃y ∈ R, P (x, y).

This statement means that

for each real number x, there is a real number y such that x > y,

or in other words, “for each real number x, there is a real number y (possibly de-
pending on x) that is smaller than x.” We claim that this statement is true. To see
this, suppose that x is any real number. The statement asserts that no matter what
x is, there is some real number y such that x > y. If we fix y = x − 1, we see that
regardless of what the value of x is, x > y. Hence, for each real number x, there is
some y (for example y = x − 1) with x > y. 4
Example 5.2. Again fix P (x, y) to be the open sentence x > y with the domain of
both x and y being the real numbers. We next examine the quantified statement

∃y ∈ R, ∀x ∈ R, P (x, y).

Note that this statement is the same as the statement in Example 5.1, except for the
order of the quantifiers. In words, this statement means that

there is some real number y such that x > y whenever x is a real number,

or in other words, “there is a real number y such that every real number is larger
than y.”
This statement is false, which we see as follows. If y is a real number, then y − 1
is not larger than y. Hence, there does not exist a real number y for which every real
number is larger than y. 4

Warning 5.3. Existentially quantified variables are always allowed to depend


on any previously quantified variables. For instance, in Example 5.1 we are
allowed to choose a value of y in terms of x, as we did by taking y = x − 1, since
the variable x was quantified before y. However, a variable can never depend on
another variable that is quantified later. For instance, in Example 5.2 we cannot
define y in terms of x, since x is quantified later than y.
44 CHAPTER II. LOGIC

The previous two examples demonstrate that changing the order of quantifiers in
a statement with multiple quantifiers can change the truth value of the statement.
This only happens when the quantifiers are not the same type. Changing the order
of existential quantifiers that are next to each other, or universal quantifiers that are
next to each other, will not change the truth value of the statement. For example,
∀x ∈ R, ∀y ∈ R, x > y
has the same truth value as
∀y ∈ R, ∀x ∈ R, x > y
(and in this case both are false). Since the order does not matter in this case we will
abbreviate either of these statements as
∀x, y ∈ R, x > y,
which we can read as “for any real numbers x and y, we have x > y.”
Similarly,
∃x ∈ R, ∃y ∈ R, x > y
has the same truth value as
∃y ∈ R, ∃x ∈ R, x > y
(and in this case both are true). Since the order does not matter in this case, we may
abbreviate either of these statements as
∃x, y ∈ R, x > y,
which we might read as “there are real numbers x and y such that x > y.”
Remark 5.4. Sometimes, when the domain of a variable is well understood and we
wish to quantify a statement over a subset of the domain that is defined by some easy
mathematical condition, we might adapt the notation that we use for a quantifier. For
instance, if x and y are variables with domain R and we wish to express the statement
“every positive real number has a positive real square root,” we might write
∀x > 0, ∃y > 0, x = y 2 ,
which is shorthand for
∀x ∈ R>0 , ∃y ∈ R>0 , x = y 2 .
This modification of notation can only be used when the domain of a variable is
explicitly stated, or completely clear from context. One common example of the use
of this notation will occur in the definition of a limit in Chapter IX, where we will let
ε, δ, and x be real variables, and define
lim f (x) = L
x→a

to mean
∀ε > 0, ∃δ > 0, ∀x ∈ R, 0 < |x − a| < δ ⇒ |f (x) − L| < ε.
(Note that many authors remove the clause “∀x ∈ R,” leaving it to the reader to fill
in that gap.) N
5. MULTIPLE QUANTIFIERS AND NEGATING SENTENCES 45

5.B Negating statements


It is often necessary to understand both how to negate sentences and what those
negations mean. For example, to qualify for President of the United States you
must be a natural born citizen and be at least 35 years old. Using these criteria,
what disqualifies one from being president? One is disqualified either by not being a
natural born citizen or being younger than 35, or both. Notice that we have used the
logical equivalence ¬(P ∧ Q) ≡ ¬P ∨ ¬Q (De Morgan’s law).
Negating a statement can be done by placing the words “it is not the case that”
in front of the statement. Alternatively, as we have seen, the negation of a statement
(or open sentence) P can be interpreted as “P is false”.
However, when negating sentences, it is often possible to make additional simpli-
fications or modifications. For example, if we wish to negate the statement P ∧ Q we
could write the result as ¬(P ∧ Q). By using De Morgan’s law, we see that

¬(P ∧ Q) ≡ (¬P ) ∨ (¬Q).

Hence, we can say that the negation of the statement P ∧ Q is also (equivalent to)
the statement (¬P ) ∨ (¬Q), which is often easier to work with.

Example 5.5. If we wish to negate the statement P ⇒ Q (where P and Q are


statements), it is helpful to recall (see Exercise 3.3(b)) that

P ⇒ Q ≡ (¬P ) ∨ Q.

Hence,
¬(P ⇒ Q) ≡ ¬((¬P ) ∨ Q) ≡ (¬¬P ) ∧ (¬Q) ≡ P ∧ (¬Q),
where we have used De Morgan’s law and double negation.
We can interpret this string of equivalences as follows. Saying “P implies Q is
false” is the same as asserting “P is true and Q is false.” 4

Negating statements with quantifiers is quite common. Suppose that we wish to


negate a statement of the form

R: ∀x ∈ S, P (x),

where P (x) is an open sentence, and x has domain S. The negation is:

It is not the case that P (x) is always true.

What does this mean? Simply, that P (x) must be false sometime (i.e., for at least
one x ∈ S). More formally,
¬R: ∃x ∈ S, ¬P (x).
Similar reasoning can be used to see that the negation of ∃x ∈ S, P (x) is the
statement ∀x ∈ S, ¬P (x). We state our conclusions as an axiom.
46 CHAPTER II. LOGIC

Axiom 5.6. Let P (x) be an open sentence, where x has domain S. Then the
negation of the statement
∀x ∈ S, P (x)
is equivalent to the statement

∃x ∈ S, ¬P (x).

Similarly, the negation of the statement

∃x ∈ S, P (x)

is equivalent to the statement

∀x ∈ S, ¬P (x).

Example 5.7. Suppose that we wish to negate the statement “all integers are posi-
tive.” We can write this statement with a quantifier as
P : ∀x ∈ Z, x > 0.
According to the axiom, the negation of this statement is (equivalent to)
¬P : ∃x ∈ Z, ¬(x > 0).
In words, we could state this as “there exists an integer that is not positive,” or “some
integer is not positive.” We note that the negation of the open sentence x > 0 is easily
seen to be x ≤ 0. Hence, we could write ¬P : ∃x ∈ Z, x ≤ 0 for the negation. (In
this example, which of P or ¬P is true?) 4
We can extend these methods to negate statements with multiple quantifiers.
Example 5.8. Let x, y, and z be variables with domains S, T , and U , respectively,
and let P (x, y, z) be an open sentence. We will negate the statement
∀x ∈ S, ∀y ∈ T, ∃z ∈ U, P (x, y, z).
In order to do this, we will use parentheses to make the order of the quantifiers clearer.
Hence, the statement that we wish to negate is
∀x ∈ S, (∀y ∈ T, (∃z ∈ U, P (x, y, z))).
Proceeding one level at a time, we see that
¬(∀x ∈ S, ∀y ∈ T, ∃z ∈ U, P (x, y, z))
≡ ∃x ∈ S, ¬(∀y ∈ T, ∃z ∈ U, P (x, y, z))
≡ ∃x ∈ S, ∃y ∈ T, ¬(∃z ∈ U, P (x, y, z))
≡ ∃x ∈ S, ∃y ∈ T, ∀z ∈ U, ¬P (x, y, z).
Notice that negating this quantified statement was as simple as swapping all ex-
istential and universal quantifiers, and negating the open sentence at the end. 4
5. MULTIPLE QUANTIFIERS AND NEGATING SENTENCES 47

Warning 5.9. One mistake that many students make is getting carried away
with negating quantifiers. In particular, when negating the statement

∀x ∈ S, P (x)

they might write, incorrectly,

∃x ∈
/ S, ¬P (x).

Notice that this sentence may be meaningless, because P (x) may not have a
truth value (or even make sense) when x ∈
/ S. The thing to remember is to swap
the quantifier without changing the domain of the variable.

Example 5.10. The problem mentioned in the previous warning most commonly
happens when we use notation other than x ∈ S in our quantifiers. For instance, if x
is a real variable, and we wish to negate
∀x > 0, P (x),
the correct negation is
∃x > 0, ¬P (x).
Since “x > 0” is shorthand for x ∈ R>0 , it would be incorrect to change it to
x ≤ 0. 4
Example 5.11. Suppose that we wish to negate the statement
P : ∀x ∈ R, ∃y ∈ R, x > y.
(Remember that this is the true statement from Example 5.1.) Then the negation is
¬P : ∃x ∈ R, ∀y ∈ R, x ≤ y.
This new statement is false. 4

5.C Greatest and least elements


We now use quantifiers to define some common terminology concerning sets of real
numbers.

Definition 5.12. Given a subset S ⊆ R, we say that S has an upper bound


when
∃x ∈ R, ∀y ∈ S, x ≥ y.
Any real number that, when plugged in for x, makes the open sentence

∀y ∈ S, x ≥ y

true is called an upper bound for S.


48 CHAPTER II. LOGIC

A subset S ⊆ R can also have a lower bound . This occurs when


∃x ∈ R, ∀y ∈ S, x ≤ y.
Note that we have just flipped the inequality ≥ to the reversed inequality ≤.
The following example provides a set with both upper and lower bounds.
Example 5.13. Fix S = {1, 2, 3}. This set has an upper bound, since there exists a
real number x that is at least as big as 1, 2, and 3. For example, the number 5 works.
So does the number π. In fact, every real number x ∈ [3, ∞) is an upper bound for
the set S.
Notice that if a set has one upper bound x, then any number bigger than x is also
an upper bound. So, there will be infinitely many upper bounds.
The set S = {1, 2, 3} also has lower bounds. The number 0 works as a lower
bound, and so does the number −1. In fact, any number x ∈ (−∞, 1] is a lower
bound for S. 4
We now give another important definition. The reader is encouraged to compare
this new definition with Definition 5.12 and try to find the differences.

Definition 5.14. Given a subset S ⊆ R, we say that S has a greatest element


when
∃x ∈ R, (x ∈ S ∧ ∀y ∈ S, x ≥ y).
An element of S that is also an upper bound on S is called the greatest element
of S.

Of course, least elements are defined similarly, by flipping the inequality. The
following two examples show how some subsets of R may fail to satisfy some of these
properties.
Example 5.15. Fix S = N ⊆ R. Note that S has no upper bound, and no greatest
element. There is no real number bigger than all the natural numbers (which, for
now, you may take for granted).
The negation of the statement “S has an upper bound,” is
∀x ∈ R, ∃y ∈ S, x < y.
This negated statement is true.
On the other hand, still taking S = N, the statement “S has a lower bound” is
true. Any number in the range (−∞, 1] will be a lower bound on S. For instance,
−3 is one of the many lower bounds on S. The number 1 is a lower bound, and it is
also the least element of S. 4
Example 5.16. Fix S = (0, 1] = {r ∈ R : 0 < r ≤ 1}. Then S has a lower bound; if
we take x = −1, we see that every element y ∈ S satisfies x ≤ y. Note that we could
have taken x = 0 or x = −3 as well. We remark that although S has a lower bound,
it has no least element.
Similarly, S has many upper bounds. For example, x = 5 is an upper bound. The
set S does have a greatest element, namely x = 1, which is also an upper bound. 4
5. MULTIPLE QUANTIFIERS AND NEGATING SENTENCES 49

We will investigate the ideas of greatest and least elements and upper and lower
bounds more in the exercises.

5.D Chart of negation rules


The following chart summarizes how to simplify negated sentences.

¬(¬P ) −→ P
¬(P ∨ Q) −→ ¬P ∧ ¬Q
¬(P ∧ Q) −→ ¬P ∨ ¬Q
¬(P ⇒ Q) −→ P ∧ ¬Q
¬(∀x ∈ S, P (x)) −→ ∃x ∈ S, ¬P (x)
¬(∃x ∈ S, P (x)) −→ ∀x ∈ S, ¬P (x)

5.E Exercises
Exercise 5.1. Write the negation of the following statements and open sentences.
In each case, the domain of x is R. In the last part, the set R>0 is the set of positive
real numbers. (Write any quantifiers and logical connectives using English.)
(a) x > 2 and x < 3.
(b) If x > 3, then x > 2.
(c) If x > 3 and x 6= 4, then x2 6= 16.
(d) If 3 < x < 4, then 9 < x2 < 16.
(e) If x = 2 or x = 3, then x2 − 5x + 6 = 0.
(f) For any x ∈ R, it happens that x2 + 2x > 0.
(g) There exists an x ∈ R such that x2 + 2x > 0.
(h) For each x ∈ R, there exists y ∈ R such that y > x2 .
(i) There exists an x ∈ R such that for any y ∈ R, it holds that y > x2 .
(j) For each ε ∈ R>0 , there exists some δ ∈ R>0 such that for each x ∈ R, if
0 < |x − 2| < δ, then |x2 − 4| < ε.

Exercise 5.2. For each pair of statements, state whether or not they have the same
truth value.
(a) ∀x ∈ R, ∃y ∈ R, x + y = 0 and ∃y ∈ R, ∀x ∈ R, x + y = 0.
(b) ∀x ∈ R, ∃y ∈ R, xy = 0 and ∃y ∈ R, ∀x ∈ R, xy = 0.
(c) ∀x ∈ R, ∃y ∈ R, xy 6= 0 and ∃y ∈ R, ∀x ∈ R, xy 6= 0.
(d) ∀x ∈ R, ∃y ∈ R, y + x2 > 0 and ∃y ∈ R, ∀x ∈ R, y + x2 > 0.

Exercise 5.3. Do the following:


(a) Give an example of a set of real numbers that has an upper bound but does not
have a greatest element.
(b) Determine whether or not there can be a set that has a greatest element but
does not have an upper bound. Explain your answer.
50 CHAPTER II. LOGIC

Exercise 5.4. Fix S = 1, 12 , 13 , 14 , . . . = n1 : n ∈ N .


 

(a) Does S have an upper bound? If so, give an upper bound.


(b) Does S have a greatest element? If so, what is it?
(c) Does S have a lower bound? If so, give a lower bound.
(d) Does S have a least element? If so, what is it?

Exercise 5.5. Fix S = (0, 1), which is the open interval of real numbers between 0
and 1.
(a) Does S have an upper bound? If so, give an upper bound.
(b) Does S have a greatest element? If so, what is it?
(c) Does S have a lower bound? If so, give a lower bound.
(d) Does S have a least element? If so, what is it?

Exercise 5.6. Let S be a set of real numbers, and let x ∈ R.


(a) Write (in symbolic logic) the negation of the statement “x is the greatest element
of S.”
(b) Write (in symbolic logic) the negation of the statement “x is an upper bound
for S.”
(c) Write (in symbolic logic) the negation of the statement “S has an upper bound.”
(Hint: (1) At the beginning of the problem we “let x ∈ R.” This means that we are
not treating x as a variable. Rather, it is a fixed (but arbitrary and unknown) real
number. So, it does not make sense to quantify over the symbol x. In particular, the
answer in part (c) should not use the symbol x, but should instead use a different
letter, like z, in place of x. (2) The hardest part of this problem may be part (a).)
Chapter III

Basic Proof Techniques

Proving the obvious has never been easy. Marty Rubin

The last two chapters were an introduction to the language of mathematics. Know-
ing the definitions and concepts of set theory and logic allow us to communicate
thoughts more clearly and succinctly. In this chapter we will put our new knowledge
to use in proving that statements are true.
A good proof is like a good painting. It opens the viewer’s mind to deeper insights,
connections, and beauties. The purpose of a proof is not only to convince the reader
that something is true, but to do so in a way that aids in their understanding of why
it is true.

51
52 CHAPTER III. BASIC PROOF TECHNIQUES

6 Direct proofs
6.A Terminology
All mathematical arguments need a foundation on which to stand; we need truths
that are taken to be self-evident. These truths are called axioms. Some axioms that
are commonly used by mathematicians are the following:
• The empty set exists.
• For each real number, there is an integer greater than it.
• Any two lines (in the plane) either intersect in a single point or are parallel.
In this book we will not worry too deeply about which axioms we will use, trusting
that readers will learn by example what sorts of statements they may use freely.
Once the language of mathematics is in place we also have definitions. We gave
many examples in the previous two chapters of concepts we have defined, such as
unions, intersections, logical connectives, and so forth. In this section, the following
two definitions will be very important.

Definition 6.1. Let n ∈ Z. We say n is an even integer if n = 2k for some


k ∈ Z. The set of even integers is written

Even = 2Z = {. . . , −4, −2, 0, 2, 4, 6, . . .}.

Definition 6.2. Let n ∈ Z. We say that n is an odd integer if n = 2k + 1 for


some k ∈ Z. The set of odd integers is written

Odd = 2Z + 1 = {. . . , −3, −1, 1, 3, 5, . . .}.

Example 6.3. The integer 3 is odd, since 3 = 2 · 1 + 1. The integer 16 is even, since
16 = 2 · 8. 4

Warning 6.4. If n is an even integer, this does not mean that n = 2k for every
k ∈ Z, only for one specific k ∈ Z. It is impossible for a single number to equal
all of the even integers at once.

The following three facts probably seem self-evident:


• If x ∈ Z is not even, then it is odd.
• If x ∈ Z is not odd, then it is even.
• There is no number that is both even and odd.
You may freely use these facts, treating them as axioms. (We will prove in a later
chapter that they follow from other, more basic, axioms.)
Finally, there are special names given to statements we want to prove.
6. DIRECT PROOFS 53

• A theorem is an important statement we prove. In this book we will only name


results “Theorems” when they are extremely important.
• A proposition is a basic statement we prove. In this book, propositions will
be statements that are proven to illustrate proof techniques, not statements to
memorize.
• A lemma is a (usually minor) result that we prove in order to use it later to
prove a bigger result. We use lemmas as a way of breaking up large proofs into
smaller, more understandable pieces.
• A corollary is a (usually minor) result that follows easily from another result
we have proved.
In the rest of Section 6 we will focus on techniques for proving statements of the
form:
∀x ∈ S, P (x) ⇒ Q(x).

6.B Trivial proofs


There are two situations where an implication is true for silly reasons. The following
definition gives the first situation.

Definition 6.5. Let S be a set. We say that the statement

∀x ∈ S, P (x) ⇒ Q(x)

is trivially true when the simpler statement ∀x ∈ S, Q(x) is true. In other


words, an implication is trivially true when the conclusion of the implication is
always true.

Here are some easy examples, followed by proofs.

Proposition 6.6. Let x ∈ R. If x2 < 73, then 0 < 1.

Proof. The conclusion 0 < 1 is always true. So the implication is trivially true.

Proposition 6.7. Let a ∈ Z. If a is odd, then 2a is even.

Proof. The conclusion is always true; the number 2a is even since it is 2 times an
integer. Hence, the implication is trivially true.
Notice that in both cases the premise of the implication was irrelevant. In the
first proposition it didn’t matter whether or not x2 < 73, since 0 < 1 is always true.
Similarly, in the second proposition it didn’t matter whether or not a is odd, because
2a is always even.
Also notice the little square box at the end of the proof. This tells the reader that
you have finished the proof.
54 CHAPTER III. BASIC PROOF TECHNIQUES

Warning 6.8. The word “trivial” should not be used in a proof to mean “this
step is easy, so I will skip it.”

Sometimes “trivial” proofs are not easy and take some work to prove.

Proposition 6.9. Let x ∈ R. If x < 5, then x2 − 2x ≥ −1.

Proof. The inequality x2 − 2x ≥ −1 is equivalent to x2 − 2x + 1 ≥ 0. This is the same


as (x − 1)2 ≥ 0, which is always true. Thus, the implication is trivially true.

Advice 6.10. It is always a good idea to understand the premise and conclusion
of an implication separately before trying to prove the implication.

6.C Vacuous proofs


There is a second situation where implications are true for silly reasons. This happens
when the premise is always false.

Definition 6.11. Let S be a set. We say that the statement

∀x ∈ S, P (x) ⇒ Q(x)

is vacuously true when the simpler statement ∀x ∈ S, ¬P (x) is true. In other


words, an implication is vacuously true when the premise of the implication is
never true.

We use the word “vacuous” when the premise of an implication is false everywhere
in the domain because we think of the implication as an empty promise in that case.
In other words, the statement is true because it isn’t asserting anything!
The following are some examples of vacuously true statements and their proofs.

Proposition 6.12. Let x ∈ Z. If 3 < x and x < 2, then x2 + 4 = 7.

Proof. The premise is impossible, so the implication is vacuously true.

Proposition 6.13. Let x ∈ Z. If −x2 > 2, then x = 5.

Proof. The premise is −x2 > 2, which is equivalent to 0 > x2 + 2. The right side is
the sum of a square and a positive number; such a sum can never be negative. Thus,
the implication is vacuously true.
6. DIRECT PROOFS 55

Advice 6.14. To remember the difference between trivial and vacuous proofs,
memorize the following phrase:
Trivial, the Q is true.
Vacuous, the premise is bogus.

Sometimes it is not obvious whether a statement is vacuously true or trivially


true. The following is a list of some examples.

Example 6.15. Consider the following statements, and determine if they are trivially
true, vacuously true, or neither trivial nor vacuous.
(1) Given a ∈ R, if a2 is a negative real number, then a = 5.
(2) Given a ∈ C, if a2 is a negative real number, then a ∈ C − R.
(3) For any x ∈ N, if x ∈ ∅, then x > 0.
(4) For any a ∈ N, either a is even or a is odd.
The answers are as follows:
(1) The statement is vacuously true, since the premise is never true. It is not trivial,
because the conclusion can be false for some a ∈ R (such as a = 6).
√ is not vacuous, since the premise is true for some a ∈ C (such
(2) This implication
as a = i = −1). It is also not trivial since the conclusion is false for some
a ∈ C (such as a = 0).
(3) This statement is both vacuous and trivial! The premise is never true, and the
conclusion is always true (when x ∈ N).
(4) This is not an implication, so it is not trivial and not vacuous. 4

6.D Outline of a direct proof


Now that we have dealt with the two oddities that can arise, we are ready to introduce
the most important technique for proving implications.
Given a statement ∀x ∈ S, P (x) ⇒ Q(x), we can prove it directly by assuming
the premise P (x) holds and then, using that information, we show that Q(x) must
also hold true. We begin with an example of such a proof.

Proposition 6.16. For each x ∈ Z, if x is even, then 5x + 3 is odd.

Proof. Let x ∈ Z be arbitrary. We will work directly. Assume x is even. This means
x = 2k for some k ∈ Z. Thus

5x + 3 = 5(2k) + 3 = 10k + 3 = 2(5k + 1) + 1.

Since 5k + 1 ∈ Z, this means that 5x + 3 is odd.

In the first sentence, we deal with the ∀x ∈ Z, by telling the reader we are letting
x be an arbitrary integer. The next sentence tells the reader what type of proof
technique we will use. In this case it is a direct proof. (We will have more options
56 CHAPTER III. BASIC PROOF TECHNIQUES

available over the next few sections.) After telling the reader we are working directly,
we must assume the premise of the implication. So the third sentence does exactly
that; we assume x is even. We then do some work, and we finish by showing that the
conclusion holds.
The basic outline of a direct proof is as follows.
Result to be proved. Given x ∈ S, if P (x) is true, then Q(x) is true.
Proof outline. Let x ∈ S.
We work directly.
Assume P (x).
Do some work (to be filled in).
Thus, Q(x) holds.

Advice 6.17. When first writing proofs it can be useful to leave some space in
the middle and write the last sentence on the bottom. That way, you can see
where you need to end up.

Here are some more examples of direct proofs.

Proposition 6.18. If n is an odd integer, then n2 − 2n + 3 is even.

Proof. Let n ∈ Z. We work directly. Assume n is odd. Hence, n = 2k + 1 for some


k ∈ Z. We then find
n2 − 2n + 3 = (2k + 1)2 − 2(2k + 1) + 3
= 4k 2 + 4k + 1 − 4k − 2 + 3 = 4k 2 + 2 = 2(2k 2 + 1).
Since 2k 2 + 1 is an integer, n2 − 2n + 3 is even.

Proposition 6.19. Let n ∈ Z. If 3n is even, then n + 7 is odd.

Proof. Let n ∈ Z. We work directly. Assume 3n is even. Hence, 3n = 2k for some


k ∈ Z. We find
n + 7 = n + (2n − 2n) + 7 = 3n − 2n + 7
= 2k − 2n + 7 = 2(k − n + 3) + 1.
Since k − n + 3 ∈ Z, we have n + 7 is odd.
In this proof, you might be tempted, after writing 3n = 2k, to solve for n and get
n = 2k/3. However, at that point you are no longer working with integers; instead,
you are working with rational numbers. Try to fill in the rest of the proof and look
for where you get an error. (Note: We will see in the next section an easier way to
prove this proposition, which doesn’t involve the trick of using 0 = 2n − 2n.)
We end this section with one final example.
6. DIRECT PROOFS 57

Proposition 6.20. If n is an odd integer, then 4n2 − 1 is odd.

Proof. Let n ∈ Z. We work directly. Assume n is odd. Thus, n = 2k + 1 for some


k ∈ Z. We find

4n2 − 1 = 4(2k + 1)2 − 1 = 4(4k 2 + 4k + 1) − 1


= 16k 2 + 16k + 3 = 2(8k 2 + 8k + 1) + 1.

Since 8k 2 + 8k + 1 ∈ Z, we have 4n2 − 1 is odd.


Did you notice that there is another way to prove this proposition? (Hint: Is it
trivial/vacuous?)

6.E Exercises
Exercise 6.1. Let x ∈ R. Prove that if x 6= 3, then x2 − 2x + 3 6= 0. (Would this
result be true if we took x ∈ C?)

Exercise 6.2. Let n ∈ N. Prove that if 2 < n < 3, then 7n + 3 is odd.

Exercise 6.3. Prove that if x is an odd integer, then x2 is odd.

Exercise 6.4. Prove that if x is an even integer, then 7x − 5 is odd.

Exercise 6.5. Let a, b, c ∈ Z. Prove that if a and c are odd, then ab + bc is even.

Exercise 6.6. Let n ∈ Z. Prove that if |n| < 1, then 3n − 2 is an even integer.

Exercise 6.7. Prove that every odd integer is a difference of two squares of integers.
(Hint: Try small cases; write 1, 3, 5, and 7 as differences of squares. It might help to
rephrase this statement as an implication, with a premise and conclusion.)
58 CHAPTER III. BASIC PROOF TECHNIQUES

7 Contrapositive proof
While the technique of direct proof is a powerful tool, this section will introduce an-
other method that is very similar in spirit. This new method is called “contrapositive
proof.” You may have experienced it in your own life. For instance, consider the
following story:
Alice is at work on Friday and tells her coworker Bob: “If it rains on Monday,
then I’m not coming in to work.” Bob has an important deadline on Monday, and so
works through the entire weekend. On Monday Bob sees Alice come into the office.
He concludes it must not be raining.
Bob’s logic is sound and will be explained (and exploited) in this section.

7.A What is the contrapositive?


Let P and Q be statements. We have been working with the implication

R: P ⇒ Q.

We say that the new sentence


¬Q ⇒ ¬P
is the contrapositive of R. A truth table shows the amazing fact that the implication
R has exactly the same truth table as the contrapositive! In other words:

Theorem 7.1. Let P and Q be statements. Then

P ⇒ Q ≡ ¬Q ⇒ ¬P.

Example 7.2. We will find the contrapositive of the statement: “If it rains on
Monday, then I’m not coming in to work on Monday.” The contrapositive (after an
easy application of double negation) is exactly: “If I come in to work on Monday,
then it is not raining on Monday.” In the story at the beginning of this section, Bob
used the contrapositive of Alice’s sentence to conclude it was not raining. 4

We can also take the contrapositive of an implication between two open sentences,
as in the following example.

Example 7.3. The contrapositive of

If 3x − 7 is even, then x is odd.

is the new sentence


If x is even, then 3x − 7 is odd.
Which one looks easier to prove when universally quantified? 4
7. CONTRAPOSITIVE PROOF 59

To prove an implication P ⇒ Q, we can instead change to the contrapositive


sentence ¬Q ⇒ ¬P and work directly with this new sentence. We usually work this
way when the direct proof (of the original sentence) is more difficult. The proof of
the following proposition shows how this is to be done: we assume the negation of
the conclusion and then show the negation of the premise.

Proposition 7.4. Given x ∈ Z, if 3x − 7 is even, then x is odd.

Proof. Let x ∈ Z. We work contrapositively. Assume x is even. Thus x = 2k for


some k ∈ Z. We find

3x − 7 = 3(2k) − 7 = 6k − 7 = 2(3k − 4) + 1,

which is odd since 3k − 4 ∈ Z.

It is possible to prove this proposition directly; however, it will be more difficult.


When we assume 3x − 7 is even, we get 3x − 7 = 2k. It is very tempting to solve
for x by bringing 7 to the other side and dividing by 3. But if we do that, we get
x = (2k + 7)/3, which is written as a rational fraction, so it is difficult to tell whether
it is even or odd (or an integer!). However, there is a clever way to work around this
fact:

Alternative proof. Let x ∈ Z. We work directly. Assume 3x−7 is even. So 3x−7 = 2k


for some k ∈ Z. Then

x = (3x − 7) − 2x + 7 = 2k − 2x + 7 = 2(k − x + 3) + 1,

which is odd since k − x + 3 ∈ Z.

The moral of this story is:

Advice 7.5. To decide whether to do a direct proof or a contrapositive proof,


choose the method that gives you the “best” information to start with.

For the next proposition, try to decide for yourself whether you should work
directly or contrapositively.

Proposition 7.6. Let x ∈ Z. If x2 − 6x + 7 is odd, then x is even.

Do you want to work directly? If you do, you will assume x2 − 6x + 7 is odd, and
try to show that x is even.
Or do you want to work contrapositively? If you do, you will assume x is odd,
and try to show that x2 − 6x + 7 is even.
60 CHAPTER III. BASIC PROOF TECHNIQUES

Proof. Let x ∈ Z. We work contrapositively. Assume x is odd. So x = 2k + 1 for


some k ∈ Z. We find

x2 − 6x + 7 = (2k + 1)2 − 6(2k + 1) + 7 = 4k 2 + 4k + 1 − 12k − 6 + 7


= 4k 2 − 8k + 2 = 2(2k 2 − 4k + 1),

which is even since 2k 2 − 4k + 1 ∈ Z.


For many people, to prove the previous proposition it is easier to work contrapos-
itively than to work directly.

7.B Division
We have done many proofs using even and odd integers. We will now introduce a
new definition, which we can use to prove more statements.

Example 7.7. (1) Does 3 divide 6? Yes, dividing 6 by 3 yields the integer 2. So
6 = 3 · 2.
(2) Does 5 divide 9? No, dividing 9 by 5 yields a remainder of 4. 4

Generalizing these examples we have the following:

Definition 7.8. Let a, b ∈ Z. We say that a divides b if

∃c ∈ Z, b = ac.

In other words, a is a divisor of b. Alternatively, b is a multiple of a.


We write a | b to mean “a divides b.”

Warning 7.9. The expression “a | b” is shorthand for the sentence that means
“a divides into b.” Thus, “a | b” means that the fraction ab is an integer. It does
not mean a ÷ b (which is just the number ab , not a sentence).

Example 7.10. (1) Is it true that 7 | 21? Yes, 21 = 7 · 3.


(2) For any integer n, we have 1 | n, since n = 1 · n.
(3) What integers does 0 divide? If 0 | n, then this means n = 0c for some c ∈ Z.
Thus, n = 0. On the other hand, 0 | 0 is true since 0 = 0 · 1.
(4) Does 8 | 4? No, so we write 8 - 4. 4

To prove a statement involving the condition a | b we use its definition to turn it


into the new sentence “b = ac for some c ∈ Z.” (Notice that the term b, which was
on the right-hand side of the vertical bar, is now alone on the left-hand side of the
equality.) This is similar to what we did with even/odd proofs; when x is even, we
rewrite this using the definition to say that x = 2k for some k ∈ Z.
7. CONTRAPOSITIVE PROOF 61

Proposition 7.11. Let a, b ∈ Z. If a | b, then a | 2b.

Proof. Let a, b ∈ Z. We work directly. Assume a | b. Thus b = ac for some c ∈ Z.


Now, 2b = 2(ac) = a(2c). Since 2c ∈ Z, we have a | 2b.
Question: In the sentence starting “Now, 2b = . . .,” how did we know to look at 2b?
Answer: We were working directly, so we knew we needed to show a | 2b. From the
definition, we knew we needed to look at 2b and “pull out” a ∈ Z as a factor, with
the other factor also an integer.
Can you figure out what is wrong with the following FALSE proposition and
proof?

Proposition 7.12 (False!). Let a, b ∈ Z. If a | 2b, then a | b.

Proof. Let a, b ∈ Z. We work directly. Assume a | 2b. Thus 2b = ac for some c ∈ Z.


Now, b = ac/2 = a(c/2). Since c/2 ∈ Z, we have a | b.
When proving statements about divisors, we usually do NOT actually divide!
Here are some more examples of proofs using divisors.

Proposition 7.13. Let a, b, c ∈ Z. If a | b and b | c, then a | c.

Proof. Let a, b, c ∈ Z. We work directly. Assume a | b and b | c. Thus b = ax and


c = by for some x, y ∈ Z.
Now, c = by = (ax)y = a(xy). Since xy ∈ Z, we have a | c.
Question: Why did we use x and y instead of just c?
Partial Answer: There are two reasons! First, c is a symbol already in use. Second,
we need two different letters, not just one letter. (Why?)

Proposition 7.14. Given x ∈ Z, if 2 - x then x is odd.

Proof. Let x ∈ Z. We work contrapositively. Assume x is even. Thus, x = 2k for


some k ∈ Z. Hence, 2 | x.

Theorem 7.15. Let a, b, c, x, y ∈ Z. If a | b and a | c, then a | (bx + cy).

Proof. Let a, b, c, x, y ∈ Z. We work directly. Assume a | b and a | c. Thus b = au and


c = av for some u, v ∈ Z.
Now,
bx + cy = (au)x + (av)y = a(ux + vy).
Since ux + vy ∈ Z, we have a | (bx + cy).
62 CHAPTER III. BASIC PROOF TECHNIQUES

7.C More terminology for implications


Suppose we are given an implication

R(x): P (x) ⇒ Q(x).

There are other interesting open sentences related to R(x). Consider the following:
• The converse of R(x) is: Q(x) ⇒ P (x).
• The inverse of R(x) is: ¬P (x) ⇒ ¬Q(x).
• The contrapositive of R(x) is: ¬Q(x) ⇒ ¬P (x).
• The negation of R(x) is: ¬R(x) ≡ ¬(P (x) ⇒ Q(x)) ≡ P (x) ∧ ¬Q(x).
The contrapositive has the same truth table as R(x) (treating P (x) and Q(x) as
variables of a logical formula). However, the converse has a different truth table.
(Try it!) The negation has another, third, truth table. (Try it!) So the converse, the
contrapositive, and the negation are (in general) each very different sentences.
What about the inverse? It does have the same truth table as one of the other
three sentences! But which one? (Try it!)

7.D Biconditional
Over the past few sections, we have been focusing on proving (universally quanti-
fied) implications P (x) ⇒ Q(x). Another common sentence to prove is the bicon-
ditional P (x) ⇔ Q(x). To prove it, we show both P (x) ⇒ Q(x) and the converse
Q(x) ⇒ P (x). Each direction can be proved directly or contrapositively! Consider
the following example.

Proposition 7.16. Let n ∈ Z. The number n2 is odd if and only if n is odd.

Proof. We first prove that if n2 is odd, then n is odd. We work contrapositively, so


assume n is even. Then n = 2k for some k ∈ Z. Hence,

n2 = (2k)2 = 4k 2 = 2(2k 2 )

is an even integer.
We now prove conversely that if n is odd, then n2 is odd. We work directly.
Assume n is odd. Then n = 2k + 1 for some k ∈ Z. Hence,

n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1

is an odd integer.

To help the reader, sometimes a proof writer will use arrows to tell the reader
which of the two directions is being proved. For instance, the previous proof could
be rewritten as follows.
7. CONTRAPOSITIVE PROOF 63

Proof. (⇒): We work contrapositively. Assume n is even, so n = 2k for some k ∈ Z.


Then
n2 = (2k)2 = 4k 2 = 2(2k 2 )
is an even integer.
(⇐): We work directly. Assume n is odd, so n = 2k + 1 for some k ∈ Z. Hence,
n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1
is an odd integer.
We end this subsection with a proof of some statement that we haven’t written
down. Try to figure out what is being proved, from the proof itself.
Proof. Assume x is even and y is odd. Therefore x = 2k and y = 2` + 1 for some
k, ` ∈ Z. We find
(x + 1)y = (2k + 1)(2` + 1) = 4k` + 2k + 2` + 1 = 2(2k` + k + `) + 1
is an odd integer.
Which of the following is being proved?
(1) If x is even and y is odd, then (x + 1)y is odd.
(2) If (x + 1)y is odd, then x is even and y is odd.
(3) If x is odd or y is even, then (x + 1)y is even.
(4) If (x + 1)y is even, then x is odd or y is even.
Answer: Did you see that two of the choices are actually correct? We could be
working directly to prove (1), or we could be working contrapositively to prove (4).

7.E Exercises
Exercise 7.1. Let a ∈ Z. Prove that if a2 + 3 is odd, then a is even.
Exercise 7.2. Prove the following: Let x, y ∈ Z. If xy + y 2 is even, then x is odd or
y is even.
Exercise 7.3. Let s ∈ Z. Prove that s is odd if and only if s3 is odd.
Exercise 7.4. A student is asked to prove the statement: “Given x ∈ Z, if 2 | x, then
x is even.” The student writes: “Let x ∈ Z. Assume, contrapositively, that x is even.
Then x = 2k for some k ∈ Z. Hence, 2 | x.”
The student made a significant error. Identify what is wrong with this student’s
proof, and then write your own correct proof (using any proof technique you prefer).
Exercise 7.5. Let a, b, c, d ∈ Z. Prove that if a | c and b | d, then ab | cd.
Exercise 7.6. State the contrapositive of the implication in the previous exercise.
Exercise 7.7. Let a ∈ Z. Prove that if 4 - a2 , then a is odd.
Exercise 7.8. Prove the following implication two ways (directly and contraposi-
tively): Given x ∈ Z, then 5x − 1 is even only if x is odd. (Be careful to prove the
correct implication. See Subsection 4.D for the meaning of “only if”.)
64 CHAPTER III. BASIC PROOF TECHNIQUES

8 Proof by cases
8.A Introductory examples
Some problems break down into natural cases. Here are some common examples:
• Integers are either even or odd.
• Real numbers (or integers) can be positive, negative, or zero.
• Numbers can be zero or nonzero.
• Real numbers can be rational or irrational.
• Sets can be empty or nonempty.
• Sets can be finite or infinite.
Some problems can be handled by considering all possible cases separately. The
proof of the following proposition shows how this is to be done.

Proposition 8.1. If x ∈ Z, then x2 + x is even.

Proof. We work directly. Assume x ∈ Z. There are two natural cases.


Case 1: Suppose x is even. Then x = 2k for some k ∈ Z. Then

x2 + x = (2k)2 + 2k = 4k 2 + 2k = 2(2k 2 + k),

which is even.
Case 2: Suppose x is odd. Then x = 2k + 1 for some k ∈ Z. Then

x2 + x = (2k + 1)2 + (2k + 1) = 4k 2 + 6k + 2 = 2(2k 2 + 3k + 1),

which is even.
In every case x2 + x is even.

The key to working by cases is that we can break a problem into smaller “sub-
problems” that each can be handled separately. Sometimes it takes practice to rec-
ognize how to break a problem into smaller cases. On the other hand, sometimes a
problem shouts “Do me by cases!” To demonstrate, let’s introduce another definition.

Definition 8.2. Let x, y ∈ Z. We say that x and y have the same parity if
either they are both even or they are both odd. If this doesn’t happen, we say
that x and y have the opposite parity.

Proposition 8.3. Let x, y ∈ Z. If x + y is even, then x and y have the same


parity.
8. PROOF BY CASES 65

Proof. Let x, y ∈ Z. We work contrapositively. Thus, we assume x and y have


opposite parity. There are two natural cases to consider.
Case 1: Suppose x is even and y is odd. Thus x = 2k and y = 2` + 1 for some
k, ` ∈ Z. Then
x + y = 2k + 2` + 1 = 2(k + `) + 1,
which is odd.
Case 2: Suppose x is odd and y is even. Thus x = 2k + 1 and y = 2` for some
k, ` ∈ Z. Then
x + y = 2k + 1 + 2` = 2(k + `) + 1,
which is odd.
In every case x + y is odd.
Notice that in this proof the two cases look almost exactly the same. When this
happens sometimes mathematicians save time by writing “The other case is similar.”
or “There are two cases, but without loss of generality we may assume x is even and
y is odd.” Feel free to write this, but only if the two cases really are no different.
Consider the following proposition, which is the inverse of the previous proposition.

Proposition 8.4. Let x, y ∈ Z. If x + y is odd, then x and y have opposite


parity.

Proof. Let x, y ∈ Z. We work contrapositively. Assume x and y have the same parity.
There are two cases.
Case 1: Suppose x and y are both even. Then x = 2k and y = 2` for some
k, ` ∈ Z. Then
x + y = 2k + 2` = 2(k + `),
which is even.
Case 2: Suppose x and y are both odd. Then x = 2k + 1 and y = 2` + 1 for some
k, ` ∈ Z. Then
x + y = 2k + 1 + 2` + 1 = 2(k + ` + 1),
which is even.
In every case x + y is even.
Notice that we didn’t say that Case 2 is similar to Case 1. That’s because they
really are different!
In some situations, the cases we should consider come from one of our assumptions.

Proposition 8.5. For any x, y ∈ Z, if x is even or y is even, then xy is even.

Proof. Let x, y ∈ Z. We work directly. Assume that x is even or y is even.


Case 1: Suppose x is even. So, x = 2k for some k ∈ Z. Then xy = 2ky, and so
xy is even.
Case 2: Suppose y is even. This is similar to Case 1.
Thus, xy is even in all cases.
66 CHAPTER III. BASIC PROOF TECHNIQUES

Why were those two cases enough to cover all possibilities? Aren’t we missing the
case where x is odd and y is odd? We are ignoring the case where x is odd and y
is odd! But we can ignore that case because we assumed the fact that x is even or
y is even (when working directly). Our assumption limited the number of cases we
needed to consider. If we hadn’t made that assumption, we would need to consider
that last possibility.

Advice 8.6. If you assume P ∨ Q, then you have two (possibly overlapping)
cases. Case 1 is when P holds, and Case 2 is when Q holds. You could also
break this up into three non-overlapping cases. Case 1 is when P and Q both
hold, Case 2 is when P holds but Q fails, and Case 3 is when P fails but Q
holds.

Warning 8.7. If you are trying to show P ∨ Q, then you do not just consider
the two cases P or Q. You do not yet know those are the only two options!
However, you do know that P or ¬P happens. So, perhaps your two cases
could be as follows. Case 1 is when P holds, and you are done. Case 2 is when
P fails, and you try to show Q now holds.

Here is another example of these ideas.

Proposition 8.8. Let x ∈ Z. Then x2 | x if and only if x ∈ {−1, 0, 1}.

Proof. Let x ∈ Z. We are proving a biconditional, so we need to prove both directions.


(⇒): We will work directly. Assume x2 | x. Thus x = x2 y for some y ∈ Z. There
are two cases we will consider.
Case 1: Suppose x = 0. Then we are done!
Case 2: Suppose x 6= 0. Then, we can divide by x, and get 1 = xy. The only
divisors of 1 are ±1. Thus x = 1 or x = −1.
In every case x ∈ {−1, 0, 1}.
(⇐) : We work directly again. Assume x ∈ {−1, 0, 1}. There are thus three cases:
x = −1, x = 0, or x = 1. In all three cases, we can check immediately that x2 | x.

Question: In the backwards direction, (⇐), we had three cases. Why didn’t we have
those three cases in the forward direction?
Answer: In the backwards direction we made the assumption x ∈ {−1, 0, 1}, which
limited the possibilities for x to three cases. In the forward direction we didn’t have
such an assumption. So, we had to consider every possibility.
The following theorem is very useful and also demonstrates these same ideas again.

Theorem 8.9. Given a, b ∈ C, then ab = 0 if and only if a = 0 or b = 0.


8. PROOF BY CASES 67

Proof. This is a biconditional, so we will prove both directions.


(⇒): We work directly. Assume ab = 0. There are two possibilities for a, given
by the following two cases.
Case 1: Suppose a = 0. Then we are done.
Case 2: Suppose a 6= 0. [Note: Why not suppose b = 0?] Since a 6= 0 we can
divide the equality ab = 0 on both sides by a, to get b = 0.
Thus, in every case, either a = 0 or b = 0 (or both).
(⇐): We now prove the converse. We again work directly, so we assume a = 0 or
b = 0. There are two cases.
Case 1: Suppose a = 0. Then ab = 0b = 0.
Case 2: Suppose b = 0. Then ab = a0 = 0.
In every case ab = 0.
What does this theorem mean? The following example shows one way to under-
stand how to use it.
Example 8.10. We will show that the only complex solutions of x2 = 3x − 2 are
x = 1 or x = 2.
If x2 = 3x − 2, then x2 − 3x + 2 = 0. Factoring, this means (x − 1)(x − 2) = 0. By
the previous theorem (take a = x − 1 and b = x − 2), we then must have x − 1 = 0
or x − 2 = 0. In other words, x = 1 or x = 2. 4

8.B Congruence
If the clock on the wall says 9:00, and 37 hours pass, what time is it then? It isn’t
too difficult to figure out that the new time is 10:00. The way we figure this out is to
notice that each 12 hour block keeps the clock fixed, and so 37 hours looks the same
as 1 hour.
We do something similar when working with even and odd numbers. We know
that an even number plus an odd number will always be odd. The reason is that
adding any multiple of 2 doesn’t change whether a number is even or odd.
These two situations are special cases of a much more general, and powerful,
technique. In the first situation, we are looking at numbers and treating multiples of
12 as irrelevant. In the second case, we are treating multiples of 2 as irrelevant. The
following definition does this for an arbitrary integer n.

Definition 8.11. Let a, b, n ∈ Z. We say that a is congruent to b modulo n


if n | (a − b). In other words, a − b = nk for some k ∈ Z. Or, in other words,
a = b + nk for some k ∈ Z; the numbers a and b are the same up to a multiple
of n. We write
a ≡ b (mod n)
to denote that a is congruent to b modulo n.

In the following example we work out some instances where this definition holds
or does not hold.
68 CHAPTER III. BASIC PROOF TECHNIQUES

Example 8.12. (1) Is 7 ≡ 3 (mod 2)? Yes, we have 2 | (7 − 3).


(2) Is 3 ≡ 16 (mod 31)? This is asking, does 31 | (3 − 16)? No, 31 - (−13). Thus
we write 3 6≡ 16 (mod 31).
(3) Is 21 ≡ 9 (mod 12)? This is asking, does 12 | (21 − 9)? Yes, 12 | 12. Notice that
this question is really asking whether 21 hours looks like 9 hours on a clock.
(4) Is 2 ≡ −2 (mod 3)? This is asking does 3 | (2 − (−2))? No, 3 - 4. So we write
2 6≡ −2 (mod 3).
(5) Is 95482 ≡ 2892 (mod 2)? We can see that the answer will be yes, since both
numbers are even. However, we double-check that 2 | (95482 − 2892), which is
true.
(6) If x is an integer, is x ≡ x (mod n)? We are asking whether n | (x − x). The
answer is yes, since n | 0. 4

In many cases, we can work with congruences almost as if they were equations.
We will later prove several theorems of this sort; the following proposition is an
example.

Proposition 8.13. Let a, b, c, n ∈ Z. If a ≡ b (mod n), then ac ≡ bc (mod n).

Proof. Let a, b, c, n ∈ Z. Assume a ≡ b (mod n). Thus n | (a − b). In other words,


a−b = nk for some k ∈ Z. Multiplying by c, we get ac−bc = nkc. Hence n | (ac−bc),
so ac ≡ bc (mod n) as desired.

This proposition says that when numbers are congruent, we can multiply by any
integer and they stay congruent. For instance, we have 5 ≡ −9 (mod 7). Multiply
by 5 to get 25 ≡ −45 (mod 7).

Example 8.14. Another way to think about congruence is that two numbers are
congruent modulo n if they have the same remainder when we divide by n. When we
divide by 2, there are only two remainders, so every x ∈ Z is either odd or even. In
other words,
x ≡ 0 (mod 2) or x ≡ 1 (mod 2).
What happens if we work modulo 3? Now there are three remainders, and we get

x≡0 (mod 3), x≡1 (mod 3), or x≡2 (mod 3).

In other words, every integer x is of exactly one of the forms 3k, 3k + 1, or 3k + 2 for
some k ∈ Z. (We will prove this later, but you can use it freely for now.) 4

The previous example tells us that sometimes we can reduce questions about
division into cases according to remainders!

Proposition 8.15. If x ∈ Z, then x3 ≡ x (mod 3).


8. PROOF BY CASES 69

Proof. Let x ∈ Z. We consider the following three cases.


Case 1: Suppose x = 3k for some k ∈ Z. Then

x3 − x = (3k)3 − 3k = 27k 3 − 3k = 3(9k 3 − k).

So 3 | (x3 − x), hence x3 ≡ x (mod 3).


Case 2: Suppose x = 3k + 1 for some k ∈ Z. Then

x3 − x = (3k + 1)3 − (3k + 1) = 27k 3 + 27k 2 + 9k + 1 − 3k − 1 = 3(9k 3 + 9k 2 + 2k).

So 3 | (x3 − x), hence x3 ≡ x (mod 3).


Case 3: Suppose x = 3k + 2 for some k ∈ Z. Then

x3 −x = (3k +2)3 −(3k +2) = 27k 3 +54k 2 +36k +8−3k −2 = 3(9k 3 +18k 2 +11k +2).

So 3 | (x3 − x), hence x3 ≡ x (mod 3).

Example 8.16. The previous proposition asserts that 3 | (10373 − 1037). Pull out a
calculator and check it! 4

8.C Absolute values


One important situation where the method of proof by cases arises is when proving
statements about absolute values. Indeed, the very definition of the absolute value of
a number is given in terms of cases.

Definition 8.17. Let a ∈ R. Define


(
a if a ≥ 0,
|a| =
−a if a < 0.

Example 8.18. We have |2| = 2, and |−2| = 2. If x = −5, then |x| = −x = 5. 4

Warning 8.19. Many students have difficulty with the idea that |x| = −x,
which is true anytime that x < 0. Part of this difficulty is that they think that
an expression beginning with a negative sign (such as −x) must be negative.
However, if x is negative, then −x is positive.
Another instance where this problem can come up is if we compute |−x|. We
note that this is not necessarily equal to x. In particular, if x is negative, then
|−x| never equals x.

We will now prove some statements involving absolute values. Several of these are
important enough to be called Theorems (and one is even important enough to have
a name).
70 CHAPTER III. BASIC PROOF TECHNIQUES

Proposition 8.20. Let a, b, x ∈ R and assume that b ≥ 0. If

|x − a| ≤ b,

then a − b ≤ x ≤ a + b.

Proof. Suppose that |x − a| ≤ b. We divide the proof into cases.


Case 1: Suppose that x − a ≥ 0. Then |x − a| = x − a, so we have that
0 ≤ x − a ≤ b. Adding a, we find that a ≤ x ≤ b + a. Since a − b ≤ a, we see that
a − b ≤ x ≤ a + b.
Case 2: Suppose that x − a < 0. Then 0 < |x − a| = −(x − a) = a − x. Hence,
0 < a − x ≤ b. Multiplying by −1, we get −b ≤ x − a < 0. Now adding a, we get
a − b ≤ x < a. Since a ≤ a + b, we have
a − b ≤ x ≤ a + b.
In both cases we obtain the desired inequalities.

Theorem 8.21 (The Triangle Inequality). Let x, y ∈ R. Then |x+y| ≤ |x|+|y|.

Proof. Without loss of generality, we may assume that x ≥ y, so that if only one of
x or y is nonnegative, it is x. We divide the remaining possibilities into four cases.
Case 1: Suppose that x ≥ 0 and y ≥ 0. Then x + y ≥ 0, so
|x + y| = x + y = |x| + |y|.
Case 2: Suppose that x < 0 and y < 0. Then x + y < 0, so
|x + y| = −(x + y) = (−x) + (−y) = |x| + |y|.
Case 3: Suppose that x ≥ 0, y < 0, and x + y ≥ 0. Then we have
|x + y| = x + y = |x| − |y| < |x| + |y|
where the inequality arises because −|y| < |y| (and one can just add |x| to both
sides).
Case 4: Suppose that x ≥ 0, y < 0, and x + y < 0. Then
|x + y| = −(x + y) = (−x) + (−y) = −|x| + |y| ≤ |x| + |y|.
Hence, in all four cases, the theorem is true.

Theorem 8.22. Let x, y ∈ R. Then |xy| = |x||y|.

Proof. This proof is left as Exercise 8.8.


8. PROOF BY CASES 71

8.D Exercises
Exercise 8.1. Let x, y ∈ Z. Prove that if x and y have the same parity, then x2 + xy
is even.

Exercise 8.2. Let a, b, c ∈ Z. Prove that if a - bc, then a - b and a - c. (The converse
is not true. Can you see why?)

Exercise 8.3. Prove the following:


(a) Given x ∈ Z, either x2 ≡ 0 (mod 4) or x2 ≡ 1 (mod 4).
(b) For any integer x, then 4 | (x4 − x2 ).

Exercise 8.4. Let a, b, c, n ∈ Z. Prove that if a ≡ b (mod n) and b ≡ c (mod n),


then a ≡ c (mod n).
If we know that 11 ≡ −3 (mod 7) and that −3 ≡ 4 (mod 7), can we say that
11 ≡ 4 (mod 7)?

Exercise 8.5. Prove, for any n ∈ Z, that 3 | n if and only if 3 | n2 . (Hint: Use the
idea in Example 8.14 to divide the proof into cases.)

Exercise 8.6. Prove that 3 | (2n2 + 1) if and only if 3 - n, for each n ∈ Z.

Exercise 8.7. Let a, b, c, d, n ∈ Z. Prove that if a ≡ b (mod n) and c ≡ d (mod n),


then ac ≡ bd (mod n).
What does this statement say if we take c = a and d = b?
We know that 19 ≡ 5 (mod 7). Do we then know 192 ≡ 52 (mod 7)? How about
19 ≡ 53 (mod 7)?
3

Exercise 8.8. Prove Theorem 8.22; for any x, y ∈ R, we have |xy| = |x||y|.

Exercise 8.9. Let a ∈ R. Prove that a2 ≤ 1 if and only if −1 ≤ a ≤ 1. In the proof


you may use the following two facts that are true for any a, b, c ∈ R.
(1) If a < b and c > 0, then ac < bc.
(2) If a < b and c < 0, then ac > bc.
(These two rules mean that if you multiply both sides of an inequality by a positive
number, then the inequality remains true. On the other hand, if you multiply both
sides by a negative number, then the inequality gets reversed.)
In the proof you should not take a square root of both sides of an inequality, nor
square both sides of an inequality.
72 CHAPTER III. BASIC PROOF TECHNIQUES

9 Proof by contradiction
9.A Basic technique and examples
In this section we explore a proof technique that can be applied not only to implica-
tions but to other statements as well; the technique is called “proof by contradiction.”
It is based upon the following simple idea:

Theorem 9.1. Let R and S be statements. If (¬R) ⇒ S is true and S is false,


then R must be true.

Proof. If the conclusion of an implication is false, the only way for the implication to
be true is if the premise is also false. Hence, ¬R is false. But this means R is true.
(Alternatively, draw a truth table.)
Another way to think about this theorem is that if by assuming ¬R we can reach
some false statement, then R must have been true after all. (If an assumption leads
to nonsense, that assumption must have been false.) We will see this proof technique
in action, by proving the following proposition.

Proposition 9.2. There is no smallest positive rational number.

Proof. Assume, by way of contradiction, that there is a smallest positive rational


number; call it r ∈ Q. Then r/2 is a rational number, still positive, and r/2 < r.
This is impossible, because r was supposed to be the smallest element with these
properties. This contradiction shows that our assumption must have been false, so
there is no smallest positive rational number.
Proof by contradiction is a very powerful technique, because it applies to many
different types of statements. However, it is also limited in two ways:
(1) By assuming ¬R you are working in an imaginary world, where you are pre-
tending R is false (even though you believe R is true). Your ultimate goal is to
find some false statement or contradiction that follows from your assumption.
The only conclusion you can make after finding that false statement is that R
must have been true after all (since you were working in an imaginary world).
(2) Sometimes it can be difficult to find the contradiction that arises from the
assumption ¬R. Unlike direct proofs or contrapositive proofs, we do not know
where we are headed. It can take practice to get a feeling for what to search
for.

9.B Proof by contradiction for implications


When R is a statement of the form

R: ∀x, P (x) ⇒ Q(x)


9. PROOF BY CONTRADICTION 73

then the negation is


¬R: ∃x, P (x) ∧ ¬Q(x).
Thus, to do a proof by contradiction in the case of an implication, you assume the
premise and the negation of the conclusion, and then search for a contradiction.

Advice 9.3. An easy way to remember what to assume when proving an im-
plication by contradiction is that you have the same assumptions as in both a
direct proof and a contrapositive proof.

Here is an example of how to do an “even/odd” proof by contradiction.

Proposition 9.4. Let x ∈ Z. If 2 | x then 2 - (x2 + 1).

Proof. Assume, by way of contradiction, that 2 | x and 2 | (x2 + 1) for some x ∈ Z. We


can then write x = 2y and x2 + 1 = 2z for some y, z ∈ Z. Plugging the first equality
into the second, we get 4y 2 + 1 = 2z. Therefore 1 = 2z − 4y 2 = 2(z − 2y 2 ) is even,
which is false. Thus, the original implication is true.

Here is another example where either a direct proof or a contrapositive proof


would be very difficult to accomplish (unless you use a lemma to help).

Proposition 9.5. Given x ∈ Z, if x2 + 2x − 3 is odd then x2 + 4x − 5 is odd.

Proof. Assume, by way of contradiction, that x2 + 2x − 3 is odd and x2 + 4x − 5 is


even, for some x ∈ Z. Then we can write x2 + 2x − 3 = 2k + 1 and x2 + 4x − 5 = 2` for
some k, ` ∈ Z. Subtracting each side of the second equation from the corresponding
side of the first equation, we obtain

(x2 + 2x − 3) − (x2 + 4x − 5) = 2k + 1 − 2`.

After simplifying, we obtain 1 = 2x + 2k − 2` is even, a contradiction.

Contradiction proofs can also involve cases. We just need to check that every case
ends in a contradiction, in order to show that each case could not have happened
after all. The following result demonstrates this idea.

Proposition 9.6. If x ∈ Z is even, then x is not the sum of three integers with
an odd number of them being odd.

Proof. Assume, by way of contradiction, that there is some even integer x that is the
sum of three integers a, b, c ∈ Z, an odd number of them being odd. There are two
cases.
74 CHAPTER III. BASIC PROOF TECHNIQUES

Case 1: Assume all three are odd. Then a = 2k + 1, b = 2` + 1, and c = 2m + 1


for some k, `, m ∈ Z. Adding, we get

x = a + b + c = 2k + 1 + 2` + 1 + 2m + 1 = 2(k + ` + m + 1) + 1

is odd, contradicting the fact that x is even.


Case 2: Assume one of the three numbers is odd and that the other two are
even. Without loss of generality, suppose c is the odd one. Then a = 2k, b = 2`, and
c = 2m + 1 for some k, `, m ∈ Z. Adding, we get that

x = a + b + c = 2k + 2` + 2m + 1 = 2(k + ` + m) + 1

is odd, contradicting the fact that x is even.


Thus, in every case, we reached a contradiction.

9.C Irrationality proofs


In this subsection we will focus on proofs that involve the following definition:

Definition 9.7. A real number r is irrational if it is not rational. In other


words, r ∈ R − Q.

Do we know that there exist any irrational numbers? Yes, and this fact was proved
thousands of years ago by the Pythagoreans. (Legend has it that the mathematician
who originally proved this fact was either killed or exiled for the proof, since it ran
counter to the doctrine of the times!) Here is the proof, essentially unchanged from
that time.

Theorem 9.8. The real number 2 is irrational.

Proof.
√ Assume, by way of contradiction, that 2 ∈ Q. Therefore, we can write
2 = a/b for some a, b ∈ N, with a/b in lowest terms. After squaring and clearing
denominators, a2 = 2b2 . Thus 2 | a2 , and hence 2 | a by Proposition 7.16. Write a = 2x
for some x ∈ Z.
Plugging a = 2x into the equality a2 = 2b2 yields 4x2 = 2b2 , or in other words
b = 2x2 . Thus 2 | b2 , and hence 2 | b. However, now a and b are both even, which
2

contradicts the fact that a/b was assumed to be in lowest terms. Hence, 2 is
irrational.

9.D Advice
We end this section with two pieces of advice.
First, sometimes one can tell that a result could be proved by contradiction be-
cause the statement R itself has some negative sounding words. For instance, in this
section we proved the following statements R:
9. PROOF BY CONTRADICTION 75

• There is no smallest
√ positive rational number.
• The number 2 is not rational.
• If x is even, then 2 does not divide x2 + 1.
It is usually easier to work with positive conditions, rather than negative conditions,
which is why proofs by contradiction work so well in these cases. The negative
conditions are turned positive after negating R.
Second, if a proof can be done without contradiction, then that is usually a better
option, because you never enter an “imaginary” world where you assume something
you are hoping to show is false.

9.E Exercises
Exercise 9.1. Let R and S be statements. Draw a truth table with columns labeled
R, S, ¬R, and (¬R) ⇒ S. Verify that the only row where S is false and (¬R) ⇒ S
is true occurs when R is true.

Exercise 9.2. Prove the following statement directly, contrapositively, and by con-
tradiction: Given x ∈ Z, if 3x + 1 is even, then 5x + 2 is odd.

Exercise 9.3. Prove, by way of contradiction, that for any a, b, c ∈ Z with a2 +b2 = c2 ,
then a is even or b is even. (Hint: Consider Exercise 8.3.)

Exercise 9.4. Prove that 3 is irrational.

Exercise 9.5. Prove that 3 2 is irrational.

Exercise 9.6. Prove: If x ∈ Q and y ∈ R − Q, then x + y ∈ R − Q.

Exercise 9.7. Prove: If we are given a nonzero rational number x and an irrational
number y, then the number xy is irrational. (Hint: Your proof should, somewhere,
use the fact that x 6= 0, because when x = 0 the conclusion is false.)

Exercise 9.8. Prove there is no smallest positive irrational number. (Hint: Use the
result of the previous exercise.)

Exercise 9.9. Given x, y ∈ Z, prove that 33x + 132y 6= 57.


76 CHAPTER III. BASIC PROOF TECHNIQUES

10 Proofs in set theory


A fundamental skill when doing proofs is handling sets. The methods developed in
the previous few sections will be extremely useful in this regard. In this section we
focus on three skills: (1) How to prove x ∈ A. (2) How to prove A ⊆ B. (3) How to
prove A = B.

10.A Proving set membership


If we want to prove x is an element of some set A, the proof might depend on how
we describe A. For instance, if A is given as a list of elements {1, 2, 3}, then we
just have to check that x is one of those elements in the list. When A is described
using set-builder notation, then we must verify that x satisfies all of the properties
for elements in A. Here is an example.

Proposition 10.1. Fix S = {n : n is an odd integer}. Then 3 ∈ S.

Proof. The number 3 is an odd integer, since 3 = 2 · 1 + 1. Thus 3 ∈ S.

Suppose T = {x ∈ N : x is a squared integer}. Is 0 ∈ T ? The answer is no. It is


true that 0 is a squared integer, but there is a second requirement for elements of T ,
they must belong to N. Thus 0 ∈ / T because 0 ∈/ N.
Here is one final example of proving that an element belongs to a set.

Proposition 10.2. (28, 6) ∈ {(x, y) ∈ Z × Z : x ≡ y (mod 11)}.

Proof. First, we see that since 28 and 6 are integers, we have (28, 6) ∈ Z × Z.
Second, we check directly that 28 − 6 = 22 is divisible by 11. So 28 ≡ 6 (mod 11).
Therefore (28, 6) satisfies all of the conditions to belong to this set.

10.B Proving inclusion of sets


Let A and B be sets. What does A ⊆ B mean? It means that every element of A is
an element of B. In other words

∀x, x ∈ A ⇒ x ∈ B.

Most often we prove this implication using a direct proof. The steps are simple.
(1) Assume x ∈ A.
(2) Using that information, show x ∈ B.
We demonstrate how this is to be done with a few examples.
10. PROOFS IN SET THEORY 77

Proposition 10.3. Fix A = {x ∈ Z : 4 | x} and B = {x ∈ Z : 2 | x}. It holds


that A ⊆ B.

Proof. Assume a ∈ A. Thus a ∈ Z and 4 | a. We can write a = 4m for some m ∈ Z.


Therefore a = 2(2m), hence 2 | a. We have demonstrated that a satisfies all the
properties needed to belong to B, so a ∈ B.
As a ∈ A was arbitrary, we have now shown A ⊆ B.
In the next proposition, we make use of the tautology P ⇒ (P ∨ Q).

Proposition 10.4. Given sets S and T , then S ⊆ S ∪ T .

Proof. Assume x ∈ S. By the tautology mentioned above we know that x ∈ S or


x ∈ T . Therefore, x ∈ S ∪ T by the definition of union.
In the next proposition we will prove that S ∪ T ⊆ S ∩ T . (Drawing a Venn
diagram helps us believe this is true, but we still need to give the formal proof.) The
method we use is still the same: we will assume x is an element of the (hypothetically)
smaller set S ∪ T and then prove it belongs to the bigger set S ∩ T .

Proposition 10.5. Given a universe U , and sets S, T ⊆ U , then S ∪ T ⊆ S ∩T .

Proof. Assume x ∈ S ∪ T . Then x ∈ U but x ∈ / S ∪ T (by the definition of set


complementation). Hence, ¬(x ∈ S ∪ T ). Thus, ¬(x ∈ S or x ∈ T ), by the definition
of union. Using De Morgan’s law, we have ¬(x ∈ S) and ¬(x ∈ T ). In other words
x∈ / S and x ∈/ T . Since x ∈ U , then x ∈ S and x ∈ T . Finally, we have x ∈ S ∩ T ,
by the definition of intersection.

Warning 10.6. With practice, you’ll never need to use ¬(x ∈ A). But be very
careful! The statement x ∈/ X ∪ Y means that x ∈
/ X and x ∈ / Y , even though
a union is defined in terms of “or”.

In summary, when proving a set inclusion, start with assuming x is an arbitrary


element of the smaller set, and then prove it also must belong to the bigger set. Note:
You do not need to always use the letter x, especially if some other letter makes more
sense for the problem at hand.

10.C Proving equality


When are two sets equal? This happens when they have exactly the same elements.
In other words A = B means
∀x, x ∈ A ⇔ x ∈ B.
This is a biconditional, which we often prove by doing each direction separately. Here
is an example of how this can be done.
78 CHAPTER III. BASIC PROOF TECHNIQUES

Proposition 10.7. Fix A = {x ∈ R : x2 ≤ 1} and B = {x ∈ R : −1 ≤ x ≤ 1}.


We have A = B.

Proof. We first prove A ⊆ B. Assume a ∈ A. Thus a ∈ R and a2 ≤ 1. The second


condition is equivalent to −1 ≤ a ≤ 1, by Exercise 8.9. Thus a ∈ B.
Conversely, we now show B ⊆ A. Assume b ∈ B. Thus b ∈ R and −1 ≤ b ≤ 1.
As mentioned above, the second condition is equivalent to b2 ≤ 1. Hence b ∈ A.

In some situations it takes more work to show that two sets are equal. For instance
we have:

Proposition 10.8. {x ∈ Z : 6 | x} = {x ∈ Z : 2 | x} ∩ {x ∈ Z : 3 | x}.

Proof. Fix A = {x ∈ Z : 6 | x}, B = {x ∈ Z : 2 | x}, and C = {x ∈ Z : 3 | x}. We


first prove A ⊆ B ∩ C. Let a ∈ A. Thus a ∈ Z and 6 | a. The second condition means
a = 6k for some k ∈ Z. Hence a = 2(3k) and a = 3(2k), so 2 | a and 3 | a. We have
shown that a ∈ B and a ∈ C (since it satisfies all the necessary conditions for set
membership). Therefore a ∈ B ∩ C.
Conversely, we now show that B ∩ C ⊆ A. Let z ∈ B ∩ C. Thus z ∈ B and z ∈ C.
Hence z ∈ Z, and 2 | z, and 3 | z. Thus z = 2k and z = 3` for some k, ` ∈ Z. Since
z is even, ` must be even. (You can prove this, contrapositively.) Hence ` = 2m for
some m ∈ Z. Thus z = 3` = 3(2m) = 6m. So 6 | z. Therefore z ∈ A.

We finish with one more example.

Proposition 10.9. Given sets X, Y , and Z, then

X ∪ (Y ∩ Z) = (X ∪ Y ) ∩ (X ∪ Z).

Proof. We first prove the inclusion X ∪ (Y ∩ Z) ⊆ (X ∪ Y ) ∩ (X ∪ Z). Assume


a ∈ X ∪ (Y ∩ Z). Therefore a ∈ X or a ∈ Y ∩ Z. We deal with those cases separately.
Case 1: Assume a ∈ X. Then, by tautology, a ∈ X or a ∈ Y . Hence a ∈ X ∪ Y ,
by the definition of union. By similar reasoning a ∈ X ∪Z. Thus a ∈ (X ∪Y )∩(X ∪Z)
by the definition of intersection.
Case 2: Assume a ∈ Y ∩ Z. Thus a ∈ Y and a ∈ Z. By tautology we know
a ∈ X or a ∈ Y , hence a ∈ X ∪ Y from the definition of union. Similarly, a ∈ X ∪ Z.
Therefore, a ∈ (X ∪ Y ) ∩ (X ∪ Z) by definition of intersection.
In both cases, we have shown a ∈ (X ∪ Y ) ∩ (X ∪ Z). This proves the needed
inclusion.
We now show, conversely, that (X ∪ Y ) ∩ (X ∪ Z) ⊆ X ∪ (Y ∩ Z). Assume
b ∈ (X ∪ Y ) ∩ (X ∪ Z). We have b ∈ X ∪ Y and b ∈ X ∪ Z, from the definition of
intersection. Hence, b ∈ X or b ∈ Y , and we also have b ∈ X or b ∈ Z. There are
two cases to consider.
10. PROOFS IN SET THEORY 79

Case 1: Assume b ∈ X. Thus (by a tautology) b ∈ X or b ∈ (Y ∩ Z). Hence


b ∈ X ∪ (Y ∩ Z).
Case 2: Assume b ∈ / X. Then, from our work above we know that b ∈ Y and
b ∈ Z. Hence b ∈ Y ∩Z. By tautology, b ∈ X or b ∈ Y ∩Z. Therefore b ∈ X ∪(Y ∩Z),
by definition of union.
In every case b ∈ X ∪ (Y ∩ Z), so we have proved the needed inclusion.

10.D Laws for sets


The following theorem lists some of the most useful set equalities. It can be useful to
try to prove for oneself a few of these equalities. (Some are extremely easy to prove,
like the commutative laws.)

Theorem 10.10. Let A, B, and C be sets. Assume that they all are subsets of
some universal set U . The following properties hold:
• Commutative laws.
A ∩ B = B ∩ A.
A ∪ B = B ∪ A.
• Associative laws.
(A ∩ B) ∩ C = A ∩ (B ∩ C).
(A ∪ B) ∪ C = A ∪ (B ∪ C).
• Distributive laws.
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
• Identity laws.
A ∪ ∅ = A.
A ∩ U = A.
• Complement laws.
A ∪ A = U.
A ∩ A = ∅.

It is a deep fact that every other set equality involving only unions, intersections,
and complements, can be derived (algebraically) from these laws. However, there are
a few other common properties that can be proved quite easily just using the methods
of this section. (In fact, we proved part of one of them earlier!)

Theorem 10.11. Let A and B be sets. Assume that they all are subsets of some
universal set U . The following properties hold:
• De Morgan’s laws.
A ∪ B = A ∩ B.
A ∩ B = A ∪ B.
• Double negation.
A = A.
80 CHAPTER III. BASIC PROOF TECHNIQUES

10.E Exercises
Exercise 10.1. For each element and set listed below, explain why the element does
or does not belong to the set.
(a) Is 3 ∈ {1, 2, 3, 4, 5, 6, 7}?
(b) Is π ∈ {1, 2, 3, 4, 5, 6, 7}?
(c) Is π ∈ R?
(d) Is 2/3 ∈ {x ∈ R : x < 1}?
(e) Is 2/3 ∈ {x ∈ Z : x < 1}?
Exercise 10.2. Fix
A = {(x, y) ∈ Z × Z : 4 | (x − y)}
and fix
B = {(x, y) ∈ Z × Z : x and y have the same parity}.
Prove that A ⊆ B.
Exercise 10.3. Fix X to be the set of integers that are congruent to −1 modulo 6
and fix Y to be the set of integers that are congruent to 2 modulo 3. Prove X ⊆ Y .
Exercise 10.4. Let A and B be sets inside some universal set U .
(a) Prove that A ∩ B ⊆ A ∪ B.
(b) Prove that A ∪ B ⊆ A ∩ B.
(c) Putting those two previous parts together, what have you proved?
(Warning: You may use Theorem 3.25, but not Theorem 10.11.)
Exercise 10.5. Let X and Y be sets. Prove X −(X −Y ) ⊆ X ∩Y . (Hint: Remember
that s ∈ S − T means s ∈ S and s ∈
/ T . Thus, s ∈
/ S − T means s ∈
/ S or s ∈ T .)
Exercise 10.6. Given a set X, prove that X ∪ ∅ = X. (Hint: If you have a case
where x ∈ ∅, then you know that case doesn’t actually happen.)
Exercise 10.7. Let n ∈ Z. Prove that
{x ∈ Z : n | x} = {x ∈ Z : x ≡ 0 (mod n)}.
Exercise 10.8. Let A, B, and C be sets. Prove that
A − (B ∩ C) ⊆ (A − B) ∪ (A − C).
Is the other inclusion true?
Exercise 10.9. For each n ∈ N, define Sn = {m ∈ Z : m ≤ n}. Prove that
[
Sn = Z.
n∈N

(Recall that, by Definition 2.9, [


x∈ Si
i∈I

means that x ∈ Si for some i ∈ I.)


11. EXISTENCE PROOFS AND COUNTEREXAMPLES 81

11 Existence proofs and counterexamples


In the previous sections we have mainly proved universal statements:
∀x ∈ S, R(x).
In this section we focus our attention on proving existential statements:
∃x ∈ S, R(x).
Often these statements are significantly easier to prove than universal statements,
because you just need to find a single example to demonstrate their truth.

11.A Constructive existence proofs


When attempting to prove ∃x ∈ S, R(x), it is sometimes possible to find an element
x of the set S satisfying the property R(x). Here are some instances where we can
do this.
Example 11.1. (1) The statement ∃x ∈ R, x > 1 is true, because x = 3 is an
example. (There are many more examples, we just needed to find one.)
(2) The statement ∃n ∈ N, n3 < 2 is true because n = 1 is an example. (In this
case, the number n = 1 is the only example.)
(3) The statement ∃x ∈ R, x2 < x is true because x = 0.5 is an example. 4
When proving a statement with universal quantifiers ∀x ∈ S, R(x), we have in the
past started the proof with the sentence: “Let x ∈ S.” This is shorthand for saying
“Let x be an arbitrary element of the set S.” When working with existence quantifiers,
we instead use words like “fix,” “put,” or “set” as in the following example.

Proposition 11.2. There exists an integer n such that n3 = n2 .

Proof. Fix n = 0. We see that n3 = 0 = n2 , as needed.

Warning 11.3. Some mathematicians use the word “let” when handling ex-
istential statements. For instance, they might have started the previous proof
with the sentence “Let n = 0.”

In some cases a statement asks for the existence of more than one element.

Proposition 11.4. There exist a, b ∈ N such that a2 | b3 but a - b.

Proof. Fix a = 8 and b = 4. Since 64 | 64 we have a2 | b3 . However 8 - 4, so a - b.


You might wonder what to do when a statement has more than one quantifier. In
that case, you deal with each quantifier as it arises. The following proposition and
proof show how this is to be done.
82 CHAPTER III. BASIC PROOF TECHNIQUES

Proposition 11.5. Every odd integer is the sum of two consecutive integers.

Proof. We are proving the following statement:

∀a ∈ Z, a is odd ⇒ (∃b ∈ Z, a = b + (b + 1)) .

Let a ∈ Z. Assume a is odd. Hence a = 2k + 1 for some k ∈ Z.


Fix b = k. Then b + (b + 1) = k + (k + 1) = 2k + 1 = a. Hence a is the sum of
two consecutive integers.

11.B Nonconstructive existence proofs


Every existence problem in the previous section was solved by finding an explicit
example. This is also called constructing an example, or giving a constructive proof.
Sometimes it is possible to prove an object exists without constructing an example.
Here is one instance.


Proposition 11.6. One of the digits of 2 = 1.414213562 . . . occurs infinitely
many times.

Proof. There are only finitely many possible digits

{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},

but there are infinitely many decimal places.

Notice that in this example we did not actually find out which digit occurs in-
finitely often, which is why we say the proof is nonconstructive. We only proved that
at least one of the digits does show up over and over. It is not much more difficult to
show that in fact two digits must occur infinitely many times. (Sketch: If, by way of
contradiction, we assume that√ only one digit showed up infinitely many times, then
the decimal √ expansion for 2 would eventually just repeat that digit. This would
show that 2 is rational, which we previously proved it is not.) Quite surprisingly, it
is an open problem in mathematics
√ whether three digits must occur infinitely often
in the decimal expansion of 2!
Here is another example, where we almost construct an example.

Proposition 11.7. There are irrational numbers a and b such that ab is rational.

Proof. We will consider two possible cases.


√ √2 √
Case 1: Assume 2 is rational. In this case, fix a = b = 2. Then ab is
rational.
11. EXISTENCE PROOFS AND COUNTEREXAMPLES 83

√ √2 √ √2 √
Case 2: Assume 2 is irrational. In this case, fix a = 2 and b = 2, and
calculate that
√  √2
√ √

2 2
ab = 2 = 2 = 2,

which is rational.

In this proof, we do not know (or care) which case is true. We just show that we
can solve the problem in either case. (If you do care, it is known that Case 2 is the
true case, but this is not easy to√prove.) There does exist a constructive proof of the
previous proposition (take a = 2 and b = log2 (9), and prove that b is irrational).
We finish with one more example of how to prove existence (in a nonconstructive
way). In the proof below we use some standard theorems from calculus, which we
will not prove in this textbook.

Proposition 11.8. The equation x5 + 2x − 1 = 0 has a solution in the open


interval (0, 1).

Proof. The function given by the polynomial equation f (x) = x5 +2x−1 is continuous
everywhere. We find that f (0) = −1 and f (1) = 2. By the Intermediate Value
Theorem, we know that f must take the intermediate value 0 for some input c ∈ (0, 1).
This number c is a solution.

11.C Uniqueness
Some problems ask for more than mere existence; they want uniqueness as well. This
means that you are asked to prove two things: first that there is an element satisfying
the given condition, and second that there are no other solutions. For example, we
can improve the previous proposition to the following:

Proposition 11.9. The equation x5 + 2x − 1 = 0 has exactly one real solution.

Proof. (Existence): We already proved, above, that the equation has at least one real
solution.
(Uniqueness): We now show that the equation can have at most one solution.
Fixing f (x) = x5 + 2x − 1, we compute the derivative f 0 (x) = 5x4 + 2 > 0. Thus,
by the first derivative test, the function f is strictly increasing. Hence, it can equal
0 only once.

Here is another example.

Proposition 11.10. For each integer x ∈ Z, there exists a unique integer y,


such that x < y < x + 2.
84 CHAPTER III. BASIC PROOF TECHNIQUES

Proof. Let x ∈ Z.
(Existence): Fixing y = x + 1 ∈ Z works.
(Uniqueness): Since (x + 2) − x = 2, these integers are exactly distance 2 apart.
Thus, there is at most one integer between them.
One technique for showing uniqueness is to assume there are two solutions (not
necessarily distinct), and then show that those two solutions are in fact equal. We
will demonstrate this technique in the proof of the following proposition.

Proposition 11.11. Every odd integer is uniquely the difference of two consec-
utive squares.

Proof. Let n ∈ Z be odd.


(Existence): Write n = 2k + 1 for some k ∈ Z. We have

(k + 1)2 − k 2 = k 2 + 2k + 1 − k 2 = 2k + 1 = n

so n is a difference of consecutive squares.


(Uniqueness): Assume that n = (x + 1)2 − x2 and n = (y + 1)2 − y 2 for some
x, y ∈ Z. Thus, we have

(x + 1)2 − x2 = (y + 1)2 − y 2 .

Expanding the squares we get

x2 + 2x + 1 − x2 = y 2 + 2y + 1 − y 2 .

In other words 2x + 1 = 2y + 1. Subtracting 1 from both sides, and cancelling the


2, we get x = y. Thus, n can be written as a difference of consecutive squares in at
most one way.
It is common to write
∃! x ∈ S, R(x)
to denote the statement “there exists a unique x ∈ S satisfying R(x).” The exclama-
tion mark after ∃ denotes uniqueness.

11.D Counterexamples and disproof


Mathematicians often encounter statements for which the truth value is unknown.
After working on the problem, they might discover that the statement they were
trying to prove is actually false. Thus, they must disprove the statement by proving
its negation. Consider the statement:
1
∀x ∈ R, x > x2 .
2
Is this statement true or false?
11. EXISTENCE PROOFS AND COUNTEREXAMPLES 85

After a moment’s reflection, we realize it is false. So we wish to give a disproof.


In other words, we want to prove its negation:
1
∃x ∈ R, x ≤ x2 .
2
Disproof of original statement. Fix x = 0 ∈ R. We easily see that x ≤ 12 x2 .
This type of disproof is called finding a counterexample. We showed that the
original universal statement was false by finding an example where it failed. Here is
another instance of this idea.
Example 11.12. Disprove the statement: Every x ∈ Z is odd. 4
Disproof. The integer x = 2 is a counterexample.
The negation of an existential statement becomes a universal statement. Thus,
when disproving an existential statement you must show that its negation is true
everywhere in the domain. For example, the statement

∃x ∈ R, x2 < −1

is false. Here is a disproof.


Disproof. Let x ∈ R be arbitrary. We know that x2 ≥ 0 > −1.
Try to decide whether the following statement is true or false, and then give a
proof or disproof.

Given a, b ∈ Z, if a | b and b | a, then a = b.

Answer: This statement is false. Its negation is

∃a, b ∈ Z, (a | b) ∧ (b | a) ∧ (a 6= b).

Disproof. Fix the integers a = 2 and b = −2. We have a | b, and b | a, and a 6= b.

Advice 11.13. When asked to either prove or disprove a statement, clearly tell
the reader which of the two you have decided to try.

11.E Exercises
Exercise 11.1. Prove the following:
(a) There exist a, b ∈ Q such that ab ∈ Q.
(b) There exist a, b ∈ Q such that ab ∈ R − Q.
(c) There exist a, b ∈ R − Q such that ab ∈ R − Q.
(d) There exist a ∈ Q and b ∈ R − Q such that ab ∈ Q.
(e) There exist a ∈ Q and b ∈ R − Q such that ab ∈ R − Q.
86 CHAPTER III. BASIC PROOF TECHNIQUES

(f) There exist a ∈ R − Q and b ∈ Q such that ab ∈ Q.


(g) There exist a ∈ R − Q and b ∈ Q such that ab ∈ R − Q.
(Hint: For part (c), note that
√ √
√ 2 √ 1− 2 √
2 · 2 = 2,

and hence at least one of the two factors on the left-hand side is irrational. Alter-
natively, one can solve part (c) constructively, by proving the fact that log2 (3) is
irrational.
For part (e), note that √ √ √
1
2 2 · 2 2 − 2 = 2,
and hence at least one of the two factors on the left-hand side is irrational. Alterna-
tively, we have the equality
 1  √1
√ 2

2 2 = 2.
√1
Break into cases, according to whether 2 2 is rational or irrational.)

Exercise 11.2. Prove or disprove: For any x ∈ Q and y ∈ R − Q, then xy ∈ R − Q.

Exercise 11.3. Prove or disprove: For each s ∈ Z, if 6s − 3 is odd, then s is odd.

Exercise 11.4. Prove or disprove: There exists an integer x such that x2 + x is odd.

Exercise 11.5. Prove or disprove: Given any positive rational number a, there is an
irrational number x ∈ (0, a).

Exercise 11.6. Prove that for any two real numbers x < y, there exists a rational
number in the interval (x, y). In this proof you may freely use the fact that if two
real numbers are more than 1 apart, then an integer lies between them.
Idea 1: Fix z = 1/(y − x). Since z and z + 2 are more than 1 apart, fix some
integer d between z and z + 2.
Idea 2: Explain why dy − dx > 1. Use this to fix an integer n between dy and dx.
12. SET PROOFS IN LOGIC 87

12 Set proofs in logic


In Section 10 we focused on performing three standard tasks involving sets:
• Prove x ∈ S.
• Prove S ⊆ T .
• Prove S = T .
In this section we work with statements involving sets and logical connectives.

12.A Implications involving set statements


Consider the statement
∀S, T, if S ⊆ T, then S ⊆ S ∩ T.
It looks like a standard implication. We will approach it directly by assuming S ⊆ T ,
and then using that assumption we will prove S ⊆ S ∩ T . Now, remember that
S ⊆ S ∩ T is also an implication; namely, ∀x, x ∈ S ⇒ x ∈ S ∩ T . So we approach
proving this implication directly as well! We make the second assumption x ∈ S,
and using it (and the previous assumption) we prove x ∈ S ∩ T . The proof will look
something like the following:
Proof outline. Let S and T be sets.
Assume S ⊆ T .
Assume x ∈ S.
..
.
Conclude x ∈ S ∩ T .
Conclude S ⊆ S ∩ T .
Now that we have mapped out the proof, here it is in its entirety.

Proposition 12.1. Given sets S and T , if S ⊆ T then S ⊆ S ∩ T .

Proof. Let S and T be sets. Assume S ⊆ T . We now show S ⊆ S ∩ T .


Assume x ∈ S. From our assumption S ⊆ T , we have x ∈ T . Thus x ∈ S and
x ∈ T . Hence, from the definition of intersection, x ∈ S ∩ T . As x was an arbitrary
element of S, we have shown S ⊆ S ∩ T .

Advice 12.2. When proving statements with multiple implications, work step
by step. For instance, suppose you want to prove a statement of the form

A ⇒ (B ⇒ C).

Working directly, you would assume A and show B ⇒ C. But to show B ⇒ C,


you can again work directly by assuming B and then showing that C holds. So
you have two assumptions, which can be used together to show C.
88 CHAPTER III. BASIC PROOF TECHNIQUES

Warning 12.3. Suppose you want to prove

(A ⇒ B) ⇒ (C ⇒ D).

Working directly (twice) you have the assumptions A ⇒ B and C. Your goal is
to prove D. Note that you do not know yet that either A or B is true!

Proposition 12.1 can be strengthened into a biconditional statement as follows.

Proposition 12.4. Given sets S and T , we have S ⊆ T if and only if S = S ∩T .

Before reading further, attempt to outline the proof of this proposition.


Proof Outline. Let S and T be sets.
(⇒): Assume S ⊆ T .
(⊆): We first show S ⊆ S ∩ T .
Assume x ∈ S.
..
.
Conclude x ∈ S ∩ T .
(⊇): We now show S ⊇ S ∩ T .
Assume y ∈ S ∩ T .
..
.
Conclude y ∈ S.
Conclude that S = S ∩ T .
(⇐): Assume S = S ∩ T .
(⊆): We show S ⊆ T .
Assume z ∈ S.
..
.
Conclude z ∈ T .
Conclude that S ⊆ T .
We leave the details for the full proof of Proposition 12.4 as an exercise.

12.B Do we always work directly?


Some implication statements involving sets should not be proved directly. For in-
stance, for fixed sets A and B, consider the statement:

(12.5) B 6= A ∪ B ⇒ A 6= B.

It is usually difficult to work with unequal sets, since A 6= B means

∃x, x ∈ A − B or x ∈ B − A.

So, instead we should try to prove (12.5) contrapositively. Here is a proof outline.
12. SET PROOFS IN LOGIC 89

Proof outline. Let A and B be sets. We work contrapositively.


Assume A = B.
(⊆): We first show B ⊆ A ∪ B.
Assume x ∈ B.
..
.
Conclude x ∈ A ∪ B.
(⊇): We now show B ⊇ A ∪ B.
Assume y ∈ A ∪ B.
..
.
Conclude y ∈ B.
Conclude B = A ∪ B.

We stated above that it is usually difficult to work with unequal sets. However,
there is one situation where this piece of advice fails. Which of the following two
statements is easier to work with?
• A = ∅.
• A 6= ∅.
The second statement is easier, because it tells us that A actually has an element.
To illustrate this fact, we will prove the following theorem.

Proposition 12.6. Let A and B be sets. If A = ∅ and B = ∅, then A ∪ B = ∅.

Proof. Let A and B be sets. We work contrapositively. Assume A ∪ B 6= ∅. Hence,


there is some element x ∈ A ∪ B. Thus x ∈ A or x ∈ B. Therefore A 6= ∅ or
B 6= ∅.

Now, compare this with a direct proof!

Proof. Let A and B be sets. We work directly. Assume A = ∅ and B = ∅. We will


show A ∪ B = ∅.
(⊆): We first show A ∪ B ⊆ ∅. Assume x ∈ A ∪ B. Then x ∈ A or x ∈ B. In
either case, this contradicts the fact that A = ∅ and B = ∅. Hence our assumption
was false, so A ∪ B has no elements.
(⊇): We now show the reverse inclusion A ∪ B ⊇ ∅. This holds vacuously.
Thus, we have shown A ∪ B = ∅, as desired.

12.C Set proofs with Cartesian products


Let S and T be sets. What does x ∈ S × T mean? It means that x = (s, t) for some
s ∈ S and some t ∈ T . Just as with intersections, unions, and complements, we use
the definition of the Cartesian product to simplify a statement. We illustrate how to
prove statements about products with the following theorem.
90 CHAPTER III. BASIC PROOF TECHNIQUES

Theorem 12.7. Given four sets A, B, C, D, if A ⊆ C and B ⊆ D, then A×B ⊆


C × D.

Proof. Let A, B, C, and D be sets. Assume A ⊆ C and B ⊆ D. We will show


A × B ⊆ C × D.
Assume x ∈ A × B. Thus x = (a, b) for some a ∈ A and b ∈ B. Since A ⊆ C,
we know a ∈ C. Also since B ⊆ D we know b ∈ D. Thus x = (a, b) ∈ C × D, as
desired.

12.D Exercises
Exercise 12.1. For any sets A, B, C, prove that if A ⊆ B ∩ C, then A ⊆ B. Also
give an example to show that the converse fails.

Exercise 12.2. Give a complete proof for Proposition 12.4, using the sketched out-
line.

Exercise 12.3. Consider the statement:

For any two sets S and T , then S ⊆ T if and only if T = S ∪ T .

Outline a proof of the statement. (Give as much detail as in the outline after Propo-
sition 12.4. You do not need to prove the statement.)

Exercise 12.4. Let S and T be sets. Prove the following.


(a) If S ∩ T = T ∪ S, then S = T .
(b) If S × T = T × S and both S and T are nonempty, then S = T .

Exercise 12.5. Let S and T be sets. Prove that S = T if and only if S − T = T − S.


(Hint: For the backwards direction, work directly using cases.)

Exercise 12.6. Let S and T be sets. Prove or disprove: S = T if and only if


S − T ⊆ T.

Exercise 12.7. Let S be a set. Prove that ∅ × S = ∅.


(Hint: It suffices to show that the assumption x ∈ ∅ × S leads to a contradiction.)

Exercise 12.8. For any sets S and T , show that S × T = ∅ if and only if S = ∅ or
T = ∅.

Exercise 12.9. Consider the statement: Given sets A, B, C, if A × B ⊆ B × C and


B 6= ∅, then A ⊆ C.
Write an outline of a proof, and then (separately) give a complete proof. Is the
conclusion true if we remove the hypothesis that B 6= ∅?

Exercise 12.10. Prove or disprove the converse of Theorem 12.7.


Chapter IV

Proof by Induction

Without continual growth and progress, such words as improvement, achievement,


and success have no meaning. Benjamin Franklin

Mathematical induction is a proof technique that is designed to prove statements


about all natural numbers. It should not be confused with inductive reasoning in the
sciences, which claims that if repeated observations support a hypothesis, then the
hypothesis is probably true; mathematical induction gives a definitive proof.
The basic idea of mathematical induction is to use smaller cases to prove larger
ones. For instance, if one wished to prove that the open sentence

P (n): n < 2n

is true for each positive integer n, one might first check that it is true when n = 1.
In fact, it is easy to check it for many different values of n.
Suppose we could prove that whenever P (k) is true for some positive integer k,
then P (k + 1) is true. We could use this to finish the problem as follows:
Since P (1) is true, P (2) must be true; since P (2) is true, P (3) must be true; since
P (3) is true, P (4) must be true; and so on, forever.
Induction is a technique for making clear what the phrase “and so on, forever”
means in the previous sentence. Anytime we find ourselves wanting to repeat a process
infinitely often in a proof, it is a sign that we should think about using induction.

91
92 CHAPTER IV. PROOF BY INDUCTION

13 Mathematical induction

13.A The principle of mathematical induction


An important property of the natural numbers is the principle of mathematical in-
duction. It is a basic axiom that is used in the definition of the natural numbers, and
as such it has no proof. It is as basic a fact about the natural numbers as the fact
that if we add 1 to any natural number, we obtain a natural number (although its
statement is more complicated).

Axiom 13.1 (The Principle of Mathematical Induction). Let P (n) be an open


sentence, where the domain of n is N. Suppose that
(i) P (1) is true and
(ii) ∀k ∈ N, P (k) ⇒ P (k + 1).
Then P (n) is true for each n ∈ N.

A proof by mathematical induction proceeds by verifying that (i) and (ii) are
true, and then concluding that P (n) is true for each n ∈ N. We call the verification
that (i) is true the base case of the induction and the proof of (ii) the inductive step.
Typically, the inductive step will involve a direct proof; in other words, we will let
k ∈ N, assume that P (k) is true, and then prove that P (k + 1) follows. If we are
using a direct proof we call P (k) the inductive hypothesis.
A proof by induction thus has the following four steps.
Identify P (n): Clearly identify the open sentence P (n). If P (n) is obvious, then
this identification need not be a written part of the proof.
Base Case: Verify that P (1) is true. This will typically be done by direct
computation or by giving an example.
Inductive Step: Prove the implication P (k) ⇒ P (k + 1) for any k ∈ N. Typically
this will be done by a direct proof; assume P (k) and show P (k +1).
(Occasionally it may be done contrapositively or by contradiction.)
Conclusion: Conclude that the theorem is true by induction. As with identify-
ing P (n), this may not need to be a written part of the proof.

Remark 13.2. An intuitive way to think of mathematical induction is as a ladder


with infinitely many rungs, numbered from the bottom. Stepping on rung number n
corresponds to confirming that P (n) is true. Hypothesis (i) of mathematical induction
says that we can step onto the first rung. Hypothesis (ii) of mathematical induction
says that if we can reach rung number k, then we can reach rung number k + 1.
Together, these two hypotheses allow us to reach any rung of the ladder. N

The following diagram gives a visualization of the preceding remark.


13. MATHEMATICAL INDUCTION 93

We begin at rung 1, by (i).


P (5)
Since we can reach rung 1, we
can reach rung 2, by (ii). P (4) ⇒ P (5)
P (4)
Since we can reach rung 2, we
can reach rung 3, by (ii).
P (3) ⇒ P (4)
Since we can reach rung 3, we P (3)
can reach rung 4, by (ii).

Since we can reach rung 4, we P (2) ⇒ P (3)


can reach rung 5, by (ii). P (2)

And so on, forever. For any


given rung, we see that we can P (1) ⇒ P (2)
reach it. P (1)

Warning 13.3. Note the importance of the base case. Without it, the inductive
step shows that we can move from one rung of the ladder to the next higher one,
but there is no evidence that we can reach the bottom of the ladder at all.
Perhaps the ladder is suspended high above the ground; the base case shows
that we can actually reach the bottom rung.

Remark 13.4. Summation notation comes up often in induction proofs. It is impor-


tant to be familiar with it. The notation
n
X
f (i)
i=1

means f (1) + f (2) + · · · + f (n − 1) + f (n), where we evaluate f at each possible integer


i between 1 and n, and add these values together. Hence,
n+1
X
f (i) = f (1) + . . . + f (n) + f (n + 1)
i=1
= (f (1) + . . . + f (n)) + f (n + 1)
n
!
X
= f (i) + f (n + 1).
i=1

This fact, and variations of it, are often used in induction proofs involving summation,
as we will see in many examples to come. N
94 CHAPTER IV. PROOF BY INDUCTION

We now proceed to give an example of a proof by induction, where we prove a


simple formula for the sum of the first n natural numbers. We will first sketch the
strategy of the proof and afterwards write the formal proof.

Proposition 13.5. For each n ∈ N,


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

Proof Strategy. We begin by identifying the open sentence P (n). In this case, P (n)
is the equality
n
X n(n + 1)
P (n): i= .
i=1
2
The base case, verifying that P (1) holds, is done by a simple computation (plug-
ging 1 in for n).
For the inductive step, we assume P (k) is true for some k ∈ N, and we show
P (k + 1) is true. Since we are assuming that P (k) is true, we have the equality
k
X k(k + 1)
i= ,
i=1
2

and we wish to show that P (k + 1) is true, or in other words that


k+1
X (k + 1)(k + 2)
i= .
i=1
2

Examining the statement of P (k + 1), we find that the left-hand side transforms
as follows:
k+1
X
i = 1 + 2 + · · · + k + (k + 1)
i=1
k
!
X
= (1 + 2 + · · · + k) + (k + 1) = i + (k + 1),
i=1

where the sum on the right is the sum involved in P (k). We now use our assumption
of P (k) to simplify the sum, and complete the proof.
Now that we have sketched the proof method, let’s write a full and formal proof.
Proof. Fix P (n) to be the open sentence
n
X n(n + 1)
P (n): i= .
i=1
2
13. MATHEMATICAL INDUCTION 95

We work by induction to prove that P (n) is true for each n ∈ N.


Base case: P (1) is true, since we have
1
X 1(1 + 1)
i=1= .
i=1
2

Inductive step: Let k ∈ N and assume that


k
X k(k + 1)
P (k): i=
i=1
2

is true. We want to show that


k+1
X (k + 1)(k + 2)
P (k + 1): i=
i=1
2

is true. Starting with the left-hand side, and simplifying with the right-hand side as
a target, we find that
k+1
X
i = 1 + 2 + 3 + · · · + k + (k + 1)
i=1
= (1 + 2 + 3 + · · · + k) + (k + 1)
k
!
X
= i + (k + 1)
i=1
k(k + 1)
= + (k + 1) (by the inductive hypothesis)
2
k(k + 1) + 2(k + 1)
= (getting a common denominator)
2
(k + 1)(k + 2)
= (factoring out k + 1).
2
So P (k + 1) is true.
Hence, by induction, P (n) is true for each n ∈ N.
Remark 13.6. It can be helpful to point out to the reader of your proofs where you
use the inductive hypothesis, as done above. Note that if you do not use the inductive
hypothesis, then you could have just proved the theorem without induction. N
Remark 13.7. With practice you will become better at seeing how P (k) and P (k+1)
are related (especially with sums like the one above), and these proofs will go more
smoothly for you. For instance, with practice we could have gone directly to the
equality !
k+1
X Xk
i= i + (k + 1)
i=1 i=1
in the proof above. N
96 CHAPTER IV. PROOF BY INDUCTION

Warning 13.8. A common mistake that students make is to consider P (k) as


a number. It is a statement, not a number. For example, in the previous proof
students might mistakenly write
k
X k(k + 1)
P (k) = i= ,
i=1
2
k(k + 1)
which is incorrect as it says that P (k) is equal to the number . Another
2
incorrect use of P (k) is the following
k+1
X k
X
i= i + (k + 1)
i=1 i=1
= P (k) + (k + 1)
k(k + 1)
= + (k + 1)
2
Note that this also arises from thinking, incorrectly, of P (k) as equal to part of
the statement that it represents.

Remark 13.9. It might appear that in an induction proof we are assuming what we
are attempting to prove. For instance, if we are trying to prove

∀n ∈ N, P (n)

by induction, then in the inductive step of the proof we will need to assume P (k) for
some k ∈ N. It would indeed be a logical mistake to assume P (k) if our immediate
goal were to prove P (k).
However, that is not the case. The goal of the inductive step is not to prove P (k),
but to prove that P (k + 1) follows from P (k). Hence, in fact, we are not assuming
what we wish to prove (namely that P (n) is true for each n ∈ N). Note also that
proving
∀k ∈ N, P (k) ⇒ P (k + 1)
by itself does not prove that P (k) is true for any natural number; it just proves that
if P (k) is true for some k, then P (k + 1) must be true as well (which is why we also
need the base case to start the induction). N

Here is another result we can prove by induction.

Proposition 13.10. Given n ∈ N, it happens that 2n > n.

Proof. We work by induction on n ∈ N.


Base case: We see that 21 = 2 > 1.
13. MATHEMATICAL INDUCTION 97

Inductive step: Let k ∈ N and assume 2k > k. We want to prove 2k+1 > k + 1.
We find

2k+1 = 2 · 2k
>2·k (by the inductive assumption)
=k+k
≥ k + 1. (since k ≥ 1)

This finishes the inductive step, so by induction we know that 2n > n for each
n ∈ N.
Induction can often be used to prove facts about finite sets. In this case, the
general technique is to induct on the size of the sets. Typically, a proposition will be
easy to prove for the empty set, or for sets with a single element. We may assume
the proposition holds for all sets of size k, and let A be a set of size k + 1. Removing
one element from A yields a set of size k, to which the inductive hypothesis applies.
Then, we only need to extend the proposition to A; how we do it depends on what
exactly we wish to prove. The following theorem is a typical example.

Proposition 13.11. Let A be a finite nonempty set of real numbers. Then A


has a least element.

Proof. Fix P (n) to be the open sentence

P (n): Every set of n real numbers has a least element.

We work by induction to show that P (n) is true for each n ∈ N.


Base case: It is clear that any set consisting of only 1 real number has a least
element (namely, its one element), so P (1) is true.
Inductive step: Let k ∈ N and assume P (k). In other words, assume that every
set of k real numbers has a least element. This is our inductive hypothesis; we want
to use it to prove P (k + 1).
Let A be any set consisting of k + 1 real numbers. Choose one of them, and call it
a. Fix B = A − {a}. We note that B has k elements, so by the inductive hypothesis,
B has a least element. Call this element b. By the definition of a least element, we
have b ≤ x for each x ∈ B. Note that since b ∈ B = A − {a}, we must have b 6= a.
Therefore, either b < a or b > a, and we break into two cases.
Case 1: If b < a, then b ≤ x for each x ∈ B ∪ {a} = A. Hence, b is the least
element of A.
Case 2: If a < b, then a < b ≤ x for each x ∈ B, and a ≤ a. Hence, a ≤ x for
each x ∈ B ∪ {a} = A, and so a is the least element of A.
In either case, A has a least element. Since A was an arbitrary set with k + 1
elements, P (k + 1) is true. This completes the inductive step.
Hence, by induction, P (n) is true for each n ∈ N. Therefore, any finite set of real
numbers has a least element.
98 CHAPTER IV. PROOF BY INDUCTION

We now give an application of induction by proving a very important counting


principle in mathematics called “the pigeonhole principle.” This principle may seem
like common sense, hence all the more reason to prove it.

Theorem 13.12 (The Pigeonhole Principle). Let m and n be natural numbers,


with m > n. If m objects are placed in n bins, then two (or more) objects must
share a bin.

Proof. Fix P (n) to be the open sentence

P (n): For each m ∈ N, if m > n and m objects are placed in n bins, then
two (or more) objects must share a bin.

We prove that P (n) holds for each n ∈ N, by induction.


Base case: We verify that P (1) is true. If we have more than one object, and we
place them all in one bin, then all the objects must clearly share a bin.
Inductive step: Assume that P (k) holds for some k ∈ N. We now show that
P (k + 1) holds. Let m ∈ N. Assume that m > k + 1 and that m objects are placed
into k + 1 bins. We need to show that two objects share a bin. Choose one of the
objects and call it x. We divide the proof into two cases.
Case 1: Suppose that the object x shares a bin with at least one other object.
In this case two objects clearly share a bin, so we are finished.
Case 2: The object x is in a bin by itself; no other object shares the bin with x.
In this case there are m − 1 remaining objects, none of which are in the same bin as
object x. Hence, these m − 1 objects must all be placed into the k remaining bins.
By the inductive hypothesis (that P (k) is true), we know that two of these objects
must share a bin, since m − 1 > k .
In both cases two objects must share a bin, which completes the inductive step.
Hence, by the principle of mathematical induction, P (n) is true for each n ∈ N.

Remark 13.13. The pigeonhole principle can be applied to many situations. For
instance, if we choose three integers, then two of them must have the same parity.
Here there are two bins; namely, the evens and the odds. If we choose three numbers,
two of them (possibly all three) must end up in the same bin, or in other words they
have the same parity.
As another example, in a class of 30 people, if each person scores between 80
and 100 percent on an exam (with no fractional scores allowed), then two people
must have received the same score since there are 21 possible scores (bins) that must
contain the 30 people. N

A variation on the pigeonhole principle occurs if we are assigning objects to bins


and we have fewer objects than bins. In this case, common sense tells us that some
bin will remain empty. You will be asked to prove this “common sense” statement in
Exercise 13.8.
13. MATHEMATICAL INDUCTION 99

Warning 13.14. It is important to note that induction cannot be used to prove


“infinite” statements. It does prove infinitely many statements. For instance,
we can prove that
n
X n(n + 1)
i=
i=1
2
for each n ∈ N. However, since ∞ ∈
/ N, induction cannot be used to prove
anything about
X∞
i.
i=1

In terms of the ladder analogy, induction proves that we can reach every rung
of the ladder, but it cannot be used to prove that we can reach the top of the
ladder (since the ladder actually has no top).

13.B Exercises
Exercise 13.1. Prove that for each n ∈ N,
n
X
(2i − 1) = n2 .
i=1

Exercise 13.2. Prove that for each n ∈ N,


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

Exercise 13.3. Prove that for each n ∈ N,


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

Exercise 13.4. (a) Prove that for each n ∈ N,

n < 3n .

(b) Prove that for each n ∈ Z, n < 3n . (Hint: With part (a) in hand, you might
not need induction for part (b).)
Exercise 13.5. Let x ∈ R − {1}. Prove that for each n ∈ N,
n
X 1 − xn+1
xi = .
i=0
1−x

Exercise 13.6. Let x ∈ R and assume that x > −1. Prove that for each n ∈ N,

(1 + x)n ≥ 1 + nx.
100 CHAPTER IV. PROOF BY INDUCTION

Exercise 13.7. Let S be any nonempty set of natural numbers. Prove that S has
a least element. (Hint: Use Proposition 13.11 and the fact that for any n ∈ N, any
subset of {1, . . . , n} is finite. You will not need to use induction in your proof, since
the induction is done in the proof of Proposition 13.11.)
The fact that any nonempty subset of the natural numbers has a least element is
called the well-ordering principle.

Exercise 13.8. Prove the following variation of the pigeonhole principle.


Let m ∈ N ∪ {0}, let n ∈ N, and assume m < n. If we suppose m objects are
placed in n bins, conclude that some bin does not contain any object.
(Hint: Use induction on n ∈ N.)
14. MORE EXAMPLES OF INDUCTION 101

14 More examples of induction


In this section we will discuss two tricks related to induction.

14.A Starting induction somewhere else


Often, we wish to prove a statement of the form

P (n) is true for each integer n ≥ a

where a is a fixed integer. Note that if a = 1, the variable n is just ranging over all
natural numbers.
Induction can be used to prove such statements. The only change is that our base
case starts at a instead of 1. We will explain why this works at the end of this section,
but for now we demonstrate how this changes proofs by giving some examples.

Proposition 14.1. For each integer n ≥ 10, it happens that 2n > n3 .

Before we start the proof we make a few remarks. First, why are we restricting to
integers n ≥ 10? The reason is because the claim is false for some smaller integers.
The inequality is false when n = 9. (Try it!) Second, what is the open sentence P (n)?
It is just P (n): 2n > n3 . When we plug in k + 1 for n, we have

P (k + 1): 2k+1 > (k + 1)3 .

The right-hand side can be simplified a bit. We note that

(k + 1)3 = k 3 + 3k 2 + 3k + 1.

In the computation in the proof below we will slowly try to “peel off” each of the
terms k 3 , 3k 2 , 3k, and 1, one at a time, so that eventually we can end up with (k +1)3 .
We are now ready for the formal proof.

Proof. We wish to prove that the open sentence

P (n): 2n > n3

is true for each integer n ≥ 10. We work by induction.


Base case: We verify that P (10) is true, as follows:

210 = 1024 > 1000 = 103 .

Inductive step: Let k ∈ N with k ≥ 10. Assume that P (k) is true. So we now
know that 2k > k 3 . We wish to prove P (k + 1), which states that

2k+1 > (k + 1)3 .


102 CHAPTER IV. PROOF BY INDUCTION

In order to do this, we examine 2k+1 closely. We find

2k+1 = 2 · 2k
= 2k + 2k
> k3 + k3 (2k > k 3 , by inductive hypothesis)
≥ k 3 + 10k 2 (since k ≥ 10)
= k 3 + 3k 2 + 7k 2 (peeling off 3k 2 )
≥ k 3 + 3k 2 + 70k (since k ≥ 10)
= k 3 + 3k 2 + 3k + 67k (peeling off 3k)
> k 3 + 3k 2 + 3k + 1 (since 67k > 1)
= (k + 1)3 .

Hence, P (k + 1) is true.
Therefore, by mathematical induction, P (n) is true for each integer n ≥ 10.

Remark 14.2. When trying to prove the inductive step, it can sometimes be difficult
to verify that P (k + 1) follows from P (k). Notice that in the previous example we
wanted to show that 2k+1 > (k + 1)3 . In order to do this, we wrote down one side
of the inequality (the left-hand side) and manipulated it in order to reach the other
side.
In the previous example we were aided by the knowledge that the right-hand side
expands as
(k + 1)3 = k 3 + 3k 2 + 3k + 1.

This gave us a target to shoot for. Moreover, the right-hand side cannot be simplified
much further, which is why we started with the left-hand side in the proof above. It
is often useful to manipulate both sides of an equation or inequality in order to work
out (on scratch paper) how to get from one side to the other. However, in the proof
we must be careful that our inequalities all go the same direction. N

We now introduce an important mathematical object called the factorial. Its


definition is reminiscent of induction because the factorial of an integer n is defined
in terms of the factorial of (n − 1). It is no surprise that many theorems about
factorials are proved by induction.

Definition 14.3. Given n ∈ Z≥0 , we define the factorial of n, written as n! and


read as “n factorial,” to be
(
1 if n = 0,
n! =
n · (n − 1)! if n > 0.
14. MORE EXAMPLES OF INDUCTION 103

Example 14.4. If we wish to compute 5!, we use the formula repeatedly as follows:

5! = 5 · 4!
= 5 · 4 · 3!
= 5 · 4 · 3 · 2!
= 5 · 4 · 3 · 2 · 1!
= 5 · 4 · 3 · 2 · 1 · 0!
=5·4·3·2·1·1
= 120.

In general, for each integer n ≥ 1 we see that

n! = n · (n − 1) · (n − 2) · · · 3 · 2 · 1. 4

Proposition 14.5. For each integer n ≥ 4 we have n! > 2n .

Proof. We wish to prove that the open sentence

P (n): n! > 2n

is true for each integer n ≥ 4. We work by induction.


Base case: Note that 4! = 24 > 16 = 24 . Hence, P (4) is true.
Inductive step: Let k ≥ 4 be an integer, and assume P (k) is true. Then we
know that k! > 2k . Now we wish to show that (k + 1)! > 2k+1 . We find

(k + 1)! = (k + 1)k!
> (k + 1)2k (since k! > 2k , by the inductive hypothesis)
> 2 · 2k (since k + 1 > 4 > 2)
k+1
=2 .

Hence, P (k + 1) is true.
Therefore, by induction P (n) is true for each integer n ≥ 4.
If we wish to prove facts about finite sets, it will often be convenient to start our
induction with the base case being any set of size 0 (namely, the empty set).

Proposition 14.6. If A is a finite set, then |P(A)| = 2|A| .

Proof. Fix P (n) to be the open sentence

P (n): If A is a set with n elements, then |P(A)| = 2n .

We will prove that P (n) is true for each integer n ≥ 0, by induction.


104 CHAPTER IV. PROOF BY INDUCTION

Base case: P (0) is true; the only set with 0 elements is the empty set, and its
only subset is itself, so |P(∅)| = 1 = 20 .
Inductive step: Assume that P (k) is true for some k ≥ 0; namely, that for any
set A with k elements, |P(A)| = 2k .
We want to prove P (k +1). Let B be a set with k +1 elements. Choose an element
of B and call it b. We divide the power set of B into two collections of subsets. Fix

S = {X ∈ P(B) : b ∈ X},

and fix
T = {X ∈ P(B) : b ∈
/ X}.
We note that T consists of the subsets of B − {b}; hence, T is just the power set
of B − {b}. Since B − {b} has k elements (one element less than B), our inductive
hypothesis tells us that |T | = 2k .
On the other hand, each element of S is uniquely the union of an element of T
with the set {b}. Hence, |S| = |T | = 2k . Since S and T have no elements in common,
the number of elements in P(B) = S ∪ T is |S| + |T | = 2k + 2k = 2 · 2k = 2k+1 .
Hence, P (k + 1) is true.
Therefore, by induction we see that P (n) is true for each integer n ≥ 0.
We can often use induction to extend statements concerning two objects to state-
ments concerning any finite number of objects. For instance, the following proposition
is an extension of De Morgan’s law, from two terms to an arbitrary (finite) number
of terms.

Proposition 14.7. For any n ∈ N, if P1 , . . . , Pn are arbitrary statements, then

¬(P1 ∨ · · · ∨ Pn ) ≡ (¬P1 ) ∧ · · · ∧ (¬Pn ).

Proof. Fix Q(n) to be the open sentence


For any n statements P1 , . . . , Pn , we have ¬(P1 ∨ · · · ∨ Pn ) ≡ (¬P1 ) ∧ · · · ∧ (¬Pn ).
We will now work by induction on n ∈ N.
Base case: Q(1) is just the statement ¬P1 ≡ ¬P1 , which is true.
Inductive step: Let k ∈ N and assume that Q(k) is true; i.e.,

¬(P1 ∨ · · · ∨ Pk ) ≡ (¬P1 ) ∧ · · · ∧ (¬Pk ).

Then we have

¬(P1 ∨ · · · ∨ Pk+1 ) ≡ ¬((P1 ∨ · · · ∨ Pk ) ∨ Pk+1 ) (associativity of ∨)


≡ ¬(P1 ∨ · · · ∨ Pk ) ∧ (¬Pk+1 ) (De Morgan’s law)
≡ (¬P1 ) ∧ · · · ∧ (¬Pk ) ∧ (¬Pk+1 ) (inductive hypothesis).

Hence, Q(k + 1) is true.


Therefore, Q(n) is true for each n ∈ N.
14. MORE EXAMPLES OF INDUCTION 105

14.B Many base cases


When proving a statement by induction, sometimes the proof of the inductive step
needs special cases when k is small. To avoid overcomplicating the inductive step,
instead we first prove P (n) for several small values of n, and then give a proof of the
inductive step for values of k starting at the largest special case. We demonstrate
with an example.

Theorem 14.8. For each n ∈ N, we have 2n+1 > n2 .

Proof. We take P (n) to be


P (n): 2n+1 > n2 .
When n = 1, we have 21+1 = 4 > 1 = 12 . When n = 2, we have 22+1 = 8 > 4 = 22 .
When n = 3, we have 23+1 = 16 > 9 = 32 . We will now use induction to prove that
P (n) is true for each integer n ≥ 3.
Base case: P (3) has already been shown to be true.
Inductive step: Now assume P (k), for some integer k ≥ 3. Hence, we know
that 2k+1 > k 2 . Then

2(k+1)+1 = 2 · 2k+1
> 2 · k2 (by the inductive assumption)
= k2 + k2
≥ k 2 + 3k (since k ≥ 3)
= k 2 + 2k + k (peeling off 2k)
> k 2 + 2k + 1 (since k > 1)
= (k + 1)2 .

Hence, P (k + 1) is true.
Therefore, by induction P (n) is true for each integer n ≥ 3. Since we have already
demonstrated P (1) and P (2), we see that P (n) is true for each n ∈ N.

Advice 14.9. To decide whether or not to do extra cases, try the inductive step
first (perhaps on scratch paper). If you need extra information (as we did above,
to replace k 2 with 3k) this could be a reason to do extra base cases.
Another reason to use extra cases is if you are working with a piecewise
defined function. Doing small cases might help handle places where the piecewise
function is different.

14.C Proof of generalized induction


Here is the promised proof that induction can start at any integer.
106 CHAPTER IV. PROOF BY INDUCTION

Theorem 14.10. Let a ∈ Z, and let P (n) be an open sentence whose domain
includes the set S = {n ∈ Z : n ≥ a}. If
(i) P (a) is true and
(ii) P (k) ⇒ P (k + 1) for each k ∈ S,
then P (n) is true for each n ∈ S.

Proof. For each n ∈ N, define P 0 (n) = P (n + a − 1). Then we have a correspondence


between P and P 0 :
P (a) P (a + 1) P (a + 2) P (a + 3) P (a + 4) P (a + 5) P (a + 6) · · ·
k k k k k k k
0 0 0 0 0 0 0
P (1) P (2) P (3) P (4) P (5) P (6) P (7) ···
This correspondence makes it clear that if we can prove P 0 (n) for each n ∈ N,
then we will have proved P (n) for each n ∈ S.
Now, P 0 (1) = P (a) is true by (i).
Further, for each k ∈ N, we see that P 0 (k) ⇒ P 0 (k + 1) holds since by (ii)
P (k + a − 1) ⇒ P (k + 1 + a − 1).
Hence, by the principle of mathematical induction, P 0 (n) is true for each n ∈ N,
so P (n) is true for each n ∈ S.
Remark 14.11. In order to illustrate the connection between P (n) and P 0 (n), we
describe the corresponding open sentences for Proposition 14.5. In that proposition,
it is asserted that the open sentence
P (n): n! > 2n
is true for each integer n ≥ 4. Thus a = 4 and
P 0 (n) = P (n + a − 1) = P (n + 3): (n + 3)! > 2n+3 .
Proving that n! > 2n is true for each integer n ≥ 4 is the same as proving that
(n + 3)! > 2n+3 is true for each integer n ≥ 1. N

14.D Exercises
Exercise 14.1. Prove that n! > 3n for each natural number n ≥ 7.
Exercise 14.2. Prove that if n is any natural number with n ≥ 6, then n! > n3 .
Exercise 14.3. Prove that for each n ∈ N, we have 3n ≥ n3 .
(Hint: Demonstrate this by direct calculation when n = 1, 2, 3. Then use induction
to complete the proof for each integer n ≥ 3, with n = 3 as your base case.)
Exercise 14.4. Prove that for any n ∈ N with n ≥ 2, if P1 , . . . , Pn are statements,
then
¬(P1 ∧ · · · ∧ Pn ) ≡ (¬P1 ) ∨ · · · ∨ (¬Pn ).
14. MORE EXAMPLES OF INDUCTION 107

Exercise 14.5. Prove that for any n ∈ N, if x1 , . . . , xn ∈ R, then


n
X n
X
xi ≤ |xi |.
i=1 i=1

(A fact that might be useful in the inductive step is that when n = 2, then this is
just the triangle inequality, which was already proved as Theorem 8.21.)

Exercise 14.6. The Fibonacci numbers are a collection of natural numbers labeled
F1 , F2 , F3 , . . . and defined by the rules

F1 = F2 = 1,

and for each integer n ≥ 3,


Fn = Fn−1 + Fn−2 .
For instance, F3 = F2 + F1 = 2 and F4 = F3 + F2 = 2 + 1 = 3.
(a) Write down the first fifteen Fibonacci numbers.
(b) Prove by induction that for each integer n ≥ 1,
n
X
Fi = Fn+2 − 1.
i=1

(c) Prove by induction that for each integer n ≥ 1,


n
X
Fi2 = Fn Fn+1 .
i=1

Exercise 14.7. Using the definition of the Fibonacci numbers from the previous
problem, prove by induction that for any integer n ≥ 13 that Fn > n2 .
(Hint: One possible idea for a proof is to fix P (n) to be the open sentence

P (n): Fn > n2 and Fn−1 > (n − 1)2 .

Use induction to prove that P (n) is true for each integer n ≥ 14. This then implies
that Fn > n2 for each integer n ≥ 13.)
108 CHAPTER IV. PROOF BY INDUCTION

15 Strong induction
15.A The definition of strong induction
Sometimes, when trying to do a proof by induction, the inductive step is not feasible
because P (k) does not provide enough information to conclude P (k + 1). In this case,
a variation on induction called “strong induction” is often useful.
The idea of strong induction is very intuitive. Recall the ladder analogy. If we
can climb to the kth rung, we just need to know that we can climb to the k + 1st
rung. However, we have more information available. If we have climbed up to the
kth rung, then we have also climbed all the steps below! It is possible to make use of
this extra information by making a stronger inductive hypothesis. In the inductive
step, instead of merely assuming P (k) we instead assume the stronger statement
Q(k) = P (1) ∧ P (2) ∧ . . . ∧ P (k). In other words, we assume that we climbed each of
the steps from the first to the kth.
The only difference between a proof by “normal” induction and a proof by “strong”
induction is that, in the inductive step, we make the stronger assumption Q(k) above.
Everything else is precisely the same—we still need a base case, and in the inductive
step we still want to conclude by showing P (k + 1).
Because these two proof techniques are so similar it is not necessary to use the
word “strong” in such a proof, unless you want to emphasize this fact to the reader.

15.B Strong induction by example


Consider the following situation. There are five cities that are (conveniently) named
A, B, C, D, and E. Each pair of distinct cities is connected by a single one-way road.
For instance, one possible collection of such roads is given by the following diagram,
where each city is represented by a dot and each road is represented by a line with
an arrow indicating the direction of the road.

B C

D E

In this diagram, we can travel directly from A to C, but not from C to A.


15. STRONG INDUCTION 109

A natural question one might ask is whether or not it is possible to find a path
through each of the cities, without ever revisiting a city. In this diagram, one such
path passing through all the cities is B → A → C → E → D. Other such paths are
A → C → B → E → D, and B → D → C → E → A, and E → D → A → C → B.
This shows that for the specific combination of one-way roads given in the diagram
above there are several paths.
Does the answer to our question change if we change the directions of the one-way
roads? What if we change the number of cities?
To answer these new questions we need to set up some notation. Let S be a finite
set of cities. We will call a collection of one-way roads, with a single road connecting
each pair of distinct cities in S, a system of one-way roads for S. If there is some
path through the cities that follows the system of one-way roads and visits each city
exactly once, we will call it a valid path through the cities.
We are now ready to answer our questions!

Proposition 15.1. If S is any finite nonempty set of cities with a system of


one-way roads, then there is a valid path through the cities.

Proof. Fix P (n) to be the open sentence: “If S is a set of n cities with a system of
one-way roads, then there is a valid path through those cities.” We work by (strong)
induction to show that P (n) is true for each integer n ≥ 1.
Base Case: Fix n = 1. In this case, starting in the single city, we don’t need to
go anywhere to say that we have visited all the cities. Hence, P (1) is true.
Inductive Step: Assume that for some k ∈ N, we know that P (1), P (2), . . . , P (k)
are each true. (This is the only place where our proof differs from a standard induc-
tion. Instead of merely assuming that P (k) holds, we have assumed that all the steps
from the first to the kth hold.) From this information, we will try to prove that
P (k + 1) holds.
To that end, let U be a set of k+1 cities with a system of one-way roads connecting
them. As U is nonempty, we may fix one of the cities in U , call it X. There are a
total of k cities remaining that are not equal to X. We divide these k cities into two
disjoint sets:

S = {Y ∈ U − {X} : the road between X and Y runs toward X}

and

T = {Y ∈ U − {X} : the road between X and Y runs away from X}.

Fix k1 = |S| and fix k2 = |T |. We note that 0 ≤ k1 ≤ k and 0 ≤ k2 ≤ k, and that U


is the disjoint union of the three sets S, T , and {X}. In particular, k1 + k2 = k.
Note that the cities in S are connected by a system of one-way roads; namely,
the roads in U that run between cities in S. A similar remark holds for T . We now
examine three cases.
110 CHAPTER IV. PROOF BY INDUCTION

Case 1. Assume k1 = 0. In this case, we have k2 = k. Since P (k) is true, there


is a valid path for the cities in T . Starting at X, then travelling to the first city in
this path, and continuing along the path, we obtain a valid path in U .
Case 2. Assume k2 = 0. This case is similar to case 1, except that we put X at
the end of the path instead of the beginning.
Case 3. Assume k1 , k2 6= 0. Then since 1 ≤ k1 < k and 1 ≤ k2 < k, we see that
both P (k1 ) and P (k2 ) are true by the (strong) inductive hypothesis. Hence, there is
a valid path for S and a valid path for T . Traversing the first path we end at a city
in S. From there we may travel to X. We then travel to the first city in the valid
path for T . We finish by traversing this path for T . This yields a valid path for U .
By (strong) induction, P (n) is true for each n ∈ N.

Note that in the first two cases of the proof above, we only needed to know that
P (k) is true. Thus, in those cases, normal induction would work. However, in the
third case we needed to use the fact that the theorem was true for networks of cities
and roads with an arbitrary number of cities smaller than k + 1, not just for networks
with exactly k cities.

Example 15.2. Fix U = {A, B, C, D, E} and consider the following system of one-
way roads for U (which is different from the system we considered previously).

B C

D E

By choosing a city, say X = C, we divide the remaining cities, as in the previous


proof, into two subsets S = {B, E} and T = {A, D}. Note that there is a valid path
for S (namely, B → E), and there is a valid path for T (namely, A → D). So, the
valid path our proof would construct is the path B → E → C → A → D. In this
case, our inductive step would be using P (2) twice to get us to P (5).
Alternatively, if we choose X = E, then S = {A, B, D} and T = {C}. Between the
cities of S we find the valid path B → A → D, and the valid path between the cities
of T is the singleton path C. The total valid path is then B → A → D → E → C.
For this choice of X, our inductive step uses P (3) and P (1) to get us to P (5). 4
15. STRONG INDUCTION 111

It may be a useful exercise for the student to go back to the system of roads
introduced at the beginning of Subsection 15.B and, using the proof method above,
see which valid paths are constructed for each X. Also, it may be useful to note
which values of P (i) are being used to conclude P (5), for each choice of X. Can you
find a valid path that does not arise from the inductive proof?

15.C More examples of strong induction


Our next example of strong induction will be given in the proof of the following:

Proposition 15.3. Every natural number can be written as a sum of distinct


integers, each of which is a power of 2.

Before we begin the proof, we want to make a few remarks that will help explain
what we are trying to prove.

Remark 15.4 (Sums of one object). When mathematicians say that a number can
be written as a sum they allow the possibility of adding only one object. Hence, the
number 8 = 23 can be considered as a sum of a single power of two. N

Remark 15.5 (Meaning of distinct). In English, the word “distinct” is often used
to mean “special” or “distinguished.” In mathematics, the word has a very precise
meaning, which is quite different; a list of objects is called distinct if no two of the
objects are equal.
For instance, there are several ways to write the number 6 as a sum of powers of
two. We have

6 = 20 + 20 + 20 + 20 + 20 + 20 = 21 + 20 + 20 + 20 + 20
= 21 + 21 + 20 + 20 = 21 + 21 + 21 = 22 + 20 + 20 = 22 + 21 .

Note that only the last way (6 = 4 + 2) gives 6 as a sum of distinct powers of 2, as
all the rest have some repetition. N

Remark 15.6 (Base 2). We illustrate the theorem for the first few natural numbers.

1 = 20 , 2 = 21 , 3 = 21 +20 , 4 = 22 , 5 = 22 +20 , 6 = 22 +21 , 7 = 22 +21 +20 .

In each case, we have written n as a sum of distinct powers of two. Mathematicians


call this representing a number in binary (or base 2). Most current cultures write
numbers in base 10, but other bases can be very important, such as base 16 (or
hexadecimal), for computing. N

We are now ready to begin the proof. Try to figure out why the proof will fail if,
in the inductive step, we only assume P (k).
112 CHAPTER IV. PROOF BY INDUCTION

Proof. Fix P (n) to be the open sentence

P (n): n can be written as a sum of distinct integers, each a power of 2.

Fix Q(n) to be the open sentence

Q(n): P (1) ∧ · · · ∧ P (n).

We work by (strong) induction to show P (n) is true for each n ∈ N.


Base case: P (1) is true, since 1 = 20 .
Inductive step: Let k ∈ N, and assume Q(k). In other words, assume that every
integer from 1 to k can be written as a sum of distinct powers of 2. We wish to use
this assumption to prove P (k + 1), i.e., that k + 1 can be written as a sum of distinct
powers of two. We will examine two cases.
Case 1: If k + 1 is odd, then k is even. By our inductive hypothesis, k can be
written as a sum of distinct powers of 2. Since only one power of two is odd (namely
20 = 1) and k is even, all of these powers of two must be even. Adding 20 = 1 to the
collection, we still have a collection of distinct powers of two, and they now add up
to k + 1.
Case 2: If k + 1 is even, then k + 1 = 2a for some a ∈ N. Now 1 ≤ a ≤ k,
so a can be written as a sum of distinct powers of two, by our inductive hypothesis.
Increasing each of these exponents by one gives us a collection of powers of two, all
distinct, that add to 2a = k + 1.
We have thus proved that Q(k) ⇒ P (k + 1). Hence, by the principle of mathe-
matical induction P (n) is true for each n ∈ N.
In order to further illustrate how the proof works, we give an example of the proof
in action. In the proof, if we have an odd number, we subtract 1. If we have an even
number, we divide by 2. We stop when we hit the base case. Thus we have:

11 −→ 10 −→ 5 −→ 4 −→ 2 −→ 1.

Now, writing 1 = 20 we work backwards through this chain, either adding 1 or


multiplying by 2 (to undo what we originally did in the chain above). Eventually we
end up with a binary expansion for 11, as follows:

20 −→ 21 −→ 22 −→ 22 + 20 −→ 23 + 21 −→ 23 + 21 + 20 .

Thus, we have 11 = 23 + 21 + 20 .
Try this yourself, by writing the number 14 in binary. Note that the inductive
step will use P (7) to help us obtain P (14).

15.D Formalizing strong induction


One might wonder if, just as for induction, we need to assume strong induction as
an axiom. The answer is no, because strong induction is really standard induction in
disguise. In the following theorem we will prove strong induction using induction on
a new sentence Q(n).
15. STRONG INDUCTION 113

Theorem 15.7. Let P (n) be an open sentence, where the domain of n is N. If


(i) P (1) is true and
(ii) for each k ∈ N, (P (1) ∧ P (2) ∧ . . . ∧ P (k)) ⇒ P (k + 1),
then P (n) is true for each n ∈ N.

Proof. Assume (i) and (ii) above. Fix Q(n) to be the open sentence

Q(n): P (1) ∧ P (2) ∧ . . . ∧ P (n).

Note that Q(k + 1) ≡ Q(k) ∧ P (k + 1). Additionally, we easily see that since the
implication Q(k) ⇒ P (k+1) holds for each k ∈ N by (ii), then we have the implication
Q(k) ⇒ Q(k) ∧ P (k + 1), and so Q(k) ⇒ Q(k + 1). Applying the principle of
mathematical induction to Q(n), we see that Q(n) is true for each natural number.
This immediately implies that P (n) is true for each natural number.

Remark 15.8. When using strong induction, typically you will not explicitly write
out what Q(n) is. It is much more common when proving the inductive step to say
something like “Assume P (i) for each integer i in the range 1 ≤ i ≤ k.” Sometimes
it will be convenient to say “Assume that P (i) is true for each natural number less
than or equal to k.” Or just say “Assume P (1), P (2), . . . , P (k) are each true.” N

15.E Where to start?


Strong induction can start at any integer, just as induction can. The formal state-
ment merges Theorems 14.10 and 15.7, as below. (The proof is similar to that of
Theorem 14.10 and will be omitted.)

Theorem 15.9. Let a ∈ Z and let P (n) be an open sentence whose domain
includes the set S = {n ∈ Z : n ≥ a}. Fix Q(n) to be the open sentence

Q(n) : P (a) ∧ · · · ∧ P (n),

which is defined only when n ∈ S. If


(i) P (a) is true and
(ii) Q(k) ⇒ P (k + 1) for each k ∈ S,
then P (n) is true for each n ∈ S.

We demonstrate how such proofs work with two examples.

Proposition 15.10. For each integer n ≥ 6, any square can be subdivided into
n squares.
114 CHAPTER IV. PROOF BY INDUCTION

Proof. Fix P (n) to be the open sentence

P (n): A square can be subdivided into n squares.

We work by induction on n ≥ 6 with n ∈ Z.


Base case: We can verify that P (6) is true. We also verify that P (7) and P (8) are
true in the diagrams below. (We do these extra base cases to help with the inductive
step.)
In addition, we have also given a picture showing how to subdivide a square into
4 smaller squares; we will use this in our proof.

n=4 n=6 n=7 n=8

Inductive step: Let k ≥ 6 be an integer, and assume that P (`) is true for each
integer ` in the range 6 ≤ ` ≤ k. We wish to prove that P (k + 1) is true. If k = 6 or
k = 7, we have already seen that P (k + 1) is true, so we may assume that k ≥ 8.
Since k ≥ 8, we have that k − 2 ≥ 6. Hence, by our inductive assumption, since
6 ≤ k − 2 ≤ k, we know that P (k − 2) is true. In other words, we know that we
can subdivide a square into k − 2 squares. Starting with this subdivision, we further
subdivide the upper-rightmost square into 4 squares. This adds three squares to the
subdivision. Thus, we have subdivided the square into k − 2 + 3 = k + 1 squares.
Hence, P (k + 1) is true.
Therefore, by mathematical induction, P (n) is true for each integer n ≥ 6.
To see this proof in action, we demonstrate how to subdivide a square into 20 squares.
Start from the subdivision into 8 squares, and repeatedly divide the upper-rightmost
square into 4 smaller squares at each stage.

n = 11 n = 14 n = 17 n = 20

We see easily how we could extend these diagrams to demonstrate the result for
n = 23, 26, 29, 32, . . . (although the upper-rightmost square would quickly become
too small to see).
To motivate our last example of a statement that can be proved by strong induc-
tion, consider the following problem.
15. STRONG INDUCTION 115

Postage Stamp Problem: Given several denominations of postage stamps,


what possible postage can be paid precisely?
Note that only a nonnegative number of each stamp can be used. (You can’t use
a negative number of stamps!) We will demonstrate this idea with a specific example.
Suppose that your local post office has stamps with two denominations: 5 cents and
7 cents. What other denominations can you get using these two types of stamps?
You can pay 21 cent postage using three 7 cent stamps. You can also pay 22 cent
postage, with three 5 cent stamps and one 7 cent stamp. However, 23 cent postage
is not possible using those two denominations. To see this, first note that we cannot
use more than three 7 cent stamps. This leaves four other options. However, none of
23 − 0(7) = 23, 23 − 1(7) = 16, 23 − 2(7) = 9, or 23 − 3(7) = 2 is a multiple of 5.
In the following proposition, we prove that every postage above 23 cents is pos-
sible. The main idea will be that if we can get five consecutive denominations, then
by adding enough 5 cent stamps we can reach all other higher denominations.

Proposition 15.11. Every integer n ≥ 24 can be written as

n = 5x + 7y

for some integers x, y ≥ 0.

Proof. We fix
P (n): For some nonnegative integers xn and yn , we have n = 5xn + 7yn .
Here, we made the dependence of the integers x and y on n explicit. This will make
it easier to find appropriate values for x and y in the inductive step.
We have the following equations:
24 = 5 · 2 + 7 · 2, 25 = 5 · 5 + 7 · 0,
26 = 5 · 1 + 7 · 3, 27 = 5 · 4 + 7 · 1, and
28 = 5 · 0 + 7 · 4.
The first equation shows us that P (24) is true, by taking x24 = 2 and y24 = 2.
Similarly, P (25), P (26), P (27), and P (28) are true. (The reason we did so many
cases will become apparent in the inductive step below.) We proceed by (strong)
induction on n ≥ 24 with n ∈ Z.
Base cases: We have seen that P (24), . . . , P (28) are all true.
Inductive step: Assume that for some integer k ≥ 28, all of P (24), . . . , P (k) are
true.
Since k ≥ 28, we have k − 4 ≥ 24. Hence, P (k − 4) is true; in other words, we can
write k − 4 = 5xk−4 + 7yk−4 for some integers xk−4 , yk−4 ≥ 0. Then adding a 5 cent
stamp yields
k + 1 = k − 4 + 5 = 5xk−4 + 7yk−4 + 5 = 5(xk−4 + 1) + 7yk−4 .
Taking xk+1 = xk−4 + 1 > xk−4 ≥ 0 and taking yk+1 = yk−4 , then P (k + 1) holds.
Hence, by induction P (n) is true for each integer n ≥ 24.
116 CHAPTER IV. PROOF BY INDUCTION

15.F Exercises
Exercise 15.1. Prove by induction that for each integer n ≥ 6, it is possible to sub-
divide an equilateral triangle into n equilateral triangles. (For example, a subdivision
into 6 equilateral triangles is given below.)

Exercise 15.2. For the network of nine cities with one-way roads below, find a
route that visits all nine cities. Do this using the method found in the proof of
Proposition 15.1, after fixing X to be the city denoted by A.
(Note that there are many routes that solve the problem, but only one that arises
from fixing X = A in the proof of Proposition 15.1.)

A
I B

H
C

G
D

F E
Exercise 15.3. (a) Prove that every integer n ≥ 14 can be written as n = 3xn +8yn
for some integers xn , yn ≥ 0 (where xn and yn depend on n).
(b) Prove that 13 cannot be written as 3x + 8y for any integers x, y ≥ 0.
Exercise 15.4. Prove, by induction on n ∈ N, that n = 2en mn for some exponent
en ∈ Z≥0 and some odd mn ∈ N. (Again, en and mn may depend on n.)
Exercise 15.5. Prove that for each natural number n ≥ 44, we can write

n = 6xn + 9yn + 20zn


15. STRONG INDUCTION 117

for some nonnegative integers xn , yn , zn . Then prove that 43 cannot be written in this
form.
(Hint: Write 44, 45, 46, 47, 48, and 49 in the given form. Use induction to prove
that any larger number can be written in the given form.)

Exercise 15.6. Find the largest postage that cannot be paid exactly with 4 cent, 10
cent, and 15 cent stamps. Prove that your answer is correct. (This proof will include
showing not only that the postage that you find cannot be achieved, but also that
every larger postage can be achieved. The correct solution is smaller than 30.)

Exercise 15.7. Recall the definition of the Fibonacci numbers from Exercise 14.6.
Prove that every positive integer is a sum of one or more distinct Fibonacci numbers.
(Hint: Given a positive integer k + 1, we can find some m so that Fm ≤ k + 1 < Fm+1 .
Write k + 1 = Fm + (k + 1 − Fm ), and show that k + 1 − Fm is either 0 or (by the
inductive hypothesis) a sum of distinct Fibonacci numbers, each smaller than Fm .)
118 CHAPTER IV. PROOF BY INDUCTION

16 The Binomial Theorem


16.A Binomial coefficients and Pascal’s triangle
Binomial coefficients show up throughout mathematics. As we will see, they appear
as the coefficients of the powers of x in the expansion of (x + 1)n . They also allow
us to count certain collections of objects in a finite set. These binomial coefficients
have many amazing properties, some of which we will prove by use of mathematical
induction.

Definition 16.1. Let n, k ∈ Z. We define the binomial coefficient as


n!

if 0 ≤ k ≤ n,
  
n
= k!(n − k)!
k
0 otherwise.

We read the symbol  


n
k
as “n choose k.”

Example 16.2. We may compute


 
7 7! 7·6·5·4·3·2·1
= =
3 3!(7 − 3)! (3 · 2 · 1)(4 · 3 · 2 · 1)
7·6·5
= = 7 · 5 = 35.
3·2·1

In Exercise 16.1 you will prove that for any integer n ≥ 0,


       
n n n n
= =1 and = = n. 4
0 n 1 n−1

Remark 16.3. It is not obvious from Definition 16.1 that the binomial coefficient is
an integer, but it will follow from the properties that we describe below.
We read nk as “n choose k” because the binomial coefficient nk counts the
number of ways to choose k objects from among n objects. See Theorem 16.6 for a
proof of this fact. N

We now state a fundamental property of the binomial coefficients.

Theorem 16.4. Let n, k ∈ Z, with n ≥ 0. Then


     
n n n+1
+ = .
k k+1 k+1
16. THE BINOMIAL THEOREM 119

Before proving Theorem 16.4, we demonstrate how to use it to build Pascal’s


triangle, which is a useful computational mnemonic for the binomial coefficients. See
Figure 16.5. Here, the top row is row 0. The leftmost column with dark entries is
column 0. The binomial coefficient nk appears in row n and column k. The arrows
indicate how 51 and 52 add to give 62 . Note that each entry (except the 1 on the
top row) is the sum of the two closest entries in the row above it.

Row 0 0 0 0 0 0 1 0 0 0 0 0

Row 1 0 0 0 0 1 1 0 0 0 0

Row 2 0 0 0 0 1 2 1 0 0 0 0

Row 3 0 0 0 1 3 3 1 0 0 0

Row 4 0 0 0 1 4 6 4 1 0 0 0

Row 5 0 0 1 5 10 10 5 1 0 0

Row 6 0 0 1 6 15 20 15 6 1 0 0

Row 7 0 1 7 21 35 35 21 7 1 0

Row 8 0 1 8 28 56 70 56 28 8 1 0

Row 9 1 9 36 84 126 126 84 36 9 1


0

n6

n7

n8

n9
n

mn

mn

mn

n
um

um

um

um

um

um

um
u

u
Col

Col

Col

Col

Col

Col

Col

Col

Col

Col

Figure 16.5: Pascal’s triangle

We now prove Theorem 16.4.

Proof. We will use properties of the factorial function here. In particular, we note
that (k + 1)! = (k + 1) · k!, and (n − k)! = (n − k) · (n − k − 1)! (when 0 ≤ k < n).
We will use these facts to obtain a common denominator in the fractions defining the
binomial coefficients nk and k+1 n
.
We break the proof into five cases,  doing the easiest cases nfirst.
Case 1: Assume k = n. Both nk and n+1

k+1
are 1, and k+1 = 0.
Case 2: Assume k > n. All three binomial coefficients inthe formula are 0.
n n n+1
 
Case 3: Assume k = −1. Then k = 0 but k+1 = k+1 = 1.
Case 4: Assume k < −1. All three binomial coefficients in the formula are 0.
120 CHAPTER IV. PROOF BY INDUCTION

Case 5: Assume 0 ≤ k < n. Then 0 < k + 1 ≤ n, and all three binomial


coefficients in the formula are defined by the rule involving factorials. Hence,
   
n n n! n!
+ = +
k k+1 k!(n − k)! (k + 1)!(n − k − 1)!
n!(k + 1) n!(n − k)
= +
(k + 1)!(n − k)! (k + 1)!(n − k)!
n!(k + 1) + n!(n − k)
=
(k + 1)!(n − k)!
n!(n + 1)
=
(k + 1)!(n − k)!
(n + 1)!
=
(k + 1)!((n + 1) − (k + 1))!
 
n+1
= .
k+1

We can now use mathematical induction to give an interpretation of the binomial


coefficients in terms of counting subsets.

Theorem 16.6. If n, k ∈ Z, then the binomial coefficient nk counts, for any




fixed set of cardinality n, the number of subsets of cardinality k.

Proof. If n < 0, there are no sets of cardinality n, so the theorem holds in that case.
We will now deal with the case n ≥ 0 by induction. Fix P (n) to be the open sentence
 
n
P (n): For each k ∈ Z, the binomial coefficient counts, for any fixed
k
set of cardinality n, the number of subsets of cardinality k.
Base case: We verify that P (0) is true. For any integer k 6= 0, there are no
subsets of cardinality k of the empty set, matching the value k0 = 0. For
 k = 0 there
0
is one subset of cardinality k of the empty set, matching the value 0 = 1. Hence,
P (0) is true.
Inductive step: Let m ≥ 0 be an integer and assume that P (m) is true. (We use
m here because k already has a meaning.) Thus, for each k ∈ Z, any set of cardinality
m has m

k
subsets of cardinality k.
Let S be a set consisting of m + 1 elements. Choose one of them and call it x.
Let k ∈ Z. If k is negative, then m+1 k
= 0 is the number of k element subsets of
m+1
S. Similarly, if k = 0, then k = 1 is the number of k element subsets of S.
Therefore, in what follows, we may assume that k > 0.
We will count subsets T of cardinality k in S by counting the subsets with x ∈ T
separately from those with x ∈ / T and then adding the two counts together.
16. THE BINOMIAL THEOREM 121

Any subset T of cardinality k with x ∈ T corresponds to the set T − {x}, which


has exactly k − 1 elements. We have T − {x}  ⊆ S − {x}. Since |S − {x}| = m the
m
inductive hypothesis says that there are k−1 such subsets.
Any subset T of cardinality k with x ∈/ T is a k-element subset of S − {x}. Again,
m

the inductive hypothesis applies, and says that there are k such subsets.
Adding these, the number of subsets of cardinality k in S is
     
m m m+1
+ =
k−1 k k
by Theorem 16.4. This completes the inductive step.
Therefore, by mathematical induction P (n) is true for each integer n ≥ 0.
Theorem 16.6 gives an easy way to prove that the binomial coefficients are all
integers, a fact that is not at all obvious from the definition.

n

Theorem 16.7. Let n, k ∈ Z. Then the binomial coefficient k
is an integer.

Proof. By Theorem 16.6, the binomial coefficient nk counts the number of subsets


of size k in a set of size n. Hence, it must be an integer.

16.B Proof of the Binomial Theorem


With basic facts about the binomial coefficients established, we are now ready to
prove the Binomial Theorem.

Theorem 16.8 (Binomial Theorem). Let x, y be variables and let n ≥ 0 be an


integer. Then
n  
n
X n n−k k
(x + y) = x y .
k=0
k

Proof. Fix P (n) to be the open sentence


n  
n
X n n−k k
P (n): (x + y) = x y .
k=0
k

We prove the theorem by induction on n ≥ 0 with n ∈ Z.


Base case: Note that P (0) is true, since (x + y)0 = 1 and
0    
X 0 0−k k 0 0 0
x y = x y = 1,
k=0
k 0

Inductive step: Suppose that P (m) is true for some integer m ≥ 0. Then we
know that m  
m
X m m−k k
(x + y) = x y .
k=0
k
122 CHAPTER IV. PROOF BY INDUCTION

Multiplying this first by x we obtain


m  
m
X m m−k+1 k
x(x + y) = x y
k=0
k
(16.9)      
m m+1 0 m m 1 m
= x y + x y + ... + xy m
0 1 m
and multiplying by y we obtain
m  
m
X m m−k k+1
y(x + y) = x y
k=0
k
(16.10)      
m m 1 m m m 0 m+1
= x y + ... + xy + xy .
0 m−1 m
Adding the respective sides of equations (16.9) and (16.10), we obtain
(x + y)m+1 = (x + y)(x + y)m = x(x + y)m + y(x + y)m
     
m m+1 0 m m 1 m
= x y + x y + ... + xy m
0 1 m
     
m m 1 m m m 0 m+1
+ x y + ... + xy + xy
0 m−1 m
     
m m+1 0 m m
= x y + + xm y + · · ·
0 1 0
     
m m m m 0 m+1
+ + xy + xy
m m−1 m
   
m + 1 m+1 0 m+1 m
= x y + x y + ···
0 1
   
m+1 m m + 1 0 m+1
+ xy + xy
m m+1
m+1
X m + 1 
= xm+1−k y k .
k=0
k

16.C Exercises
Unless otherwise noted, exercises in this section should not be done using induction.
Exercise 16.1. Use the definition of the binomial coefficient to prove that for each
integer n ≥ 0,
       
n n n n
= =1 and = = n.
0 n 1 n−1
16. THE BINOMIAL THEOREM 123

Exercise 16.2. Prove that for any n, k ∈ Z,


   
n n
= .
k n−k
Exercise 16.3. Let n, j, k ∈ Z. Using the definition of the binomial coefficient, prove
that      
n n−j n n−k
= .
j k k j
(Hint: You must deal with the three cases where j < 0, k < 0, and j + k > n, as well
as the remaining case.)
Exercise 16.4. Prove that for any integer n ≥ 0,
n  
X n
= 2n .
k=0
k

Exercise 16.5. Prove that for any n ∈ N,


n  
k n
X
(−1) = 0.
k=0
k

Exercise 16.6. Determine the coefficient of x5 y 3 in the expansion of (2x + 3y)8 .


(Warning: It is not just 83 .)
Exercise 16.7. Use the definition of the binomial coefficient to prove that for any
n, k ∈ Z,    
n n−1
k =n .
k k−1
Exercise 16.8. Do the following:
(a) Find the value of 2n

n
, for each n ∈ {0, 1, 2, 3, 4}. (Itmay be helpful to compare
your answers with Pascal’s triangle. Notice that 2n n
is the binomial coefficient
that appears in the exact middle of the triangle on row 2n, and is thus called a
“middle coefficient.”)
(b) Prove that 2n

n
is an even integer, for each n ∈ N. (Hint: Use Theorem 16.4
and Exercise 16.2.)
Exercise 16.9. Do the following:
(a) Use induction to prove that for each integer n ≥ 9,
 
n
< 2n−2 for each k ∈ Z.
k
(b) Use induction to prove that for each integer n ≥ 8,
 
n
< (n − 3)! for each k ∈ Z.
k
124 CHAPTER IV. PROOF BY INDUCTION
Chapter V

Theory of the Integers

Mathematics is the queen of the sciences and number theory is the queen of mathe-
matics. Carl Friedrich Gauss

One of the oldest surviving mathematical texts is Euclid’s Elements, a collection


of 13 books. This work, dating back to several hundred years BC, is one of the earliest
examples of logical reasoning in mathematics still available for us to read. Although
most of the books are devoted to theorems concerning geometry (many of which you
may have seen in some form in a high school geometry class), books seven and nine
deal with the arithmetic of the integers. In this chapter we will study some of the
material found in these two books.
In particular, Euclid dealt with the topics of divisibility and greatest common
divisors. It is remarkable that, thousands of years before the advent of electronic
computers, Euclid wrote down a very efficient algorithm for computing GCDs that is
still used essentially without change in modern computer systems.
In addition, Euclid defines prime numbers, proves that there are infinitely many
primes, and proves the Fundamental Theorem of Arithmetic, which states that every
natural number greater than 1 has a unique factorization into prime numbers.
The results that we present in this chapter have thus stood the test of time and
have been studied by mathematicians over millennia. Besides being important and
useful results on their own, they form a significant part of the common heritage of
mathematics.

125
126 CHAPTER V. THEORY OF THE INTEGERS

17 Divisibility
17.A Divisibility and common divisors
We now prove several facts about divisibility, some of which we took for granted in
previous sections (often treating them as axioms).

Theorem 17.1. Let a, b ∈ Z with b 6= 0. If a | b, then |a| ≤ |b|.

Proof. Assume that a | b. Then b = ak for some k ∈ Z. Note that k 6= 0 since b 6= 0,


and so |k| ≥ 1. We conclude that
|b| = |ak| = |a||k| ≥ |a|.

Corollary 17.2. Let a, b ∈ Z be nonzero. If a | b and b | a, then a = ±b.

Proof. Assume that a | b and b | a. Then by Theorem 17.1, |a| ≤ |b| and |b| ≤ |a|.
Hence, |a| = |b|, so a = ±b.

Theorem 17.3. Let b ∈ Z with b 6= 0. There are finitely many integers that
divide b.

Proof. If a ∈ Z divides b, then |a| ≤ |b| by Theorem 17.1. Hence, a ∈ {−|b|, . . . , |b|}.
This set is finite, so there are only finitely many possibilities for a.
Example 17.4. If b = 12, the divisors of b are
{−12, −6, −4, −3, −2, −1, 1, 2, 3, 4, 6, 12}. 4

Definition 17.5. A common divisor of two integers a and b is an integer c such


that c | a and c | b.

Example 17.6. If a = 12 and b = 18, then the common divisors of a and b are
precisely ±1, ±2, ±3, and ±6. 4

Theorem 17.7. Let a and b be integers, not both 0. The set of common divisors
of a and b has a largest element.

Proof. Without loss of generality, let a 6= 0. The set of divisors of a is finite and
includes the set of common divisors of a and b, so the set of common divisors is finite.
Since it is finite and nonempty (as 1 is an element), this set has a largest element.
17. DIVISIBILITY 127

Definition 17.8. Given two integers a and b, their greatest common divisor
(GCD) is written as GCD(a, b); it is the largest common divisor of a and b when
a and b are not both 0, otherwise it is 0.

Some authors leave GCD(0, 0) undefined, since every integer divides 0. However,
most follow the convention of putting GCD(0, 0) = 0, as we have done.
We next give two examples of GCDs.

Example 17.9. If a = 12 and b = 18, the list of divisors of a is

{−12, −6, −4, −3, −2, −1, 1, 2, 3, 4, 6, 12}

and the list of divisors of b is

{−18, −9, −6, −3, −2, −1, 1, 2, 3, 6, 9, 18}.

The set of numbers common to both of these sets (i.e., their intersection) is

{−6, −3, −2, −1, 1, 2, 3, 6}.

Hence, the greatest common divisor of 12 and 18 is 6. 4

Example 17.10. Let a ∈ Z be nonzero. Then every divisor of a is less than or equal
to |a|, and in fact |a| is a divisor of a. In addition, |a| is a divisor of 0. Hence,

GCD(a, 0) = |a|.

This rule also works when a = 0. 4

Remark 17.11. Some mathematicians write (a, b) for GCD(a, b). We will avoid that
notation in this book since it already has two other meanings (as an open interval
and as an ordered pair). N

We finish this subsection by stating a standard result about the GCD (the proof
is left to the motivated reader).

Lemma 17.12. Let a, b ∈ Z. We have both


• GCD(a, b) = GCD(b, a) and
• GCD(a, b) = GCD(|a|, |b|).

17.B The division algorithm


A fundamental property of the integers that relates addition and multiplication is
the division algorithm. The fact that we can divide integers and get a unique quo-
tient and remainder is the key to understanding divisibility, congruence, and modular
arithmetic.
128 CHAPTER V. THEORY OF THE INTEGERS

Theorem 17.13 (The Division Algorithm). Let n, d ∈ Z with d 6= 0. Then


there are unique integers q, r such that

n = qd + r

and 0 ≤ r < |d|.

We will prove the division algorithm in stages. First, we will prove the uniqueness
of the quotient and remainder, as a lemma. After that, we will handle existence, but
only in the case when the numerator is nonnegative and the denominator is positive.
The other cases are left for the reader in Exercise 17.8.

Lemma 17.14. Let d, q, r, q 0 , r0 ∈ Z with d 6= 0. If qd + r = q 0 d + r0 with


0 ≤ r < |d| and 0 ≤ r0 < |d|, then q = q 0 and r = r0 .

Proof of Lemma. Let d, q, r, q 0 , r0 ∈ Z with d 6= 0. Working directly, assume that


qd + r = q 0 d + r0 , with 0 ≤ r < |d| and 0 ≤ r0 < |d|. Without loss of generality, we
may assume that r ≤ r0 , which will be useful later. Rearranging the equality, we find

(17.15) (q − q 0 )d = r0 − r.

Note that since r0 < |d| and r ≥ 0, we have 0 ≤ r0 − r ≤ r0 < |d|, so that |r0 − r| < |d|.
However, by (17.15), we know d | (r0 − r). Hence, by Theorem 17.1, we see that it
must be the case that r0 − r = 0, so that r0 = r. Since d 6= 0, (17.15) now implies
that q = q 0 .

As mentioned above, we will prove the existence of q and r only in the case when
n ≥ 0 and d > 0. The other cases of the proof (when n is negative, or when d is
negative) will be left to the exercises (see Exercise 17.8).

Partial proof of Theorem 17.13. Let d > 0 be an integer, and fix P (n) to be the open
sentence

P (n): There are integers qn , rn such that n = qn d + rn and 0 ≤ rn < d.

We work by induction to show that P (n) is true for each integer n ≥ 0.


Base Case: We note that taking q0 = r0 = 0, then we have 0 = q0 d + r0 , and
0 ≤ r0 < d. Hence, P (0) is true.
Inductive Step: Assume that P (k) is true for some integer k ≥ 0; in other words,
assume that there are integers qk and rk such that k = qk d + rk , with 0 ≤ rk < d.
Then we have that
k + 1 = qk d + rk + 1.
Note that 0 ≤ rk < rk + 1 ≤ d. We now break the proof up into cases, depending on
whether rk + 1 = d or not.
17. DIVISIBILITY 129

Case 1: If rk + 1 < d, then we see that P (k + 1) is true (with qk+1 = qk and


rk+1 = rk + 1).
Case 2: If rk + 1 = d, then k + 1 = qk d + d = (qk + 1)d + 0, so P (k + 1) is true
(with qk+1 = qk + 1 and rk+1 = 0).
Hence, by induction P (n) is true for each integer n ≥ 0, when d > 0.

Advice 17.16. This proof of the division algorithm does not immediately give
us an easy way to find the quotient and remainder. However, finding q and r is
a simple task using standard long division with remainder, as taught in many
elementary schools. Although we will not review long division, we demonstrate
the work to compute q and r for n = 978 and d = 13.

 75
13 978
91
68
65
3

Hence, we find that q = 75 and r = 3, so that 978 = 75 · 13 + 3.

17.C Computing the GCD


Listing all the divisors of a and b, as we did in Example 17.9, is a very inefficient way
of computing the GCD. The next theorem will give us a very efficient tool to help
compute GCD(a, b).

Theorem 17.17 (The GCD-switching Theorem). Let a, b, c, z ∈ Z and assume


that a = zb + c. Then GCD(a, b) = GCD(b, c).

Proof. If b = 0, then the theorem is obviously true. So we may assume that b 6= 0.


Fix S to be the set of common divisors of a and b. Similarly, fix T to be the set
of common divisors of b and c. We will show that S = T . Once this is shown, the
largest element of S must be the same as the largest element of T , and the theorem
will be proved.
(S ⊆ T ): Assume that d ∈ S. Then d | a and d | b. Now c = a − zb, so we must
have d | c. Hence, d is a common divisor of b and c, so d ∈ T . Thus, S ⊆ T .
(T ⊆ S): Now assume that d ∈ T . Then d | b and d | c. Since a = zb + c, we see
that d | a. Hence, d is a common divisor of a and b, so d ∈ S. Therefore, T ⊆ S.
Hence, S = T .

The next two examples shows how one can use the GCD-switching Theorem.
130 CHAPTER V. THEORY OF THE INTEGERS

Example 17.18. Suppose that we wish to compute the GCD of 57 and 39. By the
division algorithm we know that 57 = 1 · 39 + 18. So, the GCD-switching Theorem
tells us that
GCD(57, 39) = GCD(39, 18).

These are smaller numbers, so we have made some progress. Next, since 39 = 2·18+3,
then the GCD-switching Theorem tells us that

GCD(39, 18) = GCD(18, 3).

Again these are smaller numbers, so we have made some more progress. Finally, since
18 = 6 · 3 + 0, then the GCD-switching Theorem tells us that

GCD(18, 3) = GCD(3, 0) = 3.

Thus, we have found the GCD of 57 and 39 is 3. We did this without listing all the
possible divisors.
The computations above can be streamlined by just writing

57 = 1 · 39 + 18

39 = 2 · 18 + 3

18 = 6 · 3 + 0

and concluding that GCD(57, 39) = 3. 4

In the GCD-switching Theorem, it is not required that c < |b|, so the theorem
applies in situations where we do not necessarily use the division algorithm. The
following example gives just one instance of how this can be useful.

Example 17.19. Let n ∈ Z. We will compute the possible GCDs for the numbers
3n + 1 and n − 2. Notice that

3n + 1 = 3(n − 2) + 7.

Thus, by the GCD-switching theorem, we have GCD(3n + 1, n − 2) = GCD(n − 2, 7).


The only possibilities are 1, 7.
Can both possibilities happen? Yes, but it depends on the value of n. For example,
if n = 1, then
GCD(3n + 1, n − 2) = GCD(4, −1) = 1.

If n = 2, then
GCD(3n + 1, n − 2) = GCD(7, 0) = 7. 4
17. DIVISIBILITY 131

17.D The Euclidean algorithm


We now describe the Euclidean algorithm, which very efficiently computes GCD(a, b),
for any a, b ∈ Z. By Lemma 17.12, we may as well work with only nonnegative integers
a ≥ b ≥ 0. The Euclidean algorithm involves nothing more than repeated applications
of the division algorithm; in particular, it does not involve computing divisors of a
and b. After describing the algorithm, we will prove that it gives the correct output.

Algorithm 17.20. Take as input two integers a and b satisfying a ≥ b ≥ 0.


If b = 0, output a, and terminate the algorithm.
If b 6= 0, divide a by b to get a = qb + r for some q, r ∈ Z with 0 ≤ r < b,
and then rerun the algorithm on the new integers b and r.

To show that an algorithm works correctly there are two things that need to be
demonstrated. First, the algorithm must terminate after finitely many steps; it does
us no good if the algorithm runs forever and never returns an answer. Second, the
output of the algorithm must be correct. We will demonstrate that both of these
facts hold true for our algorithm.
First, we show termination. The only possible issue is that we might rerun the
algorithm infinitely often. However, each time we rerun the algorithm, we have re-
placed the second integer b with a smaller nonnegative integer r. Thus, after no more
than |b| + 1 steps, we must reach a zero remainder.
Second, we show correctness of the output. If b = 0, then the output is correct
by Example 17.10. If b 6= 0, the GCD is unchanged by the GCD-switching Theorem,
which is Theorem 17.17.
In the next example, we demonstrate a concrete use of the Euclidean algorithm.
Example 17.21. We will find GCD(1073, −1537). After applying Lemma 17.12, we
have a = 1537 and b = 1073. Using Algorithm 17.20 produces the chain:
1537 = 1 · 1073 + 464

1073 = 2 · 464 + 145

464 = 3 · 145 + 29

145 = 5 · 29 + 0

In the last equality, the remainder is 0. Thus, in the next step, the algorithm ends by
outputting 29. Hence, GCD(1073, −1537) = 29. Note that 29 is also the last nonzero
remainder, circled in red above. 4
Remark 17.22. Notice that the number of divisions is actually significantly less
than |b|. In fact, it can be shown (although we will not prove it) that the number of
divisions required is always less than 5 log10 |b|, which is actually slightly less than 5
times the number of digits in |b|. Hence, for example, if b is a four digit number, no
more than 20 divisions will ever be needed. N
132 CHAPTER V. THEORY OF THE INTEGERS

17.E Exercises
Exercise 17.1. For the given values of n and d, compute the values of q and r
guaranteed by the division algorithm.
(a) Fix n = 17 and d = 5.
(b) Fix n = 17 and d = −5.
(c) Fix n = −17 and d = 5.
(d) Fix n = −17 and d = −5.
(e) Fix n = 256 and d = 25.
(f) Fix n = 256 and d = −25.
(g) Fix n = −256 and d = 25.
(h) Fix n = −256 and d = −25.
Exercise 17.2. Let a be an integer. Recall that a is even if there is some k ∈ Z such
that a = 2k, and recall that a is odd if there is some ` ∈ Z such that a = 2` + 1.
Prove the following statements, which we took for granted previously. (Hint: Use the
division algorithm with d = 2.)
(a) Every integer is even or odd.
(b) No integer is both even and odd.
Exercise 17.3. Write out all the divisors of 60 in a list, and then all the divisors of
42 in a separate list. Write the common divisors in a third list, and find the GCD.
(All the lists should be ordered from least to greatest.)
Exercise 17.4. Use the Euclidean algorithm to compute the following GCDs.
(a) GCD(60, 42).
(b) GCD(667, 851).
(c) GCD(1855, 2345).
(d) GCD(589, 437).
Exercise 17.5. Recall that the Fibonacci numbers are defined by setting F1 = 1,
setting F2 = 1, and for any integer n ≥ 3 setting Fn = Fn−1 + Fn−2 .
Prove by induction that GCD(Fn+1 , Fn ) = 1, for each n ∈ N.
Exercise 17.6. Let n ∈ Z. Prove that GCD(2n + 1, 4n + 3) = 1.
Exercise 17.7. Let n ∈ Z. Prove that GCD(6n + 2, 12n + 6) = 2.
Exercise 17.8. Complete the proof of Theorem 17.13 as follows.
(a) Using the fact that the theorem is true for arbitrary integers n ≥ 0 and d > 0,
next prove the theorem for arbitrary integers n < 0 and d > 0. (Hint: If
n < 0, then −n > 0. Use the proven case of the division algorithm to write
−n = qd + r, for some q, r ∈ Z with 0 ≤ r < d. Then n = (−q)d − r. If r = 0,
we are done; otherwise, we need to make an adjustment to get the remainder
between 0 and d.)
(b) Using the fact, from part (a), that the theorem is true for any integer n and
any integer d > 0, prove the theorem for any integer n and any integer d < 0.
(This will complete the proof.)
18. THE EXTENDED EUCLIDEAN ALGORITHM 133

18 The extended Euclidean algorithm


18.A The GCD as a linear combination
We now recall the result of Exercise 13.7.

Theorem 18.1. Each nonempty subset of N has a least element.

We will use this theorem to prove an important and useful statement about
GCD(a, b), for any a, b ∈ Z. The next definition will help us to state the result.

Definition 18.2. An (integral) linear combination of two integers a and b is a


number of the form ax + by where x, y ∈ Z.

Example 18.3. Fix a = 16 and b = 21. We will list some of the linear combinations
of a and b.
We see that 37 is a linear combination of 16 and 21, since

37 = 16 + 21 = a + b = a · 1 + b · 1.

We see that 0 = a · 0 + b · 0 is a linear combination of 16 and 21. (Will 0 be an


integral linear combination of any two integers a and b?)
What is the smallest linear combination of a and b? (By smallest, we will mean
in the ordering on the integers.) There isn’t a smallest combination! For instance

a · (−100) + b · (−100) = −3700.

We can form negative numbers that can be as “small” as we like.


However, there is a smallest positive linear combination of a and b . We see that

1 = 16 · 4 + 21 · (−3).

There are no positive integers smaller than 1, so this is indeed the smallest. 4

Example 18.4. When performing the division algorithm, the remainder is a linear
combination of the numerator and denominator. Indeed,

r = n − qd = n · 1 + d · (−q). 4

Theorem 18.5. Let a and b be integers, not both equal to 0. The smallest
positive integral linear combination of a and b is GCD(a, b).
134 CHAPTER V. THEORY OF THE INTEGERS

Proof. Fix S to be the set of positive integral linear combinations of a and b. In other
words,
S = {ax + by : x, y ∈ Z and ax + by > 0}.
It is clear that S is a subset of the natural numbers, since its elements are positive
integers. In addition, S is nonempty since it contains at least one of the following:

a = a · 1 + b · 0, −a = a · (−1) + b · 0, b = a · 0 + b · 1, −b = a · 0 + b · (−1).

Hence, S has a least element, which we call s. From the definition of S, there exist
some elements x, y ∈ Z satisfying s = ax + by. Note that s > 0.
Fix d = GCD(a, b). Then d | a and d | b, so by Theorem 7.15, d | ax + by, and we
have that d | s. Hence, d ≤ s.
Now we use the division algorithm to write a = qs + r with 0 ≤ r < s. Then

r = a − qs = a − q(ax + by) = a(1 − qx) + b(−qy)

is an integral linear combination of a and b. If r were positive, then r would be an


element of S that is smaller than s (which would contradict the minimality of s).
Hence, r must be 0. Therefore a = qs and we see that s | a. A similar argument
shows that s | b. Since s is a common divisor of a and b, it cannot be larger than the
greatest common divisor d. Hence, s ≤ d.
Combining the facts that d ≤ s and s ≤ d, we see that d = s.

Using Theorem 18.5, one can show that the linear combinations of a and b are
exactly the integer multiples of GCD(a, b), see Exercise 18.4.

Example 18.6. Fix a = 6 and b = 9. The theorem asserts that 3 = GCD(6, 9)


should be the smallest positive linear combination of a and b.
We see that 3 = 6(−1)+9(1) is indeed a linear combination. If we had 2 = 6x+9y,
then since 3 | 6 and 3 | 9, we would have 3 | 2, a contradiction. Similarly, 1 cannot be
a linear combination of a and b. Therefore 3 is indeed the smallest positive linear
combination and is the GCD.
Note that −15 = 3 · (−5) is a multiple of 3 = GCD(6, 9). Hence, as indicated in
the sentence preceding this example, we expect −15 to be a linear combination of 6
and 9. Note that

−15 = 3 · (−5) = (6(−1) + 9(1)) · (−5) = 6(5) + 9(−5)

is indeed a linear combination of 6 and 9. 4

18.B Calculating the GCD as a linear combination


Now that we know that GCD(a, b) can be written as an integral linear combination
of a and b, the natural question is how to compute x and y so that

GCD(a, b) = ax + by.
18. THE EXTENDED EUCLIDEAN ALGORITHM 135

The main idea is to first find the GCD using the Euclidean algorithm; this gives us a
sequence of equations arising from the division algorithm. We rewrite these equations
by solving for the remainders. Working backwards through this new list of equations,
we can write the GCD as a linear combination of each of the previous numerators
and denominators.
We demonstrate how this works with a couple of examples.
Example 18.7. We find GCD(493, 391), and we also find some x, y ∈ Z such that
GCD(493, 391) = 493x + 391y.
First, we perform the Euclidean algorithm, and solve each of the resulting equa-
tions (except the very last one) for the remainder.

493 = 1 · 391 + 102 7→ 102 = 493 − 1 · 391


391 = 3 · 102 + 85 7 → 85 = 391 − 3 · 102
102 = 1 · 85 + 17 7 → 17 = 102 − 1 · 85
85 = 5 · 17 + 0

Note that we have underlined the numerators, denominators, and remainders, but not
the quotients. This will help us keep track of things more easily. The last nonzero
remainder is 17, so we know that GCD(493, 391) = 17.
Now we see that 17 = 102−1·85, from the bottom right equation. In other words,
we have now written 17 as a linear combination of 102 and 85. Our next goal is to
write 17 as a combination of the previous numerator and denominator, 391 and 102.
Looking at the preceding equation (the second one from the bottom, on the right),
we see an expression for 85 that we plug into this equation, so

17 = 102 − 1 · ( 85 )
= 102 − 1 · (391 − 3 · 102)
= 102 − 1 · 391 + 3 · 102
= 4 · 102 − 1 · 391.

So, now 17 is a linear combination of 391 and 102. Going one equation higher, we see
an expression for 102; namely, 102 = 493 − 1 · 391. We plug this into our expression
for 17 to get

17 = 4 · ( 102 ) − 1 · 391
= 4 · (493 − 1 · 391) − 1 · 391
= 4 · 493 − 4 · 391 − 1 · 391
= 4 · 493 − 5 · 391,

and we now have expressed

GCD(493, 391) = 17 = 493 · 4 + 391 · (−5)

as a linear combination of 493 and 391. 4


136 CHAPTER V. THEORY OF THE INTEGERS

Advice 18.8. Probably the most difficult part of this algorithm is the temp-
tation to oversimplify the expression for the GCD. Taken to the extreme, each
expression for 17 above can be simplified to equal 17. It is important to keep
track of the remainders (perhaps by underlining them or boxing them) and treat
them as if they were variables rather than numbers.

Example 18.9. We will now find the GCD of 221 and 136, and write it as an integral
linear combination of 221 and 136.
We perform the Euclidean algorithm, and solve each of the resulting equations for
the remainder. In order to remind ourselves to treat the original numbers and the
remainders as if they were variables, we will again underline them.

221 = 1 · 136 + 85 7→ 85 = 221 − 1 · 136


136 = 1 · 85 + 51 7 → 51 = 136 − 1 · 85
85 = 1 · 51 + 34 7 → 34 = 85 − 1 · 51
51 = 1 · 34 + 17 7 → 17 = 51 − 1 · 34
34 = 2 · 17 + 0

The last nonzero remainder is 17, and we have 17 = 51 − 1 · 34 (from the bottom
equation on the right). The previous equation is 34 = 85 − 1 · 51. Substituting for
34, we obtain

17 = 51 − 1 · ( 34 )
= 51 − 1 · (85 − 1 · 51)
= 51 − 1 · 85 + 1 · 51
= 2 · 51 − 1 · 85,

where we have been careful to treat underlined numbers as variables, and not combine
them with other numbers.
The equation we use to substitute for 51 is 51 = 136 − 1 · 85, so

17 = 2 · ( 51 ) − 1 · 85
= 2 · (136 − 1 · 85) − 1 · 85
= 2 · 136 − 2 · 85 − 1 · 85
= 2 · 136 − 3 · 85.

Finally, we have 85 = 221 − 1 · 136. Substituting in for 85 we obtain the following:

17 = 2 · 136 − 3 · ( 85 )
= 2 · 136 − 3 · (221 − 1 · 136)
= 2 · 136 − 3 · 221 + 3 · 136
= 5 · 136 − 3 · 221.

Hence, GCD(221, 136) = 17 = 136 · 5 + 221 · (−3). 4


18. THE EXTENDED EUCLIDEAN ALGORITHM 137

18.C Relative primality


The fact that GCD(a, b) can be written as an integral linear combination of a and b
has many important consequences. In particular, we saw in the proof of Theorem 18.5
that GCD(a, b) is in fact the smallest positive integral linear combination of a and b.
This yields the following theorem.

Theorem 18.10. Let a, b ∈ Z. Then GCD(a, b) = 1 if and only if 1 = ax + by


for some x, y ∈ Z.

Proof. If GCD(a, b) = 1, Theorem 18.5 tells us that 1 = ax + by for some x, y ∈ Z.


Conversely, if 1 = ax+by for some x, y ∈ Z, then 1 is the smallest positive number
that can be written as an integral linear combination of a and b (since there are no
positive integers smaller than 1). Hence, 1 = GCD(a, b).

We give a special name to a pair of numbers that have GCD equal to 1.

Definition 18.11. Let a, b ∈ Z. If GCD(a, b) = 1, then we say that a and b are


relatively prime.

Example 18.12. Since GCD(15, 7) = 1, the numbers 15 and 7 are relatively prime.
On the other hand, GCD(5, 30) = 5, so 5 and 30 are not relatively prime. 4

We now prove two useful properties of relatively prime integers.

Theorem 18.13. Let a, b, c ∈ Z. If a | bc and GCD(a, b) = 1, then a | c.

Proof. Let a, b, c ∈ Z. Assume that a | bc and GCD(a, b) = 1. Since a | bc, we see that
bc = ak for some k ∈ Z. Also, for some x, y ∈ Z, we have 1 = ax + by. Multiplying
this last equation by c, we obtain

c = c · 1 = c(ax + by) = (ac)x + (bc)y = (ac)x + (ak)y = a(cx + ky).

Hence, since cx + ky ∈ Z, we see that a | c.

As a nice application of this theorem we have the following:

Example 18.14. Assume that 3x is even. Then 2 | 3x. Since GCD(2, 3) = 1, we see
that 2 | x. So x is even. (Previously we proved the implication “if 3x is even then x
is even” contrapositively.) 4

The next theorem gives us sufficient conditions under which we can expect the
product of two numbers to divide into another number.
138 CHAPTER V. THEORY OF THE INTEGERS

Theorem 18.15. Let a, b, c ∈ Z. If a | c and b | c and GCD(a, b) = 1, then ab | c.

Proof. Let a, b, c ∈ Z. Assume that a | c and b | c and GCD(a, b) = 1. Then for some
k, `, x, y ∈ Z, we have c = ak, c = b`, and 1 = ax + by. Multiplying this last equation
by c, we get
c = cax + cby = (b`)ax + (ak)by = ab(x` + ky).
Since x` + ky ∈ Z, we see that ab | c.

Example 18.16. If 2 | x and 3 | x, we see that 6 | x, since GCD(2, 3) = 1. 4

Warning 18.17. Note that neither of the previous two theorems is true if we
replace the assumption GCD(a, b) = 1 with a - b. For the first theorem, taking
a = 4, b = 6, and c = 2, we have that 4 | (6 · 2), and 4 - 6, but it is not the case
that 4 | 2.
For the second theorem, taking a = 12, b = 18, and c = 36, we see that both
a and b divide 36, but ab - 36. (Can you find simpler counterexamples?)

18.D Exercises
Exercise 18.1. For each pair of numbers a and b below, calculate GCD(a, b) and
find x, y ∈ Z such that GCD(a, b) = ax + by.
(a) Take a = 15 and b = 27.
(b) Take a = 29 and b = 23.
(c) Take a = 91 and b = 133.
(d) Take a = 221 and b = 377.

Exercise 18.2. Let a, n ∈ Z. Assume that GCD(a, n) = 1. Prove that there is some
b ∈ Z such that ab ≡ 1 (mod n). (Hint: Use Theorem 18.10.)
Informally, this result says that there is an element b that acts like the reciprocal
of a, modulo n.

Exercise 18.3. Let a, b ∈ Z, with b 6= 0, and fix d = GCD(a, b).


(a) Must it be the case that GCD(a, b/d) = 1? Prove your answer.
(b) Prove or disprove: If c is a positive common divisor of a and b, and c = ax + by
for some x, y ∈ Z, then c = d. (Hint: Can you show that c ≤ d? Can you show
that d ≤ c?)

Exercise 18.4. Let a, b, n ∈ Z, and fix d = GCD(a, b). Prove that d | n if and only if
n is a linear combination of a and b.

Exercise 18.5. Let a, b, c, d ∈ Z. Assume that GCD(a, b) = 1. Prove that if c | a and


d | b, then GCD(c, d) = 1.
18. THE EXTENDED EUCLIDEAN ALGORITHM 139

Exercise 18.6. The following steps lead one through a proof of the existence and
uniqueness of the lowest terms representation of a rational number.
(a) Let a, b ∈ Z, not both zero, and fix d = GCD(a, b). Prove that
 
a b
GCD , = 1.
d d

(Hint: Use Theorem 18.10.)


(b) Prove that any rational number a/b (with a, b ∈ Z and b 6= 0) can be represented
as a fraction r/s (with r, s ∈ Z and s 6= 0) satisfying GCD(r, s) = 1. (Hint: Fix
d = GCD(a, b). Define r and s in terms of a, b, and d, and use part (a).)
(c) Prove that in part (b) we can also guarantee that s > 0. (Hint: Modify the
definitions of r and s if needed.)
(d) Prove that every rational number has a unique representation as in part (c).
This is the lowest terms representation of the rational number. (Hint: Assume
that r/s = r0 /s0 with
(1) r, r0 , s, s0 ∈ Z,
(2) s, s0 > 0, and
(3) GCD(r, s) = 1 = GCD(r0 , s0 ).
Prove that s = s0 , and then that r = r0 .)

Exercise 18.7. Let a, b be positive integers. A common multiple of a and b is an


integer n such that a | n and b | n. The least common multiple of a and b, written
LCM(a, b), is the smallest positive common multiple of a and b.
(a) Determine the LCM of 12 and 18.
(b) Determine the LCM of 21 and 35.
(c) Prove that LCM(a, b) = abd
, where d = GCD(a, b).
(Hint: Show that ab/d is a common multiple of a and b. Then show that it
divides (and is thus no larger than) every other positive common multiple of
a and b. You may wish to factor a = a0 d and b = b0 d and use the fact (from
Exercise 18.6(a)) that GCD(a0 , b0 ) = 1.)
140 CHAPTER V. THEORY OF THE INTEGERS

19 Prime numbers
Now that we have a good understanding of divisibility in the integers we are prepared
to define and study the multiplicative building blocks of the integers. As far as
multiplication is concerned, prime numbers are the “atoms” from which other integers
are formed.

19.A Definition of prime numbers

Definition 19.1. A natural number p is prime if p > 1 and the only positive
divisors of p are 1 and p. A natural number n is composite if n > 1 and n is not
prime.

Example 19.2. We know that all positive divisors of a positive integer n are between
1 and n, so we may check whether a given integer is prime. The integer 2 is prime,
since there are no integers between 1 and 2. The integer 3 is prime, since it is not
divisible by 2. Similarly 5 is prime, since it is not divisible by 2, 3, or 4. Note that 4
is not prime, since it is divisible by 2.
The first few prime numbers are
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73. 4
If a number is composite, then it has a positive factor besides itself and 1. We
expand a bit on this fact in the following theorem.

Theorem 19.3. Let a ∈ N. If a is composite, then there are positive integers b


and c, both strictly between 1 and a, such that a = bc.

Proof. Assume a is composite. Since a > 1 and a is not prime, it has a positive
divisor b with 1 < b < a. So a = bc for some c ∈ Z. Clearly c is positive, and c not
equal to 1 since a 6= b. Hence, c > 1.
On the other hand, by Theorem 17.1, since c | a we have c ≤ a. But c 6= a since
b 6= 1, so 1 < c < a.
Examples of the previous theorem in action, for small composite numbers, include:
4 = 2 · 2, 6 = 2 · 3 = 3 · 2, 8 = 2 · 4 = 4 · 2,
9 = 3 · 3, 10 = 2 · 5 = 5 · 2, and 12 = 2 · 6 = 3 · 4 = 4 · 3 = 6 · 2.
We next prove the following useful fact about prime numbers.

Theorem 19.4. Let p be a prime number and let a ∈ Z. Then


(
p if p | a,
GCD(p, a) =
1 if p - a.
19. PRIME NUMBERS 141

Proof. We know that GCD(p, a) must be a positive divisor of p, so it must be 1 or


p. If p | a then p is clearly the largest common divisor; similarly, if p - a, then 1 is the
largest common divisor.

When we combine Theorem 19.4 with Theorem 18.13 we obtain the following
important description of prime numbers. The implication (1) ⇒ (2) in the following
theorem is known as Euclid’s Lemma, since Euclid proved it in the Elements.

Theorem 19.5. Let a ∈ N with a > 1. The following are equivalent:


(1) The number a is prime.
(2) For any b, c ∈ Z, if a | bc, then a | b or a | c.

Proof. (1) ⇒ (2): Assume that a is a prime number, and that a | bc and a - b. Then
GCD(a, b) = 1, so by Theorem 18.13 we see that a | c.
(2) ⇒ (1): Working contrapositively, suppose that a is not prime, so that (1) is
false. Then a is composite, and thus a = bc for some integers b, c between 1 and a by
Theorem 19.3. Now a | bc and a - b and a - c (since b and c are positive and smaller
than a). Hence, (2) is false.

In Exercise 19.2 you will use induction to prove the following natural extension of
Euclid’s Lemma.

Theorem 19.6. Let p be a prime number, let n be a natural number, and let
a1 , . . . , an ∈ Z. If
p | a1 a2 · · · an ,
then p | ai for some 1 ≤ i ≤ n.

19.B Divisibility by primes


We know that if a number is composite, then it has a factorization into smaller
numbers. One might wonder if it is possible to guarantee that these smaller numbers
must also be composite. In other words, is it possible to find a number that is so
composite that all of its factors are composite? The following theorem answers that
question (in the negative).

Theorem 19.7. Every integer larger than 1 is divisible by a prime number.

Proof. Let a > 1 be an integer. The set

S = {b ∈ N : b | a and b > 1}

is nonempty (since a is an element), so it has a least element p. By Exercise 19.3, we


conclude that p is prime.
142 CHAPTER V. THEORY OF THE INTEGERS

Next, we prove that every positive integer is a product of primes. Note that in
this theorem we allow the possibility that a number (namely 1) can be a product of
zero primes, or (if it is prime) a product of a single prime.

Theorem 19.8. Let a ∈ N. Then a is a product of primes.

Proof. Fix P (n) to be the open sentence

P (n): n is a product of primes.

We wish to prove that P (n) is true for each integer n ≥ 1, by strong induction.
Base Case: We note that P (1) is true, since 1 is a product of zero primes.
Inductive Step: Suppose, for some integer k ≥ 1, that P (1), . . . , P (k) are each
true. In other words, assume that each integer from 1 to k is a product of primes.
Our next goal is to show that P (k + 1) is true. To do so, we now break the proof
into cases depending on whether k + 1 is prime or composite.
Case 1: Suppose k + 1 is prime. Then P (k + 1) is true; k + 1 is a product of the
single prime k + 1.
Case 2: Suppose k + 1 is composite. Then we may factor k + 1 = bc, with
1 < b < k + 1 and 1 < c < k + 1 (so 2 ≤ b ≤ k and 2 ≤ c ≤ k). Hence, by
our inductive hypothesis, P (b) and P (c) are both true; both b and c are products of
primes. Hence, the product bc is a product of primes, so P (k + 1) is true.
Therefore, by induction the theorem is true.
This theorem can be greatly strengthened; we will now prove that every integer
not only has a prime factorization, but that its prime factorization is unique. The
importance of this theorem is evident from its name: The Fundamental Theorem of
Arithmetic.

Theorem 19.9 (The Fundamental Theorem of Arithmetic). Any integer n > 1


has a factorization into primes, written

n = p 1 p2 · · · pr

(for some r ∈ N) with p1 ≤ p2 ≤ . . . ≤ pr , and this factorization is unique.

Proof. We have already seen that n can be written as a product of one or more primes.
We order the primes so that they are in nondecreasing order. All that remains to be
proved is the uniqueness statement, which we will prove by strong induction.
Fix P (n) to be the open sentence

P (n): n has a unique factorization into prime numbers.

Base Case: Clearly, P (2) is true; 2 is prime, so the only way to factor it into
2 = p1 · · · pr is to have r = 1 and p1 = 2. A similar argument works for any prime p;
hence P (p) is true.
19. PRIME NUMBERS 143

Inductive Step: Assume, for some integer k ≥ 2, that P (2), . . . , P (k) are each
true. In other words, assume that each integer from 2 to k has a unique prime
factorization. We wish to prove that P (k + 1) is true. We divide the proof into two
cases.
Case 1: If k + 1 is prime, then P (k + 1) is true as explained above.
Case 2: If k + 1 is not prime, assume that
k + 1 = p1 p 2 · · · pm = q1 q2 · · · q `
has two prime factorizations, with p1 , p2 , . . . , pm , q1 , q2 , . . . , q` all prime, and such that
p1 ≤ p2 ≤ . . . ≤ pm and q1 ≤ q2 ≤ . . . ≤ q` . Note that p1 | k + 1, so
p1 | q1 q2 · · · q` .
Hence, by Exercise 19.2, we have that p1 | qi for some index i. Since qi is prime and
p1 6= 1, we must have p1 = qi . This yields q1 ≤ qi = p1 .
By a similar argument p1 ≤ q1 . Thus, p1 = q1 .
Now, (k + 1)/p1 = p2 · · · pm = q2 · · · q` . Since 2 ≤ (k + 1)/p1 ≤ k, we see that
(k + 1)/p1 has a unique factorization into primes, by our inductive hypothesis. Hence
m = `, and pi = qi for each index i from 2 to m. Since p1 = q1 , we see that the
two factorizations that we had for k + 1 were identical. Hence, k + 1 has a unique
factorization into primes, and P (k + 1) is true.
Thus, by induction, every integer n > 1 has a unique factorization into primes.
Remark 19.10. We note that typically the factorization of a number into primes
will be simplified by combining copies of the same prime together. For instance, if we
wish to factor 720, rather than writing 720 = 2 · 2 · 2 · 2 · 3 · 3 · 5 we might write
720 = 24 · 32 · 5.
This is a more compact representation of the factorization. Using this convention, we
can restate Theorem 19.9 as saying that every integer n > 1 can be uniquely written
in the form
Yk
ak
a1 a2
n = p1 p2 · · · pk = pai i ,
i=1

with k ∈QN, each pi prime, p1 < . . . < pPk , and with each ai ∈ N. (Note that the
symbol i=1 works just like the symbol ki=1 , except for multiplication instead of
k

addition.) A factorization of this form has a special name as in the next definition. N

Definition 19.11. Let n > 1 be an integer. The prime factorization


k
Y
n= pai i
i=1

with k ∈ N, with p1 < . . . < pk all prime, and with each ai ∈ N, is called the
canonical factorization of n.
144 CHAPTER V. THEORY OF THE INTEGERS

Example 19.12. The canonical factorization of 5040 is 24 · 32 · 51 · 71 . In the notation


of Definition 19.11 we have p1 = 2, a1 = 4, p2 = 3, a2 = 2, p3 = 5, a3 = 1, p4 = 7,
and a4 = 1. 4

Remark 19.13. The statement of the Fundamental Theorem of Arithmetic is not


constructive. It provides no algorithm for actually finding a prime factorization. The
theorem does guarantee that whatever (correct) method we use to find a factorization
will yield the same answer as any other method.
One simple method of finding a prime factorization is trial division. Given an
integer n ≥ 2, start with k = 2 and divide to check if n is divisible by k. If it is, add
k to the list of factors of n, replace n by n/k, and repeat the process by finding the
factors of n/k. (Stop if n/k = 1.) If n is not divisible by k, replace k by k + 1 and
repeat the process.
We demonstrate this method by finding the prime factorization of 45. First, 45 is
not divisible by 2. Hence, we check whether it is divisible by 3. It is, so we add 3 to
the list of prime factors, and replace 45 by 15. Now 15 is divisible by 3, so we add 3
again to the list of prime factors, and replace 15 by 15/3 = 5. Now 5 is not divisible
by 3 or by 4, but it is divisible by 5, so we add 5 to the list of prime factors, and
replace 5 by 5/5 = 1. We are now done. The prime factorization of 45 is 3 · 3 · 5.
The method just described is a very inefficient method of factoring and can in fact
(with just a little thought) be improved greatly. However, factoring integers seems to
be an inherently difficult problem. The search for efficient factorization techniques is
an ongoing research effort, even today. N

19.C The infinitude of primes


Thousands of years ago, the ancient Greeks knew that there were infinitely many
primes. We give here an adaptation of the proof given by Euclid of this fact. What
we will prove is actually that any finite set of primes is missing some prime. This
clearly implies that the set of all primes must be infinite.

Theorem 19.14. There are infinitely many prime numbers.

Proof. Let S be any finite set of prime numbers. Fix


Y
N =1+ p.
p∈S

Then N ≥ 2, so N is divisible by some prime q by Theorem 19.7.


Using the division algorithm to divide N by any given prime p ∈ S leaves a
remainder of 1, so no prime in S divides N . Hence, q is a prime that is not in S.
Therefore, S is missing some prime.
Since each finite set of primes is missing some prime, there must be infinitely many
primes.
19. PRIME NUMBERS 145

Remark 19.15. We can test this proof in specific situations by selecting any finite
set of primes that we wish to consider, and constructing a prime not in that set. For
instance, fix S = {2, 3, 5, 7, 11}. Then N = 2311. In this case, N is prime and N ∈
/ S.
Now suppose that S = {2, 3, 5, 7, 11, 13, 17, 19}. Then N = 9699691 = 347 · 27953.
Both 347 and 27953 are primes not in S. N

19.D Exercises
Exercise 19.1. For each of the following integers n, give its canonical prime factor-
ization.
(a) n = 27. (b) n = 3072. (c) n = 60.
Exercise 19.2. Let p be a prime number. Fix P (n) to be the open sentence
If p divides any product of n integers, then p divides one of those integers.
Prove by induction that P (n) is true for each n ∈ N. (Hint: The case n = 2 is
Theorem 19.5. For the inductive step, when showing P (k + 1) you should assume its
premise, namely that p | a1 · · · ak ak+1 , for some a1 , . . . , ak+1 ∈ Z.)
Exercise 19.3. Let n > 1 be a natural number. Prove that the smallest divisor d of
n that is greater than 1 is prime.
Exercise 19.4. The goal of this exercise is to prove that there are infinitely many
primes that are congruent to −1 modulo 3. We will do this in a series of steps.
(a) Prove that, with only one exception, each prime number is either congruent to
1 modulo 3 or congruent to −1 modulo 3.
(b) Prove that for any n ∈ N and any a1 , . . . , an ∈ Z, if ai ≡ 1 (mod 3) for each
1 ≤ i ≤ n, then the product a1 a2 · · · an is also congruent to 1 modulo 3. (Use
induction.)
(c) Let N ∈ N. Prove that if N ≡ −1 (mod 3), then N is divisible by some prime
p such that p ≡ −1 (mod 3). (Hint: Working contrapositively, assume that no
prime factor of N is congruent to −1 modulo 3. Break into cases, considering
first what happens if all the prime factors are congruent to 1 modulo 3. The
previous two parts of the problem may be useful; don’t forget that there is an
exceptional prime.)
(d) Finish the proof that there are infinitely many primes p such that
p ≡ −1 (mod 3).
(Hint: Let {p1 , . . . , pn } be any finite set of primes that are each congruent to
−1 modulo 3. Adjust the proof of Theorem 19.14, using −1 + 3(p1 p2 · · · pn ) in
place of N .)
Exercise 19.5. Prove that there are infinitely many primes p such that
p ≡ −1 (mod 4).
(Hint: Do steps (a) through (d) of the previous exercise with 3 replaced by 4 every-
where.)
146 CHAPTER V. THEORY OF THE INTEGERS
Chapter VI

Relations

Assumptions are the termites of relationships. Henry Winkler

Studying relationships between objects can yield important information about


the objects themselves. For the real numbers, we study inequalities; for sets, we
study inclusion; for the integers, we study divisibility and congruences. All of these
relationships, whether between real numbers, sets, or integers, will be seen to be
special cases of the concept of a relation introduced in this chapter.
Because it encompasses so many different examples, the concept of a relation has
very broad applicability, but this level of generality limits what we can prove. Any
theorems proved about relations must be true for a wide variety of relationships. For
this reason, mathematicians have singled out several types of relations for special
study. Among these special relations are equivalence relations, which we will study
later in this chapter, and functions, which we will study in the next chapter.
By studying special types of relations, the theorems that we can prove will be
much more interesting. The relations that we study have been chosen to be widely
applicable, while simultaneously providing us with a rich collection of theorems.

147
148 CHAPTER VI. RELATIONS

20 Properties of relations
20.A What is a relation?
There are many relations that occur in mathematics. For instance, < on the real
numbers is a relation. Inclusion, ⊆, is a relation on sets. Divisibility on the natural
numbers is a relation. The following definition of a relation encompasses all of these
examples and others.

Definition 20.1. A relation is a set R of ordered pairs. Given sets A and B, we


say that R is a relation from A to B, when R ⊆ A × B. For arbitrary elements
a ∈ A and b ∈ B we will write aRb to mean (a, b) ∈ R.
In the case when A = B, we say R is a relation on A.

This definition is very general; in fact, it is so general that many examples of


relations may have no mathematical significance. Nevertheless, some relations are
very important. We give a number of examples.
Example 20.2. Fix A = {1, 2, 3} and B = {x, y, z}. Set R = {(1, y), (3, x)}. Then
we have 1Ry and 3Rx, but not 1Rz (so we write 16Rz). In fact, besides 1 relating to
y and 3 relating to x, no element of A relates to any element of B (under the relation
R given in this example). 4
Example 20.3. Fix A = B = N, and fix R = {(a, b) ∈ N × N : a − b = 2}. Then
3R1 and 5R3, but 16R3 and 56R1. 4
Example 20.4. We can define relations on sets of words. Indeed, fix W to be the
set of all words in the English language. Fix

R = {(α, β) ∈ W × W : α and β have the same length}.

Under this relation, two words are related to each other exactly when they have the
same length. Thus “tree” is related to “yaks,” but “awesome” is not related to “gum.”
We might name this relation the “have the same length” relation. 4
Sometimes we can define relations using symbols other than R. For instance:
Example 20.5. Fix A = {1, 2, 3, 4, 5}, and fix B = P(A). We define a relation from
A to B using the following set of ordered pairs:

R = {(a, X) ∈ A × B : a ∈ X}.

Since X is a set, it makes sense to ask whether a is an element of X.


In this case, if we take a = 2 and X = {1, 2, 3} we see that aRX. However, with
a = 2 and X = {1, 4, 5}, we have a6RX.
Given a ∈ A and X ∈ B, we see that aRX if and only if a ∈ X. Thus, we could
have used the symbol “∈” instead of “R.” 4
20. PROPERTIES OF RELATIONS 149

The following example exhibits a construction of a relation in a way that will be


important to us in later sections.
Example 20.6. Fix A = {1, 2, 3, 4, 5}. We break A up into pieces by fixing the set
S = {{1, 2}, {3, 4}, {5}}. (There were many different ways we could have broken A
into pieces; this is just one of them.) We now define a relation R on A by

R = {(a, b) ∈ A × A : for some X ∈ S, both a ∈ X and b ∈ X}.

Let’s test whether or not 1 is related to 2. Take a = 1 and b = 2. Note that a


and b are both in {1, 2} ∈ S. Hence, there is some X (namely X = {1, 2}) that is an
element of S such that a ∈ X and b ∈ X, so we see that 1R2.
If we take a = 1 and b = 4, there is no element X ∈ S such that a ∈ X and b ∈ X,
so (1, 4) ∈
/ R. If we work through all the possible elements of A × A, we find that

R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4), (5, 5)}. 4

There are many different ways to define a relation. One option is to simply list
all the possible ordered pairs in R. Another option we have seen is to write R using
set-builder notation. For instance, we defined the “have the same length” relation this
way. Sometimes set-builder notation is too clunky, and so we express the definition
of the relation in words. The following example shows how this is commonly done.
Example 20.7. Recall the relation defined in Example 20.3,

R = {(a, b) ∈ N × N : a − b = 2}.

To define the same relation, we could have instead said the following:

Fix R to be a relation on N, defined by aRb if a − b = 2.

This is shorthand for the more complete sentence: “Fix R to be the relation on the
natural numbers, N, defined as the set of ordered pairs (a, b) ∈ N × N satisfying
a − b = 2.” When we define a relation R by a condition (such as a − b = 2) that
condition tells us exactly when we should expect a to relate to b. 4

Warning 20.8. As with any definition, when we define a relation R with the
word “if,” the proper interpretation is “if and only if.” For instance, in the
previous example, the definition really means “aRb if and only if a − b = 2.”
This is a standard convention of mathematical language that can take some
getting used to.

Example 20.9. Fix A = R, and define a relation on A by xRy if x − y is negative.


If we wish to express R in set-builder notation, we could write

R = {(x, y) ∈ R × R : x − y is negative}.

Because R × R is just R2 we can graph the set R in the coordinate plane, as follows.
150 CHAPTER VI. RELATIONS

Notice that xRy means the same thing as x < y. In fact, this is the mathematical
relation “less than,” and it is usually just denoted by the symbol “<” rather than
being called R. 4
Often, for commonly used relations, we will find that there is a standard symbol.
If there is not, we might use a nonstandard symbol, in which case we must be careful
to define what the symbol means.
Some other standard symbols for relations on the real numbers are
≤, ≥, >, =, 6= .
In Exercise 20.2, for each of these relations you will be asked to graph the correspond-
ing subset of R × R.
We end with one more example of a relation that is denoted by a standard symbol.
Example 20.10. Fix A to be the set of all logical formulas formed from P and Q.
Define a relation R on A by xRy if x is logically equivalent to y. This relation R is
usually written ≡. 4

20.B Properties of relations on a set A


We now study different properties that relations on a set A can have. These properties
(especially the first three) have proven to be very useful; relations that satisfy these
properties tend to be more mathematically interesting than other relations.

Definition 20.11. Let R be a relation on a set A.


(1) We say that R is reflexive if: ∀a ∈ A, aRa.
(2) We say that R is symmetric if: ∀a, b ∈ A, aRb ⇒ bRa.
(3) We say that R is transitive if: ∀a, b, c ∈ A, ((aRb) ∧ (bRc)) ⇒ (aRc).
(4) We say that R is antisymmetric if: ∀a, b ∈ A, ((aRb) ∧ (bRa)) ⇒ a = b.
20. PROPERTIES OF RELATIONS 151

Example 20.12. Consider the “equality” relation on C. Which of the four properties
above hold for this relation?
It is reflexive, since given any a ∈ C we know a = a. It is also symmetric, since
given a, b ∈ C if a = b then b = a. It is transitive; for given a, b, c ∈ C if we assume
a = b and b = c, then a = c. Finally, it is antisymmetric. (Can you fill in the proof?
Let a, b ∈ A. Assume a = b and b = a. Conclude a = b.) 4

Example 20.13. Consider the relation < on R. Using well-known facts about <, we
will show that < is not reflexive, is not symmetric, is transitive, and is antisymmetric.
(Not reflexive): Fix 0 ∈ R. We have 0 ≮ 0.
(Not symmetric): Fix 0, 1 ∈ R. We have 0 < 1 but 1 ≮ 0.
(Transitive): Let a, b, c ∈ R. Assume a < b and b < c. It follows that a < c.
(Antisymmetric): Let a, b ∈ R. Assume a < b and b < a. This is impossible,
so the implication is vacuously true. 4

Example 20.14. Fix A = {1, 2, 3, 4}. Define a relation R on A by

R = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3), (4, 4)}.

We will prove that R is reflexive, symmetric, and transitive, but not antisymmetric.
We can do this by just checking every possibility.
(Reflexive): To see that R is reflexive, we note that each of the four elements of
A relates to itself; this is because (1, 1), (2, 2), (3, 3), and (4, 4) are in R.
(Symmetric): To see that R is symmetric, we note that for any pair in R,
reversing the order of the elements in the pair yields another pair in R; for example,
(1, 2) ∈ R, and reversing the elements, (2, 1) is also in R. (What if a = 1 and b = 4?
In that case the implication is vacuously true, since the premise is false.)
(Transitive): Transitivity is harder to see. Technically, we have 4 options for
each of a, b, and c, giving a total of 64 cases. Most of those cases involve a false
premise (hence are vacuously true). Let’s do a case that is not vacuous. Notice that
(1, 2) ∈ R. In addition, there are three elements c such that (2, c) ∈ R, namely
c = 1, 2, 3. Since each of (1, 1), (1, 2), and (1, 3) are in R, we see that whenever
(1, 2) ∈ R and (2, c) ∈ R, we have (1, c) ∈ R. Repeating this process with each
element of R in place of (1, 2), we see that R is transitive.
(Not antisymmetric): Fix a = 1 and fix b = 2. Both are in A. We find 1R2
and 2R1, but 1 6= 2. 4

Remark 20.15. Notice that when a relation R is given explicitly by a set, it can be
difficult to check transitivity. N

Transitivity is often easier to check when R is defined by a standard symbol, as


we saw in previous examples. It is also easier to prove when R is defined by a rule,
as we’ll also see in the next example.
152 CHAPTER VI. RELATIONS

Example 20.16. Fix A = N, and for any a, b ∈ N, define aRb to mean that b = ak for
some k ∈ N. Note that saying that aRb is the same as saying that a | b; this relation
is just divisibility, so we will write a | b instead of aRb. Before reading further, try to
decide which of the four properties hold for this relation.
(Reflexive): Let a ∈ N. We find a | a, because a = a · 1.
(Not symmetric): Fix a = 1 and b = 2. These are elements of N. Note that
a | b but b - a.
(Transitive): Let a, b, c ∈ N. Assume that a | b and b | c. Proposition 7.13 shows
that a | c.
(Antisymmetric): Let a, b ∈ N. Assume that a | b and b | a. Then a = b by
Corollary 17.2. Note that the relation in this example is defined on N, not Z. The
divisibility relation on Z is not antisymmetric; take a = 1 and b = −1.) 4
In the examples above we either proved that a property holds or proved that it
fails. Thus, we have been using the negations of each of the properties. The following
table lists all of the negations. (We leave it as an easy exercise to identify which row
corresponds to which property.)

Definition Negation
∀x ∈ A, xRx ∃x ∈ A, x6Rx
∀x, y ∈ A, xRy ⇒ yRx ∃x, y ∈ A, xRy ∧ y6Rx
∀x, y, z ∈ A, xRy ∧ yRz ⇒ xRz ∃x, y, z ∈ A, xRy ∧ yRz ∧ x6Rz
∀x, y ∈ A, (xRy ∧ yRx) ⇒ x = y ∃x, y ∈ A, xRy ∧ yRx ∧ x 6= y

We end this section with a few more examples of relations on sets. In some cases
we will leave the proofs (and disproofs) of properties to the motivated student.
Example 20.17. Let U be a nonempty set, and fix S = P(U ). We can define a
relation R on S by ARB if A ⊆ B (where A, B ∈ S are subsets of U ). Then R is
easily seen to be reflexive (since every set is a subset of itself), transitive (since A ⊆ B
and B ⊆ C implies A ⊆ C), and antisymmetric (since A ⊆ B and B ⊆ A implies
A = B), but not symmetric. (Can you prove this last statement?) 4
Example 20.18. Let A be any nonempty set, and fix R = ∅ to be the empty relation
on A. We note that R is not reflexive (since, for each a ∈ A, we have a6Ra). On the
other hand, R is symmetric, transitive, and antisymmetric, since the implications
defining these properties are vacuously true for R (since no elements of A are related
by R). 4
Example 20.19. Let A be any nonempty set, and fix R = A × A. Then, for any
a, b ∈ A, we have aRb. The relation R is easily seen to be reflexive, symmetric, and
transitive. It is antisymmetric if and only if |A| = 1. 4
The reflexive, symmetric, and transitive properties are very important, and will
be studied together in the next section.
20. PROPERTIES OF RELATIONS 153

20.C Exercises
Exercise 20.1. Fix A = {1, 2, 3, 4, 5, 6} and fix

R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (2, 5), (2, 6), (3, 5), (4, 5), (4, 6)}.

(a) Give an example of elements a, b ∈ A such that aRb.


(b) Give an example of elements a, b ∈ A such that a6Rb.
(c) For each a ∈ A, fix Sa = {x ∈ A : aRx}. Thus, Sa is the set of elements to
which a relates. Write down the six sets S1 , . . . , S6 by listing their elements.
For example, S1 = {1, 2, 3, 4}.
(d) For each a ∈ A, fix Ta = {x ∈ A : xRa}. Thus, Ta is the set of elements that
relate to a. Write down the six sets T1 , . . . , T6 by listing their elements.

Exercise 20.2. For each of the relations R from R to R defined below, write R as a
set using set-builder notation, and graph R as a subset of R2 .
(a) Define R by xRy if x ≤ y.
(b) Define R by xRy if x ≥ y.
(c) Define R by xRy if x > y.
(d) Define R by xRy if x = y.
(e) Define R by xRy if x 6= y.

Exercise 20.3. Define a relation R on R by xRy if xy < 0.


(a) Describe R as a set using set-builder notation.
(b) Graph R as a subset of R × R.
(c) Determine whether R is reflexive, symmetric, transitive, and/or antisymmetric.
(Give complete proofs.)

Exercise 20.4. Define a relation R on R by xRy if x − y ∈ Z.


(a) Describe R as a set using set-builder notation.
(b) Graph R as a subset of R × R.
(c) Determine whether R is reflexive, symmetric, transitive, and/or antisymmetric.
(Give complete proofs.)

Exercise 20.5. Define a relation R on Z by aRb if a − b is even.


(a) Describe R as a set using set-builder notation.
(b) Prove that R is reflexive, symmetric, and transitive.
(c) Prove that R is not antisymmetric.
(d) For which integers b is it the case that 1Rb?

Exercise 20.6. For each part, give an example of a relation R on the set A = {1, 2, 3}
with the specified properties. Write R as a set of ordered pairs.
(a) R is reflexive, symmetric, and transitive.
(b) R is reflexive and symmetric, but not transitive.
(c) R is reflexive and transitive, but not symmetric.
(d) R is reflexive, not symmetric, and not transitive.
(e) R is not reflexive, but is symmetric and transitive.
154 CHAPTER VI. RELATIONS

(f) R is not reflexive and not transitive, but is symmetric.


(g) R is not reflexive and not symmetric, but is transitive.
(h) R is not reflexive, not symmetric, and not transitive.

Exercise 20.7. Fix A = {1, 2, 3, 4, 5} and fix S = {{1, 2, 3}, {3, 4}, {5}}. Define

R = {(a, b) ∈ A × A : for some X ∈ S, both a ∈ X and b ∈ X}.

(See Example 20.6 for a similar construction.)


(a) Write out the elements of R.
(b) Is R reflexive? Symmetric? Transitive? (Give complete proofs.)

Exercise 20.8. Fix A = {1, 2, 3, 4, 5} and fix S = {{1, 2}, {4, 5}}. Define

R = {(a, b) ∈ A × A : for some X ∈ S, both a ∈ X and b ∈ X}.

(See Example 20.6 for a similar construction.)


(a) Write out the elements of R.
(b) Is R reflexive? Symmetric? Transitive? (Give complete proofs.)
21. EQUIVALENCE RELATIONS 155

21 Equivalence relations
Knowing that we have a relation R on a set A tells us very little about either R or A.
We can find many examples of relations on A, but without further information there
is very little that we can say about a relation.
Placing conditions (such as “reflexive”, “symmetric”, and so forth) on a relation
reduces the number of examples that we can find, but increases the amount that we
know and can prove about each example.
One class of relations that has proven useful to mathematicians is the class of
equivalence relations. Equivalence relations have enough conditions that we can prove
useful theorems about them, but they are general enough that there are many exam-
ples of them in all areas of mathematics.

21.A Definition and examples


The definition of an equivalence relation is as follows:

Definition 21.1. Let R be a relation on a set A. We say that R is an equivalence


relation if R is reflexive, symmetric, and transitive.

Equality is the prototypical example of an equivalence relation, but there are many
more examples.

Example 21.2. Fix A = {1, 2, 3, 4}. Define a relation R on A by

R = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3), (4, 4)},

as in Example 20.14. We have seen that R is reflexive, symmetric, and transitive.


Hence, R is an equivalence relation. 4

Example 21.3. Fix A = Z and for any a, b ∈ A, require aRb if a and b have the
same parity. One easily checks that this relation is reflexive (an integer has the same
parity as itself), symmetric (if a and b have the same parity, then so do b and a), and
transitive (if a and b have the same parity, and b and c have the same parity, then a
and c have the same parity). Hence, R is an equivalence relation. 4

Example 21.4. Fix A = R and for any a, b ∈ A, require aRb if |a| = |b|. Again,
one checks easily that this is reflexive (|a| = |a|), symmetric (|a| = |b| clearly implies
that |b| = |a|), and transitive (if |a| = |b| and |b| = |c|, then |a| = |c|). Hence R is an
equivalence relation. 4

Example 21.5. Fix A to be the set of all triangles. For any a, b ∈ A, require aRb
if a is similar to b. (Recall from geometry that two triangles are similar if they have
the same interior angles.). One sees easily that this is an equivalence relation. 4
156 CHAPTER VI. RELATIONS

In many cases, equivalence relations are written using symbols other than R to
indicate that two elements are related. A common symbol to use for a generic equiv-
alence relation is ∼, which can be read “is equivalent to.” Other symbols that might
be used to represent equivalence relations include ≡, ∼ =, ≈, u, ', l. Using these
symbols for a relation that is not an equivalence relation can cause confusion. Note
that these symbols can have many different meanings, so if you use them it is impor-
tant to say what they mean. For instance, ≡ could mean congruence modulo n or
it could mean logical equivalence (or it could have another meaning) depending on
where it occurs.
Example 21.6. Fix A = R × R. Define a relation ∼ on A by (a, b) ∼ (c, d) if
a2 + b2 = c2 + d2 . We check that ∼ is an equivalence relation.
Note that for (a, b) ∈ R × R, we have a2 + b2 = a2 + b2 . Hence, (a, b) ∼ (a, b), so
the relation ∼ is reflexive.
Suppose that (a, b) ∼ (c, d). Then a2 + b2 = c2 + d2 , so c2 + d2 = a2 + b2 , and
(c, d) ∼ (a, b). Hence, ∼ is symmetric.
Finally, assume that (a, b) ∼ (c, d) and (c, d) ∼ (e, f ). Then a2 + b2 = c2 + d2 and
c2 + d2 = e2 + f 2 , so a2 + b2 = e2 + f 2 , and we see that (a, b) ∼ (e, f ). Hence ∼ is
transitive.
Therefore, ∼ is an equivalence relation. 4
Example 21.7. Let P , Q, R be variables, and fix A be the set of all logical formulas
formed from P , Q, and R. For any a, b ∈ A, write a ≡ b if a is logically equivalent to
b. One may check that ≡ is an equivalence relation. 4
Example 21.8. Fix A = {1, 2, 3, 4, 5} and fix S = {{1, 2}, {3, 4}, {5}}.
Define a relation R on A by
(21.9) R = {(a, b) ∈ A × A : for some X ∈ S, both a ∈ X and b ∈ X}.
This is the same relation that we constructed in Example 20.6, where we saw that
(21.10) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4), (5, 5)}.
We will now prove that R is an equivalence relation. We begin by noting two facts
about S that will be important: (1) every element of A is a member of some element
of S, and (2) the elements of S are disjoint sets; no two of them share a common
element of A. We will prove that R is an equivalence relation using (21.9), rather
than using the explicit list (21.10).
(Reflexive): Let a ∈ A. There is some X ∈ S such that a ∈ X. Hence,
(a, a) ∈ R, so aRa. Therefore, R is reflexive.
(Symmetric): Let a, b ∈ A and assume aRb. Then (a, b) ∈ R, so for some X ∈ S
we have a, b ∈ X. Hence, b, a ∈ X, so (b, a) ∈ R, and we see that bRa. Therefore R
is symmetric.
(Transitive): Let a, b, c ∈ A and assume aRb and bRc. Then there is some X ∈ S
such that a, b ∈ X, and there is some Y ∈ S such that b, c ∈ Y . Since the elements
of S are disjoint, b ∈ X and b ∈ Y implies that X = Y . Therefore, both a and c are
in X, and aRc. Therefore R is transitive. 4
21. EQUIVALENCE RELATIONS 157

21.B Equivalence classes


The properties of equivalence relations are chosen to mimic properties of equality.
Often when we have an equivalence relation it is useful to gather together elements
that are related under the equivalence relation and to treat them as if they were equal.
Forming equivalence classes is the tool that performs this gathering.

Definition 21.11. Let A be a set and let ∼ be an equivalence relation on A.


For any element a ∈ A, we define the equivalence class of a by

[a] = {x ∈ A : a ∼ x}.

The element a is called a representative of the class [a].

Other common notations for the equivalence class of a are a, â, or ã. These
symbols are used to represent the equivalence classes for many different equivalence
relations; thus, if you use one of these notations, you must define it. Similarly, if
you see such symbols in mathematical writing, you should look to see how they are
defined.
Example 21.12. Fix A = {1, 2, 3, 4} and define a relation R on A by

R = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3), (4, 4)}.

We saw in Example 20.14 that R is an equivalence relation. We now determine its


equivalence classes.
First, [1] consists of all elements x ∈ A such that 1Rx. Examining R, we find that
1R1, 1R2, 1R3, and 16R4. Hence, [1] = {1, 2, 3}.
Now [2] consists of all elements x ∈ A such that 2Rx. Examining R, we find that
2R1, 2R2, 2R3, and 26R4. Hence, [2] = {1, 2, 3}.
Similarly, [3] = {1, 2, 3}.
Finally, [4] = {4}, since the only x ∈ A with 4Rx is x = 4.
We note that there are two equivalence classes in A. The first equivalence class is
[1] = [2] = [3] = {1, 2, 3} and the second is [4] = {4}. These classes divide the set A
into two subsets, as in the diagram below.

1 3
2 4
4
Example 21.13. Fix A = {1, 2, 3, 4, 5, 6}, and define a relation ∼ on A by
 
(1, 1), (1, 3), (2, 2), (2, 4), (3, 1), (3, 3),
R= .
(4, 2), (4, 4), (5, 5), (5, 6), (6, 5), (6, 6)

Then R is an equivalence relation. We will determine the equivalence classes of R.


158 CHAPTER VI. RELATIONS

To determine [1], we look for all of the ordered pairs (1, x) ∈ R. The only x’s that
work are 1 and 3. Hence, [1] = {1, 3}.
Similarly, [2] = {2, 4}, [3] = {1, 3}, [4] = {2, 4}, [5] = {5, 6}, and [6] = {5, 6}. We
note that there are three equivalence classes, since [1] = [3], [2] = [4] and [5] = [6].
Because A is finite, we can easily draw a picture illustrating how the equivalence
classes divide A into three pieces.

1 3 5

2 4 6
4

Example 21.14. Fix A = Z, and fix ∼ to be the relation defined on A by a ∼ b


if a and b have the same parity. We saw in Example 21.3 that ∼ is an equivalence
relation. We will compute the equivalence classes.
The equivalence class [0] consists of all numbers having the same parity as 0.
Hence, [0] = 2Z, the set of even integers. The equivalence class [1] consists of all
numbers having the same parity as 1. Hence, [1] is the set of odd integers.
Notice that if a is any even integer, [a] = 2Z = [0]. Similarly, if a is any odd integer,
[a] = [1]. Hence, in this case, there are exactly two equivalence classes, each containing
infinitely many elements. Each class also has infinitely many representatives. For
instance, · · · = [−2] = [0] = [2] = [4] = · · · . 4

Example 21.15. Fix A = R, and for any a, b ∈ A, define a l b by the rule |a| = |b|.
We saw in Example 21.4 that l is an equivalence relation. For each a ∈ A, we will
denote the equivalence class of a by [a].
We see that [0] = {x ∈ R : 0 l x} = {x ∈ R : |0| = |x|}. There is only one such
value of x, namely x = 0. Hence, [0] = {0}.
Now, [1] = {x ∈ R : 1 l x} = {x ∈ R : |1| = |x|}, or in other words the
real numbers with absolute value 1. There are two such numbers: 1 and −1. Hence,
[1] = {1, −1}.
Moving to negative numbers, [−2] = {x ∈ R : −2 l x} = {x ∈ R : |−2| = |x|},
or in other words, the real numbers with absolute value 2. There are two such
numbers: 2 and −2. Hence, [−2] = {2, −2}.
In general, if a ∈ R and a 6= 0, we see that [a] = {a, −a}.
We see that there are infinitely many different equivalence classes in R, each
having one or two elements. 4

We conclude this section by proving a very simple theorem, which is really just a
restatement of the definition of an equivalence class. Nevertheless, this restatement
will be quite useful to us, in telling us whether or not an element belongs to an
equivalence class.

Theorem 21.16. Let ∼ be an equivalence relation on a set A and let a, b ∈ A.


Then a ∼ b if and only if b ∈ [a].
21. EQUIVALENCE RELATIONS 159

Proof. First, assume that a ∼ b. Then, by the definition of [a], we have b ∈ [a].
Conversely, assume that b ∈ [a]. Then, by the definition of [a], we have a ∼ b.

21.C Exercises
Exercise 21.1. Fix A = {1, 2, 3} and fix R to be the relation on A given by

R = {(1, 1), (1, 2), (2, 1), (2, 2), (2, 3), (3, 2), (3, 3)}.

Is R reflexive? Symmetric? Transitive? Antisymmetric? Is R an equivalence relation?


(Give proofs.)

Exercise 21.2. Fix A = {1, 2, 3, 4, 5}. Give an example of an equivalence relation


R on the set A that has exactly two equivalence classes. Explicitly write out the
relation R as a set of ordered pairs.

Exercise 21.3. Let R be an equivalence relation on the set A = {1, 2, 3, 4, 5}. Assume
that 1R3 and 3R4. Given these conditions, which ordered pairs must belong to R?
(Hint: There are at least 11 such elements.)

Exercise 21.4. Fix A = {1, 2, 3, 4, 5} and fix S = {{1, 2}, {3, 4}, {5}}. Define

R = {(a, b) ∈ A × A : for some X ∈ S, both a ∈ X and b ∈ X}

as in Example 21.8. We have seen that R is an equivalence relation. What are the
equivalence classes of R?

Exercise 21.5. Fix A = R − {0}. Define a relation ∼ on A by a ∼ b if ab > 0.


(a) Prove that ∼ is an equivalence relation on A.
(b) Determine the equivalence classes of ∼.

Exercise 21.6. Fix A to be the set of humans with English names. Define a relation
≈ on A by α ≈ β if α and β have the same first letter in their first names. (For
instance, anyone named “Eugene” is related by ≈ to anyone named “Elizabeth”.)
(a) Prove that ≈ is an equivalence relation on A.
(b) Determine the equivalence classes of ≈.

Exercise 21.7. Let A be a set. Let R be a reflexive, symmetric, and antisymmetric


relation on A. Prove that R is the equality relation on A. (In other words, prove that
for any x, y ∈ A, we have xRy if and only if x = y.)
160 CHAPTER VI. RELATIONS

22 Equivalence classes and partitions


In this section we prove that an equivalence relation allows us to break up a set
into jigsaw-like pieces that one can fit together to give the entire set. Conversely,
we will prove that if you break a set into jigsaw pieces, then one can define a cor-
responding equivalence relation. We saw an example of this earlier, with the set
A = {1, 2, 3, 4, 5, 6}. The equivalence relation
 
(1, 1), (1, 3), (2, 2), (2, 4), (3, 1), (3, 3),
R=
(4, 2), (4, 4), (5, 5), (5, 6), (6, 5), (6, 6)

corresponded to breaking A into the equivalence classes pictured below.

1 3 5

2 4 6

This correspondence holds for arbitrary equivalence relations, as we will prove in


this section.

22.A Properties of equivalence classes


The following theorem provides some useful criteria for determining whether two
equivalence classes are equal.

Theorem 22.1. Let ∼ be an equivalence relation on a set A, and for any x ∈ A


denote the equivalence class of x by [x]. For any x, y ∈ A, the following are
equivalent:
(1) x ∼ y (the elements are related).
(2) [x] ∩ [y] 6= ∅ (the classes intersect nontrivially).
(3) [x] = [y] (the classes are equal).

Proof. We prove the equivalence by proving three implications: (1) ⇒ (3), (3) ⇒ (2),
and (2) ⇒ (1). This will prove that we can move from any one condition to any other.
(1) ⇒ (3): Assume x ∼ y. By symmetry we also have y ∼ x. We wish to show
[x] = [y]. We will prove this equality by showing both inclusions.
First we will show [x] ⊆ [y]. Let z ∈ [x]. We then know x ∼ z. Since y ∼ x and
x ∼ z, by transitivity we obtain y ∼ z. Hence z ∈ [y], and we have shown [x] ⊆ [y].
The other inclusion, [y] ⊆ [x], is proved similarly.
(3) ⇒ (2): Now assume that [x] = [y]. By the reflexive property, x ∼ x.
Therefore x ∈ [x] = [y]. Hence [x] ∩ [y] 6= ∅ since x is in the intersection.
(2) ⇒ (1): Finally, assume [x] ∩ [y] 6= ∅. Thus, there is some element z ∈ [x] ∩ [y].
We then have x ∼ z and y ∼ z. By symmetry and transitivity, x ∼ y.
22. EQUIVALENCE CLASSES AND PARTITIONS 161

This theorem, along with Theorem 21.16 from the previous section, allows us to
prove three central properties for equivalence classes. Let A be a set and let ∼ be an
equivalence relation on A. The following all hold:
• (Nonempty pieces) No equivalence class is empty.
Proof. Let [x] be an equivalence class. Since x ∼ x by the reflexive property,
we then have x ∈ [x].
• (Covering) Every element of A is an element of some equivalence class.
Proof. An arbitrary element a ∈ A belongs to the equivalence class [a] (again,
by the reflexive property).
• (Disjoint pieces) Any two classes are either disjoint or equal.
Proof. Since (2) implies (3) in Theorem 22.1, two classes that are not disjoint
are equal.
We can think of these three conditions as describing how to break a set into jigsaw
pieces. First, none of the pieces should be empty. (Empty jigsaw pieces would just
fall out of the box, and they wouldn’t be missed anyway!) Second, when you put all
of the pieces together, you should get the entire puzzle (in this case, the entire set
A). Third, none of the pieces should overlap (else they don’t fit together into a jigsaw
puzzle).
We have proved that these three facts about equivalence classes are necessary.
In the next subsection, we will show that they are sufficient to describe a (unique)
equivalence relation with the same equivalence classes.

22.B Partitions and equivalence classes


The three facts mentioned at the end of the previous subsection help us to define the
concept of a partition, as follows:

Definition 22.2. Let A be a set. A collection P of subsets of A is called a


partition of A if the following three conditions hold:
(Nonempty pieces) No set in P is empty.
(Covering) Every element of A is a member of some element of P .
(Disjoint pieces) Any two distinct elements of P are disjoint.
An element of P is called a part (or piece) of the partition.

Example 22.3. Fix A = {1, 2, 3}. Then the following are partitions of A:
P1 = {{1, 2, 3}},
P2 = {{1, 2}, {3}},
P3 = {{1, 3}, {2}},
P4 = {{2, 3}, {1}},
P5 = {{1}, {2}, {3}}.
162 CHAPTER VI. RELATIONS

If we wish to represent these five partitions graphically, we can do so as below, where


the set A = {1, 2, 3} is represented as a circle. The parts of the partition are separated
by line segments.
1 1 1 1 1
2 3 2 3 2 3 2 3 2 3

P1 P2 P3 P4 P5

Careful examination shows that there are no other partitions of A.


Each of the following collections is not a partition of A. Try to figure out what is
wrong in each case before reading the answers below.
(1) {∅, {1, 2}, {3}}
(2) {{1, 3}}
(3) {{1, 2}, {2, 3}}
(4) {{1, 2}, {3, 4}}
(5) {1, 2, 3}
Here are the reasons each of the sets above is not a partition of A:
(1) This collection fails the “nonempty pieces” condition, since one of the pieces is
empty.
(2) This collection fails the “covering” condition, since we are missing 2.
(3) This collection fails the “disjoint pieces” condition, since the two distinct pieces
overlap.
(4) This collection does not consist of subsets of A. (It would be a partition for the
new set B = {1, 2, 3, 4}.)
(5) This collection is not a set of sets. (It would be a partition with an extra pair
of set braces around it, and would then equal P1 above.)
4
Example 22.4. Let’s partition N into four parts. One such partition would be the
following:
P = {{1}, {2}, {3}, {x ∈ N : x ≥ 4}}.
Three of the pieces are very small, and the other piece is infinite.
Another possibility would be the following, somewhat more natural, example.
Given n ∈ N fix Sn = {x ∈ N : x ≡ n (mod 4)}. Our new partition is

P 0 = {S1 , S2 , S3 , S4 }.

This is a partition because every natural number is congruent to exactly one of the
four numbers 1, 2, 3, 4. 4
Example 22.5. There are fifteen different partitions of the set A = {1, 2, 3, 4}. We
do not list them all, but mention that there is one partition with one part, seven
partitions with two parts, six partitions with three parts, and one partition with
four parts. As an example, {{1, 2}, {3, 4}} is a partition of A with two parts, and
{{1}, {2}, {3, 4}} is a partition of A with three parts. 4
22. EQUIVALENCE CLASSES AND PARTITIONS 163

The following theorem asserts that from an equivalence relation we can build a
partition.

Theorem 22.6. Let ∼ be an equivalence relation on a set A. For any a ∈ A,


denote its equivalence class by [a]. Then the set

P = {[a] : a ∈ A}

is a partition of A.

Proof. We already proved above that the set of equivalence classes satisfies all three
of the defining conditions for a partition.
The next two examples will demonstrate how we pass from an equivalence relation
to a partition.

Example 22.7. Fix A = {1, 2, 3} and fix R to be the relation defined by

R = {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3)}.

We can easily confirm that R is an equivalence relation. The equivalence classes are
[1] = {1} and [2] = {2, 3} = [3]. Hence, the set of equivalence classes is {{1}, {2, 3}},
which is the partition P4 from Example 22.3. 4

Example 22.8. Consider the “same parity” relation on Z. The two equivalence
classes are the sets of even integers and odd integers. This partitions Z into two
disjoint sets. 4

The next theorem allows us to pass from a partition to an equivalence relation,


thereby reversing the direction of the previous theorem.

Theorem 22.9. Let P be a partition of a set A. There is an equivalence relation


∼ on A such that the equivalence classes of ∼ are precisely the parts of P .

Proof. Let P be a partition of A. Define the relation ∼ on A by a ∼ b if a and b are


both in a common part of P . We will show that ∼ is an equivalence relation.
First note that if A is empty (so that P is also empty), then symmetry and
transitivity hold vacuously, while reflexivity holds since there is nothing to check. So,
hereafter we assume A is nonempty.
(Reflexive): Let a ∈ A. By the covering property, a is an element of some part
of P . Hence, a ∼ a, so ∼ is reflexive.
(Symmetric): Let a, b ∈ A and assume a ∼ b. Thus, there is some part X ∈ P ,
such that a ∈ X and b ∈ X. Hence, b, a ∈ X, so b ∼ a. Thus, ∼ is symmetric.
(Transitive): Let a, b, c ∈ A and assume a ∼ b and b ∼ c. So a, b ∈ X and
b, c ∈ Y , where X and Y are parts of P . Since b is an element of both X and Y , we
164 CHAPTER VI. RELATIONS

must have X = Y (by the disjoint pieces property), so a, c ∈ X, and hence a ∼ c.


Thus, ∼ is transitive, and this finishes the proof that ∼ is an equivalence relation.
Finally, we prove that the equivalence classes of ∼ are exactly the parts of P . For
any a ∈ A there is exactly one part X ∈ P with a ∈ X (by the covering and disjoint
pieces conditions). By the definition of ∼, the elements of [a] are exactly the elements
of X, so [a] = X. Hence, the equivalence classes of ∼ are parts of P . Conversely, we
show that the parts of P are equivalence classes. Given a part X ∈ P , it is nonempty.
So there is some element a ∈ X. By the same argument above we obtain [a] = X, so
it is an equivalence class.

Together, Theorems 22.6 and 22.9 tell us that partitions of a set A and equivalence
relations on A correspond to each other; every partition gives an equivalence relation
and every equivalence relation gives a partition. The following example demonstrates
this fact concretely.

Example 22.10. We partition Z into three pieces, in the following way:

P = {{0}, {x ∈ Z : x < 0}, {x ∈ Z : x > 0}}.

In other words, we partition Z into its zero, negative, and positive pieces.
What is the corresponding equivalence relation? It is the “two elements are related
if they are both positive, both zero, or both negative” relation. More formally,

R = {(x, y) ∈ Z × Z : x, y ∈ Z>0 or x = y = 0 or x, y ∈ Z<0 }. 4

22.C Transversals of equivalence relations


On occasion it is important to be able to refer to representatives of equivalence classes.
When we pick one representative for each class, the collection of those representatives
has a special name.

Definition 22.11. Let ∼ be an equivalence relation on a set A. A transversal


of ∼ is a set S ⊆ A, such that S consists of exactly one representative of every
equivalence class of ∼.

Example 22.12. Fix A = {1, 2, 3, 4, 5} and fix

R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)}.

Then R is an equivalence relation on A. The equivalence classes of R are

[1] = [2] = {1, 2}, [3] = {3}, [4] = [5] = {4, 5}.

Then the set {1, 3, 5} is a transversal, since it consists of a single element from each
equivalence class. Other transversals are {1, 3, 4}, {2, 3, 4}, and {2, 3, 5}. 4
22. EQUIVALENCE CLASSES AND PARTITIONS 165

Example 22.13. Define a relation ∼ on R by a ∼ b if a − b ∈ Z. Thus, two real


numbers are related by ∼ if they are an integer apart from one another. So, for
instance, π is related to π − 3. We will show that ∼ is an equivalence relation, and
that the set [0, 1) is a transversal of ∼.
(Reflexive): Let a ∈ R. We have a − a = 0 ∈ Z, and so a ∼ a.
(Symmetric): Let a, b ∈ R, and assume a ∼ b. Thus, a − b ∈ Z, and so we have
b − a = −(a − b) ∈ Z. Therefore b ∼ a.
(Transitive): Let a, b, c ∈ R. Assuming a ∼ b and b ∼ c, then we know that
a − b, b − c ∈ Z. Adding, we find that a − c = (a − b) + (b − c) ∈ Z, so a ∼ c.
Hence, ∼ is an equivalence relation.
We now proceed to show that [0, 1) is a transversal of ∼. Define the floor of x, writ-
ten bxc, to be the unique integer such that bxc ≤ x < bxc + 1. Thus, bxc is obtained
by “rounding down,” even when x is negative. (So b5.6893c = 5, b−3.49583c = −4,
and bπc = 3.) The quantity x − bxc is called the fractional part of x and is in [0, 1).
First, every element of R is related to its fractional part, since x minus its fractional
part x − bxc is the integer bxc. This shows that some element from each equivalence
class is a member of [0, 1). Finally, if a, b ∈ [0, 1) with a 6= b, then a 6∼ b, since
0 < |a − b| < 1, so a − b ∈ / Z. Thus, no more than one element from any equivalence
class belongs to [0, 1). 4

Advice 22.14. There are typically two steps to proving that a given set T is a
transversal of an equivalence relation ∼ on a set A.
First, you need to prove that every element of A is related to at least one
element of T . Often this can be done by giving an explicit construction; for any
element a ∈ A, construct an element t ∈ T such that a ∼ t.
Second, you need to prove that every element of A is related to at most one
element of T . In other words, T cannot contain two representatives from the
same class. So, it suffices to prove that t1 ∼ t2 implies t1 = t2 , for any t1 , t2 ∈ T .

Example 22.15. Fix ∼ to be the relation on R × R defined by (a, b) ∼ (c, d) if


a + d = b + c. We will show that ∼ is an equivalence relation and give a transversal
of ∼.
(Reflexive): Let (a, b) ∈ R × R. Then (a, b) ∼ (a, b) since a + b = a + b.
(Symmetric): Let (a, b), (c, d) ∈ R × R. Assume that (a, b) ∼ (c, d). Then
a + d = b + c. It follows that c + b = a + d, and we see that (c, d) ∼ (a, b).
(Transitive): Let (a, b), (c, d), (e, f ) ∈ R × R. Assume that (a, b) ∼ (c, d) and
(c, d) ∼ (e, f ). Then a + d = b + c and c + f = d + e. Adding these equations, we see
that a + d + c + f = b + c + d + e. Subtracting c + d from both sides of this equality,
we see that a + f = b + e, so (a, b) ∼ (e, f ).
Hence, ∼ is reflexive, symmetric, and transitive, so it is an equivalence relation.
Fix T = {(0, d) : d ∈ R}. We will show that T is a transversal for ∼.
Let (a, b) ∈ R×R. Then (0, b−a) ∈ T , and (a, b) ∼ (0, b−a), since a+(b−a) = b+0.
Hence, every element of R × R is related to at least one element of T .
166 CHAPTER VI. RELATIONS

Now, suppose that (0, d1 ) ∼ (0, d2 ). Then 0 + d2 = d1 + 0, hence d1 = d2 . So


(0, d1 ) = (0, d2 ). This shows that no element of R × R is related to more than one
element of T . Therefore T is a transversal. 4

22.D Exercises
Exercise 22.1. Fix A = {1, 2, 3, 4}. List one partition of A with one part, seven
partitions of A with two parts, six partitions of A with three parts, and one partition
of A with four parts. This gives a total of fifteen partitions of A. (There are no more,
but you do not need to prove this.)

Exercise 22.2. Let A be a set with |A| = 10, and let ∼ be an equivalence relation
on A. Denote the equivalence classes of ∼ by [x], for each x ∈ A. Suppose that we
have elements a, b, c ∈ A with |[a]| = 3, |[b]| = 5, and |[c]| = 1.
(a) Are any of a, b, and c related to each other by ∼?
(b) How many equivalence classes for ∼ are there?

Exercise 22.3. Define a relation ∼ on R2 by (a, b) ∼ (c, d) if a2 + b2 = c2 + d2 . We


saw in Example 21.6 that ∼ is an equivalence relation.
(a) Describe the equivalence class [(3, 4)], both as a set and geometrically.
(b) For an arbitrary element (a, b) ∈ R2 , describe [(a, b)].
(c) Prove that the set [0, ∞) × {0} is a transversal of ∼.

Exercise 22.4. Fix W to be the set of all words in the English language. Define a
relation on W by α ≈ β if α and β have the same first letter.
(a) Prove that ≈ is an equivalence relation.
(b) Denote the equivalence class of α ∈ W using the notation [α]. Taking α = “cat”,
list six elements of the equivalence class [α].
(c) How many equivalence classes are there for ≈?
(d) Describe a transversal of ≈. (You do not need to write it down in full.)

Exercise 22.5. Let A be a set with n elements. Define a relation ∼ on P(A) by


X ∼ Y if |X| = |Y |, for any X, Y ∈ P(A).
(a) Prove that ∼ is an equivalence relation.
(b) Describe the equivalence classes for ∼.
(c) How many equivalence classes are there for ∼?
(d) One way to write down the set A is as A = {a1 , a2 , . . . , an }. Using this descrip-
tion of A, write down a transversal of ∼.
(e) How many elements of P(A) are in each equivalence class?

Exercise 22.6. Fix A = {1, 2, . . . , 10}. For each i ∈ A, define

Si = {X ∈ P(A) : i is the least element of X}.

Fix P = {{∅}, S1 , . . . , S10 }.


(a) Prove that P is a partition of P(A). (Hint: Are the parts of P empty? Disjoint?
Is every element of P(A) in some part?)
22. EQUIVALENCE CLASSES AND PARTITIONS 167

(b) Fix ∼ to be the equivalence relation on P(A) corresponding to P . How many


equivalence classes does ∼ have?
(c) Write down a transversal of ∼.
(d) Determine the equivalence class [{8, 9, 10}] by listing its elements.
(e) How large is the equivalence class [{2, 3, 4}]? (Do not write down all of its
elements.)

Exercise 22.7. Give another proof of Theorem 22.1, by proving that (1) implies (2),
that (2) implies (3), and that (3) implies (1). Note that your proof should not use
any theorems after or including Theorem 22.1; it should only use basic properties of
equivalence relations and equivalence classes.

Exercise 22.8. In this exercise we will show that an equivalence relation is uniquely
determined by its equivalence classes, as follows: Let A be any set. Let ∼ and ≈ be
two equivalence relations on A. Show that if their equivalence classes are the same,
then the relations are the same. (In other words, conclude that for any a, b ∈ A, we
have a ∼ b if and only if a ≈ b.)
(Hint: For ease of notation, write the equivalence class of a ∈ A under the relation
∼ using the notation [a], and write the equivalence class under the relation ≈ using
the notation a.)
168 CHAPTER VI. RELATIONS

23 Integers modulo n
In this section we will study integer congruence and prove it is an equivalence relation.

23.A Review of integer congruence


Recall the definition of congruence modulo n (Definition 8.11).

Definition 23.1. Let a, b, n ∈ Z. We say that a ≡ b (mod n) when a = b + nk


for some k ∈ N.

We read a ≡ b (mod n) as “a is congruent to b modulo n” or “a is congruent to b


mod n.” This defines a relation on Z. (Two elements are related if they are congruent
modulo n.) We refer to the relation as “congruence modulo n.”

Theorem 23.2. Congruence modulo n is an equivalence relation on Z.

Proof. (Reflexive): Let a ∈ Z. We have a = a + n · 0. Hence, a ≡ a (mod n), and


so congruence modulo n is reflexive.
(Symmetric): Let a, b ∈ Z, and assume a ≡ b (mod n). Then a = b + nk for
some k ∈ Z. This implies that b = a + n(−k), so b ≡ a (mod n). Hence, congruence
modulo n is symmetric.
(Transitive): Let a, b, c ∈ Z, and assume both that a ≡ b (mod n) and that
b ≡ c (mod n). Then a = b + nk and b = c + n` for some k, ` ∈ Z. Then
a = b + nk = (c + n`) + nk = c + n(` + k),
so a ≡ c (mod n). Hence, congruence modulo n is transitive.

23.B Congruence classes modulo n


Having verified that congruence modulo n is an equivalence relation, we can utilize
our knowledge of equivalence relations from the previous sections. In particular, we
can talk about equivalence classes under the relation of congruence modulo n.
For instance, congruence modulo 3 is an equivalence relation. The set of integers
that are congruent to 0 modulo 3 is
{. . . , −6, −3, 0, 3, 6, 9, . . .}.
This is the equivalence class of 0, under the relation “congruence modulo 3,” which
is also the equivalence class of 3, 6, −3, and so forth. We will see in a moment that
there are only two other equivalence classes, which are
{. . . , −5, −2, 1, 4, 7, . . .}
and
{. . . , −4, −1, 2, 5, 8, . . .}.
We will now set up the notation to prove this in much greater generality.
23. INTEGERS MODULO n 169

Definition 23.3. An equivalence class in Z under the relation congruence mod-


ulo n is called a congruence class modulo n. The congruence class of a ∈ Z will
be denoted by a.

Given a, b ∈ Z, we see by Theorem 22.1 that a = b if and only if a ≡ b (mod n).


We know by Theorem 22.6 that the equivalence classes for an equivalence relation
on Z form a partition of Z. We will now proceed to determine the congruence classes
for “congruence modulo n” and determine the number of distinct classes. To do this
we will make use of the division algorithm. In the following theorem we restrict to
the case n > 0, since allowing n to be 0 would make the theorem false (why?) and
allowing n to be negative would require absolute values in the statement.

Theorem 23.4. Let n ∈ N. There are n congruence classes modulo n, namely


the classes
0, 1, 2, . . . , n − 1.
For any a ∈ Z, we have
a = {a + kn : k ∈ Z}.

Proof. We first prove that the only congruence classes are the ones listed in the
theorem. Let a ∈ Z. By the division algorithm a = qn + r for some q, r ∈ Z and
0 ≤ r < n. Thus a = r + nq, so a ≡ r (mod n). Hence, a = r is one of the n
congruence classes listed in the theorem.
It remains to show that no two congruence classes listed in the theorem are equal.
This follows from the uniqueness of the remainder in the division algorithm, which
was proved in Lemma 17.14.
Finally, we note that for any a ∈ Z,

a = {x ∈ Z : x ≡ a (mod n)}
= {x ∈ Z : x = a + kn for some k ∈ Z}
= {a + kn : k ∈ Z}

as claimed.
The set of congruence classes modulo n is so important that we write it using a
special notation.

Definition 23.5. Let n ∈ N. We define Zn to be the set

{0, 1, 2, . . . , n − 1}

of congruence classes modulo n.

We note the following facts about Zn :


170 CHAPTER VI. RELATIONS

(a) |Zn | = n.
(b) Every element of Z is a member of exactly one element of Zn .
(c) Every element of Zn is an infinite subset of Z.

Example 23.6. The set Z4 has four elements. They are written 0, 1, 2, 3. Each
of these elements, even though it looks like a number, is really an infinite set. For
instance,
1 = {. . . , −7, −3, 1, 5, 9, . . .}. 4

Remark 23.7. We have said that the n elements 0, . . . , n − 1 are the only elements
in Zn . There are many other integers, in fact infinitely many, that are not elements
of the set {0, 1, . . . , n − 1}. What happens to their congruence classes?
The proof of Theorem 23.4 shows that for every integer a ∈ Z, the congruence
class a is the same as one of the classes r with 0 ≤ r < n. We can think of a and r
as different names for the same congruence class. For instance, in Z6 the congruence
class 1 has many different representatives:

· · · = −11 = −5 = 1 = 7 = 13 = 19 = · · · . N

23.C Operations on Zn
Even though the elements of Zn are sets (not numbers), we still want to treat these
elements as if they were numbers. In fact, you have probably already done this
without realizing it. For instance, when you add clock times together you are doing
arithmetic in Z12 . When you use the fact that “odd plus even equals odd” you are
doing arithmetic in Z2 .
The following theorem will help us make a sensible definition of addition and
multiplication on the set Zn .

Theorem 23.8. For any a, b, c, d, n ∈ Z, if a ≡ b (mod n) and c ≡ d (mod n),


then
(1) a + c ≡ b + d (mod n) and
(2) ac ≡ bd (mod n).

Proof. Suppose that a ≡ b (mod n) and that c ≡ d (mod n). Then a = b + nk and
c = d + n` for some k, ` ∈ Z.
We find that

a + c = (b + nk) + (c + n`) = b + c + n(k + `),

so a + c ≡ b + d (mod n). Hence, (1) is true.


We next find that

ac = (b + nk)(d + n`) = bd + bn` + nkd + n2 k` = bd + n(b` + kd + nk`).

Thus, ac ≡ bd (mod n). Hence, (2) is true.


23. INTEGERS MODULO n 171

The next example demonstrates how using this theorem can help simplify com-
putations modulo n.
Example 23.9. We have that 28 ≡ 2 (mod 26) and 29 ≡ 3 (mod 26). Hence,
according to the theorem, 28 · 29 ≡ 2 · 3 (mod 26). Indeed, computation shows that

28 · 29 = 812 = 6 + 806 = 2 · 3 + 26 · 31.

Multiplying 2 and 3 is much easier than multiplying 28 and 29. Thus, finding 28 · 29
modulo 26 is very easy. You just multiply 2 · 3 to get 6. 4
The upshot of this theorem is that when adding and multiplying, if we are only
interested in what the result is modulo n, then we only need to worry about what the
inputs are modulo n. Motivated by this, we make a definition of what it means to
add and multiply congruence classes mod n. (The following definition may be strange
at first. If so, work through the examples that follow.)

Definition 23.10. Let n ∈ N. Given X, Y ∈ Zn , then X = a and Y = b for


some a, b ∈ Z. We define
X + Y = a + b,
and
X · Y = a · b,
where the + and · on the right denote addition and multiplication of integers.

Warning 23.11. It is important to notice that on the left-hand side of the


equations in Definition 23.10, the + and · symbols are not the usual addition
and multiplication of integers. They are telling us how to add and multiply
elements of Zn , which are sets rather than just numbers. The definition shows
that these operations are closely related to addition and multiplication on the
integers, but they are not the same!

We will illustrate this definition by working modulo 7 and modulo 11. In these
examples, when we work in Zn we will always write our results as r with 0 ≤ r < n,
even though we may use numbers larger than n during the computations.
Example 23.12. We perform the following computations in Z7 :

5 + 6 = 5 + 6 = 11 = 4,
1 + 6 = 1 + 6 = 7 = 0,
5 · 6 = 5 · 6 = 30 = 2, and
3 · 5 = 3 · 5 = 15 = 1.

If we want to add two equivalence classes, we choose representatives, add the repre-
sentatives, and then simplify (in this case modulo 7). 4
172 CHAPTER VI. RELATIONS

Example 23.13. We perform the following calculations in Z11 :

5 + 6 = 5 + 6 = 11 = 0,
1 + 6 = 1 + 6 = 7,
5 · 6 = 5 · 6 = 30 = 8, and
3 · 5 = 3 · 5 = 15 = 4.

If we want to add two equivalence classes, we choose representatives, add the repre-
sentatives, and then simplify (in this case modulo 11). 4

Warning 23.14. It is not obvious that the definition of addition (or of multi-
plication) in Zn makes sense. Given any X, Y ∈ Zn , we have defined X + Y by
choosing integers a and b with X = a and Y = b, and then taking X +Y = a + b.
However, other choices of integer representatives for these classes would be pos-
sible. Does the value of X + Y depend on our choices?
Fortunately, no. Suppose that we had picked other integers c and d with
X = c and Y = d. Then a ≡ c (mod n) and b ≡ d (mod n). Hence, by
Theorem 23.8 we know that a + b ≡ c + d (mod n), so a + b = c + d. Hence,
our choices make no difference in the value of X + Y .
When we have a definition that appears to depend on choices, but for which
those choices can be shown to make no difference after all, we say that the
operation being defined is well-defined. We have thus shown that addition on
Zn is well-defined.

Example 23.15. We write the complete addition and multiplication tables for Z6 .
+ 0 1 2 3 4 5 · 0 1 2 3 4 5
0 0 1 2 3 4 5 0 0 0 0 0 0 0
1 1 2 3 4 5 0 1 0 1 2 3 4 5
2 2 3 4 5 0 1 2 0 2 4 0 2 4
3 3 4 5 0 1 2 3 0 3 0 3 0 3
4 4 5 0 1 2 3 4 0 4 2 0 4 2
5 5 0 1 2 3 4 5 0 5 4 3 2 1

In these tables we wrote every entry using 0, 1, . . . , 5. We can do this because the set
{0, 1, . . . , 5} is a transversal for the equivalence classes. We could have used any other
transversal such as {1, 2, 3, 4, 5, 6}, {−2, −1, 0, 1, 2, 3}, or even {−10, −5, 0, 5, 10, 15}
(but it is best to keep things simple).
We notice some interesting facts about multiplication and addition in Zn that are
different from addition and multiplication in Z.
If a is an integer and a + a = 0, then a must equal 0. However, in Z6 we have
3 + 3 = 0 even though 3 6= 0.
If a, b ∈ Z with a · b = 0, then either a = 0 or b = 0 (or both). However, in Z6 we
have 2 · 3 = 0 even though neither 2 nor 3 is equal to 0. 4
23. INTEGERS MODULO n 173

This example shows that we cannot take facts about addition or multiplication
in Zn for granted. We must prove those facts about addition and multiplication that
we wish to use in Zn , rather than just assuming they hold. In the exercises you will
prove some basic facts about operations in Zn that do match our intuition from Z.
We demonstrate with an example.

Example 23.16. Let n ∈ N. We will prove that for each X ∈ Zn , we have X +0 = X.


Let X ∈ Zn . Then for some a ∈ Z, we have X = a. (Note that we could take
0 ≤ a < n, but we do not need this extra information.) We find

X + 0 = a + 0 = a + 0 = a = X. 4

23.D Exercises
Exercise 23.1. Let n ∈ N and let a ∈ Z. Write the class of a in Zn as a. Prove that
0 ∈ a if and only if n | a.

Exercise 23.2. Compute the following. Write the results as r, with r ∈ Z nonnega-
tive and as small as possible.
(a) 6 + 7 in Z9 .
(b) 6 · 7 in Z9 .
(c) 59 · 119 in Z30 .
(d) 6 · 5 + 85 in Z7 .
10
(e) 2 in Z5 . (By ak we mean a
| · a{z· · · a}, for each k ∈ N.)
k times
Exercise 23.3. Create addition and multiplication tables for Z5 . Be sure to write
each entry of the tables as one of 0, 1, 2, 3, or 4.

Exercise 23.4. Let n ∈ N. Prove the following facts about addition and multiplica-
tion in Zn .
(a) For any X, Y ∈ Zn , X + Y = Y + X.
(b) For any X, Y ∈ Zn , X · Y = Y · X.
(c) For any X ∈ Zn , X · 0 = 0.
(d) For any X ∈ Zn , X · 1 = X.
(e) For any X ∈ Zn , X · 2 = X + X.
(f) For any X ∈ Zn , there is some Y ∈ Zn such that X + Y = 0.
(g) For any X, Y, Z ∈ Zn , (X + Y ) · Z = (X · Z) + (Y · Z).

Exercise 23.5. Demonstrate that for each X 6= 0 in Z5 , there is some Y ∈ Z5 such


that X ·Y = 1. (Hint: Use the multiplication table that you created in Exercise 23.3.)

Exercise 23.6. Is it true that for each X 6= 0 in Z6 , there is some Y ∈ Z6 such that
X · Y = 1?

Exercise 23.7. In this exercise we generalize what was done in the previous two
exercises.
174 CHAPTER VI. RELATIONS

(a) If n ∈ N is composite, prove that there are elements a, b ∈ Zn with a · b = 0


even though a, b 6= 0.
(b) If n ∈ N is prime, prove that given a, b ∈ Zn , if a · b = 0, then a = 0 or b = 0.
(Hint: Use Euclid’s Lemma, Theorem 19.5.)
(c) If n ∈ N is prime, prove that for any nonzero a ∈ Zn , there exists b ∈ Zn with
a · b = 1. (Hint: First prove that if a 6= 0 then GCD(a, n) = 1. Then write 1 as
a linear combination of a and n.)
Chapter VII

Functions

Greatness is not a function of circumstance. Greatness, it turns out, is largely a


matter of conscious choice, and discipline. James C. Collins

Functions play an important role in mathematical applications to physics, engi-


neering, biology, economics, and so forth. If you have taken algebra and calculus, then
you evaluated functions, graphed functions, and determined derivatives and integrals
of functions. However, the precise definition of what a function is may have been
somewhat vague.
In this chapter we will make precise exactly what modern mathematicians mean
by a function. The definition will allow us to study functions that are defined on
complicated sets, including sets that are much more general than the set of real
numbers. We will see examples of functions defined on congruence classes, power
sets, and other sets.
We will also discuss various properties of functions. The properties that we study
have been chosen for their usefulness; they show up throughout higher mathematics.
As you progress in mathematics, you will find that an important tool in studying
any class of mathematical objects is the study of functions between the objects. The
definitions and techniques that we learn in this chapter will prepare you for this study.

175
176 CHAPTER VII. FUNCTIONS

24 Relations and functions


Recall that a relation R is defined to be a set of ordered pairs. For an appropriate
choice of sets A and B, we can view R as a relation from A to B (i.e., as a subset
R ⊆ A × B). For example, consider the relation R = {(1, 2), (3, 5)}. This is a relation
from C to Z, since it consists of ordered pairs in C × Z. Similarly, it is a relation from
N to N. In fact, as long as {1, 3} ⊆ A and {2, 5} ⊆ B, the relation R will be a relation
from A to B. The set of first coordinates of a relation (in this case, {1, 3}) and the
set of second coordinates of a relation (in this case, {2, 5}) both play an important
role in mathematics, and have special names, as given in the following definition.

Definition 24.1. Let R be a relation (i.e., a set of ordered pairs). The set of
first coordinates of R is called the domain of R, and it is denoted by dom(R).
In other words,
dom(R) = {a : (a, b) ∈ R for some b}.
The set of second coordinates of R is called the image of R, and it is denoted
by im(R). In other words,

im(R) = {b : (a, b) ∈ R for some a}.

Given any relation R, then it is a relation from dom(R) to im(R), or more generally
from any set A that contains dom(R) to any set B that contains im(R).
For example, the set {1, (4, −3)} is not a relation, because the element 1 is not
an ordered pair. However, the set R = {(1, 1), (2, 1), (6, −10)} is a relation, because
all of its elements are ordered pairs. Its domain is dom(R) = {1, 2, 6} and its image
is im(R) = {1, −10}. (The image of a relation is also often called the range.)
When a relation contains only finitely many ordered pairs, as in the previous
example, it is possible to draw a visual representation of the relation, as below.

1
1
2
−10
6

dom(R) im(R)

The arrows 7→ give us a visual cue to help us connect the first coordinates to the
second coordinates in the relation.

24.A Finding domains and images


Every relation has a domain and an image. In the following examples we compute
domains and images for some relations that we have seen before, and for some new
ones as well.
24. RELATIONS AND FUNCTIONS 177

Example 24.2. Fix R to be the divisibility relation on N. In other words, for any
a, b ∈ N, then (a, b) ∈ R exactly when a | b. The elements of R include

(1, 1), (1, 2), (2, 2), (1, 3), (3, 3), (1, 4), (2, 4), (4, 4), . . . .

It appears that every natural number occurs as a first coordinate, so we might guess
that N = dom(R). We will prove that this guess is correct by showing that these two
sets are subsets of each other.
(⊆): Let x ∈ N. Then x = x · 1 so x | x, and we see that (x, x) ∈ R. Hence, x
occurs as a first coordinate of some pair in R, so x ∈ dom(R).
(⊇): Let x ∈ dom(R). Thus, x appears as the first coordinate of some ordered
pair (x, y) ∈ R for some y. From the definition of R, we know that x, y ∈ N with
x | y. Since x ∈ N we are done.
A similar argument shows that the image of R is N. Note that even though

dom(R) = im(R) = N,

this does not mean that R = N×N, only that R ⊆ N×N. For example, (2, 3) ∈
/ R. 4

Example 24.3. Consider the relation < on R. For each r ∈ R, we have r < r + 1.
Thus, each real number occurs as a first coordinate of some ordered pair in <, and
hence R ⊆ dom(<). Since this relation is defined only on R, the reverse inclusion
dom(<) ⊆ R also holds. Therefore, we have the equality dom(<) = R.
A similar argument shows that im(<) = R. 4

Example 24.4. Fix A to be the set of humans, and fix B to be the set of letters
in the English alphabet. Define a relation R from A to B, by saying that a person
p ∈ A is related to a letter α ∈ B exactly when α is one of the letters in p’s name
(if p has at least one English name). For example, any person with the name “Bob
Eng” is related to each of the letters “b,e,g,n,o” (and possibly other letters, if that
person has another English name like “Robert Eng”).
The domain of R is exactly the subset of A consisting of people who have at least
one English name. (Thus, the domain of R is a proper subset of A, since not every
person has an English name.) The image of R is the entire alphabet set B, since each
letter does appear in at least one name. (In fact, there is an unsubstantiated story
about an individual whose full name contains all the letters!) 4

Example 24.5. Define the squaring relation on R by using set-builder notation and
setting
S = {(x, y) ∈ R2 : y = x2 }.

Some elements of S include (0, 0), (2, 4), (−π, π 2 ), and ( 2, 2). Since S is a relation
on R, we can graph its elements in the plane as follows.
178 CHAPTER VII. FUNCTIONS

y
3

1
x
−2 −1 1 2
−1

Visually considering this graph, we might guess that dom(S) = R and im(S) = R≥0 .
Exercise 24.2 asks you to prove that these guesses are correct. 4

24.B Rules and well-definedness


In this subsection we describe a convenient—but potentially hazardous—notation. It
is a notation that you may have seen before, but the possible pitfalls were probably
glossed over. To motivate the idea, we start with two familiar examples.
Example 24.6. The reciprocal relation on R≥0 is the set

R = {(x, y) ∈ R2≥0 : y = 1/x}.

Two of the ordered pairs in R are (2, 1/2) and (1/3, 3); there are infinitely many other
elements in R. Since R is a relation on R≥0 , we can graph its elements in the plane
as follows.
y

1
(2, 1/2)
x
1 2 3

For any x, y ∈ R≥0 , the pair (x, y) belongs to R exactly when the equality y = 1/x
holds.
The careful reader will note that the equation y = 1/x is technically meaningless
when x = 0, since it is impossible to divide by 0. We give it meaning by saying that if
the expression is undefined, then the pair (x, y) is not in R; thus no pair in R can have
0 as a first coordinate. Putting it another way, the equation forces dom(R) ⊆ R>0 .
(With a little more work, this inclusion can be improved to an equality.) 4
24. RELATIONS AND FUNCTIONS 179

Example 24.7. The square root relation on R is the set

T = {(x, y) ∈ R2 : y is a square root of x} = {(x, y) ∈ R2 : y 2 = x}.


√ √
Some of the ordered pairs in T are (0, 0), (2, 2), and (2, − 2). Since T is a relation
on R, we can graph its elements in the plane as follows.
y
2

1 (2, 2)

x
−1 1 2 3

−1 (2, − 2)

−2


For any x, y ∈ R, we might say that (x, y) ∈ T when
√ y = ± x.
For some values of x ∈ R, the rule y = ± x is again technically meaningless.
Indeed, since we are working over R, not C, we cannot take square roots of negative
numbers. Thus, when x < 0 we will interpret the rule as telling us (x, y) ∈
/ T . (If we
had wanted to allow complex square roots, then instead of defining a relation “on R”
we should have said that we were defining a relation “from R to C.”)
There is another oddity with this rule. We have used the equality√symbol in an
unusual way; the left side y is a single number, but the right side ± x is possibly
two different numbers. A√single number cannot equal two different
√ numbers.

The notation y = ± x√is really shorthand for “y = x or √ y = − √x.” For
example, if we write y = ± 2, we do not mean √ that y is both
√ 2 and − 2 at the
√ that either y = 2 or y = − 2.
same time. Rather, we mean
Thus, the rule y = ± x allows for multiple values of y when x > 0, for a single
value of y when x = 0, and for no values of y when x < 0. 4

Keeping these examples in mind, let us think about relations in a new way. Let R
be a relation, and consider an arbitrary element r ∈ R. Then r must be an ordered
pair, so we can write r = (a, b) for some a ∈ dom(R) and some b ∈ im(R). Instead of
writing (a, b) ∈ R, it is much simpler to write aRb, or even a 7→ b. It is very useful
to think of R as a collection of arrows, where the object a is sent by an arrow to b.
This partly explains the terminology of “range” since b is “downrange” from a, if we
follow the arrow’s path.
For example, consider the relation {(1, 3), (1, 4), (2, 4)}. We can visualize this
relation, as below.

1 3
2 4
180 CHAPTER VII. FUNCTIONS

There are three arrows; they are 1 7→ 3, 1 7→ 4, and 2 7→ 4.


Alternatively, we might say that the numbers on the left are inputs, and the
numbers on the right are outputs. This terminology is especially
√ useful when there
is some simple rule that describes the relation, like y = ± x.

Warning 24.8. Remember that a rule may be undefined at some possible in-
puts, or it may give multiple outputs on a given input.

There are usually visual or verbal cues to help readers know when a rule can have
multiple outputs on a given input. For example, ± is such a visual cue. The next
example also has such a visual cue.

Example 24.9. Define a relation from Z6 to Z by the rule that (x, x) ∈ R for each
x ∈ Z. Thus,
. . . (−1, −1), (0, 0), (1, 1), (2, 2), . . .
are the elements of R. It may look like each input has exactly one output, but looks
can be deceiving. The cue is the bar notation. Remember that equivalence classes
modulo 6 have multiple representatives.
For example, we find 0 = 6. Thus, the given rule tells us that (0, 0) ∈ R and also
that (0, 6) = (6, 6) ∈ R. The single input 0 has the multiple outputs 0 and 6 (among
others). 4

When defining rules with multiple outputs, be sure to provide the necessary visual
or verbal cues, as demonstrated in the following example.

Example 24.10. A student wishes to define a relation R on Q via a simple rule, and
writes: A pair (x, y) ∈ Q2 will belong to R when

y is the sum of the numerator and the denominator of x.

For example (3/4, 7) ∈ R.


Unfortunately, the phrase “the numerator and the denominator” in this rule is
deceptive. A rational number x may have more than one numerator and denominator.
For example, 3/4 = 6/8. Thus, (3/4, 14) = (6/8, 14) ∈ R. In other words, the input
3/4 has more than one output under this rule. The rule should have made this
more obvious, perhaps by appending the phrase “for some representation of x as a
fraction.”
Of course, it is possible to modify the rule in order to guarantee that outputs are
unique. For instance, one could merely append “when written in lowest terms” to
the rule. 4

Surprisingly, outputs are sometimes unique despite the existence of visual cues
suggesting otherwise. For example, define a relation R on Z5 by the rule (a, a2 ) ∈ R
for each a ∈ Z. Notice that this rule uses representatives of equivalence classes (which
provides the visual cue).
24. RELATIONS AND FUNCTIONS 181

As an initial test whether outputs are unique, consider the class 1. Some of the
representatives of this class are 1, 6, and 11. If we square these representatives and
look at the resulting classes, we find that

12 = 1, 62 = 36 = 1, and 112 = 121 = 1.

So, the outputs are all the same.


Perhaps that was a fluke with the class 1, so let’s try again with the class 2. Some
representatives are −3, 2, and 7. In this case we find

(−3)2 = 9 = 4, 22 = 4, and 72 = 49 = 4.

Thus, once again the outputs are all the same. Therefore, we guess that this rule only
gives one output on any given input. But how do we prove that our guess is correct?
The process is somewhat complicated, so we will outline the general idea, while
showing how to apply it to this specific example. Later, we will give more examples.

Step 1: Pick a new variable symbol that has not appeared previously in the problem.
This helps us avoid common errors; the symbol definitely should not appear in the
rule defining the relation.
In our current example, we see that the letter a was used in the rule defining R
so it is off the table, but the letter x is fair game.

Step 2: Assert that this new variable is given an arbitrary value from the domain of
the relation.
So, in our case, we will write: “Let x ∈ Z5 .” It is important to remember that
the entire reason that we are checking that outputs of the rule are unique is because
the input x can be represented in different ways. This leads us to the next step.

Step 3: Consider two arbitrary representatives, and assume they both represent the
given input.
In our case, those representatives are integers representing the class x. So we will
write: “Let a1 , a2 ∈ Z, and assume that x = a1 = a2 .”

Step 4: Finally, check that the outputs are the same when we plug those two repre-
sentatives into the rule.
In our case, this means that we need to check that a21 = a22 . Here is the full proof.

Proof. Let x ∈ Z5 . Let a1 , a2 ∈ Z, and assume that x = a1 = a2 . Our goal is to show


that a21 = a22 .
From our assumption, we know that a1 ≡ a2 (mod 5), so a1 = a2 + 5k for some
k ∈ Z. Squaring both sides, we find

a21 = (a2 + 5k)2 = a22 + 10a2 k + 25k 2 = a22 + 5(2a2 k + 5k 2 ).

Thus, a21 ≡ a22 (mod 5), and hence a21 = a22 , as desired.
182 CHAPTER VII. FUNCTIONS

The computation in the proof above could also be accomplished by appealing to


Theorem 23.8. That theorem is very useful in showing that some (but not all) rules
using equivalence classes will give a unique output.
There is a special terminology for rules that have unique outputs.

Definition 24.11. A rule defining a relation is said to be well-defined when for


any given input, the rule can produce at most one output. On the other hand,
if multiple outputs can be produced, it is a multi-valued rule.

We will say that a relation is well-defined when the rule defining it is well-defined.
In the next two examples, we will investigate whether or not the two given relations
are well-defined.
Example 24.12. In this example we will be working both modulo 6 and modulo 3,
so we need different notations for the different equivalence classes. As usual, we will
denote congruence classes modulo 6 by a, where a ∈ Z. For this example we will
denote congruence classes modulo 3 by [a], where a ∈ Z.
Define a relation R from Z6 to Z3 by the rule that (a, [a]) ∈ R for each a ∈ Z.
After some experimentation (trying different representatives for the same input), we
guess that this rule is well-defined. Here is the proof.
Let x ∈ Z6 . Let a, b ∈ Z, and assume that x = a = b. Hence, a ≡ b (mod 6), or
in other words a = b + 6k for some k ∈ Z. We find a = b + 3(2k), which implies that
a ≡ b (mod 3), so [a] = [b]. Therefore, the rule defining R is well-defined. 4
Example 24.13. Using the same notation as in the previous example, define a re-
lation S from Z3 to Z6 by the rule that ([a], a) ∈ S for each a ∈ Z. Despite the
fact that S looks very similar to R, after some experimentation we discover that it is
not well-defined. Specifically, the single input x = [1] = [4] leads to distinct outputs
1 6= 4. This rule is multi-valued. 4
For most rules you encounter, like y = x2 , there is no question that a given input x
leads to a unique output x2 , so no proof of well-definedness is needed. Visual cues can
help you decide whether well-definedness is obvious or not. Those cues can include:
• equivalence classes,
• rules that do not work directly with the input, and √
• rules that explicitly give multiple outputs (like ± x).
Example 24.14. Here is another example of a rule that is not well-defined. Look
for how elements in the domain can be represented in multiple ways.
Suppose a professor wishes to assign grades to a class in a nontraditional way. The
professor takes X to be the set of students in the class, and takes Y = {A, B, C, D, F }.
The professor decides to assign grades (thus defining a relation from X to Y ) by the
rule that the grade is given by

the first letter of the


student’s name if the result is in {A, B, C, D},



F otherwise.
24. RELATIONS AND FUNCTIONS 183

How would students react to this? Amelia Andrews would be overjoyed. Robert
Smith would likely say: “Call me Bob.” What grade would John Adams receive?
Since the professor has not made clear whether the grade is determined by the first
or the last name, John could make a case that he should receive either an A or an F
(he would probably argue for the former).
In this example, the proposed rule that the professor wishes to use is not well-
defined. For a given student, there can be multiple grades assigned, depending on
which name is used for the student. 4

24.C Defining functions


We are now ready to define functions, as understood in modern mathematics.

Definition 24.15. A function is a relation that is well-defined.

In other words, a function is a set R of ordered pairs, where if (a, b1 ), (a, b2 ) ∈ R,


then b1 = b2 . The rule defining R cannot be multi-valued. Each input occurs exactly
once as a first coordinate. This can be expressed in symbols as:

(24.16) ∀a ∈ dom(R), ∃!b ∈ im(R), (a, b) ∈ R.

Any rule that always takes a single input to a single output will be a function. An
arrow diagram for a function cannot have multiple values on some input, so it cannot
have any part that looks like the following diagram.

y1
x
y2

Not a function.
For a function, each input can go to only one output. However, different inputs
may go to the same output. In other words, the order of the quantifiers in (24.16)
is extremely important; the uniqueness of b ∈ im(R) is only with respect to some
given element a ∈ dom(R) that we previously focused on. The following example
demonstrates how outputs of functions may repeat.

Example 24.17. Consider the squaring relation of Example 24.5, defined by

S = {(x, y) ∈ R2 : y = x2 }.

Each input x clearly goes to the single output y = x2 , so this is a function.


The two different inputs 2 and −2, go to the same output 4. Nevertheless, squaring
is a function because it is not multi-valued (i.e., it is well-defined). 4

One of the most important (and simplest) functions is defined as follows.


184 CHAPTER VII. FUNCTIONS

Definition 24.18. Let A be a set. The identity function on A is the function

{(x, x) : x ∈ A}.

It is denoted by idA .

An identity function always takes an input back to itself. For example, fixing
A = {1, 2, 3}, then, as a collection of ordered pairs,

idA = {(1, 1), (2, 2), (3, 3)}.

Fixing B = {r, s, t, u, v}, then, as a collection of ordered pairs,

idB = {(r, r), (s, s), (t, t), (u, u), (v, v)}.

Any identity function is really just the equality relation on the given set.

24.D Exercises
Exercise 24.1. Visually represent the relation R = {(1, 6), (1, 7), (3, 1), (4, 6)} using
arrows between elements in two bubbles. Clearly label the domain and image bubbles.
Explain whether or not R is a function.
Exercise 24.2. Fix S to be the squaring relation on R, as defined in Exercise 24.5.
Prove that dom(S) = R and that im(S) = R≥0 .
Exercise 24.3. The relation on R given by the rule y = 1/x is not defined at x = 0.
So, the domain of this relation is R − {0}. Its image also happens to be R − {0}. The
rule is obviously well-defined.
For each of the following rules defining a relation on R, similarly state the domain,
state the image, and state whether or not the rule is well-defined (all without proof).
(a) y = sin(x).
(b) y = tan(x).
(c) y = ln(x).

(d) y = ±√ 1 − x.
(e) y = 3 x/(2 + x).
(Using any freely available graphing calculator may help you make an educated guess.)
Exercise 24.4. Define a relation R on Z5 by the rule (a, a5 ) ∈ R for each a ∈ Z.
You may take for granted that this rule is well-defined (which it is). Are R and idZ5
equal? (Hint: Both R and idZ5 are collections of exactly five ordered pairs.)
Exercise 24.5. For each a ∈ Z, denote the congruence class of a modulo 8 by a, and
denote the congruence class of a modulo 4 by [a]. Determine, with proof or disproof,
which of the following relations is well-defined.
(a) The relation R from Z8 to Z4 defined by the rule x 7→ [x].
(b) The relation S from Z4 to Z8 defined by the rule [x] 7→ x.
24. RELATIONS AND FUNCTIONS 185

(c) The relation T from Z4 to Z8 defined by the rule [x] 7→ 2x.


(d) The relation U from Z4 to Z8 defined by the rule [x] 7→ 3x.
(Hint: On scratch paper, first test whether different representatives for a fixed input
can yield different outputs.)

Exercise 24.6. The “unit circle relation on R” will be denoted by C, and it is defined
by the rule that (x, y) ∈ R2 belongs to C exactly when x2 + y 2 = 1.
Find the domain and the range of C, and give proofs that those claims are correct.
Also state whether or not the rule is well-defined, and give a proof or disproof for
that claim. (Hint: Solve for y. You might find Exercise 8.9 helpful.)

Exercise 24.7. Give an example of a finite relation R where |dom(R)| < |R| and
|im(R)| < |R|.

Exercise 24.8. Let R be any finite relation.


(a) Prove that |dom(R)| ≤ |R|.
(b) Prove that |im(R)| ≤ |R|.
(c) Prove that if R is a function, then |dom(R)| = |R|.
(Hint: List the distinct ordered pairs in R.)
186 CHAPTER VII. FUNCTIONS

25 Function notation
In this section, we introduce useful notations and terminology for functions, includ-
ing the idea of codomains, inverses, images of subsets and elements, and piecewise
functions.

25.A Codomains
Let f be a function. Recall that the domain of f is the set of all first coordinates
that appear in the ordered pairs in f , while the image of f is the set of all second
coordinates. For example, fixing

f = {(1, 2), (2, 2), (3, 4), (4, 1)},

then the domain is dom(f ) = {1, 2, 3, 4}, and the image is im(f ) = {1, 2, 4}. We view
the elements in the domain as inputs, and the elements in the image as outputs. Note
that the set f given above really is a function, because each input goes to only one
output.
Given sets A and B, and given a function f , when is f a relation from A to B?
This happens when A contains the domain and B contains the image. In the example
above, we could take A = {1, 2, 3, 4} = dom(R) and take B = {1, 2, 3, 4, 5}. We can
visualize that situation using the arrow diagram

1
1
2
2
3
3
4
4
A 5
B
Notice that im(f ) ( B. We can think of the set B as a collection of possible outputs.
There is a special name for such sets.

Definition 25.1. Given a function f , then a codomain for f is a set containing


the image of f . We write f : A → B to mean that A and B are sets and that f
is a function with domain A and codomain B.

Advice 25.2. Codomains are adjustable. For many purposes, feel free to change
the codomain to any set containing the image.

Warning 25.3. Codomains can also be defined for general relations, not just
functions. However, the notation f : A → B is only used for functions.
25. FUNCTION NOTATION 187

Codomains are especially useful in cases when it is difficult to calculate the image
of a function. Without knowing exactly which outputs occur, we may at least know
what types of objects they are, as in the next example.

Example 25.4. Consider the function f : R → R defined by the rule that (x, y) ∈ f
when y = sin(x) + cos(x). This function is defined everywhere, so dom(f ) = R. The
graph of the function is

−6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6
−1

and it looks like the outputs occur in the range [−1.414213562


√ . . . , 1.414213562 . . .].
We recognize those
√ numbers
√ as the decimal expansions of ± 2. So we might guess
that im(f ) = [− 2, 2]. This equality can be proved using trigonometry, but it is
much easier to see that the outputs of the rule are real numbers, so they occur in the
codomain R. 4

The notation f : A → B is very compact. When given a rule defining f , if you


are also told that f : A → B, there are three things you should check (usually in your
head, not on paper).
(1) You should convince yourself that the rule defining f makes sense on all of A,
so that A is really the domain. If the rule doesn’t make sense on some elements
of A, then A needs to be replaced by the true domain.
(2) You should convince yourself that the outputs of the rule will always land in B.
If this is not clear or is incorrect, you may need to replace B with a larger set.
(3) You should convince yourself that the rule defining f is well-defined. Usually
this is obvious, but if not, then a proof should be written down.

The following two examples illustrate how your thought process might go, when
given a rule supposedly defining a function.

Example 25.5. Suppose that a fellow mathematician


1
2 says that a function f : R → R
is defined by the rule that (x, y) ∈ f when y = x−2 − 5.
First, the rule does not make sense when x = 2, but it does make sense everywhere
else in the proposed domain. So, you could inform your colleague that the domain
should really be R − {2}.
Second, the rule gives outputs that will always be real numbers (when we plug in
real numbers), so R is a perfectly acceptable codomain. Thus, you are free to accept
that fact without further comment.
Finally, the rule describes a unique output y determined solely from the input x.
Thus, you are free to accept the fact that f is a function without further comment. 4
188 CHAPTER VII. FUNCTIONS

Example 25.6. Suppose you are told: Fix g : Z → Z to be the function defined by
the rule that (x, y) ∈ g when y = x2 .
The rule makes sense on any integer input, so Z is a valid domain. The outputs will
then also be integers, and so Z is a valid codomain. The rule is obviously well-defined.
So, you may accept the given claim without further comment.
Note that Z≥0 would also have been a valid codomain, since the rule obviously
yields only nonnegative outputs; but N would not be a valid codomain. The image is
exactly {0, 1, 4, 9, . . .}, and this would be the smallest valid codomain. 4

25.B Inverse notation


We now describe how to “invert” a relation, and in future sections we will study when
the inverse is a function.

Definition 25.7. Let R be a relation. The inverse relation is the set

R−1 = {(b, a) : (a, b) ∈ R}

where we reverse each ordered pair in R.

Example 25.8. Suppose that


R = {(1, 2), (2, 2), (3, 4), (4, 1)}.
Then
R−1 = {(2, 1), (2, 2), (4, 3), (1, 4)}.
The relation R is a function from A to B. (Why?)
The relation R−1 is not a function from B to A. (Why?) 4

25.C Images and preimages


Fix A = {1, 2, 3, 4} and fix B = {1, 2, 3, 4, 5}. Define a function f : A → B by the
following arrow diagram (which appeared in the previous subsection).

1
1
2
2
3
3
4
4
5
A
B

To express the fact that (1, 2) ∈ f , we can use the relation notation 1 f 2 or the arrow
notation 1 7→ 2. However, there is also a function notation f (1) = 2. Similarly, we see
that f (2) = 2, f (3) = 4, and f (4) = 1. This function notation is defined as follows.
25. FUNCTION NOTATION 189

Definition 25.9. Let f be a function. We write

f (a) = b

to mean that (a, b) ∈ f . In other words, f (a) is the second coordinate of the
unique ordered pair having a as its first coordinate.
When f (a) = b, we say that b is the image of a under the function f .

Here is another example of this notation in action; as you read the first sentence,
note how much easier it is to express the rule defining the function.

Example 25.10. Define a function f : R → R by the rule that f (x) = x2 + 2x + 1.


Notice that f (1) = 4 and
√ √ 2 √ √
f ( 2) = 2 + 2 2 + 1 = 3 + 2 2.

Thus, the image of 1 under f is 4. If it is understood that f is the only function under
consideration, we could just say that the image of 1 is 4 (since there is no possibility

of confusion about
√ which function we mean). Similarly, we can say that 3 + 2 2 is
the image of 2. 4

We can extend function notation by allowing ourselves to not only plug individual
elements into a function, but also plug in sets of elements. For example, again consider
the function g : Z → Z given by the rule g(x) = x2 . Some individual images are
g(0) = 0, g(1) = 1, g(2) = 4, and g(−1) = 1. We can also plug sets of inputs into g,
like {−2, −1, 1}, and get

g({−2, −1, 1}) = {g(−2), g(−1), g(1)} = {4, 1, 1} = {1, 4}.

If we plug all the integers into g we get

g(Z) = {. . . , g(−1), g(0), g(1), g(2), . . .} = {0, 1, 4, 9, . . .} = im(g).

This motivates the following definition.

Definition 25.11. Let f : A → B be a function, and let S ⊆ A. The image of


S (under f ) is the set

(25.12) f (S) = {f (s) ∈ B : s ∈ S}.

It is usually easy to tell, from context, whether a single input or a set of inputs
is being plugged into a function (or a relation). The exercises will give you more
practice in this task.
190 CHAPTER VII. FUNCTIONS

Example 25.13. Consider the function f : R → R given by the rule f (x) = sin(x).
Notice that f (π) = sin(π) = 0 is a single image. We can also plug in sets, like [0, π/2],
and we get
f ([0, π/2]) = sin([0, π/2]) = [0, 1].
If we plug in the entire domain, we get f (R) = [−1, 1] = im(f ). (Note that all of
those outputs are repeated infinitely often.) 4
Given a function f , we defined its inverse relation f −1 . We will also use the
notation f −1 in a different way, in the following definition.

Definition 25.14. Let f : A → B be a function, and let T ⊆ B. The preimage


of T (under f ) is the set

(25.15) f −1 (T ) = {a ∈ A : f (a) ∈ T }.

In other words, f −1 (T ) consists of the inputs of arrows (in f ) that land in T .

There are now two different meanings for the notation f −1 ; you will need to
distinguish between them for yourself, based on context. The following example
demonstrates how to compute preimages.
Example 25.16. Define a function g : R → R by the rule that g(x) = x2 . The inverse
relation g −1 is exactly the square root relation. (Note that g −1 is not a function, so
we should not write g −1 : R → R.) Using preimage notation, for each x ≥ 0,
√ √
g −1 ({x}) = { x, − x}.
In other words, to get an output of x under g, there are two possible inputs (except
when x = 0, when there is one input).
When x < 0, then g −1 ({x}) = ∅. There are no inputs that when plugged in to g
give a negative number.
Similarly, we find
g −1 ({1, 9, 16}) = {−4, −3, −1, 1, 3, 4}.
Also,
g −1 ({−4, 25}) = {−5, 5}
since g cannot send anything to −4, but it sends both 5 and −5 to 25. We may even
find preimages of infinite sets; for example, g −1 ([1, 4]) = [−2, −1] ∪ [1, 2]. 4

25.D Proving equality between functions


Two functions are equal when they are the same set of ordered pairs. However, most
functions are defined by rules, not by listing their ordered pairs. To check that two
different looking rules define the same function, you should verify that the domains
are the same and that when given an arbitrary element of the domain, the rules give
the same output on that element.
25. FUNCTION NOTATION 191

Example 25.17. If we define f : Z → Z by f (x) = 2x + 2, and we define g : Z → R


by g(x) = 2(x + 1), then is it the case that these functions are equal? Yes. First,
they have the same domain, Z. Second, they have the same outputs, since

f (x) = 2x + 2 = 2(x + 1) = g(x)

for each x ∈ Z. Therefore, f = g.


If we define h : R → R by h(x) = 2x + 2, then this rule looks exactly like the rule
for f . However, we can plug any real number into h, but only integers can be plugged
into f . Their domains are different, so f 6= h.
Define p : Z → Z by p(x) = x3 . This function has the same domain as f . To show
that they are not equal, we need to find a specific example where their rules differ.
(It is not enough to claim that the rules look different.) For example, p(0) = 0 but
f (0) = 2. Thus f 6= p. 4

25.E Piecewise defined functions


The following theorem has a very simple proof, but it expresses an important idea.

Theorem 25.18. If R and S are relations, then R ∪ S is a relation.

Proof. Assume that R and S are relations. In order to show that R ∪ S is a relation,
we need to show that an arbitrary element z ∈ R ∪ S is an ordered pair. From the
definition of union, z ∈ R or z ∈ S. In either case, z is an ordered pair, from the
assumption that R and S are relations.

You have secretly seen this theorem in action previously.


√ For example, the square
root relation from R≥0 to R, given by the rule y = ± x, is just the union of the pos-
itive square root function and the negative square root function. Another important
example is the absolute value function, defined on R by the rule
(
x if x ≥ 0,
|x| =
−x if x < 0.

This is a piecewise defined function. One piece is the function f1 : R≥0 → R given by
the rule f1 (x) = x, and the other piece is the function f2 : R<0 → R given by the rule
f2 (x) = −x. Their union is the absolute value function.
There is an important difference between the previous two examples. The two
parts of the absolute value function are defined on the disjoint domains R≥0 and R<0 ,
and their union is a function. The two parts of the square root relation are defined
on the same domain R>0 , and their union is not a function, just a relation.
The following theorem shows that a union of functions will be a function as long
as the domains of the parts are disjoint.
192 CHAPTER VII. FUNCTIONS

Theorem 25.19. Let f1 : A1 → B1 and f2 : A2 → B2 be functions. Further


assume that {A1 , A2 } is a partition of the set A. Taking f = f1 ∪ f2 , then f is
a function from A to B1 ∪ B2 , given by the piecewise defined rule
(
f1 (x) if x ∈ A1 ,
f (x) =
f2 (x) if x ∈ A2 .

Proof. We already know that f is a relation, by Theorem 25.18.


Next, we show that f is a function, by showing that an input can only go to one
output. Assume that (x, y1 ), (x, y2 ) ∈ f . Thus, each of these pairs either belongs to
f1 or f2 . We handle these options via cases.
Case 1: Assume that (x, y1 ) and (x, y2 ) both belong to f1 . Then, since f1 is a
function, the input x goes to a unique output. Thus y1 = y2 .
Case 2: Assume that (x, y1 ) and (x, y2 ) both belong to f2 . By similar reasoning
as in Case 1, we get y1 = y2 .
Case 3: Assume that (x, y1 ) ∈ f1 and (x, y2 ) ∈ f2 . Then x ∈ dom(f1 ) = A1 and
x ∈ dom(f2 ) = A2 , contradicting the fact that A1 ∩ A2 = ∅; this case cannot occur.
Case 4: Assume that (x, y1 ) ∈ f2 and (x, y2 ) ∈ f1 . By similar reasoning as in
Case 3, this case cannot occur.
Thus, in all noncontradictory cases we have y1 = y2 , as desired.
Finally, we show that the rule for f is correct. Assume that (x, y) ∈ f is an
arbitrary element. Then (x, y) ∈ f1 or (x, y) ∈ f2 . In the first case, x ∈ A1 and
y = f1 (x). In the second case, x ∈ A2 and y = f2 (x). These are exactly the separate
parts of the rule. (This also shows that dom(f ) = A and B1 ∪ B2 is a codomain.)

The following example involves finite sets. You might try drawing the arrows
yourself to check that the diagram in the example is correct.

Example 25.20. Fix A = P ∪ Q, where P = {1, 2, 3} and Q = {4, 5, 6}, and fix
B = {1, 2, 3}. Then {P, Q} is a partition of A. If we define g : P → B by g(x) = 4−x,
and we define h : Q → B by h(x) = x − 3, we see that

g = {(1, 3), (2, 2), (3, 1)}

is a function from P to B and

h = {(4, 1), (5, 2), (6, 3)}

is a function from Q to B. By Theorem 25.19 we may define a function f : A → B


by the rule (
4 − a if a ∈ {1, 2, 3},
f (a) =
a − 3 if a ∈ {4, 5, 6}.
Graphically, we have the following diagram, where the top three arrows indicate the
function g, and the bottom three arrows are h.
25. FUNCTION NOTATION 193

1
P 2
1
3
2
4
3
Q 5
B
6
A

As a collection of ordered pairs, we see that f is given by

f = g ∪ h = {(1, 3), (2, 2), (3, 1), (4, 1), (5, 2), (6, 3)}. 4

Example 25.21. Question: What is wrong with the following piecewise defined
function? Try to define f : R → R by the rule
(
x2 + 2 if x ≥ 0,
f (x) =
−1 if x ≤ 0.

Answer: The rule gives two different values at 0, and hence it does not define a
function. The problem is that the two domains “x ≥ 0” and “x ≤ 0” overlap, and
unfortunately the rule has more than one value on the overlap. 4

Warning 25.22. Typically, authors leave it as an unstated task for readers to


(mentally) check that the parts of a piecewise rule are defined over a partition
of the domain. You should mentally confirm, when presented with a piecewise
rule, that the parts really are defined on a partition of the domain.

In the following example, check for yourself that the conditions in the piecewise
function are defined on a partition on the domain. (There is no need to explicitly
name the parts of the partition.)

Example 25.23. We can define a function f : Z → Z by the rule


(
3x + 1 if x is odd,
f (x) =
x/2 if x is even.

Note that when x is even then x/2 ∈ Z, so this really does give a function with
codomain Z. We have, for instance, f (1) = 4, f (2) = 1, f (3) = 10, and so forth.
This function is interesting to many mathematicians. Given an arbitrary n ∈ N,
it is an unsolved problem whether or not the sequence n, f (n), f (f (n)), . . . eventually
contains the number 1. The Collatz conjecture is the guess that it will indeed always
contain 1. 4
194 CHAPTER VII. FUNCTIONS

It is straightforward to generalize Theorem 25.19 to partitions of A with more


than two parts. You are asked to do this in Exercise 25.8 for an arbitrary number of
parts. For now, we give an example with three parts.
Example 25.24. We can define a function f : R → R by

−1 if x < −1

f (x) = 0 if −1 ≤ x ≤ 1

1 if 1 < x

Note that the three conditions on x partition R. The partition is


{{x ∈ R : x < −1}, {x ∈ R : −1 ≤ x ≤ 1}, {x ∈ R : 1 < x}}.
We graph the function f below, with the portions given by the separate conditions
in different colors.
y

x
−2 −1 1 2

−1

25.F Exercises
Exercise 25.1. Which of the relations defined below are functions from the domain
A = {1, 2, 3, 4} to the codomain B = {1, 2, 3, 4, 5}?
(a) f1 = {(1, 3), (2, 3), (3, 3), (4, 3)}.
(b) f2 = {(1, 2), (2, 3), (3, 5), (4, 6)}.
(c) f3 = {(1, 2), (2, 3), (2, 4), (4, 5)}.
(d) f4 = {(1, 2), (1, 3), (2, 3), (3, 4), (4, 1)}.
(e) f5 = {(1, 2), (2, 3), (4, 5)}.
(f) f6 = {(1, 2), (1, 2), (2, 3), (3, 4), (4, 1)}. (Hint: Do repetitions matter?)
Exercise 25.2. Use the same notation as in the previous exercise. For each of the
six relations fi , write the inverse relation fi−1 by listing its elements. Further, in each
case state (without proof) first, whether or not fi−1 is a function, and second, whether
or not it is valid to write fi−1 : B → A. (Hint: The answers to these two questions
will not always be the same for a given fi .)
Exercise 25.3. Each of the sentences listed below is incorrect. In each case, explain
the error and then write a corrected sentence without changing the rule (and making
only minor changes to the domain and codomain).
25. FUNCTION NOTATION 195

(a) Define f : R → R by f (x) = 1/ sin(x).



(b) Define g : Q → Q by g(x) = x + 2.
(c) Define h : Z → Z by h(x) = 1/x.
Exercise 25.4. Fix A = {1, 2, 3, 4, 5} and B = {6, 7, 8, 9, 10}. Also fix
f = {(1, 7), (2, 6), (3, 7), (4, 6), (5, 9)},
which is a function from A to B.
(a) Fix S1 = {1, 2, 3}, S2 = {1, 5}, and S3 = {3}. For each i ∈ {1, 2, 3}, find f (Si ).
(b) Find f −1 , and state whether or not it is a function from B to A.
(c) Fix T1 = {9}, T2 = {6, 7}, and T3 = {8}. For each i ∈ {1, 2, 3}, find f −1 (Ti ).
Exercise 25.5. In each case, prove or disprove that for each function f : A → B,
and for every pair of subsets X, X 0 ⊆ A, the equality holds.
(a) f (X ∪ X 0 ) = f (X) ∪ f (X 0 ).
(b) f (X ∩ X 0 ) = f (X) ∩ f (X 0 ).
(Hint: One equality is true and the other is false. For the proof, show that the two
sides are subsets of each other, using (25.12).)
Exercise 25.6. In each case, prove that for each function f : A → B, and for every
pair of subsets Y, Y 0 ⊆ B, the equality holds.
(a) f −1 (Y ∪ Y 0 ) = f −1 (Y ) ∪ f −1 (Y 0 ).
(b) f −1 (Y ∩ Y 0 ) = f −1 (Y ) ∩ f −1 (Y 0 ).
(Hint: Use (25.15).)
Exercise 25.7. Determine, with proof or disproof, whether the given pairs of func-
tions are equal.
(a) The function f : Z → Z defined by the rule f (x) = x4 + 4 and the function
g : Z → R defined by the rule g(x) = (x2 − 2x + 2)(x2 + 2x + 2). (The given
codomains are different. Does this matter?)
(b) The function f : R → Q defined by the rule f (x) = 1 and the function g : Q → Q
defined by the rule g(x) = 1.
(c) The function f : Z5 → Z10 defined by the rule f (x) = [2x] and the function
g : Z5 → Z10 defined by the rule g(x) = [2x3 ]. (We are using square brackets
for elements of Z10 . You may take for granted that these two functions are
well-defined, which they are.)
Exercise 25.8. Let I be a set of indices, and for each i ∈ I let fi : Ai → Bi be a
function. Assume that {Ai : i ∈ I} is a partition of a set A. Fixing
[
f= fi ,
i∈I
S
prove that f is a function from A to i∈I Bi and that the rule for f (as a piecewise
defined function) is given by
f (x) = fi (x) when x ∈ Ai for some i ∈ I.
(Hint: Modify the proof of Theorem 25.19. You may need to recall Definition 2.9.)
196 CHAPTER VII. FUNCTIONS

26 Injective and surjective functions


Although a function from A to B consists of ordered pairs with the condition that
each element a ∈ A is the first coordinate of exactly one ordered pair, there is no
such constraint on elements of B. As we have seen, it is possible that an element of
B can be the second coordinate of several ordered pairs in a function; it can also be
the second coordinate of no ordered pairs.
We will now discuss two conditions on functions that together guarantee that
every element of B is the second coordinate of exactly one ordered pair. Even though
the strongest results occur when both conditions hold, each condition separately is
important enough to study on its own.

26.A Injective functions


Given some curve in the plane (such as in the two pictures below), in order for it
to be the graph of a function it must pass the vertical line test: every vertical line
hits the curve in at most one point. Thus, the curve on the left does not represent a
function, while the curve on the right passes the test.
y y

x x
The vertical line test checks that each x-input yields at most one y-output. If
we turn this around, and ask which functions pass the horizontal line test (i.e., no
output comes from two different inputs) we get the following definition:

Definition 26.1. Let f be a function. We say f is injective if distinct elements


of dom(f ) are mapped by f to distinct elements of im(f ). In symbols,

∀a1 , a2 ∈ dom(f ), a1 6= a2 ⇒ f (a1 ) 6= f (a2 ).

In order to avoid working with inequalities, one usually uses the contrapositive

(26.2) ∀a1 , a2 ∈ dom(f ), f (a1 ) = f (a2 ) ⇒ a1 = a2 .

Advice 26.3. Students should memorize (26.2), as that is the formulation of


injectivity commonly used in proofs. Injectivity will usually be verified by doing
a direct proof using (26.2), although on occasion other methods can be utilized.
26. INJECTIVE AND SURJECTIVE FUNCTIONS 197

Injective functions are also called “one-to-one” (or 1-1) functions, meaning each
element of a codomain B is the image of at most one element from the domain A.
(For an injective function, each element of im(f ) is the image of exactly one element
from the domain.) In other words, for each b ∈ B either there is a unique a ∈ A
such that f (a) = b, or there is no element in A that maps to b. This is in contrast to
functions that might take two, three, or more elements of A to a fixed element of B.
In other words, a function f : A → B is injective exactly when:

(26.4) Each b ∈ B is the second coordinate of at most one ordered pair in f .

The name “one-to-one” does not refer to the fact that the function takes each
individual element of A to one element of B (as opposed to multiple elements of B);
this is a property that all functions have (corresponding to the vertical line test).
The next example illustrates what injectivity looks like for functions on finite sets.

Example 26.5. Fix A = {1, 2, 3} and fix B = {1, 2, 3, 4}. Define f : A → B by

f = {(1, 4), (2, 3), (3, 1)}.

Clearly, distinct elements of A map to distinct elements in B. In other words, 1, 2,


and 3 each go to different places. Hence, f is injective by checking (26.4) in every
case.
Thinking of f pictorially, we get:

1
1
2
2
3
3
4
A
B
In terms of the diagram, we can think of injectivity as meaning that there is never
more than one arrow pointing at an element of B. 4

Example 26.6. Fix A = {1, 2, 3} and fix B = {1, 2, 3, 4}. Define f : A → B by

f = {(1, 4), (2, 3), (3, 3)}.

Thinking of f pictorially, we get:

1
1
2
2
3
3
4
A
B
198 CHAPTER VII. FUNCTIONS

We see from the diagram that f (2) = f (3) even though 2 6= 3. Thus, this function is
not injective. 4
In most of the following examples we take Advice 26.3 to heart and prove injec-
tivity by showing that (26.2) holds.
Example 26.7. Define f : R → R by the rule f (x) = 2x + 1. Notice that f passes
the horizontal line test, so it should be injective. We will prove that claim.
Let x1 , x2 ∈ R. Assume that f (x1 ) = f (x2 ). Then 2x1 + 1 = 2x2 + 1. Subtracting
1 and dividing by 2, we obtain x1 = x2 . Hence, f is injective. 4
Example 26.8. Define f : R → R by the rule f (x) = x2 . This function fails the
horizontal line test, so it should not be injective. Indeed, f (1) = f (−1), but 1 6= −1.
Hence, f is not injective. 4
Example 26.9. Define f : [0, ∞) → R by the rule f (x) = x2 . We will show that f is
injective. (Notice that it passes the horizontal line test, since it is only the right half
of the parabola.)
Let x1 , x2 ∈ [0, ∞). Assume f (x1 ) = f (x2 ), so x21 = x22 . Taking square roots, we
have x1 = ±x2 . Since both are nonnegative, x1 = x2 , and thus we have shown that f
is injective. 4
The previous two examples show that injectivity depends as much on the domain
as on the rule used to define the function.
Example 26.10. Define f : R − {2} → R − {1} by the rule
x−1
f (x) = .
x−2
First it is important to check (perhaps on scratch paper) that f is indeed a function
with the given domain and codomain, as follows. For each a ∈ R − {2}, we see that
f (a) is a real number. If f (a) were equal to 1, we would have
a−1
= 1,
a−2
so that a − 1 = a − 2, and hence −1 = −2. This is not possible, so f (a) ∈ R − {1}.
Now, we prove injectivity. Let x1 , x2 ∈ R − {2} and suppose that f (x1 ) = f (x2 ).
We have
x1 − 1 x2 − 1
= .
x1 − 2 x2 − 2
Cross-multiplying, we find
(x1 − 1)(x2 − 2) = (x2 − 1)(x1 − 2).
Expanding both sides, we obtain
x1 x2 − 2x1 − x2 + 2 = x1 x2 − 2x2 − x1 + 2
Cancelling equal terms on both sides, and adding 2x1 + 2x2 to both sides yields
x2 = x1 .
Hence, f is injective. 4
26. INJECTIVE AND SURJECTIVE FUNCTIONS 199

Example 26.11. Define a function f : Z → Z by


(
n + 1 if n ≥ 0,
f (n) =
n if n < 0.

We will show that f is injective.


Let a, b ∈ Z and assume f (a) = f (b). We consider the following three cases.
Case 1: Assume a ≥ 0 and b ≥ 0. Then a + 1 = f (a) = f (b) = b + 1. Subtracting
1 from both sides, we get a = b.
Case 2: Assume a < 0 and b < 0. Then a = f (a) = f (b) = b.
Case 3: Assume (without loss of generality) that a < 0 and b ≥ 0. Then we have
f (a) = a < 0 and f (b) = b + 1 > 0, so f (a) 6= f (b), which contradicts our assumption.
Thus, this case never really occurs after all.
In all (noncontradictory) cases we have shown a = b. Hence, f is injective. 4

Remark 26.12. Proving that a piecewise defined function is injective will almost
always involve a proof by cases. N

26.B Surjective functions


Recall the two graphs of curves given in the previous subsection:
y y

x x

The curve on the left is not a function because it fails the vertical line test. If we
are asking for a function from R to R, then the curve on the right also fails to be a
function because it is not defined everywhere. In other words, some vertical lines do
not hit the curve; there are “holes” for all negative values of x.
Thus, any function f : A → B satisfies two basic properties:
• (Vertical line test): For each input, there is at most one output.
• (No holes in the domain): For each input, there is at least one output.
Putting these two properties together we get exactly the definition of a function (for
each element of the domain, there is exactly one output in the codomain).
In the previous subsection we studied what happens if we reverse the roles of
the domain and codomain, turning the vertical line test into the horizontal line test.
Here, we study the same reversal, but with the “no holes in the domain” rule changed
to the “no holes in the codomain.”
200 CHAPTER VII. FUNCTIONS

Definition 26.13. A function f : A → B is surjective (to B) if every element


of B occurs (at least once) as the image under f of some a ∈ A. In symbols,

(26.14) ∀b ∈ B, ∃a ∈ A, f (a) = b.

Surjective functions are sometimes called “onto”; meaning, they map onto all
elements of the given codomain. In other words, when proving that f : A → B is
surjective, you are showing that B = im(f ). In terms of ordered pairs:
(26.15) Each b ∈ B is a second coordinate of at least one ordered pair in f .

Warning 26.16. Surjectivity is only meaningful when you have fixed a specific
codomain. Without a codomain, surjectivity is meaningless.

Example 26.17. Fix A = {1, 2, 3, 4} and fix B = {1, 2, 3}. Define f : A → B by


taking
f = {(1, 2), (2, 2), (3, 3), (4, 1)}.
We note that each element 1, 2, 3 ∈ B appears at least once as the second coordinate
of an ordered pair in f (in fact, 2 appears twice). Visualizing f as a diagram, we have

1
1
2
2
3
3
4
B
A
In terms of the diagram, we can think of surjectivity as meaning that there is at least
one arrow pointing at each element of B. 4
In order to prove that f : A → B is surjective we normally verify (26.14). We
start by letting b ∈ B be an arbitrary element of B. We then need to somehow use b
to prove the existence of an element a ∈ A such that f (a) = b. We will demonstrate
how this is to be done with many examples.
Example 26.18. Define f : R → R by the rule f (x) = 2x + 1. If we graph this
function, each horizontal line crosses the graph, so there are no holes in the codomain.
Thus, we should believe that f is surjective. We will now prove it.
Let b ∈ R, and fix
b−1
a= .
2
Note that a ∈ R (the domain). We compute
   
b−1 b−1
f (a) = f =2 + 1 = (b − 1) + 1 = b.
2 2
Hence, f is surjective. 4
26. INJECTIVE AND SURJECTIVE FUNCTIONS 201

Remark 26.19. This proof may be unsatisfying because, like many existence proofs,
it clearly shows that a exists with f (a) = b, but it does so without explaining how a
might be found. This is due to the fact that the correct a was found using scratchwork,
but that work was not included in the proof. We will do that scratchwork now.
Given b ∈ R, we wish to find a such that f (a) = b. Hence, we wish to solve
2a + 1 = b.
Subtracting 1, we see that 2a = b − 1. Dividing by 2 yields
b−1
a= .
2
This gives the desired element.
Notice that the preceding paragraph derives the desired a. However, the work done
there is not the proof of surjectivity. To do the proof we need to check two things.
First, that this a we found in our scratchwork belongs to the domain. Second, that
f (a) = b. You should do the work of calculating the desired a on scratch paper and
afterwards write out the proof. N
Example 26.20. Define f : R → R by f (x) = x2 . Does this function pass the “no
holes in the codomain” test? No, we see that all negative values are missed. We will
now formally prove f is not surjective. Fixing b = −1, then for any a ∈ R we have
f (a) = a2 6= −1 = b. Hence, f is not surjective. 4
Example 26.21. Define f : R → [0, ∞) by√f (x) = x2 . Let b ∈ [0, ∞). Since b is
nonnegative it has a square root, so fix a = b. Clearly a is real, hence it belongs to
the domain. Now,
√ √ 2
f (a) = f ( b) = ( b) = b.
Since b was an arbitrary element of the codomain, f is surjective. 4
The previous two examples show that surjectivity can depend as much on the
codomain as on the rule used to define the function.
Example 26.22. Define f : R − {2} → R − {1} by the rule
x−1
f (x) = .
x−2
We wish to show that f is surjective.
4 y

1
x
−10 −8 −6 −4 −2 2 4 6 8 10
−1

−2
202 CHAPTER VII. FUNCTIONS

(Note: This function only has a “hole” in the codomain if our codomain is R. We
remove that hole by limiting the codomain to R − {1}.)
Let b ∈ R − {1}. Fix
2b − 1
a= .
b−1
We need to show that a belongs to the domain R − {2}. Clearly a ∈ R (since b 6= 1).
Assuming, by way of contradiction, that a = 2, we would have 2b − 1 = 2(b − 1).
Simplifying, we get −1 = −2, a contradiction. Hence, a ∈ R − {2}.
Now
2b − 1
−1 2b − 1 − (b − 1) b
f (a) = b − 1 = = = b.
2b − 1 2b − 1 − 2(b − 1) 1
−2
b−1
Hence, f is surjective. 4
Remark 26.23. Again, this proof of surjectivity is quite unsatisfying. It gives no
idea how a was found. Note that we wish to find a such that
a−1
f (a) = = b.
a−2
Clearing denominators by multiplying by a − 2, we have a − 1 = b(a − 2), or in other
words a − 1 = ab − 2b. Hence, we want 2b − 1 = ab − a = a(b − 1). Dividing by b − 1,
we see that we want
2b − 1
a= .
b−1
This calculation is an important step in finding the correct a, but is not a necessary
part of the written proof. N
Example 26.24. Fix S = {1, 2, 3, 4, 5}, and fix A = P(S) − {∅}. Define a function
f : A → S by
f (X) = the least element of X,
for each X ∈ A. You may check directly that f is a function from A to S (for instance
f ({3, 4, 5}) = 3 and f ({2, 4}) = 2). We will now prove that f is surjective.
Let b ∈ S. Fix a = {b}. Since {b} ∈ P(S) and {b} 6= ∅ we have that a ∈ A.
Clearly, the least element of {b} is b. Hence, f (a) = f ({b}) = b. This proves that f
is surjective. 4
Example 26.25. Define f : Z → Z by the rule
(
n if n ≥ 0,
f (n) =
n + 1 if n < 0.
We will show that f is surjective.
Let b ∈ Z. We consider the following two cases.
Case 1: If b ≥ 0, then fixing a = b we have a ∈ Z and f (a) = f (b) = b.
Case 2: If b < 0, then fixing a = b−1 < 0 we have a ∈ Z and f (a) = f (b−1) = b.
Hence, f is surjective. (Note that f (−1) = f (0) = 0, so f is not injective.) 4
Remark 26.26. As with injectivity, proving the surjectivity of a piecewise defined
function will generally involve proof by cases. N
26. INJECTIVE AND SURJECTIVE FUNCTIONS 203

26.C Bijective functions


We have defined two important properties of functions: injectivity and surjectivity.
When we combine these two properties we obtain a very special type of function.

Definition 26.27. A function f : A → B is bijective if it is both injective and


surjective (to B).

Remark 26.28. A bijective function is often called a bijection. (Similarly, injective


functions are called injections, and surjective functions are called surjections.) A
bijection is also called a “one-to-one correspondence.” Although the latter term risks
being confused with the very similar phrase “one-to-one function,” which does not
imply surjectivity, it is nevertheless frequently used. N
Example 26.29. Fix A = {1, 2, 3} and fix B = {4, 5, 6}. Define a function f : A → B
by taking
f = {(1, 5), (2, 6), (3, 4)}.
Since each element of A occurs exactly once as a first coordinate of an ordered pair
in f , we know f is a function. Since each element of B occurs exactly once as a
second coordinate, f is both injective and surjective by (26.4) and (26.15). Hence, f
is bijective. 4
Example 26.30. Define f : R → R by f (x) = 2x + 1.
We have seen (Example 26.7) that f is injective and (Example 26.18) that f is
surjective. Hence, f is a bijection. 4
Example 26.31. Define f : R − {2} → R − {1} by the rule
x−1
f (x) = .
x−2
We have seen (Example 26.10) that f is injective and (Example 26.22) that f is
surjective. Hence, f is a bijection. 4
Example 26.32. Let A be a set. The identity function idA : A → A is always
bijective. For injectivity, let a1 , a2 ∈ A and assume idA (a1 ) = idA (a2 ). By definition
of the identity function a1 = a2 . For surjectivity, let b ∈ A (the codomain). Fix
a = b ∈ A. Then idA (a) = a = b. 4
In the next chapter we will see that bijections help us show that two sets have the
same size.

26.D Exercises
Exercise 26.1. Fix A = {1, 2, 3} and fix B = {x, y}. List all functions from A to B,
and for each function state (without proof) whether it is injective, surjective, both
(bijective), or none of the above.
Now do the same for all functions from B to A.
204 CHAPTER VII. FUNCTIONS

Exercise 26.2. For each of the following, determine (with proof) whether the func-
tion is injective and/or surjective.
(a) The function f : Z → Z given by f (n) = 2n + 1.
(b) The function g : R → R given by g(x) = x2 + 2x + 2.
(c) The function h : Z → Z given by h(n) = n + 3.
Exercise 26.3. Consider the function f : Z5 → Z5 defined by f (a) = 2a + 3.
(a) Prove that f is well-defined.
(b) Is f injective? Surjective? Give proofs. (Hint: You cannot divide by 2, but
you can multiply by 3. Alternatively, write out the ordered pairs and check all
cases.)
Exercise 26.4. For each part, find a function f : R → R satisfying the given condi-
tions.
(a) It is neither injective nor surjective.
(b) It is injective but not surjective.
(c) It is surjective but not injective.
(d) It is both injective and surjective.
In all cases give proofs. (Hint: For some of these, piecewise defined functions may be
useful.)
Exercise 26.5. Consider the function f : R − {2} → R − {1} defined by
x−3
f (x) = .
x−2
(a) Prove that f is a function from R − {2} to R − {1}. (The only question is
whether f (x) ∈ R − {1} whenever x ∈ R − {2}.)
(b) Prove that f is injective.
(c) Prove that f is surjective.
Exercise 26.6. Consider the function f : Z2 → Z defined by f (m, n) = 3m − 2n. Is
f injective? Surjective? (Give proofs.)
Exercise 26.7. Let f be an injective function.
(a) Prove that the inverse relation f −1 is a function. (Hint: For f −1 to be a function,
you need to show that for any pairs (b, a1 ), (b, a2 ) ∈ f −1 , then a1 = a2 .)
(b) Prove that f −1 is injective.
Exercise 26.8. Let f : R → R be a function. Suppose that we graph f in the xy-
plane, with the domain being the horizontal axis, and the codomain being the vertical
axis. Prove the following:
(a) (The vertical line test): Since f is a function, every vertical line intersects the
graph of f at most once.
(b) (No holes in the domain): Since f is a function, every vertical line intersects
the graph of f at least once.
(c) (The horizontal line test): The function f is injective if and only if every hori-
zontal line intersects the graph of f at most once.
(d) (No holes in the codomain): The function f is surjective if and only if every
horizontal line intersects the graph of f .
27. COMPOSITION OF FUNCTIONS 205

27 Composition of functions
Fix A = {1, 2, 3, 4}, B = {5, 6, 7}, and C = {8, 9, 10, 11}, and fix functions f : A → B
and g : B → C defined by

f = {(1, 6), (2, 5), (3, 7), (4, 6)}

and
g = {(5, 8), (6, 9), (7, 10)}.
A picture of this situation appears below:

1 8
5 g
2 9
f 6
3 10
7
4 11
A B C

One can ask what might happen if we were to begin at an element of A, and first
follow the arrow for the function f (to an element of B), and then follow the arrow for
the function g (to an element of C). We would then get a drawing like the following:

1 8
2 9
3 10
4 11
A C

Each arrow in the new diagram is obtained by traversing two consecutive arrows
in the original diagram. We notice that the new diagram describes a function, since
each element of A has a single arrow emanating from it. We call this function the com-
position. In this section we will formally define compositions and study how function
properties (such as injectivity or surjectivity) behave on composites of functions.

27.A Defining function composition


Here is the formal definition of what it means to compose two functions.

Definition 27.1. Let f : A → B and g : B → C be functions. We define the


composition of g with f , written g ◦ f , to be the new function g ◦ f : A → C
given by rule (g ◦ f )(x) = g(f (x)).

Remark 27.2. We note that this definition is sensible; for each x ∈ A, we have that
f (x) ∈ B, so g(f (x)) exists and is in C. N
206 CHAPTER VII. FUNCTIONS

Example 27.3. Fix A = {1, 2, 3, 4}, B = {5, 6, 7}, and C = {8, 9, 10, 11}, and
suppose we have functions f : A → B and g : B → C defined by

f = {(1, 6), (2, 5), (3, 7), (4, 6)}

and
g = {(5, 8), (6, 9), (7, 10)}.
Since f (1) = 6 and g(6) = 9, we have (g ◦ f )(1) = g(f (1)) = g(6) = 9.
Since f (2) = 5 and g(5) = 8, we have (g ◦ f )(2) = g(f (2)) = g(5) = 8.
Similarly, (g ◦ f )(3) = 10 and (g ◦ f )(4) = 9. Hence, we have that

g ◦ f = {(1, 9), (2, 8), (3, 10), (4, 9)}. 4

Example 27.4. Define f : R → R by f (x) = x+1 and define g : R → R by g(x) = x2 .


Then g ◦ f : R → R is given by

(g ◦ f )(x) = g(f (x)) = g(x + 1) = (x + 1)2 .

In this example, since the codomain of g is the same as the domain of f , we may
also construct the function f ◦ g : R → R. This function is given by

(f ◦ g)(x) = f (g(x)) = f (x2 ) = x2 + 1.

Notice that f ◦ g is not the same function as g ◦ f . The order in which the functions
are composed does matter. Because of this, we say that function composition is not
commutative. This is in contrast to operations like addition of real numbers, where
a + b = b + a. 4
Although function composition is not commutative, it does satisfy a different
property that is very useful. This property is motivated by the question: What
happens if we compose three functions?

Theorem 27.5. Let A, B, C, and D be sets, and let f : A → B, g : B → C, and


h : C → D be three given functions. The two new functions h ◦ (g ◦ f ) : A → D
and (h ◦ g) ◦ f : A → D are equal.

Proof. The domains of h ◦ (g ◦ f ) and (h ◦ g) ◦ f are both A. Hence, to prove that


the functions are equal, we need only check that for each a ∈ A both functions give
the same image.
Let a ∈ A. Then
 
h ◦ (g ◦ f ) (a) = h (g ◦ f )(a) = h(g(f (a))),

and  
(h ◦ g) ◦ f (a) = (h ◦ g) f (a) = h(g(f (a))).
Hence, we see that the image of a under each of the two functions is the same.
Therefore, they are equal.
27. COMPOSITION OF FUNCTIONS 207

Remark 27.6. A graphical representation of this theorem is given below.

g◦f

• •
h
A B g C D
f
• •

h◦g

The statement of the theorem is that following the arrow marked g ◦ f and then the
arrow marked h, in other words h ◦ (g ◦ f ), yields the same result as following f and
then following h ◦ g, in other words (h ◦ g) ◦ f . N

Remark 27.7. The fact that (h ◦ g) ◦ f = h ◦ (g ◦ f ) is called associativity of


function composition. Associativity is a property that shows up in many places in
math. For any a, b, c ∈ R, we have two different forms of associativity, namely the
equality (a + b) + c = a + (b + c) for addition as well as the equality (ab)c = a(bc)
for multiplication. If you have seen matrix multiplication, then you know that for
three square matrices A, B, and C of the same size, then (AB)C = A(BC). Different
manifestations of associativity are often, in some way, related to the associativity of
function composition. N

The identity function behaves very well with respect to composition.

Theorem 27.8. Let A and B be sets, and let f : A → B be a function. We


have
(1) idB ◦f = f and
(2) f ◦ idA = f .

Proof. We prove (1) and leave (2) as an exercise.


Note that idB ◦f : A → B and f : A → B both have the same domain A. Let
a ∈ A. Notice that f (a) ∈ B. Then

(idB ◦f )(a) = idB (f (a)) = f (a).

Hence, we see that idB ◦f = f .

It is tempting to think of mathematical definitions as set in stone. However, as


a budding mathematician you should question every definition given to you. You
should ask whether the definition could be improved or generalized. The following
example shows how the definition of composition may be slightly generalized.
208 CHAPTER VII. FUNCTIONS

Example 27.9. Define f : R − {0} → R − {0} by the rule f (x) = 1/x, and define
g : R → R by the rule g(x) = sin(x).
We would like to define the composition g ◦ f : R − {0} → R by the rule

(g ◦ f )(x) = sin(1/x).

This rule perfect sense. However, the technical definition of composition prevents us
from doing this, because it requires that the codomain of the first function equal the
domain of the second function. In our case, the codomain of f is R − {0} and the
domain of g is R, and these are not equal.
However, this causes no real problems, because we could easily have expanded the
codomain of f to equal R. All we really need is that the image of f is contained in
the domain of g. Thus, we can in fact define g ◦ f if we allow a more general definition
of composition that only requires the inclusion im(f ) ⊆ dom(g).
What happens if we try to define the reversed composition f ◦ g? The image of g
is [−1, 1], which is not a subset of the domain of f . This leads to problems, because
the rule should be (f ◦ g)(x) = 1/ sin(x), but this rule makes no sense whenever
sin(x) = 0. This rule only defines a function whose domain is R − Zπ. 4

Warning 27.10. Hereafter, given two functions f and g, when defining the
composition g ◦ f we will only require that im(f ) ⊆ dom(g).

27.B Composition of injective and surjective functions


When we compose functions, properties of the component functions can sometimes
be deduced from the composition, and properties of the composition can sometimes
be deduced from the component functions. We investigate both of these possibilities.

Theorem 27.11. Let A, B, and C be sets, and let f : A → B and g : B → C


be functions.
(1) If g ◦ f is injective, then f is injective.
(2) If g ◦ f is surjective, then g is surjective.
(3) If f and g are injective, then g ◦ f is injective.
(4) If f and g are surjective, then g ◦ f is surjective.
(5) If f and g are bijective, then g ◦ f is bijective.

Proof. (1) Assume that g ◦ f : A → C is injective. To prove that f is injective, let


a1 , a2 ∈ A and assume f (a1 ) = f (a2 ); we will show a1 = a2 . Applying g to both sides
of the assumed equality yields g(f (a1 )) = g(f (a2 )), and so

(g ◦ f )(a1 ) = (g ◦ f )(a2 ).

Since g ◦ f is injective, we see that a1 = a2 . Hence, f is injective.


27. COMPOSITION OF FUNCTIONS 209

(2) See Exercise 27.1.


(3) See Exercise 27.1.
(4) Assume that f and g are surjective. We wish to show that g ◦ f is surjective.
Let c ∈ C. Since g : B → C is surjective, there is some b ∈ B such that g(b) = c.
Since f : A → B is surjective, there is some a ∈ A such that f (a) = b. Then
(g ◦ f )(a) = g(f (a)) = g(b) = c.
(5) This follows from parts (3) and (4).

Advice 27.12. If you are asked to prove or disprove a statement not covered
by the previous theorem, about injectivity (or surjectivity) and function compo-
sition, be very skeptical. You will likely want to disprove such a statement.

The following example is important to keep in mind. It shows that even when a
composition is bijective, the component functions do not need to be bijective.

Example 27.13. Fix A = {1}, B = {1, 2}, and C = {1}. Also define f : A → B by
the rule f (x) = 1, and define g : B → C by the rule g(x) = 1. This situation can be
pictured as follows.

1
1 f g 1
2
A B C

The composition g ◦ f : A → C is a bijection; in fact, it is the identity function idA .


But f is not surjective to B, and g is not injective. So a composition may be bijective
even though neither part is bijective. 4

27.C Inverse relations and inverse functions


Suppose that f is a function. Then f is a relation, so it has an inverse relation f −1 .
When is f −1 also a function? The answer is surprisingly simple (and emphasizes the
importance of injectivity).

Theorem 27.14. Let f be a function. Then f is injective if and only if f −1 is


a function.

Proof. (⇒): Assume that f is injective. This means that given any two pairs
(a1 , b), (a2 , b) ∈ f with the same output, then a1 = a2 . After inverting the pairs,
this means that given any two pairs (b, a1 ), (b, a2 ) ∈ f −1 with the same input, then
a1 = a2 . In other words, the rule defining f −1 is well-defined, so f −1 is a function.
(⇐): Each of the logical steps above is reversible.
210 CHAPTER VII. FUNCTIONS

Let f : A → B be an injective function. We now know that f −1 is a function. But,


can we write f −1 : B → A? For this to hold, we need to know that B = dom(f −1 ), or
(after flipping ordered pairs) that B = im(f ). This is equivalent to f being surjective.
Putting this all together, we have:

Theorem 27.15. Let f : A → B be a function. Then f −1 is a function from B


to A if and only if f is a bijection (to B).

Example 27.16. Define f : R → R by the rule f (x) = 2x+1. We’ve shown previously
that f is a bijection. As a collection of ordered pairs, we have
f = {(x, y) : x ∈ R, y = 2x + 1}.
Hence, the inverse relation is the set
f −1 = {(y, x) : x ∈ R, y = 2x + 1} = {(y, x) : y ∈ R, x = (y − 1)/2},
since if y = 2x + 1, then we may solve for x and we find x = (y − 1)/2. So we see
that f −1 is a function given by the rule f −1 (y) = (y − 1)/2. 4

Advice 27.17. Suppose a function f (x) = y is given by a simple rule. If we


can solve for x in terms of y, this gives us the rule f −1 (y) = x for the inverse
relation.
In the example above, we had f (x) = 2x + 1. We set y = 2x + 1, subtract 1
and divide by 2 to obtain
y−1
x= ,
2
showing that the inverse relation to f is f −1 (y) = (y − 1)/2.

Example 27.18. Define f : R → R by the rule f (x) = x2 . Setting y = x2 , we might


√ √
think that we can solve for x to get x = y, and then guess f −1 (y) = y. This

is not correct, because when we solved for x we should have set x = ± y. Thus,
the inverse relation is not a function. (This can also be seen from the fact that f is
neither injective, nor surjective.) 4
Example 27.19. We have seen that f : R − {2} → R − {1} given by
x−1
f (x) =
x−2
is a bijection. Setting y = f (x), we will solve for x. Multiplying by x − 2, we find
xy − 2y = x − 1.
Moving all terms with x to one side, and all other terms to the other side, we get
xy − x = 2y − 1, so that
x(y − 1) = 2y − 1.
27. COMPOSITION OF FUNCTIONS 211

Dividing by y − 1, we obtain
2y − 1
x= .
y−1
Hence, the inverse relation to f is f −1 : R − {1} → R − {2} given by

2y − 1
f −1 (y) = . 4
y−1

27.D Composition of inverse functions


If f is an injective function, we saw previously that the inverse relation f −1 is a
function. Thus, we call f −1 the “inverse function” of f .
If f is a noninjective function, then f −1 is not a function, but it is a relation.
One rarely encounters the inverse relation for a noninjective function. Adding to the
confusion, mathematician also use the notation “f −1 ” to refer to the preimage (as we
saw in previous homework).
The following theorem collects together a lot of information regarding the inverse
function of a bijective function.

Theorem 27.20. Let f : A → B be a bijective function. The following each


hold:
(1) (f −1 )−1 = f .
(2) f −1 : B → A is a bijective function.
(3) f −1 ◦ f : A → A is equal to idA .
(4) f ◦ f −1 : B → B is equal to idB .

Proof. Throughout the proof we let f : A → B be a bijection.


(1) This part holds for any relation f . If we reverse the ordered pairs in f , and
then reverse again, we are back to the original relation.
(2) By Theorem 27.15, we know f −1 is a function from B to A. Now, by part
(1) above, its inverse relation is f , which is a function from A to B. Thus, by using
Theorem 27.15 again, but switching the roles of f and f −1 , we know f −1 is a bijection.
(3) We note that f −1 ◦ f and idA have the same domain. Now for any a ∈ A, we
have (a, f (a)) ∈ f , so we see that (f (a), a) ∈ f −1 . This tells us that f −1 (f (a)) = a,
proving that (f −1 ◦ f )(a) = a = idA (a). Hence, f −1 ◦ f = idA .
(4) This is similar to part (3), by switching the roles of f and f −1 .

27.E Exercises
Exercise 27.1. Let f : A → B and g : B → C be functions.
(a) Prove that if f and g are injective, then g ◦ f is injective.
(b) Prove that if g ◦ f is surjective, then g is surjective.

Exercise 27.2. Let f : A → B be a function. Prove that f ◦ idA = f .


212 CHAPTER VII. FUNCTIONS

Exercise 27.3. Prove or disprove: If f : A → B and g : B → C are functions, and g


is surjective, then g ◦ f is surjective.

Exercise 27.4. Prove or disprove: If f : A → B and g : B → C are functions, and


g ◦ f is injective, then g is injective.

Exercise 27.5. Let f : A → B and let g : B → A be functions. Assume that both


g ◦ f = idA and f ◦ g = idB . Do the following:
(a) Prove that f and g are bijective. (Hint: Cite previous theorems, using the fact
that the identity function is a bijection. You will need to use the fact that both
g ◦ f and f ◦ g are bijections, since Example 27.13 shows that one of them being
a bijection is not sufficient.)
(b) Prove that g = f −1 . (Hint: Use associativity of composition.)

Exercise 27.6. Let f : A → B and g : B → C be functions. Prove that if f and g


are both bijective, then (g ◦ f )−1 = f −1 ◦ g −1 .
(Hint: How do you check if functions are equal?)

Exercise 27.7. Prove that the function f : R − {5} → R − {3} given by the rule
3x + 1
f (x) =
x−5
is bijective. Find a rule for the function f −1 : R − {3} → R − {5}.

Exercise 27.8. Fix A = {1, 2, 3} and define f : A → A as

f = {(1, 2), (2, 3), (3, 1)}.

Do the following:
(a) Determine f −1 as a set of ordered pairs.
(b) Determine f ◦ f as a set of ordered pairs.
(c) Determine f ◦ f ◦ f as a set of ordered pairs.
(d) For each n ∈ N, define
fn = f ◦ · · · ◦ f .
| {z }
n times

Then

f 1 = f,
f 2 = f ◦ f,
f 3 = f ◦ f ◦ f,

and so forth. Determine f n as a set of ordered pairs, for each n ∈ N.


28. ADDITIONAL FACTS ABOUT FUNCTIONS 213

28 Additional facts about functions


28.A Functions between finite sets
Let f : A → B be a function. When A or B is finite, then we can draw conclusions
about injectivity or surjectivity of f , by examining the size of im(f ).

Theorem 28.1. Let A and B be sets, and let f : A → B be a function. If A is


finite, then |im(f )| ≤ |A|. Moreover (still assuming A is finite) f is injective if
and only if |im(f )| = |A|.

Proof. As a collection of ordered pairs, f has |A| elements. Hence, there are at most
|A| second coordinates. Thus, there cannot be more than |A| elements in the image
of f .
We now prove the last sentence. For the forward direction, assume that f is
injective. Then all second coordinates of pairs in f are distinct, so the number of
such second coordinates, which is |im(f )|, is equal to |f | = |A|.
For the converse we work contrapositively. Assume that f is not injective. Then
f has fewer than |A| distinct second coordinates (since at least two of the |A| second
coordinates must be equal). Hence, |im(f )| < |A|.

Theorem 28.2. Let A and B be sets, and let f : A → B be a function. If B is


finite, then |im(f )| ≤ |B|. Moreover (still assuming B is finite) f is surjective
if and only if |im(f )| = |B|.

Proof. Left as Exercise 28.1.


When both the domain and the codomain of a function are finite, then injectivity
or surjectivity of the function gives us information about their relative sizes.

Theorem 28.3. Let A and B both be finite sets, and let f : A → B be a function.
(1) If f is injective, then |A| ≤ |B|.
(2) If f is surjective, then |A| ≥ |B|.
(3) If f is bijective, then |A| = |B|.

Proof. We make use of Theorems 28.1 and 28.2.


(1) If f is injective, then |A| = |im(f )| ≤ |B| (since im(f ) ⊆ B).
(2) If f is surjective, then |A| ≥ |im(f )| = |B|.
(3) This follows from (1) and (2).
Example 28.4. Fix A = {1, 2, 3, 4} and fix B = {1, 2, 3, 4, 5}. Then |A| < |B|.
Hence, by the contrapositive of part (2) above, we know that there can be no surjective
function from A to B. This also implies that there can be no bijective function from
A to B. 4
214 CHAPTER VII. FUNCTIONS

A special property of finite sets is that, in some cases, injectivity and surjectivity
may imply each other.

Theorem 28.5. Let A and B be finite sets and assume |A| = |B|. A function
f : A → B is injective if and only if it is surjective.

Proof. Suppose A and B are finite with |A| = |B|, and that f : A → B is a function.
(⇒): Assume f is not surjective. Then |im(f )| < |B| = |A|, so f is not injective.
(⇐): Assume f is not injective. Then |im(f )| < |A| = |B|, so f is not surjective.

Warning 28.6. Theorem 28.5 does not apply if A and B are infinite sets.
Firstly, we don’t yet know what it means for two infinite sets to have the same
size. However, even if A = B, there are still problems. For instance, define
f : N → N by the rule
f (n) = n + 1
and define g : N → N by the rule
(
1 if n = 1,
g(n) =
n − 1 if n > 1.

One may quickly check that f is injective but not surjective, and g is surjective
but not injective.

Remark 28.7. A common use of Theorem 28.5 occurs when A is a finite set and
f : A → A is a function. In this case, the sizes of the domain and codomain are clearly
equal, so f is injective if and only if f is surjective. N
Example 28.8. Fix A = {1, 2, 3}. If f : A → A is a function, is it automatically
bijective?
No, it is not. But if it is injective, then it is automatically surjective (and vice
versa), since the domain and codomain are both finite of the same size. 4

28.B Partitions and pasting functions


Often, it will happen that we wish to define a function from a set A to a set B.
However, it might be the case that A is too large or too complicated to make it
convenient for us to define such a function. Yet, if we can partition A, then defining
functions on the pieces may be easier, and then we may define a piecewise function
on all of A.
Proving injectivity and surjectivity of piecewise functions is usually more compli-
cated than for functions defined by a single simple rule. Cases are usually required.
We will now examine a special situation of piecewise defined functions for which in-
jectivity and surjectivity are easier to handle. These functions will also be useful to
us later.
28. ADDITIONAL FACTS ABOUT FUNCTIONS 215

Definition 28.9. Let A and B be sets. Suppose that {Pi }i∈I is a partition of
A and that {Qi }i∈I is a partition of B, both indexed by the same set I. Assume
that for each index i ∈ I, we are given a function fi : Pi → Qi . We then define
a function f : A → B by taking
[
f= fi ,
i∈I

with the rule f (a) = fi (a) if a ∈ Pi . We call f the function obtained by pasting
together the fi .

Example 28.10. Fix A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and fix subsets P1 = {1, 2, 3},
P2 = {4, 5, 6, 7}, and P3 = {8, 9, 10}. Then {P1 , P2 , P3 } is a partition of A.
Fix B = {1, 2, 3, 4, 5}, and fix subsets Q1 = {1, 2, 3}, Q2 = {4}, and Q3 = {5}.
Then {Q1 , Q2 , Q3 } is a partition of B.
Define f1 : P1 → Q1 by f1 (x) = x. Define f2 : P2 → Q2 by f2 (x) = 4, and define
f3 : P3 → Q3 by f3 (x) = 5. Pasting together the fi we obtain a function f given by
the rule

f1 (x) if x ∈ P1 ,

f (x) = f2 (x) if x ∈ P2 ,

f3 (x) if x ∈ P3 .


x if x ∈ P1 ,

= 4 if x ∈ P2 ,

5 if x ∈ P3 .

We can view this situation as follows:

1 1
2 2
3 3
4
5
6 4
7
8
9 5
10
4

The following theorem tells us when a pasted together function is injective, sur-
jective, or both.
216 CHAPTER VII. FUNCTIONS

Theorem 28.11 (The Pasting Together Theorem). Using the notation as given
in Definition 28.9, each of the following holds:
(1) If each fi is injective, then f is injective.
(2) If each fi is surjective, then f is surjective.
(3) If each fi is bijective, then f is bijective.

Proof. (1) Suppose that each fi is injective. We will show that f is injective, so
let a1 , a2 ∈ A and assume f (a1 ) = f (a2 ). We know that a1 ∈ Pi and a2 ∈ Pj for
some indices i and j (since the P ’s partition A). Hence f (a1 ) = fi (a1 ) ∈ Qi , and
f (a2 ) = fj (a2 ) ∈ Qj . Since f (a1 ) = f (a2 ) we have Qi ∩ Qj 6= ∅. But the Q’s partition
B, hence Qi = Qj , or in other words i = j. Thus

fi (a1 ) = f (a1 ) = f (a2 ) = fi (a2 ).

Since fi is injective, a1 = a2 .
(2) Suppose that each fi is surjective. Let b ∈ B, so b ∈ Qi for some index i.
Since fi is surjective, there is some a ∈ Pi with fi (a) = b. Hence, f (a) = fi (a) = b.
Therefore, f is surjective.
(3) This part follows from (1) and (2).
The next example shows how we can use pasting to find a bijection from N to Z.
Example 28.12. We partition N into {P1 , P2 }, where P1 is the set of even natural
numbers, and P2 is the set of odd natural numbers. We partition Z into {Q1 , Q2 },
where Q1 is the set of positive integers, and Q2 is the set of nonpositive integers.
Define f1 : P1 → Q1 by f1 (n) = n/2, and f2 : P2 → Q2 by f2 (n) = −(n − 1)/2.
Pasting together, define f : N → Z by
(
n/2 if n is even,
f (n) =
−(n − 1)/2 if n is odd.

One checks easily that f1 and f2 are bijections (see Exercise 28.2). Hence, by the
Pasting Together Theorem, f is a bijection. 4

28.C Characteristic functions


We define a special kind of pasted-together function, which is useful in many parts of
mathematics.

Definition 28.13. Let A be a set and let S be a subset of A. The characteristic


function of S, denoted by χS : A → {0, 1}, is the function defined by the rule
(
χS (a) = 1 if a ∈ S
0 if a ∈ A − S
28. ADDITIONAL FACTS ABOUT FUNCTIONS 217

We can view this situation, as depicted below.


1 S
S A−S 0 A−S

The elements in S are mapped to 1, and everything else in the domain is mapped
to 0. The function χS indicates (by the 1 or 0 output, thought of as a “yes/no”)
whether an element belongs to S or not.

Advice 28.14. It can be useful to think of the characteristic function as a metal


detector. It beeps (gives an output of 1) when you are near elements of S (the
metal), but is silent (gives an output of 0) in the complement A − S.
Notice that the notation χS does not indicate the domain of the characteristic
function. The domain is typically either understood from context or explicitly
stated, for instance by saying “χS : A → {0, 1}.”

Example 28.15. Fix A = R, and fix S = [0, 1], which is the closed interval from 0
to 1. The graph of χS : R → {0, 1} is
y

x
−2 −1 1 2

28.D Restrictions of functions


Suppose f : A → B is a function and S is a subset of A. It will often be the case
that we wish to study the function f limited to the set S. This situation occurs often
enough that we have a special name and notation for it.

Definition 28.16. Let A and B be sets and let f : A → B be a function. If


S ⊆ A, we can define a new function

f |S : S → B

by the rule f |S (x) = f (x) for each x ∈ S. We call f |S the restriction of f to S,


and read it as “f restricted to S.”
218 CHAPTER VII. FUNCTIONS

Example 28.17. Define f : R → R by the rule f (x) = x2 . We note that f is not


injective, since f (−1) = f (1). If we restrict f to the domain of nonnegative real
numbers, then the resulting function f |R≥0 : R≥0 → R is in fact injective. Note that
it is defined by the same rule as f , except that we restrict the allowed inputs. 4
Remark 28.18. If we think about the restriction of f to S in terms of ordered pairs,
we come up with the following description. If f : A → B is the function
f = {(a, f (a)) : a ∈ A},
then
f |S = {(a, f (a)) : a ∈ S}.
Hence, f |S is just the set of those ordered pairs in f whose first coordinate is in S. N
We have already seen that it is also possible to adjust a function by changing its
codomain. The codomain can be any set containing the image (but the function is
only surjective when the codomain equals the image).

28.E Exercises
Exercise 28.1. Prove Theorem 28.2.
Exercise 28.2. Prove that the functions f1 and f2 defined in Example 28.12 are both
bijections.
Exercise 28.3. Give an example of a bijective function f : Z → {0, 1}×N and include
a proof that it is bijective.
(Hint: Partition Z into positive and nonpositive integers. Partition {0, 1} × N into
{{(0, n) : n ∈ N}, {(1, n) : n ∈ N}}.
Define two bijections, and then use the Pasting Together Theorem.)
Exercise 28.4. Fix A = {n ∈ Z : −3 ≤ n ≤ 3}, and define f : A → Z by the rule
f (x) = x2 + 2x + 2.
(a) Write f as a set of ordered pairs.
(b) Find im(f ).
(c) Find a subset C of A so that f |C is injective and im(f |C ) = im(f ).
Exercise 28.5. Let f : A → B be an injective function, and let S be an arbitrary
subset of A.
(a) Prove that f |S : S → B is injective.
(b) Prove that f : A → im(f ) is a bijection.
Exercise 28.6. Let A be a set, and let S1 , S2 be subsets of A. Given an arbitrary
a ∈ A, prove the following facts for characteristic functions defined on the domain A:
(a) If T = S1 ∪ S2 and S1 ∩ S2 = ∅, then χT (a) = χS1 (a) + χS2 (a).
(b) If T = S1 ∩ S2 , then χT (a) = χS1 (a) · χS2 (a).
(c) If T = S1 ∪ S2 , then χT (a) = χS1 (a) + χS2 (a) − χS1 (a) · χS2 (a).
(Hint: Cases.)
Chapter VIII

Cardinality

...it’s very much like your trying to reach Infinity. You know that it’s there, but you
just don’t know where—but just because you can never reach it doesn’t mean that it’s
not worth looking for. Norton Juster, The Phantom Tollbooth

In the very first chapter of this book, we defined the cardinality of a finite set to
equal the number of its elements. Thus, for instance, the sets {a, b, c} and {1, 2, 3}
have the same cardinality, which is 3. For infinite sets we cannot define the cardinality
to be the number of elements, because such sets do not have any (finite) number of
elements.
However, there is a reason we do not just define the cardinality of an infinite set
to be the symbol ∞; there is a better way to measure the size of sets! This came as
a shock to mathematicians in the late 1800’s, who expected all infinite sets to have
the same size. This theory was developed by Cantor, who showed that the set of real
numbers R has bigger cardinality than N. In this chapter we develop Cantor’s theory
of cardinality, which has become an important part of modern mathematics.

219
220 CHAPTER VIII. CARDINALITY

29 Definitions regarding cardinality


In this section, we will define what it means for two sets to have the same cardinality,
discuss what it means for a set to have the same size as the natural numbers, and
prove some basic facts about cardinality.

29.A How do we measure the size of sets?


The first question we must answer is: How do we measure the size of a set? For finite
sets we simply count out the elements. For instance, if A = {68, 5, 39291, 90}, then
we just count off each element, and we see that |A| = 4. By counting this way we
form a bijection
f : {1, 2, 3, 4} → A
given by
f (1) = 68, f (2) = 5, f (3) = 39291, and f (4) = 90.
Intuitively, we can think of sets having the same “size” if there is a bijection between
them. This motivates the following definition.

Definition 29.1. Let A and B be sets. We say that A and B have the same
cardinality if there exists a bijection f : A → B. If this holds, we write |A| = |B|.
If there is no bijection from A to B, we say that they have different cardi-
nalities and write |A| =6 |B|.

Remark 29.2. We will prove, shortly, that the “same cardinality” relation is an
equivalence relation, which will justify our use of an equality sign for the relation. N
The following are some examples and nonexamples of sets with the same cardi-
nality.
Example 29.3. (1) Consider the three sets A = {a, b, c, d, e, f }, B = {1, 2, 3, 4, 5, 6},
and C = {0, 1, 2, 3, 4, 5}. It is easy to construct a bijection from A to B (since both
sets have exactly six elements). So |A| = |B|. There are also bijections from A to C,
and from B to C (since C also has six elements), so |A| = |C|, and |B| = |C|.
(2) Fix S = {1, 2, 3} and fix T = N. There is no bijection from S to T (since T
has more than 3 elements). Thus |S| = 6 |T |.
(3) It can be tricky when working with infinite sets to tell whether they have the
same cardinality. For instance, does N have the same cardinality as 2N? The answer
is yes! There is a bijection f : N → 2N, given by f (n) = 2n. In other words,
f (1) = 2, f (2) = 4, f (3) = 6, f (4) = 8, ...
is a bijection from N to 2N. Thus, we do have
|N| = |2N|. 4
The following example is so important that we’ll call it a theorem.
29. DEFINITIONS REGARDING CARDINALITY 221

Theorem 29.4. The cardinalities of N and Z are the same.

Proof. We need to construct a bijection f : N → Z; or, in other words, we need to


“count” the elements of Z using the natural numbers. The idea is to first count 0, and
then successively count the positive and negative integers, as in the following table
n 1 2 3 4 5 6 7 8 9 10 · · ·
f (n) 0 1 −1 2 −2 3 −3 4 −4 5 ···
which yields the needed bijection between N and Z.

Remark 29.5. The previous proof was very informal. First, the definition of the
function f is sloppy. To be more precise we should define f as a piecewise function
from N → Z by the rule
(
n/2 if n is even,
f (n) =
−(n − 1)/2 if n is odd.

This is exactly the same function as in Example 28.12.


Second, we didn’t prove that the function f is injective and surjective. This was
previously assigned as Exercise 28.2.
Amazingly, it turns out that this function can be expressed by a (somewhat com-
plicated) single formula
1 + (−1)n (2n − 1)
f (n) = .
4
(It is not expected that a student would be able to come up with this formula without
a lot of help!) N

Advice 29.6. To prove that two sets have the same cardinality, you are required
to find a bijection between the two sets. Generally there are many different
bijections. Try to look for a simple one.

We end this subsection with one more example.

Example 29.7. We will prove that the open interval A = (0, 1) and the open interval
B = (1, 4) have the same cardinality. We thus want to construct a bijection between
these two sets. The most obvious option would be to stretch by a factor of 3 and
then shift right by 1. So we define g : (0, 1) → (1, 4) by the rule

g(x) = 3x + 1.

It is straightforward to check that g is a function from A to B, and that g is both


injective and surjective. 4
222 CHAPTER VIII. CARDINALITY

29.B Basic results and a picture


In the previous subsection, we defined what it means for two sets to have the same
cardinality. To really justify that definition, we should show that the relation of
“having the same cardinality” is an equivalence relation on sets.

Theorem 29.8. The “same cardinality” relation of Definition 29.1 is an equiv-


alence relation on the collection of sets.

Proof. We first prove that this relation is reflexive. Let X be any set. The identity
function idX : X → X is a bijection. Thus X is related to X.
Next, we prove symmetry. Let X and Y be any sets, and assume X relates to
Y . In other words, assume there is a bijection f : X → Y . Then f has an inverse
function f −1 : Y → X, which is also a bijection. Hence Y relates to X.
Finally, we prove transitivity. Let X, Y , and Z be any sets, and assume there
are bijections f : X → Y and g : Y → Z. The composite function g ◦ f : X → Z is a
bijection, as needed.
The equivalence classes of this equivalence relation are precisely the collections of
sets with the same cardinality.
The observant reader will have noticed that we defined when two sets A and B have
the same cardinality, |A| = |B|, but that we have not defined what the cardinality
of an individual set is. Mathematicians solve this problem by choosing a (special)
transversal of this equivalence relation; the representatives in the transversal are the
cardinal numbers. Thus, the cardinality of a set, denoted by |A|, is a special element
of the equivalence class of A under the relation “having the same cardinality.” There
are specific symbols used to represent the cardinality of a set. For finite sets, that
symbol is just the actual size of the set. Thus, we still have |{2, 79, −4}| = 3.
For infinite sets things are much more complicated. (Did you expect otherwise?)
The smallest infinite cardinal |N| is written as ℵ0 (read as “aleph-nought”). The next
infinite cardinal is ℵ1 , and so forth. The diagram below gives some perspective to this
chain. (We put question marks in places where we do not yet have any examples.)

29.C Definition of countable sets


The easiest infinite set to understand is the set of natural numbers. Its cardinality
is given a special symbol |N| = ℵ0 . We think of the natural numbers as “counting
numbers,” which motivates the following two definitions.

Definition 29.9. Given a set A, we say that A is countably infinite if |A| = |N|.

Definition 29.10. Given a set A, we say that A is countable if it is either finite


or countably infinite.
29. DEFINITIONS REGARDING CARDINALITY 223

The following are some examples and nonexamples involving these definitions.
Example 29.11. (1) The empty set is countable, since it is finite. It is not countably
infinite (since it isn’t infinite).
(2) The set {1, 2, 93828283928} is countable and finite, but not infinite, and hence
not countably infinite.
(3) Theorem 29.4 tells us that the integers are a countably infinite set. Similarly,
Example 29.3 tells us that 2N is a countably infinite set.
(4) The set of integer squares, {n2 : n ∈ Z}, is infinite; we will see shortly that it
is countably infinite.
(5) Are there any sets that are infinite but not countably infinite? These would
be sets that occur strictly above ℵ0 in the diagram below. We will prove in Section 31
that, yes, there are such sets! 4

Cardinalities Examples
.. ..
. .
ℵ2 ?
Infinite
ℵ1 ?
ℵ0 N, 2N, Z, . . .
.. ..
. .
2 {1, 2}, {1, 3}, . . .
Finite
1 {1}, {2}, . . .
0 ∅

Advice 29.12. To show that a set A is countably infinite, you just need to
arrange its elements in a nonrepeating, infinite list

A = {a1 , a2 , a3 , . . .}.

This is precisely what we did when we proved that Z is countably infinite, we put
its elements in the list 0, 1, −1, 2, −2, 3, −3, . . ..

Warning 29.13. If you are proving that a set is countably infinite by putting
its elements into a list, then do not skip elements and do not repeat elements.
Otherwise, you didn’t really create a bijection.

Question: Which of the following lists proves that Z is countably infinite?


(a) {0, 1, 2, 3, . . .}.
(b) {0, 1, 0, −1, 0, 2, 0, −2, . . .}.
(c) {1, 0, 2, −1, 3, −2, 4, −3, . . .}.
224 CHAPTER VIII. CARDINALITY

Answer: Only (c) works. The list in (a) skips the negative integers. (However,
it does prove that the nonnegative integers are countably infinite.) The list in (b)
repeats 0. Of the choices, only (c) lists every integer exactly once, thus providing a
bijection with N.

29.D Subsets of countable sets


Many operations involving countable sets yield new countable sets. One of the most
useful results is the following:

Theorem 29.14. Any infinite subset of a countably infinite set is countably


infinite.

Proof. Let A be a countably infinite set. We can write the elements of A in an infinite
list a1 , a2 , a3 , . . .. Let B be an infinite subset of A.
Fix n1 to be the smallest natural number with an1 ∈ B, which exists since B 6= ∅
as B is infinite. Put b1 = an1 .
Next fix n2 to be the smallest natural number with n2 > n1 and an2 ∈ B, which
exists since B − {b1 } = 6 ∅ as B is infinite. Put b2 = an2 .
Repeating this process (by induction) we create an infinite list b1 , b2 , . . .. Clearly
there are no repetitions in this list. This new list covers every element of B because
we can also prove (by induction) that ni ≥ i for each i ∈ N; hence, we have worked
all the way through the list of elements of A.

Corollary 29.15. Any subset of a countable set is countable.

Proof. We leave this as Exercise 29.7.

Example 29.16. Not every subset of N is countably infinite. For instance, {3, 7, 19}
is a subset but not countably infinite.
However, every infinite subset of N is countably infinite by Theorem 29.14. For
instance, since there are infinitely many primes (by Theorem 19.14), then we know
that the set of all primes
{2, 3, 5, 7, 11, 13, 17, . . .}
is countably infinite.
Is S = {x3 : x ∈ Z} = {. . . , −27, −8, −1, 0, 1, 8, 27, 64, . . .} countably infinite?
Yes! First, it is an infinite set since as you cube larger and larger integers, you get
infinitely many different cubes (because the cubing function is strictly increasing). As
S is an infinite subset of the countably infinite set Z, we know S is countably infinite
by Theorem 29.14. 4

Example 29.17. Is |2Z| = ℵ0 ? Yes, since 2Z is an infinite subset of the countably


infinite set Z.
29. DEFINITIONS REGARDING CARDINALITY 225

Alternatively, you could create an explicit bijection f : N → 2Z, although this is


more difficult. We see that we can list the elements of 2Z as 0, 2, −2, 4, −4, 6, −6, . . ..
From this pattern, one possible bijection is given by the rule
1 + (−1)n (2n − 1)
f (n) = . 4
2

29.E Exercises
Exercise 29.1. Indicate whether the following statements are true or false, with
proof/reason or counterexample:
(a) Any two finite sets have the same cardinality.
(b) If f : A → B is a function between two sets, then |f | = |A| (thinking of f as a
set of ordered pairs).
(c) Every subset of N is countably infinite.
(d) Every subset of an infinite set has cardinality ℵ0 .
(e) If f : A → B is a surjective function, then |f | = |B| (thinking of f as a set of
ordered pairs).
Exercise 29.2. Prove that the set of those natural numbers with exactly one digit
equal to 7 is countably infinite. For instance, the number 103792 has exactly one of
its digits equal to 7, while 8727 has two digits equal to seven.
Exercise 29.3. Consider the set

S = {x ∈ Z : x = a2 + b2 for some a, b ∈ Z}.

Prove that |S| = |N|.


Exercise 29.4. Define h : (0, ∞) → (0, 1) by the rule
x
h(x) = .
x+1
x
Verify that h is a function by showing that for any x ∈ (0, ∞) we have x+1 ∈ (0, 1).
Then prove that h is a bijection. What does this say about the cardinality of these
open intervals?
Exercise 29.5. Adjust the formula in Exercise 29.4 to define a bijective function
j : (−∞, 0) → (−1, 0). Verify that your new rule j defines a function to the given
codomain and that it is a bijection.
Exercise 29.6. Prove that |R| = |(0, 1)|. (Hint: Use the previous two exercises to
define a piecewise bijection from R to (−1, 1). Then find a bijection from (−1, 1) to
(0, 1) and compose the two bijections.)
Exercise 29.7. Prove Corollary 29.15.
Exercise 29.8. Prove that a set A is countable if and only if there exists an injective
function f : A → N. (This exercise may be useful for future exercises.)
226 CHAPTER VIII. CARDINALITY

30 More examples of countable sets


Often a combination of two countable sets is countable. For instance, in this section
we will prove that the union of two countable sets is countable, and that the Cartesian
product of two countable sets is countable. Finally, we will show that Q is countably
infinite.

30.A Unions

Theorem 30.1. If A and B are countable sets, then A ∪ B is countable.

Proof. Fix B 0 = B −A. Notice that A∪B = A∪B 0 . Also since B is countable so is B 0 ,
by Corollary 29.15. Thus, to prove the theorem, it suffices to work with B 0 in place
of B. The benefit of working with B 0 instead of B is that A ∩ B 0 = A ∩ (B − A) = ∅;
i.e., A and B 0 are disjoint.
We will handle the case when A and B 0 are both countably infinite, leaving the
other cases as Exercise 30.1.
So assume that A and B 0 are countably infinite. Thus, we can write the elements
of A in an infinite list a1 , a2 , a3 , . . .. Similarly list the elements of B 0 as b1 , b2 , b3 , . . ..
We need to list the elements of A ∪ B 0 in an infinite list, which is easy to do by
interlacing the two lists, as
a1 , b1 , a2 , b2 , a3 , b3 , . . .
There is no repetition in this list, since A ∩ B 0 = ∅ and the two original lists have no
repetitions. Also, this new list contains each of the elements of A ∪ B 0 = A ∪ B.

Advice 30.2. The type of argument used in the first paragraph of the proof
above is referred to as reducing to a simpler situation. For instance, in the proof
above we could say there that we reduced to the case where the two sets are
disjoint.
After a reduction, mathematicians will simply assert that they now need
only consider the simpler situation. For example, after the first paragraph of
the proof above, we could simply say “We thus may assume A ∩ B = ∅.” This is
because we would recognize that, after replacing B by B 0 , this situation actually
occurs.

30.B Products
Taking a union is not the only operation we can do with two sets. Another operation
is intersection. When we intersect two sets, the cardinality can get much smaller.
There is a third operation: the Cartesian product. Cantor came up with a very
clever method for showing that the product of two countably infinite sets is still
countably infinite. Thus we have:
30. MORE EXAMPLES OF COUNTABLE SETS 227

Theorem 30.3. If A and B are countably infinite sets, then A × B is as well.

Proof. Without loss of generality, we just need to show that N × N is countably


infinite. Consider the following diagram:

(1, 1) (1, 2) (1, 3) · · ·

(2, 1) (2, 2) (2, 3) · · ·

(3, 1) (3, 2) (3, 3) · · ·


.. .. .. . .
. . . .

Travel along each arrow, starting at the smallest arrow, and passing to the next
smallest arrow. This allows us to list the elements of N × N as

(1, 1), (2, 1), (1, 2), (3, 1), (2, 2), (1, 3), . . . ,

according to when we pass through each ordered pair. We will hit each ordered pair
exactly once.
Remark 30.4. The bijection f : N × N → N described in Theorem 30.3 was only
described implicitly because the idea of the proof is much more important than the
details. However, we can explicitly describe the function. It is given by the rule
(m + n − 1)(m + n − 2)
f ((m, n)) = + n.
2
The first term (m+n−1)(m+n−2)
2
is the size of the triangle covered by the previous arrows,
and the last term n counts how far along the current arrow we have travelled. (The
details of proving that f is a bijection are left to the motivated reader!)
There are other ways of showing |N × N| = |N|. For instance, we could show that
the function g : N × N → N given by the rule

g((m, n)) = 2m−1 (2n − 1)

is also a bijection. (Proving that g is a bijection requires the lemma that every
natural number can be written as a unique power of 2 times a unique odd integer; for
existence, see Exercise 15.4.)
There are many other options. For instance, we could have used arrows pointing
down and to the left, instead of up and to the right. Alternatively, we could have
“snaked” back and forth along each finite diagonal. N

30.C Rational numbers


We are almost ready to describe the cardinality of Q. First, let’s deal with the positive
rational numbers Q>0 .
228 CHAPTER VIII. CARDINALITY

Theorem 30.5. The set Q>0 is countably infinite.

Proof. Put the elements of Q>0 into a diagram as below. (We write fractions that
are not in lowest terms in a light gray color.)

1 2 3 4
1 1 1 1
···
1 2 3 4
2 2 2 2
···
1 2 3 4
3 3 3 3
···
1 2 3 4
4 4 4 4
···
.. .. .. .. ..
. . . . .

Now, we just list the elements as before, skipping over the elements in light gray,
since they will be counted when they are in lowest terms. This counting procedure
never repeats elements (since we skip those fractions not in lowest terms), and con-
tinues forever since Q>0 is infinite (since N is a subset; in other words, the top row
of the diagram is infinite).

Remark 30.6. Here is an alternative proof of Theorem 30.5. Define a function


f : Q>0 → N × N by sending a rational number a/b (written in lowest terms) to the
ordered pair (a, b). The function f is injective, but not surjective. The set im(f ) is
infinite, and a subset of the countably infinite set N × N. Thus im(f ) is countably
infinite. But f is a bijection from Q>0 to im(f ), hence Q>0 is countably infinite. N

Corollary 30.7. The set Q is countably infinite.

Proof sketch. We have Q = Q>0 ∪ {0} ∪ Q<0 . We know that Q>0 is countable by
Theorem 30.5. Also, Q<0 is countable since there is an easy bijection Q>0 → Q<0 .
Also, {0} is finite, hence countable. By Theorem 30.1, the union of two countable sets
is countable, so Q>0 ∪ {0} is countable. Applying Theorem 30.1 again, we find that
Q = (Q>0 ∪ {0}) ∪ Q<0 is countable. It is also infinite, hence countably infinite.

We finish with one more example of how to show a set is countably infinite.

Example 30.8. Fix S = {(i, j) ∈ N × N : i ≥ j}. This set is pictured below. We


will prove that S is countably infinite.
30. MORE EXAMPLES OF COUNTABLE SETS 229

(1, 1) (1, 2) (1, 3) (1, 4) (1, 5) · · ·

(2, 1) (2, 2) (2, 3) (2, 4) (2, 5) · · ·

(3, 1) (3, 2) (3, 3) (3, 4) (3, 5) · · ·

(4, 1) (4, 2) (4, 3) (4, 4) (4, 5) · · ·

(5, 1) (5, 2) (5, 3) (5, 4) (5, 5) · · ·


.. .. .. .. .. . .
. . . . . .

First, the set S is infinite, since the left column is infinite. Since S ⊆ N × N and
N × N is countably infinite, we know that S is countably infinite by Theorem 29.14.
Alternatively, we can list the elements of S by using the “up arrow” argument
from earlier. (We can’t list the elements of S by going down columns, but could we
list the elements of S by traveling across the successive rows?) 4

30.D Exercises
Exercise 30.1. Finish the proof of Theorem 30.1. (Hint: There are two unfinished
cases: (a) both A and B 0 are finite, or (b) one is finite and the other is infinite.)

Exercise 30.2. Prove that {0, 1} × N is countably infinite. (Hint: Use theorems in
this section.)

Exercise 30.3. Let A and B be countable sets. Prove that A × B is countable. (How
is this different from what was proved in Theorem 30.3?)

Exercise 30.4. Let A1 , A2 , . . . be arbitrary sets. Fix B1 = A1 , and for each integer
n ≥ 1 fix Bn+1 = Bn × An+1 . Hence, we have

B2 = A1 × A2 ,
B3 = (A1 × A2 ) × A3 ,
B4 = ((A1 × A2 ) × A3 ) × A4 ,

and so forth. Do the following:


(a) Prove that if A1 , A2 , . . . are all countable, then Bn is countable for each n ∈ N.
(Hint: Induction.)
(b) Recall that the set A1 × A2 × A3 (without parentheses) consists of ordered
triples of the form (a1 , a2 , a3 ) where each ai ∈ Ai . On the other hand, the
set B3 = (A1 × A2 ) × A3 (with parentheses) consists of elements of the form
((a1 , a2 ), a3 ) where each ai ∈ Ai . These elements are ordered pairs where the
first coordinate is also an ordered pair.
Describe a bijective function f : A1 × A2 × A3 → (A1 × A2 ) × A3 = B3 by giving
a (simple) rule, and then prove its bijectivity.
(c) Prove that if A1 , A2 , A3 are countable, then the set A1 × A2 × A3 is countable.
230 CHAPTER VIII. CARDINALITY

(The motivated student might attempt generalizing parts (b) and (c) above, by prov-
ing that there is a bijection from the set of ordered n-tuples A1 × A2 × · · · × An to
the set Bn . This shows that if A1 , A2 , . . . , An are countable, then the set of ordered
n-tuples A1 × A2 × · · · × An is countable.)

Exercise 30.5. Prove that |Z × N| = |Q|.

Exercise
S∞ 30.6. Prove that if A1 , A2 , . . . are pairwise disjoint, countably infinite sets,
then i=1 Ai is countably infinite. (Hint: Not induction. Think about “up S∞ arrow”
arguments. Alternatively, you could construct a bijection from N × N to i=1 Ai .)

Exercise 30.7. Prove that the set of all finite subsets of N is countably infinite.
31. UNCOUNTABLE SETS 231

31 Uncountable sets
The results of this section will be centered around the following definition.

Definition 31.1. Any set A that is not countable is said to be uncountable.

We can think of the uncountable sets as those sets that are bigger than the count-
ably infinite sets, as in the following figure.
Cardinalities Examples

..
.

Uncountable ℵ2
Infinite
ℵ1

Countably Infinite ℵ0 N, 2N, Z, Q, N × N . . .

..
.

Countable 2 {1, 2}, {1, 3}, . . .


Finite
1 {1}, {2}, . . .

0 ∅

As is evident from this diagram, we still don’t have any examples of uncountable sets.
In this section we will see that there are many examples.

31.A How big is R?


Before we can talk about how big the set of real numbers is, we need to explain more
precisely what a real number is. We usually think of real numbers as infinite decimal
expansions. For instance:

1 = 1.00000 . . .

2 = 1.41421 . . .
π
− = −0.24166 . . .
13
24
e−6 − = −3.42609 . . .
7

However, real numbers do not always have unique infinite decimal expansions. If a
232 CHAPTER VIII. CARDINALITY

number ends in repeating 9’s, we can shift up and end in repeating 0’s. For example,

0.99999 . . . = 1.00000 . . .
8.3929999 . . . = 8.3930000 . . .
−3928.83829999 . . . = −3928.83830000 . . .

To avoid nonuniqueness issues, we will always avoid writing decimal expansions that
end in repeating 9’s.
Our goal now is to show that R is uncountable. From a previous homework
problem we know that |(0, 1)| = |R|, so it suffices to show that (0, 1) is uncountable.
(This set is easier to work with.) We know that (0, 1) is infinite, so to prove that it
is uncountable we must show that there does not exist any bijection f : N → (0, 1).
Cantor’s trick to do this is to show that every function f : N → (0, 1) is not surjective,
using what is now commonly called a “diagonalization argument.” Before we give the
technical proof, we demonstrate the idea with an example.
Supposing f : N → (0, 1) is the function where

f (1) = 0.29838293 . . . ,
f (2) = 0.43828183 . . . ,
f (3) = 0.73826261 . . . ,
f (4) = 0.20030000 . . . ,
f (5) = 0.73724892 . . . ,

and so forth, our goal is to prove that f is not surjective. Thus, we must find some
element x ∈ (0, 1) that is not in the image of f . We will construct x digit by digit,
so that it doesn’t match any of the numbers on our list.
First, we want x to be different from f (1) = 0.29838293 . . .. We can make sure this
is true by guaranteeing that the first digit (past the decimal point) of x is different
from the first digit of f (1). So, let’s change that first 2 to a 4, and put

x = 0.4 . . . .

Notice that no matter what we do with the rest of the digits of x, it will not match
the decimal expansion of f (1).
Second, we want x to be different from f (2) = 0.43828183 . . .. They do match on
their first digit, but we can also make their second digits different by changing the 3
to a 4. So we put
x = 0.44 . . . ,
and x will not equal f (1) or f (2).
Third, we want x to be different from f (3) = 0.73826261 . . .. It already is different
because of our choice of the first two digits, but we wish to continue the pattern we
have already come up with, to make sure that the third digit is different. So we
change the 8 to a 4, and put
x = 0.444 . . . ,
31. UNCOUNTABLE SETS 233

and we have x 6= f (1), f (2), f (3).


For the fourth number, f (4) = 0.20030000 . . ., we change the 3 to a 4, and put

x = 0.4444 . . .

and we have x 6= f (1), f (2), f (3), f (4).


For the fifth number, f (5) = 0.73724892 . . ., we need to change the fifth digit 4,
so we change it to 7. Put
x = 0.44447 . . . .
In general, we look at the nth digit of f (n), and change it to a 4, unless it is already
a 4, in which case we change it to a 7. We place that new digit in the appropriate
place in x. After all of these changes, x cannot match any number on our list, so f
is not surjective.
This process works for any function f : N → (0, 1). To test your understanding,
assume that f is a different function satisfying

f (1) = 0.12345 . . . ,
f (2) = 0.44444 . . . ,
f (3) = 0.92453 . . . ,
f (4) = 0.44743 . . . ,

and use this same process to construct a number x ∈ (0, 1) that is not in this list.
Our process tells us to change digits to 4’s and 7’s. Many other digits would work
just as well, but not the digit 9 because we want to avoid ending in repeating 9’s, and
not the digit 0 because we want to avoid constructing the number 0.00000 . . . ∈
/ (0, 1).
We are now prepared to give the formal proof that (0, 1) is uncountable. As
discussed above, the technique used in this proof is known as Cantor’s diagonalization
argument.

Theorem 31.2. The set (0, 1) is uncountable.

Proof. Let f : N → (0, 1) be any function. We will show that f is not surjective.
For each n ∈ N, write f (n) using a decimal expansion f (n) = 0.d1,n d2,n d3,n . . . that
doesn’t end in repeating 9’s. Fix x ∈ (0, 1) to be the number with decimal expansion
x = 0.x1 x2 x3 . . . where for each n ∈ N we have
(
4 if dn,n 6= 4,
xn =
7 if dn,n = 4;

in particular, the nth digit of x is different from the nth digit of f (n), and so x 6= f (n).
Therefore f is not surjective, as x is not in the image.
234 CHAPTER VIII. CARDINALITY

Corollary 31.3. The set R is uncountable.

The cardinality of R is called the continuum, and we write |R| = c. You might
ask: Where does c fit in the chain of cardinalities? Is it just one step up from ℵ0 ?
The answer is strange. It depends on the axioms you use! Some mathemati-
cians do assume c = ℵ1 ; this assumption is called the continuum hypothesis. Most
mathematicians simply do not worry about this question.
We have already seen that |(0, 1)| = |R|, so (0, 1) also has continuum cardinality.
Here are some more examples of sets with continuum cardinality, for any a, b ∈ R
with a < b.
(1) Any open interval (a, b). (We can also replace a with −∞, or b with ∞.)
(2) Any half-open interval [a, b). (We can replace b with ∞.)
(3) Any half-open interval (a, b]. (We can replace a with −∞.)
(4) Any closed interval [a, b].
To give the idea behind how to prove these facts, we will show:

Proposition 31.4. The half open interval (0, 1] has the same cardinality as the
open interval (0, 1), and hence it has continuum cardinality.

Proof. We define a bijection f : (0, 1) → (0, 1], as follows. Fix


   
1 1 1 1
S= , , ,... = : n ∈ N ( (0, 1),
2 4 8 2n

and fix T = S ∪ {1} ( (0, 1]. Now, define f as a piecewise function by the rule
(
x if x ∈
/S
f (x) =
2x if x ∈ S.

The first piece of this function is a bijection from (0, 1) − S to (0, 1] − T , and the
second piece is a bijection from S to T . By pasting together, f is a bijection from
(0, 1) to (0, 1].
We end this section with one last useful result about uncountable sets.

Theorem 31.5. Let A and B be sets, with A ⊆ B. If A is uncountable, then B


is uncountable.

Proof. This is the contrapositive of Corollary 29.15.

Example 31.6. Any subset S ⊆ R such that (0, 1) ⊆ S is uncountable, by the


previous theorem. In a later section we will show that any such subset has continuum
cardinality.
There are lots of subsets of R that are not uncountable. Can you list some? 4
31. UNCOUNTABLE SETS 235

31.B Exercises
Exercise 31.1. If f : N → (0, 1) is a function where

f (1) = 0.12345 . . . ,
f (2) = 0.44444 . . . ,
f (3) = 0.92453 . . . ,
f (4) = 0.44743 . . . ,

and so forth, then write down as many decimal digits as possible for the number
x ∈ (0, 1) that is constructed in the proof of Theorem 31.2.
Exercise 31.2. Let a, b ∈ R with a < b. Construct a bijection f : (0, 1) → (a, b), and
prove it is a bijection. (This shows that bounded open intervals all have the same
cardinality.)
Exercise 31.3. Prove that the interval [0, 1) has continuum cardinality (perhaps by
composing previously created bijections).
Exercise 31.4. Prove that the interval [0, 1] has continuum cardinality.
Exercise 31.5. Prove that the set of irrational numbers is uncountable. (Hint:
Theorem 30.1 may be useful, along with contradiction.) Find a subset of the irrational
numbers that is countably infinite.
Exercise 31.6. Prove that the set C of complex numbers is uncountable. (With
more work one can prove that C has continuum cardinality, but this is not obvious.)
Exercise 31.7. We previously defined a product of two sets A and B to be the
collection of ordered pairs from A and B. A similar definition works for infinitely
many sets. For example, let A1 , A2 , A3 , . . . be a list of sets indexed by N. Their set
product, denoted by Y
Ai or A1 × A2 × A3 × · · · ,
i∈N

is defined to be the set of ordered sequences (or tuples indexed by the set N), i.e.
Y
Ai = {(a1 , a2 , a3 , . . .) : ai ∈ Ai for each integer i ≥ 1} .
i∈N

We showed previously that a finite product of countable sets is countable. Sur-


prisingly, a countably-indexed product of countable sets is often uncountable. Below,
you will be asked to prove this in a special case.
Show that the product
Y
{0, 1} = {(a1 , a2 , a3 , . . .) : ai ∈ {0, 1} for each integer i ≥ 1}.
i∈N

is uncountable. (Hint: (1) This product is the set of infinite sequences of 0’s and 1’s.
(2) Modify Cantor’s diagonalization argument, as used in the proof of Theorem 31.2.)
236 CHAPTER VIII. CARDINALITY

32 Injections and cardinalities


In the previous section we proved the amazing fact that R is not a countable set. Thus,
we might expect that |N| < |R|. We have only defined when cardinalities are equal.
In this section we give a method for determining inequalities between cardinalities.

32.A Injections vs. bijections


Let A and B be arbitrary sets. We would like to think of A as “smaller” than B if we
can fit A inside B. However, consider the set N, which sits properly inside Z. These
sets have the same cardinality! Thus, we have to be extra careful about whether
cardinalities are strictly smaller or not.
One way to think about fitting A inside another set B is to use an injection.
This motivates the following definitions (which will only be fully justified in the next
section).

Definition 32.1. Let A and B be sets. If there is an injection f : A → B, we


write |A| ≤ |B|. If there is an injection but no bijection from A to B, then we
write |A| < |B|.

The following are some examples of these definitions in action.


Example 32.2. (1) What is the relation between the set A = {1, 3, 5} and the set
B = {2, 4, 6, 8}? There is an injection from A to B but no bijection (since A has
three elements, but B has four elements). Thus |A| < |B|.
(2) What is the relation between the sets 2N and N? The function f : 2N → N
defined by the rule f (x) = x is injective. Hence, |2N| ≤ |N|. However, both sets are
countably infinite, so in fact there is a (different) bijective function between the sets,
so we have |2N| = |N|.
(3) What is the relation between the sets N and R? The function N → R sending
each natural number to itself is an injective function. Hence |N| ≤ |R|. In the previous
section we proved that R is uncountable, so there is no bijection between these sets.
Hence, we have the strict inequality |N| < |R|. 4

Advice 32.3. We can think of injections as giving only “half” of the information
needed to construct a bijection, which is why we only get an inequality ≤.

You might recall that in our tower of cardinalities (found at the beginning of the
previous section) we had an infinite list of infinite cardinalities ℵ0 < ℵ1 < ℵ2 < . . ..
But so far, we have only found two types of infinite cardinalities; the countably infinite
sets, and the sets of continuum size. In our next theorem we will prove that for any
set A we have |A| < |P(A)|. Thus, we have an infinite chain of increasing infinite
cardinalities
|N| < |P(N)| < |P(P(N))| < . . . .
32. INJECTIONS AND CARDINALITIES 237

When A is a finite set, say |A| = n, then we know |A| < |P(A)| because n < 2n .
But how does this process work when A is an infinite set? In that situation we
cannot simply count elements. Rather, we must prove that there is no bijection
g : A → P(A). Our approach will be similar to how we showed R is not countable.
Start with an arbitrary function g : A → P(A), and show that g is not surjective
by finding some set B ∈ P(A) that is not in the image of g. Note that B will be a
subset of A, since B ∈ P(A). The hardest part is constructing B. We will give an
explicit example (using finite sets), and then give the formal proof for arbitrary sets.
Fix A = {1, 2, 3}. Hence
P(A) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
Consider the function g : A → P(A) where g(1) = {2}, g(2) = ∅, and g(3) = {1, 2, 3}.
We want to find a set B ∈ P(A) that we can prove is not equal to g(1), g(2), or g(3).
Of course, we could just pick one of the other five sets not in the image of g in this
case; but we want to come up with a method that will work for any set A.
So, we ask the question: Is x ∈ g(x)?
• Is 1 ∈ g(1) = {2}? The answer is no.
• Is 2 ∈ g(2) = ∅? The answer is no.
• Is 3 ∈ g(3) = {1, 2, 3}? The answer is yes.
We construct B ∈ P(A) by the following rule: If the answer to the question “Is
x ∈ g(x)?” is no then we put x ∈ B, but if the answer is yes then we leave x out of
B. Using the answers we had above, we see that B = {1, 2}.
Notice that B will not equal g(x) because if x ∈ g(x) then x ∈/ B, and vice versa.
Indeed, we see that
• 1∈/ g(1) but 1 ∈ B.
• 2∈/ g(2) but 2 ∈ B.
• 3 ∈ g(3) but 3 ∈
/ B.
This forces B to be different from any set in the image of g.
One more example is in order, to test our understanding. Suppose that we fix
A = {1, 2, 3} as above, and suppose that h : A → P(A) is the function defined by
the rule h(1) = {2, 3}, h(2) = {2}, and h(3) = {2, 3}. If we follow the same pattern
as above, asking the question “Is x ∈ h(x)?” and using the answers to define B, what
set B do we get? (Before looking at the answer, try this construction yourself.)
Answer: The set is {1}.
Remark 32.4. The set B is sometimes called the barber set. This is because there
is some connection with the following paradox: There lives a barber in a small town
who always obeys the rule that he will shave everyone in town who doesn’t shave
themselves, but if they shave themselves he will not shave them.
Does the barber shave himself? If he does, then he cannot shave himself by his
own rule. But if he doesn’t, then he must shave himself by his rule.
One way to resolve the paradox is to assume instead the barber does not live in
the town. This corresponds, roughly, to the fact that B is not in the image of the
function. N
We are now ready to prove the theorem in general.
238 CHAPTER VIII. CARDINALITY

Theorem 32.5. If A is a set, then |A| < |P(A)|.

Proof. Let A be any set. First, we prove that |A| ≤ |P(A)|, so we need to find an
injective function f : A → P(A). Define f by the rule f (a) = {a}. To prove that f
is injective, let a1 , a2 ∈ A and assume f (a1 ) = f (a2 ). Hence {a1 } = {a2 }. Therefore
a1 = a2 , since sets are equal exactly when they have the same elements.
Next, let g : A → P(A) be an arbitrary function. We will show that g is never
surjective, and hence there is no bijection between A and P(A). Fix

B = {x ∈ A : x ∈
/ g(x)},

which is called the “barber set” for g. This is a subset of A, hence an element of
P(A). We will show that B is not in the image of g.
Let a ∈ A be arbitrary. There are two cases.
Case 1: Assume a ∈ g(a). In this case a ∈ / B, hence g(a) 6= B.
Case 2: Assume a ∈ / g(a). Then a ∈ B, hence g(a) 6= B.
In every case B 6= g(a). Since a ∈ A was arbitrary, this means B cannot be in the
image of g (since it does not equal any element of the image of g).

32.B How big is P(N)?


We now know that |N| < |P(N)|, but exactly how big is P(N)? In the next section
we will prove it has continuum cardinality. However, we currently have the tools to
find another set with the same cardinality. For the rest of this section, given a set A
we will denote the set of all functions from A to {0, 1} by F(A).

Theorem 32.6. If A is any set, then |P(A)| = |F(A)|.

Proof. We must construct a bijection between the two sets P(A) and F(A). The
rule is this: send a subset S ⊆ A to its characteristic function, χS : A → {0, 1}. In
other words, we define f : P(A) → F(A) by the rule

f (S) = χS .

We first show that f is injective. Let S, T ∈ P(A) and assume f (S) = f (T ). We


then have χS = χT . Plugging in an arbitrary element a ∈ A, we have χS (a) = χT (a).
The left-hand side is 1 when a ∈ S and 0 otherwise, and similarly for the right-hand
side. Thus, a ∈ S if and only if a ∈ T . In other words S = T .
Finally, we show that f is surjective. Let ϕ : A → {0, 1} be any function. Put
S = {a ∈ A : ϕ(a) = 1}. We then check directly that ϕ = χS . (They have the same
domain and codomain, and the same rule.) Hence ϕ = f (S), so f is surjective.
32. INJECTIONS AND CARDINALITIES 239

Corollary 32.7. The set F(N) is uncountable.

Proof. The equality |P(N)| = |F(N)| follows from the previous theorem. We also
know |N| < |P(N)|, hence F(N) is uncountable.
Remark 32.8. In Exercise 31.7, you proved that ∞
Q
i=1 {0, 1} is uncountable. The
corollary above gives an easier way to see this, since functions N → {0, 1} can be
thought of as infinite sequences of 0’s and 1’s. N

32.C Exercises
Exercise 32.1. State the truth value of each of the following statements, proving
your answer.
(a) Every uncountable set has the same cardinality as (0, 1).
(b) For any sets A and B, if A ⊆ B, then |A| ≤ |B|.
(c) For any sets A and B, if A ( B, then |A| < |B|.
(d) For any sets A, B, and C, if A ⊆ B ⊆ C and both A and C are countably
infinite, then B is countably infinite.
(e) No subset of R has smaller cardinality than R.
(f) For any sets A and B, if |A| < |B| and A is finite, then B is infinite.
(g) For any sets A and B, if |A| < |B| and A is countable, then B is uncountable.
(h) For any sets A and B, if |A| < |B| and A is countably infinite, then B is
uncountable.
(i) For any set A, there exists another set B such that |A| < |B|.
Exercise 32.2. Fix A = {a, b, c, d, e}, and define g : A → P(A) by the rule:
g(a) = {b, d}, g(b) = {a, c, e}, g(c) = {a, c, d, e}, g(d) = ∅, and g(e) = {e}.
List the elements of the barber set B = {x ∈ A : x ∈
/ g(x)}. Why is it not in the
image of g?
Exercise 32.3. Find a set with cardinality bigger than that of R. Then find a set
with cardinality bigger than that.
Exercise 32.4. Theorem 28.5 says that for any finite sets A and B, if |A| = |B| and
f : A → B is a function, then f is injective if and only if f is surjective. Prove that
this fails for infinite sets, by proving the following:
(a) There is an infinite set S and a function f : S → S that is injective but not
surjective.
(b) There is an infinite set S and a function g : S → S that is surjective but not
injective.
In both parts prove that the function you construct has the required properties.
Exercise 32.5. Let A and B be sets with f : A → B a bijection. Define a new
function g : P(A) → P(B) by the rule g(S) = {f (s) : s ∈ S}, where S ⊆ A is an
arbitrary element of P(A). Prove that g is a bijection.
Conclude that for any two sets A and B, if |A| = |B|, then |P(A)| = |P(B)|.
240 CHAPTER VIII. CARDINALITY

Exercise 32.6. Define a function f : R → P(Q) by the rule

f (x) = {q ∈ Q : q ≤ x}.

Prove that f is injective. (Hint: For any two real numbers x < y, there is a rational
number strictly between them. See Exercise 11.6.)
Using this injection, in conjunction with the previous exercise, derive the inequal-
ity |R| ≤ |P(N)|.

Exercise 32.7. Let A and B be nonempty sets. Prove that there exists an injection
f : A → B if and only if there exists a surjection g : B → A. (Hint: For the backwards
direction, given a surjection g : B → A, then define a function f : A → B by the rule
f (a) = one of the elements that mapped to a under g.)
33. THE SCHRÖDER–BERNSTEIN THEOREM 241

33 The Schröder–Bernstein Theorem


Let a, b ∈ R. If we know that a ≤ b and b ≤ a, then we must have a = b. In other
words, the “less than or equal to” relation on the real numbers is antisymmetric.
We have used a similar notation for cardinalities, and it is natural to ask whether
or not this relation is antisymmetric. In other words, given sets A and B, if we know
that |A| ≤ |B| and |B| ≤ |A|, must we have |A| = |B|? The answer is yes, and this
result is called the Schröder–Bernstein Theorem.

Theorem 33.1 (Schröder–Bernstein Theorem). Let A and B be arbitrary sets.


If |A| ≤ |B| and |B| ≤ |A|, then |A| = |B|.

Remark 33.2. The story of how this theorem came to be proved is long and some-
what convoluted. Cantor was the first to state the theorem, but apparently he had
no proof. The first proof (that we know of) was found by Dedekind, but he did not
publish his work at the time.
Schröder announced a proof, which was later shown to have an error. Finally, in
1897, Bernstein (who was only 19 years old, and a student of Cantor) presented a
proof. At nearly the same time Schröder independently found an error-free proof as
well. Hence, these two mathematicians have their names attached to the theorem. N

33.A Sketching the proof using genealogy


Here we will sketch the main ideas of the proof. The proof is a direct one. Given sets
A and B, assume that |A| ≤ |B| and that |B| ≤ |A|. In other words, we assume that
we have two injective functions f : A → B and g : B → A. Our goal is to show that
|A| = |B|; in other words, we need to create a bijection h : A → B.
Of course, if f is already a bijection, we are done. So we may as well assume
that f is not surjective. Similarly, we also assume g is not surjective (since if it is
bijective, then we are done). We will also assume that A ∩ B = ∅, to keep their
elements separate, although the proof works nearly the same without this simplifying
assumption.
The main idea of the proof is that we first partition A into two pieces called A1
and A2 , and similarly we partition B into two pieces called B1 and B2 . Then, we
create a bijection hi : Ai → Bi for each i ∈ {1, 2}. Finally we invoke the Pasting
Together Theorem, which gives us a bijection h : A → B as pictured below:
A = A1 ∪ A2
  
 h h
yh y 1 y 2
B = B1 ∪ B2 .
The only information we have available comes from the two functions f and g
that we have given to us. We must somehow use the functions f and g to make any
progress on this problem. We might ask how these functions behave. Consider some
242 CHAPTER VIII. CARDINALITY

element a ∈ A. Applying f , we have a new element f (a) ∈ B. We call a the parent


of f (a), and we call f (a) the child of a. See the picture below.

A B

a
f (a)

We can also talk about elements of B being parents of children in A via the
function g. The parent-child relationship in this case appears below.

A B

g(b) b

There are some very important facts we need to know about these parent-child
relationships.
(1) Every element in A is the parent of exactly one child in B, because f is a
function. Similarly, every element in B is the parent of exactly one child in A.
(2) Every element in A has at most one parent in B, because g is injective. Similarly,
every element in B has at most one parent in A, because f is injective.
(3) Some element in A has no parent in B, because g is not surjective. Similarly,
some element in B has no parent in A, because f is not surjective.
We can pass from a parent to a child, but then that child has its own child. In
this way, we have a chain of descendants. By fact (1), there are no siblings in the
list of descendants; there is always exactly one child per generation. For instance, if
a ∈ A, its chain of descendants is

f (a), g(f (a)), f (g(f (a))), . . . ,

which is pictured below.

A B

a
f (a)
g(f (a))
.. f (g(f (a)))
. .. ..
. .

It is possible that this chain of descendants could loop around and repeat itself (for
instance, we might have g(f (a)) = a, so that a is its own grandparent), but this
situation will cause us no difficulty.
33. THE SCHRÖDER–BERNSTEIN THEOREM 243

Just as we can consider descendants, we can also consider ancestors. The ancestors
of an element are its parent, the parent of its parent, and so forth. By the important
fact (2) above, there are never multiple parents in a generation. There is at most
one parent, and occasionally, by fact (3), there are no parents. Thus, sometimes
the ancestry terminates, and sometimes it goes backwards forever (including when it
loops).
The genealogy of an element x (of either A or B) is the chain consisting of its
ancestors, descendants, and itself. If an element of a genealogy has no parent, we say
it is the beginning of the genealogy. (Note that there is at most one beginning to any
genealogy.) Genealogy chains can exhibit many different behaviors, but there is one
important property that will help us in our proof. We say that genealogies come in
two types:
(1) The genealogy does not begin in B. (This consists of the cases where the
genealogy begins in A, or when the chain of ancestors never ends, including
when it loops.)
(2) The genealogy does begin in B.
A key fact is that a parent and its child are in the same chain, and so they have the
same genealogy. Their genealogies thus have the same type.
We are now ready to describe a partition of A. We put A = A1 ∪ A2 where

Ai = {a ∈ A : the genealogy of a is of type i}.

Similarly, we put B = B1 ∪ B2 where

Bi = {b ∈ B : the genealogy of b is of type i}.

Now that we have a partition of A and a partition of B, to construct a bijection


h : A → B it suffices by the Pasting Together Theorem to construct bijections
hi : Ai → Bi for each i = 1, 2. Each of these functions will be defined slightly
differently.
Define h1 : A1 → B1 by the rule h1 (x) = f (x). To show that h1 is a bijection
requires us to prove three facts.
(1) We first show that h1 really is a function taking elements of A1 to B1 . To that
end, let x ∈ A1 . This means that the genealogy of x is of type 1. The child of
x is f (x) ∈ B, which has the same type of genealogy. Thus h1 (x) = f (x) ∈ B1 .
(2) We next show that h1 is injective. Let x1 , x2 ∈ A1 . Assume that h1 (x1 ) =
h1 (x2 ). From the definition of h1 , we have f (x1 ) = f (x2 ). Since f is injective,
x1 = x2 . So we see that h1 is injective.
(3) Finally, we show that h1 is surjective. Let y ∈ B1 . We then know (from the
definition of B1 ) that y has a type 1 genealogy. In particular, y must have a
parent x ∈ A, since its genealogy cannot begin at y in B. The parent, x, also
has a type 1 genealogy, and so x ∈ A1 . Now, h1 (x) = f (x) = y, where that
last equality comes from the fact that x is the parent of y. So we see that h1 is
surjective.
Having now dealt with h1 , we will next define h2 . To do this, we first define a
function j : B2 → A2 by the rule j(y) = g(y). Mimicking the three parts above, it is
244 CHAPTER VIII. CARDINALITY

straightforward (and left as Exercise 33.5) to show that j is a bijective function from
B2 to A2 . We fix h2 : A2 → B2 to be its inverse, which is also a bijective function by
Theorem 27.20(2).
This completes the sketched proof of the Schröder–Bernstein Theorem.

33.B Examples
The Schröder–Bernstein Theorem is not only beautiful symbolically, but also quite
useful because it is sometimes very easy to describe injections back-and-forth between
two sets A and B, yet it may be difficult to describe a bijection. Here are some
standard examples.
Example 33.3. We will prove that the closed interval [3, 10] has the same cardinality
as (0, 1).
Define f : [3, 10] → (0, 1) by the rule f (x) = (x − 2)/10. This is a linear function
with f (3) = 1/10 and f (10) = 8/10. So f maps [3, 10] injectively into the interval
[1/10, 8/10] ⊆ (0, 1).
On the other hand, the function g : (0, 1) → [3, 10] given by g(x) = x + 3 is also
an injection.
By the Schröder–Bernstein Theorem, we are done. 4
This next example is so important that we will call it a theorem.

Theorem 33.4. |P(N)| = |R|.

Proof. In Exercise 32.6, we proved that |R| ≤ |P(N)|. (For an alternative proof
of this inequality, see Exercise 33.6 below.) By the Schröder–Bernstein Theorem, it
suffices to now prove |P(N)| ≤ |R|.
Define f : P(N) → R by the rule f (S) = 0.χS (1)χS (2)χS (3) . . .. (For instance, if
S = {1, 3, 4, 7, 9, . . .} then f (S) = 0.101100101 . . . ∈ R.) It just remains to show that
this function is injective. Let S, T ⊆ N be arbitrary, and assume f (S) = f (T ). Thus
0.χS (1)χS (2)χS (3) . . . = 0.χT (1)χT (2)χT (3) . . . .
Since neither decimal expansion involves repeating 9’s, the two expansions are equal.
Hence χS (n) = χT (n) for each n ∈ N. This means that S and T have exactly the
same elements so S = T , which finishes showing that f is an injective function.

33.C Exercises
Exercise 33.1. Let X, Y , and Z be sets. Prove that if X ⊆ Y ⊆ Z and |X| = |Z|,
then |X| = |Y | as well.
Exercise 33.2. Prove that A = [−5, 16) and B = (0, ∞) have the same cardinality.
(Hint: Find injections A → B and B → A, and then use the Schröder–Bernstein
Theorem. Alternatively, use Exercise 33.1 twice, with X = (0, 1), Z = R, and Y = A
or Y = B.)
33. THE SCHRÖDER–BERNSTEIN THEOREM 245


Exercise 33.3. Prove that A = Q ∪ [−2, −1] ∪ { 2} and B = [3, 6) ∪ (15, 17) have
the same cardinality.

Exercise 33.4. Given sets A and B, prove that if there is an injection f : A → B


and a surjection g : A → B, then |A| = |B|. (Hint: A previous homework exercise
might be useful.)

Exercise 33.5. Prove the claim from Subsection 33.A that the function j : B2 → A2
given by the rule j(y) = g(y) is a bijective function. (Hint: Modify the three steps
used to show that h1 is a bijective function.)

Exercise 33.6. In Exercise 32.6 we showed that |R| ≤ |P(N)|. In this exercise, we
will give a different proof. We will use the fact (which you may take for granted) that
every real number has a binary expansion, just like it has a decimal expansion.
Define a function f : (0, 1) → P(N), by sending the binary expansion (not ending
in repeating 1’s) of a real number 0.a1 a2 a3 . . . ∈ (0, 1) to the set

{i ∈ N : ai 6= 0},

where each ai is either 0 or 1. (For instance, 0.0110100 . . . 7→ {2, 3, 5, . . .}.) Prove


that f is an injective function.
246 CHAPTER VIII. CARDINALITY
Chapter IX

Introduction to Analysis

The only way to discover the limits of the possible is to go beyond them into the
impossible. Arthur C. Clarke

In the third century BC, the Greek mathematician Archimedes used the “method
of exhaustion” to estimate the circumference of a circle of diameter 1, and thus
estimate the value of π. His method involved inscribing a regular n-gon inside the
circle, circumscribing the circle by a regular n-gon, and bounding the circumference
of the circle between the perimeters of the two n-gons. For example, taking n = 4,
n = 5, and n = 6, we get the following approximations.

2.8284 < π < 4.0000 2.9389 < π < 3.6327 3.0000 < π < 3.464

As n gets larger the approximations get better; when n = 100 we get

3.141 < π < 3.143,

and when n = 1000 we get

3.141587 < π < 3.141603.

This computation was among the first uses in antiquity of the idea of a limit; however,
it would be nearly two millennia before the concept of limit was formally defined and
given a logical foundation.
Newton and Leibniz used a concept of limit in the development of calculus, but
it was not until around 1820 that Bolzano and Cauchy formalized the definition of
limit. It was even later when it was finally written in the way most mathematicians
now use limits.

247
248 CHAPTER IX. INTRODUCTION TO ANALYSIS

34 Sequences
The infinite list of numbers
1 1 1 1 1 1
, , , , , ,...
1 2 3 4 5 6
is an example of what we shall call a sequence. Sequences arise naturally in many
contexts. For instance, you might measure the speed of a race car every second and
produce a list of speeds. Or you could measure, over time, the temperature of heated
metal. Maybe your list of numbers is the total population in a bacterial culture,
measured every morning in the lab.
In all these cases, the numbers give us a brief glimpse at a process that could
continue on forever. Extrapolating from the data, we might make a guess about how
the sequence behaves, or perhaps fit it to a nice function. For instance, you might
guess that the list of numbers above comes from the function 1/n, as n ranges over
the natural numbers (and you’d be right!).
A fundamentally important question we can ask is: Where are these numbers
headed? Scientists use the mathematical theory developed in this section to determine
the eventual behavior, or limit, of such sequences.

34.A What are sequences, exactly?


The formal definition of a sequence is as follows.

Definition 34.1. A sequence is a function f : N → R. The image f (n) of


n ∈ N is called the nth term of the sequence. Often we will write the terms of
a sequence with subscripts; i.e., we write them as

a1 , a2 , a3 , . . .

where an = f (n).

Example 34.2. It is important to be able to pass back and forth between a list of
numbers and the function that defines the list.
For example, define a function f : N → R by the rule f (n) = 2n. Thus, the
nth term of our sequence is an = 2n, and the first few terms are given as follows:
a1 = 2, a2 = 4, a3 = 6, a4 = 8, a5 = 10, . . ..
On the other hand, if you are given the list of numbers 2, 4, 8, 16, . . ., then you
might guess that this sequence arises from the function g : N → R given by the rule
g(n) = 2n . 4

Example 34.3. Try to figure out the rule for the following sequences:
(1) −1, 1, −1, 1, −1, 1, . . .,
(2) 1, 3, 5, 7, . . .,
(3) 1, 0, 0, 0, 0, . . ., and
(4) −10, 18397863, 2, 939, −10383, . . ..
34. SEQUENCES 249

Here are some possible answers:


(1) an = (−1)n ,
(2) an = 2n − 1,
(3) an = 0n−1 (or you could give a piecewise definition), and
(4) not enough information to find a pattern! 4

Definition 34.4. If we wish to refer to a sequence a1 , a2 , a3 , . . ., we may use the


notation
(an )n∈N .

Example 34.5. Define an = 2n . If we wish to refer to the sequence


a1 , a2 , a3 , . . .
we could write (an )n∈N or (2n )n∈N . Both notations would refer to the sequence
2, 4, 8, . . . . 4

34.B Arithmetic sequences


Each of the following sequences have something in common. See if you can discover
what it is.
1, 3, 5, 7, 9, . . .
13, 8, 3, −2, −7, . . .
6, 9, 12, 15, 18, . . .
Answer: Each term in the sequence is a fixed distance from the previous term.
In the first sequence, the terms jump by adding 2, in the second sequence they jump
by adding −5, and in the last sequence the terms jump by adding 3.
These types of sequences are so common we give them a special name.

Definition 34.6. Let c, d ∈ R. The sequence given by the formula

an = c + (n − 1)d

for each n ∈ N is called the arithmetic sequence with first term c and common
difference d.

Example 34.7. The arithmetic sequence with first term 2 and common difference 2
has terms
a1 = 2, a2 = 4, a3 = 6, a4 = 8, a5 = 10, . . .
The nth term is given by the formula an = 2 + (n − 1)2 = 2n. 4
Can you find the first six terms of the arithmetic sequence with first term π and
common difference −e?
250 CHAPTER IX. INTRODUCTION TO ANALYSIS

34.C Geometric sequences


There is a second very common type of sequence. Look to see if you can find what
the following sequences have in common.

1, 2, 4, 8, 16, 32, . . .
1, 1/2, 1/4, 1/8, 1/16, . . .
3, −6, 12, −24, 48, . . .

Answer: Each term in the sequence is a fixed multiple of the previous term. In
the first sequence we multiply each term by 2 to get the next term, in the second
sequence we multiply by 1/2, and in the third sequence we multiply by −2.

Definition 34.8. Let c, r ∈ R. The sequence given by the formula

an = c · rn−1

for each n ∈ N is called the geometric sequence with first term c and common
ratio r.

Example 34.9. The geometric sequence with first term 4 and common ratio 1/10 is
given by the formula
 n−1
1
an = 4
10

and the first few terms are


4, 4/10, 4/100, . . . 4

34.D Sequences and their limits


In this subsection we will discuss what it means for a sequence to approach a limit.
To give an example, consider the sequence defined by the rule an = n1 , given at the
beginning of this section. This sequence begins

1 1 1 1 1 1
, , , , , ,...
1 2 3 4 5 6

It appears that the limit should be 0; the terms are getting closer and closer to 0.
We will now give the formal definition of what it means for a sequence to approach
a limit. This definition is quite complicated, so we will explain the true meaning
behind the symbols afterwards.
34. SEQUENCES 251

Definition 34.10. Given a sequence (an )n∈N , we say that it converges to L ∈ R


if the following holds:

(34.11) ∀ε ∈ R>0 , ∃N ∈ R, ∀n ∈ N, n > N ⇒ |an − L| < ε.

In this case, we say that L is a limit of the sequence.


If a sequence (an )n∈N converges to some L ∈ R, we say that the sequence
converges or that it is a convergent sequence. We write limn→∞ an = L.
If a sequence does not converge to any limit, we say that the sequence di-
verges, or that it is a divergent sequence.

We will spend the rest of this section studying this definition and coming to an
understanding of what it means. We begin by peeling off each of the quantifiers.
What is ε? The first quantifier is “∀ε ∈ R>0 .” The variable ε is used to help us
measure how close the sequence gets to the limit L. We want to be able to prove that
our sequence can get arbitrarily close to the limit L. Thus, we want to prove that our
sequence eventually gets within a distance of 1/100 of the limit, but also eventually
within a distance of 1/1000 of the limit, and eventually within 1/10000, and so forth.
Thus, we do not just take ε = 1/100, we allow it to be any positive constant.
What is N ? The second quantifier is “∃N ∈ R.” The variable N helps us tell
how far along the sequence we must go, so that after that point the sequence stays
within a distance of ε from the limit.
For instance, again consider the sequence 1, 1/2, 1/3, . . .. When ε = 1/2, how far
along the sequence do we need to travel until it stays within a distance 1/2 of the
limit L = 0? We see that by the time we reach the second term, all of the rest of
the terms are within a distance of 1/2 from 0. When ε = 1/100, we now must take
N = 100. For even smaller values of ε, we have to take larger values of N so that the
sequence stays that close to the limit.
Note that the second quantifier is existential. This means that you must fix a
specific value of N (depending on ε) that will satisfy the definition of limit. This
value of N will usually be found in scratch work, outside the proof. This is often the
hardest part of a limit proof, and we will show how this is to be done shortly.
What is n? The third and final quantifier is “∀n ∈ N.” The variable n is just
one of the subscripts in our sequence.
What does the premise of the implication, n > N , say? The condition
n > N just tells us that we will only look at the terms in the sequence past N . When
looking at limits, we really only care about what eventually happens.
What does the conclusion of the implication, |an − L| < ε, say? The
condition |an − L| < ε is just an easy way of saying that the nth term of our sequence
is within a distance of ε from the limit L. Equivalently, by removing the absolute
value signs, we may write L − ε < an < L + ε.
Proving Limits. Every proof of a limit for a sequence will look essentially the
same. First you must deal with each of the quantified variables. The universal (for
all) variables must be left arbitrary. The existential variables must be fixed, but only
252 CHAPTER IX. INTRODUCTION TO ANALYSIS

in terms of previous variables. The implication is usually dealt with directly.

Proof outline.
Let ε > 0.
Fix N = found from scratch work ∈ R.
Let n ∈ N.
Assume n > N .
Do some work (usually by reversing the scratch work).
Conclude |an − L| < ε.

We will show how this is accomplished, by proving the following result.

Theorem 34.12.
1
lim = 0.
n→∞ n

Scratch. This work should not appear on your homework, or in your proof.
Start with the conclusion |an − L| < ε. We know that an = 1/n and L = 0. So
the inequality becomes |1/n − 0| < ε. In other words |1/n| < ε. Since 1/n is positive,
the absolute value signs disappear, and we have 1/n < ε, or in other words n > 1/ε.
This will be our value for N . F

We are now ready to do the proof.

Proof. Let ε > 0. Fix N = 1/ε ∈ R. Let n ∈ N. Assume n > N . Thus, n > 1/ε.
Taking reciprocals (noting that both sides of the inequality are positive), we get
1/n < ε. Hence,
|an − L| = |1/n − 0| = 1/n < ε
as desired.

Let’s do another example.

Proposition 34.13. Given the sequence (an )n∈N defined by an = 1 − n3 , then

lim an = 1.
n→∞

Scratch. Start with |an − L| < ε. Plugging in the values for an and L, we have
 
3
1− − 1 < ε.
n

Simplifying we have |−3/n| < ε. Since n > 0 we have |−3/n| = 3/n. Hence, we may
write 3/n < ε. Solving for n, we get n > 3/ε. This is our value for N . F

With the scratch work done, the proof is straightforward.


34. SEQUENCES 253

Proof. Let ε > 0. Fix N = 3/ε ∈ R. Let n ∈ N. Assume n > N . Thus n > 3/ε.
Since ε and n are positive, we get 3/n < ε. Thus
 
3 3 3
|an − L| = 1 − −1 = − = <ε
n n n
as desired.

Warning 34.14. In the previous examples, each term of the sequence is closer
to the limit L than the previous term. It is tempting to think that this is a
valid definition of a limit; i.e., the terms get closer and closer to L without ever
actually reaching L or getting farther away. In the next example, we will see
that this is not true.

Proposition 34.15. Define a sequence (an )n∈N by the formula


(
1
if n is odd,
an = n
0 if n is even.

We have
lim an = 0.
n→∞

This example is interesting because the sequence actually reaches the limit (every
even numbered term is equal to the limit) and moves away from the limit infinitely
often (each odd numbered term is farther from the limit than the previous term).
However, it does not move too far away from the limit.
Scratch. Start with |an − L| < ε. There are two cases.
Case 1: Suppose n is odd. Then an = 1/n so our inequality becomes |1/n−0| < ε.
Solving for n, as before, we reach n > 1/ε.
Case 2: Suppose n is even. Then an = 0 and our inequality becomes |0 − 0| < ε.
This is true no matter the value of n, so in this case any value of N will work.
We must use an N that works in every case. Thus N = 1/ε should suffice. F
With our scratch work completed, the proof now follows.
Proof. Let ε > 0. Fix N = 1/ε ∈ R. Let n ∈ N. Assume n > N . We have two cases
to consider.
Case 1: Suppose n is odd. In this case we have
|an − L| = |1/n − 0| = 1/n < 1/N = ε.
Case 2: Suppose n is even. In this case we have
|an − L| = |0 − 0| = 0 < ε.
Thus, in every case we have |an − L| < ε.
254 CHAPTER IX. INTRODUCTION TO ANALYSIS

34.E Divergence
Remember that in order for a sequence a1 , a2 , a3 , . . . to converge, we have:

∃L ∈ R, ∀ε ∈ R>0 , ∃N ∈ R, ∀n ∈ N, n > N ⇒ |an − L| < ε.

Thus, to prove that the sequence is divergent we need to prove:

∀L ∈ R, ∃ε ∈ R>0 , ∀N ∈ R, ∃n ∈ N, n > N ∧ |an − L| ≥ ε.

As you can see, each of the four different quantifiers has been changed.
We start a divergence proof by letting L ∈ R be arbitrary. Subsequently, we must
find some ε so that our sequence will continue to have some terms at least ε away
from L. (Thus, ε usually depends on L.) We let N ∈ R be arbitrary, and must find
a subscript n, past N , such that an has distance more than ε from L.
We will do one example, where ε does not depend on L.

Proposition 34.16. Given the sequence (an )n∈N defined by an = (−1)n , then
an is divergent.

Proof. Let L ∈ R. Fix ε = 1/2 ∈ R>0 . Let N ∈ R. To find a term in our sequence
that is at least distance 1/2 from L we consider two cases.
Case 1: Suppose L ≥ 0. Fix n ∈ N to be the smallest odd integer with n > N .
Since n is odd, an = −1. We find

|an − L| = |(−1) − L| = L + 1 > 1/2 = ε.

Case 2: Suppose L < 0. In this case we fix n ∈ N to be the smallest even integer
with n > N . Since n is even, an = 1. We find

|an − L| = |1 − L| = 1 − L > 1/2 = ε

(since L < 0, we know −L > 0, hence 1 − L > 1).


In every case, we fixed some n ∈ N satisfying both of the inequalities n > N and
|an − L| > ε.

34.F One more limit trick


Sometimes when proving that a limit exists it will be useful to use one of the following
functions to specify the value of N .

Definition 34.17. Let a, b ∈ R. We define the maximum and minimum of


these two numbers to be
( (
a if a ≥ b, a if a ≤ b,
max(a, b) = and min(a, b) =
b if a < b b if a > b.
34. SEQUENCES 255

Example 34.18. Fix a = 5 and b = 6. Then max(a, b) = 6 and min(a, b) = 5. Let


x ∈ R, and fix y = max(x, 1) and z = min(x, 1). Then y ≥ 1 and z ≤ 1. 4

Here is an example of a limit proof in which it is useful to specify N as the


maximum of two numbers.

Proposition 34.19. Define a sequence (an )n∈N by the formula


n+3
an = .
2n − 21
Then
1
lim an = .
n→∞ 2

Scratch. Once again, we start our scratch work by considering |an − L| < ε, and try
to solve for n. Thus, we want

n+3 1
− < ε.
2n − 21 2

Finding a common denominator, we obtain

2(n + 3) − (2n − 21)


< ε,
2(2n − 21)

or in other words 27/|4n − 42| < ε. Thus, we reduce to |4n − 42| > 27/ε.
There are two possibilities here, depending on whether 4n − 42 is positive or
negative. (Note: It is never zero since n ∈ N.) In the positive case we want
27
4n − 42 > ,
ε
which reduces (after some algebra) to
27 + 42ε
(34.20) n> .

In the case when 4n − 42 is negative, we want
27
42 − 4n > ,
ε
which reduces to
42ε − 27
(34.21) n< .

Inequality (34.21) does not help us since we want to find a lower bound on n. Thus,
we must guarantee that case never happens, or in other words, we must guarantee
256 CHAPTER IX. INTRODUCTION TO ANALYSIS

that 4n − 42 is positive. This means we want to take 4n − 42 > 0, or in other words


n > 21/2. Combining this with (34.20), we want to take
 
21 27 + 42ε
N = max , ,
2 4ε

so that if n > N then n is greater than both 21/2 and (27 + 42ε)/(4ε). F

We are now ready to begin our proof.

Proof. Let ε > 0. Fix N = max(21/2, (27 + 42ε)/4ε) ∈ R. Let n ∈ N. Assume


n > N . Using the fact that N ≥ 21/2, we have 4n − 42 > 4N − 42 ≥ 0. We also find

27 + 42ε 27
4n − 42 > 4N − 42 ≥ 4 − 42 = .
4ε ε
Hence, we find that

n+3 1 27 27 27
|an − L| = − = = < = ε.
2n − 21 2 4n − 42 4n − 42 27/ε

The trick used in the proof above is that we can use maximums to guarantee our
sequence is far enough along so that it behaves in a certain way (in this case, we
needed it to stay positive).

34.G Exercises
Exercise 34.1. Write the first six terms, and determine the nth term an , for each of
the following sequences.
(a) An arithmetic sequence with first term 5 and common difference −3.
(b) A geometric sequence with first term 4 and common ratio 2.
(c) An arithmetic sequence with first term 1/2 and common difference 3/4.
(d) A geometric sequence with first term 3/5 and common ratio 2/3.

Exercise 34.2. Translate the following phrases into symbolic logic. (Your answer
should include any necessary quantifications on the variables ε, N , and n.)
(a) The sequence (an )n∈N defined by an = 3 − 4/n converges to L = 3.
(b) The sequence (an )n∈N defined by an = 6 does not converge to L = 3. (Note:
This sequence does converge to L = 6.)

Exercise 34.3. Let a, b, x ∈ R. Prove the following facts.


(a) max(a, b) ≥ a and max(a, b) ≥ b.
(b) min(a, b) ≤ a and min(a, b) ≤ b.
(c) If x > max(a, b), then x > a and x > b.

Exercise 34.4. Prove that


2
lim = 0.
n→∞ n2
34. SEQUENCES 257

Exercise 34.5. Prove that


3n − 5 3
lim = .
2n + 4
n→∞ 2
(Hint: When n ∈ N, then 2n + 4 is always positive, so you don’t have to worry about
when it is negative.)

Exercise 34.6. Prove or disprove: The sequence (an )n∈N defined by an = (n + 1)/n
converges. (Hint: On scratch paper, write out the first ten terms to see if the sequence
is going somewhere.)

Exercise 34.7. Let c ∈ R. Assume that (an )n∈N is the arithmetic sequence with first
term c and common difference 0. Prove that the sequence (an )n∈N converges to c. (In
other words, prove that the constant sequence c, c, c, . . . converges to c.)

Exercise 34.8. Prove that the sequence (an )n∈N defined by an = n does not converge
to L = 3.

Exercise 34.9. Prove that limn→∞ ( n2 + 1 − n) = 0.

Exercise 34.10. Assume that (an )n∈N is the geometric sequence with first term c
and common ratio r, for some c, r ∈ R. Prove the following statements.
(a) If |r| < 1, then an converges to 0.
(b) If c 6= 0 and an converges to 0, then |r| < 1.
(c) If c > 0 and r > 1, then an diverges.
(Feel free to use laws of logarithms as well as the fact that if a, b ∈ R with 0 < a < b,
then ln(a) < ln(b). In particular, when 0 < r < 1 we have ln(r) < 0, and when r > 1
we have ln(r) > 0.)
258 CHAPTER IX. INTRODUCTION TO ANALYSIS

35 Series
In this section we introduce the idea of adding infinitely many objects together. There
are many applications for these ideas, which lead naturally into the development of
the integral in calculus.

35.A What is a series?


We write ∞
P
n=1 an to denote the series a1 + a2 + a3 + · · · . But what does this really
mean?
The numbers an form a sequence, which we call the terms or the summands of
the series. From those terms, we can form an entirely new sequence with terms
s1 = a1 ,
s2 = a1 + a2 ,
s3 = a1 + a2 + a3 ,
s4 = a1 + a2 + a3 + a4 ,
..
.
which is called the sequence of partial sums. These sums are only the beginning
portion of the series, which is why we call them partial sums. We can also define the
partial sums using the more compact formula
(35.1) sn+1 = sn + an+1 ,
which we sometimes will find P∞useful.
We say that the series n=1 an converges to a sum S if limn→∞ sn = S. In other
words, the series converges when the sequence of partial sums converges. Thus, the
methods of the previous section apply.
When first working with series it is important to note that the sequence of terms
a1 , a2 , a3 , . . . is very different from the sequence of partial sums s1 , s2 , s3 , . . .. For
instance, it is possible that the terms converge but the partial sums diverge.
In the next two examples, we will investigate how to describe the partial sums
when given a sequence of summands.
Example 35.2. Define (an )n∈N by the rule an = 1. In other words, (an )n∈N is the
constant sequence of 1’s. We find that the partial sums for this sequence are
s1 = a1 = 1,
s2 = a1 + a2 = 1 + 1 = 2,
s3 = a1 + a2 + a3 = 1 + 1 + 1 = 3,
s4 = a1 + a2 + a3 + a4 = 1 + 1 + 1 + 1 = 4,
..
.
and we would guess that, in general, sn = n. We will prove that our guess is correct,
by induction.
35. SERIES 259

Proof. Base case: When n = 1, we have s1 = 1.


Inductive step: Assume sk = k for some integer k ≥ 1. We want to show
sk+1 = k + 1. Using (35.1), we have

sk+1 = sk + ak+1 = sk + 1 = k + 1,

since sk = k by the inductive hypothesis. 

In this example the sequence of terms a1 , a2 , a3 , . . . converges to 1. However, the


sequence of partial sums s1 , s2 , s3 , . . . diverges. 4

Example 35.3. Consider the sequence (bn )n∈N defined by the rule

1 1
bn = − .
n n+1
The first few terms in this sequence are given by

1 1 1
b1 = − = ,
1 2 2
1 1 1
b2 = − = ,
2 3 6
1 1 1
b3 = − = , and
3 4 12
1 1 1
b4 = − = ,
4 5 20
and it appears that this sequence is converging (fairly quickly) to 0.
Now consider the sequence of partial sums. The first few terms are

1
s 1 = b1 = ,
2
1 1 2
s 2 = b1 + b2 = s 1 + b2 = + = ,
2 6 3
2 1 3
s 3 = b1 + b2 + b3 = s 2 + b3 = + = ,
3 12 4
3 1 4
s 4 = b1 + b2 + b3 + b4 = s 3 + b4 = + = , and
4 20 5
4 1 5
s 5 = b1 + b2 + b3 + b4 + b5 = s 4 + b5 = + = .
5 30 6
They appear to be converging to 1. Before we can prove convergence, we need more
information about the sequence of partial sums.
1
It appears that the partial sums are given by the rule sn = 1 − n+1 . (Try it for
the first four terms above.) We will now prove that this is correct, by induction.
260 CHAPTER IX. INTRODUCTION TO ANALYSIS

Proof. Base case: When n = 1, then s1 = 1/2 = 1 − 1/2.


Inductive step: Assume sk = 1 − 1/(k + 1) for some integer k ≥ 1. We want to
show sk+1 = 1 − 1/(k + 2). Using (35.1), we have
   
1 1 1 1
sk+1 = sk + bk+1 = 1 − + − =1−
k+1 k+1 k+2 k+2

as desired. 

Now that we know sn = 1 − 1/(n + 1), we can prove limn→∞ sn = 1. We will not
include the scratch work, but here is the proof.
1
Proof. Let ε > 0. Fix N = ε
− 1 ∈ R. Let n ∈ N. Assume n > N . We find

1 1 1
|sn − S| = 1 − −1 = < =ε
n+1 n+1 N +1

as desired. 

This finishes our proof that ∞ 1 1


P 
n=1 n − n+1
= 1. Those who have taken calculus
might recognize that this is a telescoping sum, which makes it much easier to simplify.
4

Advice 35.4. To prove that a series converges try the following steps:
(1) Compute a few partial sums.
(2) Conjecture a general formula for the partial sums.
(3) Prove that formula by induction.
(4) Using your formula for the partial sums, find the limit.
(5) Finally, prove that the partial sums converge to that limit.

We will demonstrate how to prove convergence of series with one more example,
leaving most of the work as Exercise 35.3.

Example 35.5. Consider the series ∞ 1


P
n=1 2n . The first few partial sums work out to
be 1/2, 3/4, 7/8, 15/16, . . .. By induction, we can prove that

1
sn = 1 − .
2n
These partial sums converge to 1. 4

We now prove a powerful result that can often be used to show that a series does
not converge. We first state and prove the result in terms of convergence, and give
the contrapositive (in terms of divergence) as a corollary. Before reading this proof,
it might be helpful to review the triangle inequality (Theorem 8.21).
35. SERIES 261

Theorem 35.6. Let (an )n∈N be a sequence of real numbers. If the series

X
ai
i=1

converges, then
lim an = 0.
n→∞

Proof. We will write


n
X
sn = ai
i=1

for the partial sums of the series. The theorem asserts that if limn→∞ sn exists, then
limn→∞ an = 0. Note that for any integer n ≥ 2, we have sn − sn−1 = an .
Assume that the series converges; in other words, assume that the sequence (sn )n∈N
of partial sums converges to some limit L. Our goal is now to show that

lim an = 0.
n→∞

Let ε > 0 be arbitrary. We wish to find an N ∈ R such that for any natural
number n > N , we have |an | < ε.
Since ε > 0, we also have that ε/2 > 0. Hence, since the sequence (sn )n∈N
converges, there is some M ∈ R such that for any natural number n > M , we have
|sn − L| < ε/2. Taking N = M + 1, and letting n be a natural number with n > N ,
then both n and n − 1 are greater than M . Hence,

|sn − L| < ε/2 and |sn−1 − L| < ε/2.

Therefore,

|an | = |sn − sn−1 |


= |(sn − L) + (L − sn−1 )|
≤ |sn − L| + |L − sn−1 | (by the triangle inequality)
= |sn − L| + |sn−1 − L|
< ε/2 + ε/2
= ε.

We thus see that for this value of N , it is true that for any natural number n > N
we have |an − 0| < ε. Therefore
lim an = 0.
n→∞
262 CHAPTER IX. INTRODUCTION TO ANALYSIS

Corollary 35.7. Let (an )n∈N be a sequence of real numbers. If

lim an 6= 0
n→∞

then ∞
X
ai
i=1

does not converge.

Example 35.8. The series



X i+3
i=1
2i − 21
does not converge, because
n+3 1
lim = 6= 0
n→∞ 2n − 21 2
by Proposition 34.19. 4
Example 35.9. The series

X
(−1)i
i=1

does not converge, since


lim (−1)n
n→∞

does not exist (see Proposition 34.16), and hence does not equal 0. 4
Note that the converse of Theorem 35.6 does not hold; it is possible for

lim an = 0
n→∞

to hold while ∞
X
ai
i=1

does not converge. See Exercise 35.5 for an example.

35.B Exercises
Exercise 35.1. Consider the sequence (an )n∈N given by the rule an = n. Find the
first 6 terms of the sequence of partial sums (sn )n∈N . Conjecture a simple formula for
sn and prove it.
Exercise 35.2. Let c, d ∈ R and fix (an )n∈N to be the arithmetic sequence defined
by an = c + (n − 1)d. (This is the arithmetic sequence withP
first term c and common
difference d.) Find a formula for the nth partial sum sn = nk=1 ak and prove it.
35. SERIES 263

Exercise 35.3. Give a complete proof that



X
1/2n = 1,
n=1

by filling in the missing details from Example 35.5. This should include:
(a) Giving a proof (by induction) that sn = 1 − 1/2n .
(b) Giving a proof that lim sn = 1.
n→∞

X 1
Exercise 35.4. Prove or disprove: The series converges.
n=1
3n
P∞ 1
Exercise 35.5. In this exercise we will show that the harmonic series k=1 k does
not converge. Throughout the exercise, for each integer n ≥ 1 take
n
X 1
sn = ,
k=1
k

which is the nth partial sum.


(a) The main idea for showing that the harmonic series diverges is to break the
series into pieces
1 1 1 1 1 1 1 1 1 1 1
1+ + + + + + + + + + ··· + + +··· ,
2 3 4 5 6 7 8 9 10 15 16
|{z} | {z } | {z } | {z }
t1 t2 t3 t4

where each box contains twice as many terms as the previous box.
Notice that
1 1
t1 = ≥ ,
2 2
1 1 1 1 1 1
t2 = + ≥ + = 2 · = , and
3 4 4 4 4 2
1 1 1 1 1 1 1 1 1 1
t3 = + + + ≥ + + + = 4 · = ,
5 6 7 8 8 8 8 8 8 2
where the inequalities come from replacing terms with possibly smaller fractions.
In general, for each integer n ≥ 1 define
2n−1 +2n−1 2 n
X 1 X 1 1 1
tn = = = n−1 + ··· + n.
k k 2 +1 2
k=2n−1 +1 k=2n−1 +1

Prove that tn ≥ 12 for each integer n ≥ 1. (Hint: How many terms are being
added? What is the smallest one?)
(b) Show that s2n ≥ 1 + n2 , for each integer n ≥ 0, by induction.
(Hint: For each integer n ≥ 0, we have s2n+1 = s2n + tn+1 .)
(c) Now show that the harmonic series does not converge.
264 CHAPTER IX. INTRODUCTION TO ANALYSIS

36 Limits of functions
Define f : R − {0} → R by the rule
sin x
f (x) = .
x
If we evaluate this function for some values of x near 0, we find the following interesting
behavior.
x 0.1 0.01 0.001
f (x) 0.998334 0.999983 0.999999
It appears that as x gets close to 0, the value of f (x) gets close to 1. (Note that we
cannot just plug x = 0 into the function, since that would result in division by 0.)
The graph of the function f (x) seems to confirm this behavior.

1.5 y

0.5

x
−10 −5 5 10

−0.5

However, graphs can sometimes be misleading. Thus, in this section we will


formalize what we mean when we say that a function approaches a value. This will
become our definition of the limit of a function.

36.A Windows
In the example above, there are two related quantities we focus upon: the input x of
the function, and the output f (x). We are interested in the behavior of the outputs
f (x) as x approaches some fixed constant, which we might call the point of interest.
In the previous example that point of interest is 0, but more generally we use the
letter a ∈ R to describe the place where x is headed. Sometimes we write x → a as
shorthand for the sentence “as x goes towards the point of interest a.”
Similarly, we use the letter L to denote the limiting value that f (x) approaches
(if any) as x → a. We might write f (x) → L to mean that “f (x) is approaching the
limit L.”
To formalize all of this, we start (just as with sequences) by letting ε > 0 denote
some (positive, arbitrarily small) quantity that tells us how close our function should
36. LIMITS OF FUNCTIONS 265

be to the limit L. For instance, in the example above, when ε = 1/4 we want our
function to stay between the two dashed lines in the graph below.

1.5 y

0.5

x
−10 −5 5 10

−0.5

The top dashed line is y = L + ε and the bottom dashed line is y = L − ε. We


want the graph of y = f (x) to stay between these two lines, but of course, as you can
plainly see, the function does not stay between those two lines everywhere. However,
it does stay between those two lines near the point of interest a = 0.
The next question we must answer is: How close must the input x get to the point
of interest a so that the output f (x) stays between those two lines? For example,
let’s add two (green) vertical dashed lines to our previous graph, which tell us exactly
how far away from a = 0 the values of x can range before the function takes on values
outside the band bordered by the (red) horizontal dashed lines.

1.5 y

0.5

x
−10 −5 5 10

−0.5

Those vertical lines are (approximately) x = 1.275698 and x = −1.275698. Thus


we see that x can vary as much as 1.275698 away from the point of interest, and our
function stays within ε = 1/4 of the limit. If we take a smaller value of ε, then we
have less room to vary.
Those two horizontal lines along with the two vertical lines give us a window (the
rectangle in the middle). As we take smaller values of ε, that window should squeeze
266 CHAPTER IX. INTRODUCTION TO ANALYSIS

in on the limit L. Notice that if the graph of our function has points between the two
green lines that are also either above the top red line or below the bottom red line
(i.e., directly above or below the window), then we have not placed the vertical lines
correctly.
We let δ > 0 be a variable that measures (given some ε) how far x can vary away
from the point of interest and still guarantee that f (x) stays within a distance of ε
from the limit value L. In other words, δ is some constant small enough that the
vertical lines x = a + δ and x = a − δ together with the horizontal lines y = L + ε
and y = L − ε produce a window for our function.

36.B Limit definition


We begin by defining certain subsets of R.

Definition 36.1. A deleted neighborhood of a ∈ R is a subset of R of the form


(c, d) − {a}, where c < d are real, and a ∈ (c, d) ⊆ R.

We can think of a deleted neighborhood as a set of real numbers that contains all
the points “close to” a (but does not contain a itself).
Example 36.2. Fix a = 2. Some deleted neighborhoods of a include

(−10, 2.1) − {2}, (1, 3) − {2}, (1.9999999, 2.00000001) − {2}. 4

We are now equipped to give the formal definition of what we mean by a limit for
functions. Afterwards, we will explain all of the notation.

Definition 36.3. Suppose we are given a point of interest a ∈ R, and a possible


limit value L ∈ R, along with a function f : S → R, where S is a subset of R
that includes some deleted neighborhood of a. We write

lim f (x) = L
x→a

to mean that

∀ε ∈ R>0 , ∃δ ∈ R>0 , ∀x ∈ S, 0 < |x − a| < δ ⇒ |f (x) − L| < ε.

In this case we say that the limit of the function f , as x approaches the point
of interest a, is the real number L.

What is ε? As before, ε measures how close the function gets to the limit L. It
is allowed to get arbitrarily small.
What is δ? The second quantifier is “∃δ ∈ R>0 ”. The variable δ measures how
close x must be to the point a in order for our function to stay within ε of the limit.
It must be fixed in terms of ε.
36. LIMITS OF FUNCTIONS 267

What is S? The domain of the function f is S; it is the set of real numbers


on which f is defined. We want f (x) to be defined for any real number x that is
“close to” a, but not necessarily at a. We do this by requiring that some deleted
neighborhood of a is a subset of S. This reflects the idea that a limit depends on
what happens near (but not at) a.
What is x? It is the variable we are plugging into our function f .
What does the premise of the implication, 0 < |x − a| < δ, say? It says two
different things. First, the inequality 0 < |x − a| tells us that x 6= a. When defining
limits, we do not care what f (x) actually does at x = a, only what it does nearby.
Second, the inequality |x − a| < δ tells us that x is allowed to range only a distance
of δ away from the point of interest.
What does the conclusion of the implication, |f (x) − L| < ε, say? This
condition says that the function value f (x) is within a distance of ε from the limit L.
Equivalently, by removing the absolute value signs, we may write −ε < f (x) − L < ε,
or in other words, L − ε < f (x) < L + ε.
When handling limits, each proof should look nearly the same. We give the general
outline of such a proof below. The reader should note how each quantifier is dealt
with in turn, and the implication will be proved directly.

Proof outline.
Let ε > 0.
Fix δ = found in scratch work > 0.
Let x ∈ S.
Assume 0 < |x − a| < δ.
Reverse the steps in scratch work.
Conclude that |f (x) − L| < ε.

36.C Examples of limits


Some of the easiest limits are for linear functions.

Example 36.4. Fix f (x) = 3x + 2, fix a = 2, and fix L = 8. (Note: If we plug x = 2


into f , we get f (2) = 8. In this case we do believe that the limit will also equal the
function’s value at the point of interest.) We will show that

lim 3x + 2 = 8.
x→2

Scratch. Since this is the scratch work, we start with the conclusion |f (x) − L| < ε,
and try to eventually get information about the quantity |x − a| = |x − 2|. We have

|f (x) − L| = |(3x + 2) − 8| = |3x − 6| = 3|x − 2|.

Thus we want 3|x − 2| < ε, or in other words |x − 2| < ε/3. This tells us what value
for δ we should use. F

With the scratch work done, we can now give the formal proof.
268 CHAPTER IX. INTRODUCTION TO ANALYSIS

Proof. Let ε > 0. Fix δ = ε/3 > 0. Let x ∈ R. Assume 0 < |x − 2| < δ. We then find
|f (x) − L| = |(3x + 2) − 8| = |3x − 6| = 3|x − 2| < 3δ = 3(ε/3) = ε
as desired. 
Limits for other linear polynomials will work similarly. 4
Example 36.5. We find L ∈ R such that lim −2x + 3 = L.
x→−1
Set f (x) = −2x + 3. Plugging in the point of interest a = −1, we find that
f (−1) = (−2)(−1) + 3 = 5. Thus we would guess the limit is L = 5. We now prove
it (without including our scratch work).
Proof. Let ε > 0. Fix δ = ε/2 > 0. Let x ∈ R. Assume 0 < |x − (−1)| < δ. We find
|f (x) − L| = |(−2x + 3) − 5| = |−2x − 2| = 2|x + 1| < 2δ = 2(ε/2) = ε
as desired. 
When working with a linear function f (x) = cx + d (for some constants c, d ∈ R
with c 6= 0) the best value for δ should be δ = ε/|c|. In this example we have c = −2
and indeed, the value for δ was ε/|c|. 4
There is one last trick that will help us to evaluate limits. In limit proofs we have
one assumption, namely
0 < |x − a| < δ.
However, we also have some control on which δ we fix. If we guarantee that δ ≤ 1,
then our assumption gives us |x − a| < 1, or in other words
a − 1 < x < a + 1.
This allows us to limit x a lot. (If we need an even smaller interval containing x,
we can take δ even smaller.) We will use this idea to find the limit of a quadratic
function.

Proposition 36.6. lim x2 + x = 2.


x→1

We will include the scratch work, so you can see how this is done. (Normally, it
should not appear in your proof.)
Scratch. Start with |f (x) − L| < ε. We have f (x) = x2 + x and L = 2, and so
plugging in those values we want |x2 + x − 2| < ε. If we factor the left side of the
inequality, we get
(36.7) |x − 1| · |x + 2| < ε.
At this point, one might want to take δ = ε/|x + 2|, but δ must not depend on x.
(Why?) To handle this issue, we bound |x + 2| as follows. Assuming δ ≤ 1, we get
|x − 1| < δ ≤ 1, and hence −1 < x − 1 < 1. Thus, by adding 3 throughout, we have
2 < x + 2 < 4. Now 2 < |x + 2| < 4. Using this bound in (36.7), we see that we need
|x − 1| < ε/4. F
36. LIMITS OF FUNCTIONS 269

We are now ready for the proof.


Proof. Let ε > 0. Fix δ = min(1, ε/4) > 0. Let x ∈ R. Assume that we have
0 < |x − 1| < δ. First, since δ ≤ 1, this tells us |x − 1| < 1, so −1 < x − 1 < 1.
Therefore 2 < x + 2 < 4, and taking absolute values we get |x + 2| < 4. Second, since
δ ≤ ε/4 we find

|f (x) − L| = |(x2 + x) − 2| = |x − 1||x + 2| < δ · 4 ≤ (ε/4)4 = ε

as desired.
We end this section with one final example of a limit proof.

Proposition 36.8.
2x + 1 5
lim = .
x→2 3x + 2 8

Before reading the proof below, try to do the scratch work yourself, and see if it
helps you figure out the choices made in the proof.
Proof. Let ε > 0. Fix δ = min(1, 40ε) > 0. Let x ∈ R−{−2/3}. (Notice that we have
to avoid x = −2/3 since the function is not defined there.) Assume 0 < |x − 2| < δ.
First, since δ ≤ 1, this tells us |x − 2| < 1 hence −1 < x − 2 < 1. Adding 2 we
get 1 < x < 3. Multiplying by 3 and adding 2, we get 5 < 3x + 2 < 11. Taking
reciprocals, we find that 1/11 < 1/(3x + 2) < 1/5. Then taking absolute values, we
have 1/|3x + 2| < 1/5. Second, since δ ≤ 40ε we find

2x + 1 5 x−2 |x − 2| δ 40ε
|f (x) − L| = − = = < ≤ = ε.
3x + 2 8 8(3x + 2) 8 · |3x + 2| 8·5 40

Advice 36.9. When simplifying |f (x) − L| you should expect that |x − a| is one
of the factors. That can help you simplify the expression (and also gives a quick
double-check that you have not made an algebra mistake).

36.D Exercises
Exercise 36.1. Prove that
lim 2x + 3 = 11.
x→4

Exercise 36.2. Let a, c, d ∈ R. Prove that

lim cx + d = ca + d.
x→a

(Hint: Consider the cases in which c = 0 and c 6= 0, separately. Be sure that your
proof properly handles the case where c < 0.)
270 CHAPTER IX. INTRODUCTION TO ANALYSIS

Exercise 36.3. Prove that

lim x2 + 3x + 3 = 43.
x→5

Exercise 36.4. Prove that


7x + 4
lim = 2.
x→2 4x + 1
Exercise 36.5. Prove that

lim x3 + x2 + 2 = 38.
x→3
37. CONTINUITY 271

37 Continuity
37.A Defining continuity
Intuitively, continuity for a function f : R → R means that there are no holes or jumps
in the function. Put another way, if we focus on a point of interest a ∈ R, we need
f (a) to be defined, and for any x near a we want f (x) to be near f (a). Thus, there
are two separate conditions that combine to give the formal definition of continuity.

Definition 37.1. Let S ⊆ R. Given a function f : S → R and a point of interest


a ∈ S, we say that f is continuous at a if
(1) S includes an open interval around a and
(2) lim f (x) = f (a).
x→a
If a function is continuous at all points in its domain, we say that the function
is continuous (everywhere that it is defined).

Example 37.2. Define f : R → R by the rule f (x) = cx + d, where c, d ∈ R. By


Exercise 36.2, for any a ∈ R we have

lim f (x) = ca + d = f (a).


x→a

Hence, f is continuous at a for each a ∈ R. Since f is continuous at all points in its


domain, we can thus say that f is continuous. 4

Example 37.3. Fix f : R → R to be the characteristic function of the set [0, 1]. Then
(
1 if 0 ≤ x ≤ 1
f (x) =
0 otherwise.

One can check that f is continuous at each a ∈ R − {0, 1}. We will show that f is not
continuous at 1. (The other numbers in the domain are handled in Exercise 37.3.)
Note that f (1) = 1. Then we need to show that

lim f (x) = 1
x→1

is false. Hence, we need to show that

∃ε > 0, ∀δ > 0, ∃x ∈ R, (0 < |x − 1| < δ) ∧ (|f (x) − 1| ≥ ε).

Choose ε = 1/2. Let δ > 0 be arbitrary, and fix x = 1 + δ/2. We notice that
0 < |x − 1| = δ/2 < δ and, since x > 1,

|f (x) − 1| = |0 − 1| = 1 > ε.

Hence, f is not continuous at 1. 4


272 CHAPTER IX. INTRODUCTION TO ANALYSIS

Example 37.4. Define f : R≥0 → R by the rule f (x) = x. Note that 0 is in the
domain of f , but the domain of f does not include any open interval around 0.
Hence, f is not continuous at 0. Since 0 belongs to the domain of f , we see that f
is a discontinuous function. (Some texts would say this function is continuous at 0,
using an alternative definition of continuity for endpoints of intervals. This illustrates
that one must carefully check definitions when verifying statements.) 4

37.B Building new functions from old


We will now discuss several different ways to combine functions to form new functions.

Definition 37.5. Let A, B ⊆ R, and let f : A → R and g : B → R be functions.


We define a new function f + g : A ∩ B → R by the rule

(f + g)(x) = f (x) + g(x).

We may also define a new function f g : A ∩ B → R by

(f g)(x) = f (x)g(x).

If we fix B 0 = {x ∈ B : g(x) 6= 0}, we may define a function f /g : A ∩ B 0 → R


by
(f /g)(x) = f (x)/g(x).

Example 37.6. Fix f (x) = x2 and fix g(x) = 2x + 1, which are functions defined
on all real numbers. Then (f + g)(x) = x2 + 2x + 1 and (f g)(x) = x2 (2x + 1) are
functions defined on all real numbers. Note that g(x) = 0 when x = −1/2. Hence,
(f /g)(x) = x2 /(2x + 1) is a function defined on R − {−1/2}. 4

37.C Limit laws


When we build a function by adding or multiplying two known functions, it turns out
that we can prove that the limits of the functions interact nicely.

Theorem 37.7. Let f and g be real-valued functions defined on a deleted neigh-


borhood S of a ∈ R. Suppose that lim f (x) = L and lim g(x) = M . Then
x→a x→a

lim (f + g)(x) = L + M
x→a

Proof. Assume that limx→a f (x) = L and limx→a g(x) = M . We wish to show that
limx→a (f + g)(x) = L + M . We will do this by choosing an arbitrary ε and finding a
δ such that for any x ∈ S,

0 < |x − a| < δ ⇒ |(f + g)(x) − (L + M )| < ε.


37. CONTINUITY 273

Let ε > 0. Then ε/2 > 0. Hence, since limx→a f (x) = L, there is some δ1 > 0
such that for any x ∈ S, we have the implication

(37.8) 0 < |x − a| < δ1 ⇒ |f (x) − L| < ε/2.

Similarly, since limx→a g(x) = M , there is some δ2 > 0 such that for any x ∈ S, we
have

(37.9) 0 < |x − a| < δ2 ⇒ |g(x) − M | < ε/2.

Choose δ = min(δ1 , δ2 ). Let x ∈ S, and assume 0 < |x − a| < δ. Since δ ≤ δ1 , and


δ ≤ δ2 , from (37.8) and (37.9) we get

|f (x) − L| < ε/2 and |g(x) − M | < ε/2.

Now, using the triangle inequality we have

|(f + g)(x) − (L + M )| = |f (x) + g(x) − L − M |


= |(f (x) − L) + (g(x) − M )|
≤ |f (x) − L| + |g(x) − M |
< ε/2 + ε/2
= ε.

Hence,
lim (f + g)(x) = L + M.
x→a

Theorem 37.10. Let f and g be real-valued functions defined on a deleted neigh-


borhood S of a ∈ R. Suppose that lim f (x) = L and lim g(x) = M . Then
x→a x→a

lim (f g)(x) = LM.


x→a

Proof. We first do the proof under the assumption that one of L and M is not zero.
Without loss of generality, we assume that L 6= 0.
Let ε > 0. Then ε/(2|L|) > 0, so, since limx→a g(x) = M , we can find a δ1 > 0 so
that for any x ∈ S, if 0 < |x − a| < δ1 , we have |g(x) − M | < ε/(2|L|). Note that this
conclusion further implies that |g(x)| < |M | + ε/(2|L|).
Now
ε
> 0,
2 (ε/(2|L|) + |M |)
so there is some δ2 so that when 0 < |x − a| < δ2 , we have
ε
|f (x) − L| < .
2 (ε/(2|L|) + |M |)

Choose δ = min(δ1 , δ2 ). Let x ∈ S.


274 CHAPTER IX. INTRODUCTION TO ANALYSIS

Now, assume that 0 < |x − a| < δ. Then |x − a| < δ1 and |x − a| < δ2 . Hence,
|g(x) − M | < ε/(2|L|) and
ε
|f (x) − L| < .
2 (ε/(2|L|) + |M |)
We then have
|(f g)(x) − LM | = |f (x)g(x) − LM |
= |f (x)g(x) − Lg(x) + Lg(x) − LM |
= |(f (x) − L)g(x) + L(g(x) − M )|
≤ |(f (x) − L)g(x)| + |L(g(x) − M )|
= |f (x) − L||g(x)| + |L||g(x) − M |
ε
< (|M | + ε/(2|L|)) + |L|ε/(2|L|)
2 (ε/(2|L|) + |M |)
= ε/2 + ε/2
= ε.
Hence,
lim (f g)(x) = LM.
x→a
The proof in the case that both L and M are equal to 0 is much less complicated,
and is left to the reader (see Exercise 37.4).
One can also prove that the limit of f /g is the limit of f over the limit of g,
provided that the limit of g is nonzero. We state the theorem here, without proof.

Theorem 37.11. Let f and g be real-valued functions defined on a deleted neigh-


borhood S of a ∈ R. Suppose that lim f (x) = L and lim g(x) = M with M 6= 0.
x→a x→a
Then
lim (f /g)(x) = L/M.
x→a

From the previous three theorems, we can deduce the following result about con-
tinuity.

Theorem 37.12. Let S be a subset of R, and let f : S → R and g : S → R be


real-valued functions that are continuous at some a ∈ S. Then f + g, and f g
are continuous at a. If g(a) 6= 0, then f /g is continuous at a.

Proof. We prove the theorem for the sum; the proofs for the product and the quotient
are similar.
Suppose that f and g are continuous at a. Then
   
lim (f + g)(x) = lim f (x) + lim g(x) = f (a) + g(a) = (f + g)(a).
x→a x→a x→a

Hence, f + g is continuous at a.
37. CONTINUITY 275

Remark 37.13. Note that if f and g are continuous at all points in their domain,
then so is their sum and their product. The quotient f /g will be continuous at all
points of S at which g is nonzero. N

37.D Continuity of polynomials


In Exercise 36.2, you were asked to prove that any linear function (that is, a function
of the form f (x) = cx + d) is continuous at all real numbers. This implies that
constant functions are continuous (a constant function is of the form f (x) = d; it is
a “linear” function in which c = 0).
We now generalize this exercise to prove that every polynomial function is con-
tinuous.

Theorem 37.14. Let n ≥ 0 be an integer. Let f : R → R be a polynomial


function of degree at most n; that is, a function of the form

f (x) = an xn + an−1 xn−1 + · · · + a1 x + a0 ,

with ai ∈ R for each integer i satisfying 0 ≤ i ≤ n. Then f is continuous at


every real number.

Proof. Fix P (n) to be the open sentence


Every polynomial function of degree at most n is continuous.
We prove the theorem by induction on the integer n ≥ 0.
Base Case: We have proved that P (0) is true in Exercise 36.2.
Inductive step: Assume that P (k) is true, for some integer k ≥ 0. We will show
that P (k + 1) now follows.
Let f be any polynomial of degree at most k + 1, and write
f (x) = ak+1 xk+1 + ak xk + · · · + a1 x + a0 ,
where a0 , a1 , . . . , ak+1 ∈ R. Then both of the (functions given by the) polynomials xk
and ak xk + · · · + a1 x + a0 are continuous by the inductive hypothesis, and ak+1 x is
continuous by Exercise 36.2. Hence, the product
ak+1 xk+1 = (ak+1 x)xk
is continuous by Theorem 37.12, so the sum
f (x) = ak+1 xk+1 + ak xk + · · · + a1 x + a0


is also continuous, again by Theorem 37.12. Hence, P (k + 1) is true.


Example 37.15. The polynomial function given by the rule
f (x) = 3x4 − 6x2 + 2x − 1
is continuous at every real number. 4
276 CHAPTER IX. INTRODUCTION TO ANALYSIS

37.E Exercises

Exercise 37.1. Prove that the function f : R≥0 → R given by the rule f (x) = x is
√ √ √
x+3
continuous at a = 9. (Hint: x − 3 = ( x − 3) · x+3 = √x−9

x+3
.)

Exercise 37.2. Let f : R → R be a function, let a ∈ R, and let L1 , L2 ∈ R. Prove


that if
lim f (x) = L1 and lim f (x) = L2 ,
x→a x→a

then L1 = L2 . (Warning: You may not merely assert that

L1 = lim f (x) = L2 ,
x→a

and conclude that L1 = L2 . This is because in Definition 36.3, we defined the notation

lim f (x) = L
x→a

using the symbol “=”, but we never proved that the symbol “=” used this way satisfies
the transitive property. Rather, you should use the fact that L1 and L2 each satisfy
the condition in Definition 36.3 to prove that they are equal.)

Exercise 37.3. Taking f to be the characteristic function of [0, 1], as described in


Example 37.3, prove the following.
(a) For each a ∈ R − {0, 1}, the function f is continuous at a.
(b) The function f is not continuous at 0.

Exercise 37.4. Prove Theorem 37.10 in the case that both L and M are equal to 0.

Exercise 37.5. Let f be a function of the form

g(x)
f (x) = ,
h(x)

where g(x) and h(x) are polynomials. Prove that f is continuous at all points where
it is defined. (You may use Theorem 37.12.)
Index

(a, b), 12, 13 absolute value, 69


[a, b], 12 antisymmetric, 150
| · |, 69 arithmetic sequence, 249
ℵ0 , 222 associative laws, 79
a | b, 60 associativity, 207
a ≡ b (mod n), 67 axioms, 52
C, 4
c, 234 base case, 92
∃, 36 base two, 111
∃!, 84 biconditional, 26, 62
∈, 2 bijection, 203
∈,
/ 2 bijective, 203
binary, 111
∅, 4
binomial coefficient, 118
Even, 52
binomial theorem, 121
∀, 35
⇒, 25 canonical factorization, 143
⇔, 26 Cantor’s diagonalization argument, 233
∩,
T 9 cardinal numbers, 222
i∈I , 17 cardinality, 7
∧, 23 continuum, 234
¬, 24 countable, 222
∨, 23 countably infinite, 222
max(a, b), 254 different, 220
min(a, b), 254 finite, 7
N, 3 infinite, 7
Odd, 52 same, 220
P(S), 8 uncountable, 231
×, 13 Cartesian product, 13
Q, 4 characteristic function, 216
R, 4 closed interval, 12
⊆, 5 codomain, 186
(, 6 Collatz conjecture, 193
S 5
*, common divisor, 126
i∈I , 17 common multiple, 139
∪, 9 commutative laws, 79
Z, 3 complement, 10
Zn , 169 complement laws, 79

277
278 INDEX

complex numbers, 4 dummy variable, 17


composite, 140
composition (of functions), 205, 208 elements, 2
conclusion (of an implication), 25 empty set, 4
congruence, 168 equal sets, 2
congruence class, 169 equivalence class, 157
congruent, 67, 168 equivalence relation, 155
congruent modulo n, 67 Euclid’s Lemma, 141
conjunction, 23 Euclidean algorithm, 131
continuous, 271 even integers, 52
continuum, 234 existence proofs, 81
continuum hypothesis, 234 constructive, 81
contradiction, 30 nonconstructive, 82
contrapositive, 62 existential quantification, 36
contrapositive proof, 58 existential quantifier, 36
convergent sequence, 251 factorization
converges, 251, 258 canonical, 143
converse, 62 unique, 142
corollary, 53 Fibonacci numbers, 107
countable, 222 finite set, 7
countably infinite, 222 floor function, 165
counterexamples, 84 for all, 35
De Morgan’s law fractional part, 165
logic, 29 function, 183
sets, 79 composition, 205, 208
declarative sentence, 22 continuous, 271
definitions, 52 injective, 196
deleted neighborhood, 266 inverse, 211
descendants, 242 one-to-one, 197
onto, 200
diagonalization argument, 233
restriction, 217
difference (of sets), 10
surjective, 200
disjoint, 12
well-defined, 172
disjunction, 23
Fundamental Theorem of Arithmetic, 142
disproof, 84
distributive laws, 79 GCD, 127
divergent sequence, 251 GCD-switching Theorem, 129
diverges, 251 genealogy, 243
divides, 60 geometric sequence, 250
division algorithm, 127 greatest common divisor, 127
divisor, 60 greatest element, 48
domain grue, 32
of a variable, 33
domain (of a relation), 176 harmonic series, 263
double negation, 79 horizontal line test, 204
INDEX 279

identity (function), 184 multiple (of an integer), 60


identity laws, 79 multiple quantifiers, 43
image
of an element, 189 natural numbers, 3
subset, 189 negating statements with quantifiers, 45
image (of a relation), 176 negation, 24, 62
implication, 25 negation rules, summary, 49
conclusion, 25 numbers
premise, 25 complex, 4
index set, 16 integers, 3
induction, 92 irrational, 12, 74
natural, 3
infinite set, 7
rational, 4
injection, 203
real, 4
injective, 196
injectivity, 197 odd integers, 52
integers, 3 one-to-one correspondence, 203
even, 52 one-to-one function, 197
odd, 52 onto, 200
intersection, 9 open interval, 12
interval open sentence, 33
closed, 12 opposite parity, 64
half-open, 12 ordered n-tuple, 230
open, 12 ordered pair, 13
inverse ordered triple, 15
function, 211
of an implication, 62 parity
relation, 188 opposite, 64
irrational numbers, 12, 74 same, 64
partial sums, 258
least common multiple, 139 partition, 161
least element, 48 parts (of a partition), 161
lemma, 53 Pascal’s triangle, 119
limit (of a function), 266 pasting together, 215
limit (of a sequence), 251 Pasting Together Theorem, 216
linear combination, 133 piecewise defined function, 191
logical connective, 27 pigeonhole principle, 98
logical formula, 27 point of interest, 264
logically equivalent, 28 polynomial function, 275
lower bound, 48 power set, 8
lowest terms, 4, 139 preimage, 190
premise (of an implication), 25
maximum, 254 prime, 140
minimum, 254 principle of mathematical induction, 92
modus ponens, 30 product (Cartesian), 13
multi-valued (rule), 182 proof by contradiction, 72
280 INDEX

proper subset, 6 statement, 22


proposition, 53 strong induction, 113
subset, 5
quantifiers proper, 6
for all, 35 surjection, 203
there exists, 36 surjective, 200
there exists unique, 84 surjectivity, 200
range (of a relation), 176 symmetric, 150
rational numbers, 4 tautology, 30
real numbers, 4 term (of a sequence), 248
reflexive, 150 term (of a series), 258
relation, 148 theorem, 53
antisymmetric, 150 there exists, 36
reflexive, 150 there exists unique, 84
symmetric, 150 transitive, 150
transitive, 150 transversal, 164
relatively prime, 137 triangle inequality, 70
representative (of an equivalence class), trivially true, 53
157 truth table, 28
restriction (of a function), 217
uncountable, 231
same parity, 64 union, 9
Schröder–Bernstein Theorem, 241 uniqueness proofs, 83
sequence, 248 universal quantification, 35
arithmetic, 249 universal quantifier, 36
convergent, 251 universal set, 10
divergent, 251 upper bound, 47
geometric, 250
limit, 251 vacuously true, 54
term, 248 variable, 33
series, 258 dummy, 17
converges, 258 Venn diagram, 9
partial sums, 258 vertical line test, 196, 199, 204
term, 258
set, 2 well-defined, 172
complement, 10 well-defined (rule), 182
difference, 10 well-ordering principle, 100
equality, 2 without loss of generality, 65
finite, 7
infinite, 7
intersection, 9
product, 13
union, 9
universal, 10
set-builder notation, 4

You might also like