Classnotes Discrete Math
Classnotes Discrete Math
These class notes were used for fifteen years in a discrete math class taught at
Case Western Reserve University until I retired in 1999. I am making them available
as
a resource to anyone who wishes to use them. They may be copied and distributed for
educational use, provided that the recipients are charged only the copying costs.
If I were revising these notes today I would make some sizeable changes. The
most important would be to reformulate the definition of division on page 4 to
require that
the divisor be nonzero. The result would change the statement “0 divides 0” from
true to
false, and would affect the answers to a number of exercises.
Charles Wells
DISCRETE
MATHEMATICS
Charles Wells
Charles Wells
Department of Mathematics
Case Western Reserve University
10900 Euclid Avenue
Cleveland, OH 44106-7058, USA
Email: [email protected]
Contents
39
Functions
56
40
61
41
63
2
Integers
42
64
43
65
Division
44
Sets of functions
66
5
More about proofs
45
Binary operations
67
Primes
10
46
Fixes
68
Rational numbers
11
47
69
Real numbers
12
48
Associativity
70
12
49
Commutativity
71
10
50
Identities
72
bers
14
51
Relations
73
11
Propositions
15
52
75
12
Predicates
16
53
75
13
Universally true
19
54
Operations on relations
77
14
Logical Connectives
21
55
Reflexive relations
77
15
Rules of Inference
24
56
Symmetric relations
78
16
Sets
25
57
Antisymmetric relations
79
17
26
58
Transitive relations
80
18
Setbuilder notation
27
59
Irreflexive relations
81
19
29
60
82
20
31
61
21
32
62
87
22
33
63
The GCD
88
23
Singleton sets
34
64
90
24
Russell’s Paradox
35
65
Euclid’s Algorithm
92
25
Implication
35
66
93
26
Vacuous truth
37
67
97
27
68
99
28
Modus Ponens
40
69
102
29
Equivalence
40
70
Propositional forms
104
30
42
71
Tautologies
105
31
43
72
Contradictions
107
32
46
73
Lists of tautologies
107
33
47
74
110
34
48
75
Quantifiers
112
35
Ordered pairs
49
76
114
36
Tuples
50
77
Order of quantifiers
115
37
Cartesian Products
52
78
Negating quantifiers
116
38
Extensions of predicates
79
55
ments
117
IV
80
184
81
186
Method
120
and
82
121
functions
187
83
Proving equivalences
122
189
84
Multiple equivalences
123
189
85
Uniqueness theorems
124
190
86
Proof by Contradiction
125
195
87
Bezout’s Lemma
127
127 Closures
197
88
A constructive proof of Bezout’s Lemma
128
198
89
131
200
90
132
130 Congruence
201
91
Inverse images
132
203
92
Surjectivity
133
204
93
Injectivity
134
205
94
Bijectivity
136
134 Orderings
206
95
Permutations
137
208
96
137
136 Preorders
209
97
Tuples as functions
138
210
98
Functional composition
140
211
99
Idempotent functions
143
212
100
Commutative diagrams
144
212
101
Inverses of functions
146
141 Suprema
213
102
150
142 Lattices
215
103
Mathematical induction
151
216
104
Least counterexamples
154
218
105
157
220
106
159
221
107
147 Isomorphisms
223
point
160
224
108
163
225
109
Lists
164
227
110
Strings
167
228
111
Formal languages
169
230
112
Families of sets
171
233
113
Finite sets
173
154 Subgraphs
234
114
Multiplication of Choices
174
155 Isomorphisms
234
115
Counting with set operations
176
236
116
237
117
Partitions
180
239
118
182
241
119
The class function
183
243
Bibliography
253
Index of Symbols
260
Index
254
These class notes are for MATH 304, Fall semester, 1999. Previous versions are not
usable because the text has been rewritten.
It would be a good idea to leaf through this copy to see that all the pages are
there and correctly printed.
Exercises The key to learning the mathematics presented in these notes is in doing
all the exercises. Many of them are answered in the back; when that is so, the text
gives you the page the answer is on. You should certainly attempt every exercise
that has an answer and as many of the others that you have time for.
Indexes On each page there is a computer-generated index of the words that occur
on that page that are defined or discussed somewhere in the text. In addition,
there
is a complete computer-generated index on page 254. In some cases the complete
index has entries for later pages where significant additional information is given
for
the word.
Acknowledgments A grant from the Fund for the Improvement of Post- Secondary
Education supported the development of these class notes. A grant from the Con-
solidated Natural Gas Corporation supported the development of the Mathematica
package dmfuncs.m and the concomitant revisions to these notes.
I would like to thank Michael Barr, Richard Charnigo, Otornar Hajek, Ernest
Leach, Marshall Leitman and Arthur Obrock for finding mistakes and making many
helpful suggestions.
I would appreciate being notified of any errors or ambiguities. You may contact
me at [email protected].
Charles Wells
1
1. How to read these notes proposition 15
specification 2
This text introduces you to the subject matter of discrete mathematics; it includes
a theorem 2
substantial portion of the basic language of mathematics used by all
mathematicians,
as well as many topics that have turned out to be useful in computer science.
This may very well be the first mathematics course in which you are expected
to produce a substantial amount of correct mathematical reasoning as well as to
compute answers to problems.
Most important concepts can be visualized in more than one way, and it is vital
to be able to conceive of these ideas in some of the ways that mathematicians and
computer scientists conceive of them. There is discussion in the text about most of
the concepts to help you in doing this. The problem is that this type of discussion
in general cannot be cited in proofs ; the steps of a proof are allowed to depend
only
on definitions, and previously proved theorems. That is why the text has labels
that
distinguish the logical status of each part.
What follows is a brief glossary that describes many of the types of prose that
occur in this book.
1.1 Glossary
Not all concepts are defined in this text. Basic ideas such as integers and real
numbers are described but not defined; we depend on your familiarity with them
from earlier courses. We give a specification for some of these.
For study purposes it is worthwhile to verify that each example does fit the
definition. This is usually easy.
A few examples are actually non-examples: mathematical objects that you might
think are examples of the concept but in fact are not.
corollary 1
fact 1
lemma 2
proof 4
theorem 2
usage 2
warning 2
Proofs are discussed in more detail in Chapters 3,5, and in a sequence of chapters
beginning with Chapter 80. Particular proof techniques are described in smaller
sections throughout the text.
“Show” is another word for “prove”. (Not all math texts use the word “show”
in this way.)
Note: As of this revision (June 22, 1999) there are some statements called
“remark” that perhaps should be called “fact”, “usage” or “warning”. The author
would appreciate being told of any mislabeled statement.
Usage A paragraph marked “Usage” describes the way some terminology or sym-
bolism is used in mathematical practice. Sometimes usage varies from text to text
(example: Section 2.2.1) and in many cases, the usage of a term or symbol in mathe-
matical texts is different, often in subtle ways, from its usage in other texts
(example:
Section 14.1.2).
Warning A paragraph marked “Warning” tells you about a situation that has
often (in my experience) misled students.
2. Integers
2.1.1 Remark Note that this is not a formal definition; it is assumed that you
are familiar with the integers and their basic properties.
definition 4
integer 3
natural number 3
negative 3
nonnegative integer 3
nonnegative 3
positive integer 3
positive 3
specification 2
theorem 2
usage 2
a) n is positive if n > 0 .
b) n is negative if n < 0.
c) n is nonnegative if n > 0.
2.2.1 Usage
a) A few authors define zero to be both positive and negative, but that is not
common mathematical practice in the USA.
2.3 Theorem
2.3.1 Remarks
2.3.2 Exercise Describe precisely all integers m and n for which m n is an integer.
Note that Theorem 2.3 does not quite answer this question!
boldface 4
definition 4
divide 4
integer 3
negative integer 3
nonnegative integer 3
positive integer 3
Each Definition in this text gives the word or phrase being defined in boldface.
Each definition gives a precise description of what is required for an object to
fit
that definition. The only way one can verify for sure that a statement about a
defined object is correct is to give a proof that it is correct based on the
definition
or on previous facts proved using the definition.
Definition 2.2 gives a precise meaning to the words “positive”, “negative”, “non-
negative” and “natural number”. Any question about whether a given integer is
positive or negative or is a natural number must be answered by checking this defi-
nition.
3.1.1 Method
3.1.2 Example The statement “0 is positive” is false. This claim can be justified
by rewriting the statement using Definition 2.2: “0 > 0”. Since this last statement
is false, 0 is not positive.
3.1.3 Remark The preceding example illustrates the use of Method 3.1.1: I jus-
tified the claim that “0 is positive” is false by using the definition of
“positive”.
3.1.4 Example It also follows from Definition 2.2 that 0 is not negative (because
the statement 0 < 0 is false), but it is nonnegative (because the statement 0 > 0
is
true) .
4. Division
definition 4
divide 4
divisor 5
even 5
existential state-
ment 5, 113
factor 5
integer 3
odd 5
usage 2
4.1.7 Remarks
a) Warning: Don’t confuse the vertical line a verb meaning “divides”, with
the slanting line “/” used in fractions. The expression “3 | 6” is a sentence, but
the expression “6/3” is the name of a number, and does not form a complete
sentence in itself.
c) Definition 4.1 does not say that there is only one integer q for which m = qn.
However, it is true that if n is nonzero then there is only one such q , because
then q = m/n. On the other hand, for example 0 = 5- 0 = 42-0 so 0 | 0 and
there is more than one q proving that fact.
d) Definition 4.1 says that m\n if an integer q exists that satisfies a certain
property. A statement that asserts the existence of an object with a property
is called an existential statement. Such statements are discussed in more
detail on page 113.
0 every integer
1 - 1 , 1
30 -1, -2, -3, -5, -6, -10, -15, -30, 1, 2, 3, 5, 6, 10, 15, 30
4.1.9 Usage Many authors add the requirement that n/0 to Definition 4.1,
which has the effect of making the statement 0 | 0 meaningless.
4.1.10 Exercise Find all the integers m for which m | 2. (Answer on page 243.)
definition 4
divide 4
division 4
integer 3
proof 4
theorem 2
We will state and prove some simple theorems about division as an illustration of
some techniques of proof (Methods 5.1.2 and 5.3.3 below.)
5.1 Theorem
Proof Let m be any integer. We must prove that m\ m. By Definition 4.1, that
means we must find an integer q for which m = gm. By first grade arithmetic, we
can use q= 1 .
5.1.1 How to write a proof (1) In the preceding proof, we start with what is
given (an arbitrary integer to ) , we write down what must be proved (that m\m),
we apply the definition (so we must find an integer q for which to = qrn ) , and we
then write down how to accomplish our goal (which is one step in this simple proof
- let q= 1 ) .
5.1.3 Example Theorem 5.1 asked us to prove that every integer divides itself.
Property P is that of being an integer and property Q is that of dividing itself.
So we began the proof by assuming m is an integer. (Note that we chose a name,
to, for the integer. Sometimes the theorem to be proved gives you a name; see
for example Theorem 5.4 on page 8.) The proof then proceeds without assuming
anything special about to. It would have been wrong, for example, to say
something
like “Assume to. = 5” because then you would have proved the theorem only for
5.
5.2 Theorem
5.2.1 Remark Theorem 5.2 may have surprised you. You can even find texts in
which the integer q in the definition of division is required to be unique. For
those
texts, it is false that every integer divides 0.
divide 4
factor 5
integer 3
proof 4
theorem 2
Proof Let m be any integer. By Definition 4.1, we must find an integer q for
which m = q T . By first grade arithmetic, we can use q = m.
5.3.1 Exercise Prove that if m\n and a and b are nonnegative integers such
that a <b, then m a \ n b .
Proof Theorem 5.1 says that every integer is a factor of itself. Since 42 is an
integer, it is a factor of itself.
5.3.4 Example In Example 5.3.2, the theorem was Theorem 5.1, the type of
object was “integer”, and c was 42.
5.3.5 Remark Make sure you understand the difference between Method 5.1.2
and Method 5.3.3.
5.3.7 How to write a proof (2) Worked Exercise 5.3.8 below illustrates a more
complicated proof. In writing a proof you should normally include all these
steps:
PS.l Write down what is given , and translate it according to the definitions
of the
terms involved in the statement of what is given. This translation may involve
naming some of the mathematical objects mentioned in the statement to be
proved.
PS. 3 Carry out some reasoning that, beginning with what is given, deduces what
is
to be proved.
The third step can be quite long. In some very simple proofs, steps PS-1 and
PS-2
may be trivial. For example, Theorem 5.3 is a statement about every integer. So
for
step PS-1, one merely names an arbitrary integer: “Let m be any integer.” Even,
here, however, we have named what we will be talking about.
Another very important aspect of proofs is that the logical status of every
state-
ment should be clear. Each statement is either:
divide 4
integer 3
nonnegative integer 3
positive integer 3
proof 4
theorem 2
universal instantia-
tion 7
usage 2
c) A statement that has been deduced from preceding known statements. For
each of these, a reason must be given, for example “Universal Instantiation”
or “high school algebra” .
5.3.8 Worked Exercise Prove that any two nonnegative integers which divide
each other are the same.
Answer First, we follow PS-1 and write down what we are given and translate it
according to the definition of the words involved (“divides” in this case):
Assume
we are given integers m and n. Suppose m\n and n\m. By Definition 4.1, the
first statement means that for some q, n = qm .. The second statement means
that
for some q' , m = q'n. Now we have written and translated what we are given.
PS-2: We must prove that m = n. (This translates the phrase “are the same”
using the names we have given the integers.)
a) If m = 0 , then n = qm = g x 0 = 0 , so m = n.
5.4 Theorem
m + n = qk + q'k = (q + q')k
5.4.2 Existential Bigamy In the proof of Theorem 5.4, we were given that
k \ m
and k\n. By using the definition of division, we concluded that there are
integers
q and q' for which m = qk and n = q'k. It is a common mistake called
existential
bigamy to conclude that there is one integer q for which m = qk and n = qk.
Consider that the phrase “Thurza is married” by definition means that there
is
a person P to whom Thurza is married. If you made the mistake just
described
you would assume that if Amy and Thurza were both married, then they would
be
married to the same person. That is why it is called “existential bigamy” .
Mrs. Thurza Golightly White was the author’s great great grandmother, and
Mrs. Amy
Golightly Walker was her sister. They were very definitely married to
different people.
In problems 5.5.1 through 5.5.5, you are asked to prove certain statements
about
integers and division. Your proofs should involve only integers — no
fractions should
appear. This will help insure that your proof is based on the definition of
division
and not on facts about division you learned in high school. As I mentioned
before,
you may use algebraic facts you learned in high school, such as that fact
that for
any integers, a(b + c) = ab + ac.
5.5.2 Exercise Prove that if n > 0, then any nonnegative integer less than
n
which is divisible by n must be 0. (Answer on page 243.)
The DmFuncs package contains the function DividesQ [k,n] . It returns True
if k | n and False otherwise. For example, DividesQ [3 , 12] returns True
but
DividesQ [5 , 12] returns False.
divide 4
division 4
existential bigamy 9
factor 5
integer 3
nonnegative integer 3
10
composite integer 10
definition 4
even 5
factor 5
integer 3
odd 5
positive integer 3
prime 10
6. Primes
Prime numbers are those, roughly speaking, which don’t have nontrivial
factors.
Here is the formal definition:
6.1.4 Exercise Prove that any even number bigger than 2 is composite.
6.1.5 Exercise Which of these integers are prime and which are
composite? Fac-
tor the composite ones: 91, 98, 108, 111. (Answer on page 243.)
6.1.6 Exercise Which of these integers are prime and which are
composite? Fac-
tor the composite ones: 1111, 5567, 5569.
6.1.7 Exercise Prove that the sum of two odd primes cannot be a prime.
The command Prime [n] gives the nth prime in order. For example. Prime
[1]
gives 2, Prime [2] gives 3, and Prime [100] gives 541.
11
7. Rational numbers
7.1.1 Example The numbers 3/4 and —11/5 are rational. 6 is rational
because
6 = 6/1. And .33 is rational because .33 = 33/100.
7.2 Theorem
definition 4
divide 4
divisor 5
fact 1
integer 3
lowest terms 11
proof 4
rational number 11
rational 11
representation 15
theorem 2
3 _ 6 _ -9
4 “ 8 “ —12
7.2.2 Fact Two representations m/n and r/s give the same rational
number if
and only if ms = nr .
7.3.1 Example 3/4 is in lowest terms but 6/8 is not, because 6 and 8
have 2 as
a common divisor.
a c ac
b X d bd
and
ad + be
bd
(7.1)
decimal expansion 12
decimal representa-
tion 12
decimal 12, 93
digit 93
integer 3
rational 11
real number 12
specification 2
usage 2
8. Real numbers
negative if r < 0 .
8.1.1 Remark Specification 8.1 is informal, but it’s all you are
going to get, since
a formal definition is quite involved.
8.1.3 Usage The symbol \f\ denotes 2. It does not denote —2. In
general, for
a positive real number x , the notation \J x denotes the positive
square root of x ,
which is precisely the unique positive real number r with the
property that r 2 = x.
The unique negative number s such that s 2 = x is denoted by —\fx.
This usage may conflict with usage you saw in high school, but it
is standard in
college-level and higher mathematics.
8.2 Infinity
13
Mathematicians referring to an approximation may use an ellipsis
(three dots),
as in “ 7 r is approximately 3.14159...”.
9.2 Theorem
DR. 2 dk = + 1 ;
decimal 12, 93
digit 93
integer 3
real number 12
string 93, 167
theorem 2
usage 2
2 ).
9.2.3 Remarks
b) The proofs of Theorems 9.2 and 10.1 (below) are based on the
theory of
geometric series (and are easy if you are familiar with that
subject) but that
belongs to continuous mathematics rather than discrete
mathematics and will
not be pursued here.
a) 1.414, y/2.
b) 473,472.999.
c) 4.09, 4.1.
a) 53.9, 53.0.
b) 39/13, 2.9.
14
lowest terms 11
rational 11
real number 12
theorem 2
a) f .
b) f •
c) 105.3.
10. Decimal representation of rational numbers
10.1 Theorem
You can see why this is true by thinking about the process of
long division:
Suppose you have gone far enough that you have used up all the
digits in the
dividend (so all further digits are zero). Then, if you get a
certain remainder in the
quotient twice, the process necessarily repeats the second time
what it did the first
time.
15
decimal 12, 93
digit 93
integer 3
lowest terms 11
positive integer 3
predicate 16
proposition 15
rational 11
real number 12
specification 2
usage 2
0.42857142857142857143
11. Propositions
algebraic expres-
sion 16
instance 16
integer 3
predicate 16
proposition 15
relational symbols
specification 2
usage 2
16
12. Predicates
x 2 --+4 y (12.1)
x 2 b4 y>x + y (12.2)
is a predicate.
17
integer 3
predicate 16
proposition 15
real number 12
12.2 Substitution
22 6 .
xy b4 y>xy + y
xy
In doing such substitution you must take into account the rules
concerning how
algebra is written; for example to substitute x + y for x and y
+ z for y in (12.1)
you must judiciously add parentheses:
{x + y) 2
b 4 (y + z) > x + y + y + z
x + y
12.3 Types
18
divide 4
integer variable
predicate 16
proposition 15
real variable 18
substitution 17
usage 2
Answer Any real number between 1 and 2 makes “x > 1 and x < 2”
true, for
example x = \ or x = \[2 . The values x = 0 , x = 1 , x = — 1 ,
and x = 42 all make
it false.
it is false.
12.4.1
m 4
12.4.2
m =
12.4.3
m =
m + 1 .
12.4.4
m =
2 m.
12.4.5
9
m =
- m.
We will name predicates with letters in much the same way that
we use letters to
denote numbers in algebra. It is allowed, but not required , to
show the variable(s)
in parentheses. For example, we can say: let P{x) denote the
predicate “25 < x ” .
Then P(42) would denote the proposition “25<42”, which is true;
but P(— 2)
would be false. P(42) is obtained from P{x) by substitution.
Predicates can have more than one variable. For example, let
Q(x,y ) be “x <
y" . Then Q(25,42) denotes the proposition obtained by
substituting 25 for x and
42 for y. Q( 25,42) is true; on the other hand, Q( 25,-2) is
false, and Q(25,y) is a
predicate, neither true nor false.
19
b) P(l,3,2).
c) P(x,x,y)
d) P(x,x + y,y + z) .
definition 4
law 19
predicate 16
real number 12
type (of a vari-
able) 17
universally true 19
usage 2
20
definition 4
predicate 16
quantifier 20, 113
real number 12
type (of a vari-
able) 17
usage 2
13.2 Definition: V
We will use the notation (Vx) to denote that the predicate
following it
is true of all x of a given type.
a) (Vn)(n + 3 > n) .
b) (Vx) (x + 3 > x) .
c) (Vn)(3n>n).
d) (Vn)(3n + 1 > n) .
e) (Vx)(3x>x).
21
14.1.2 Usage
P && Q.
14.2.1 Usage
a) (n > 3 or n is even)
b) (n | 6 or 6 | n)
c) n is prime or (n | 6)
(Answer on page 243.)
a) (n + 1 = n) V (n = 5) .
b) (n > 7) V (n < 4) .
c) (n > 7) A (n < 4) .
d) (n < 7) V (n > 4) .
and 21, 22
conjunction 21
definition 4
disjunction 21
divide 4
even 5
integer 3
predicate 16
prime 10
proposition 15
usage 2
22
definition 4
even 5
fact 1
integer 3
negation 22
or 21, 22
positive integer 3
predicate 16
truth table 22
usage 2
P Q PAQ
T T T
T F F
FT F
F F F
P Q PVQ
T T T
T F T
FT T
F F F
P Q P XOR Q
T T F
T F T
FT T
F F F
14.4.2 Usage
a) XOR in Mathematica is Xor. PXORQ may be written either P
~Xor~ Q or
Xor [P,Q] .
Answer (a) and (b) say the same thing, (c) is not true of
7, for example, but (a)
23
P -nP
~T F
F T
14.5.3 Usage
divide 4
fact 1
integer 3
negation 22
predicate 16
truth table 22
usage 2
e = a && (b | | ! c)
T T T T
T T F T
TFT F
T F F T
F T T F
F T F F
F F T F
F F F F
24
and 21, 22
definition 4
logical connective 21
or 21, 22
propositional vari-
able 104
rule of inference 24
usage 2
Pi,,,. ,P n |— Q
These say that if you know P , you know PvQ, and if you
know Q , you know
PVQ.
P Q P*Q
T T F
T F F
FT T
F F F
(a)
P Q P NAND Q
T T F
T F T
FT T
F F T
(b)
P Q P NOR Q
T T F
T F F
FT F
F F T
(c)
25
m = qn |— n \ m
divide 4
integer 3
natural number 3
nonnegative integer 3
positive integer 3
positive 3
rational 11
real number 12
rule of inference 24
truth table 22
usage 2
16 . Sets
26
definition 4
integer 3
set 25, 32
type (of a vari-
able) 17
a) (Vx:Z)x > 0
b) (Vx:N)x > 0
17.1.2 Remark
27
12,2,5,6}
comprehension 27,
29
defining condition 27
definition 4
integer 3
predicate 16
setbuilder nota-
tion 27
set 25, 32
type (of a vari-
able) 17
usage 2
18.1.1 Usage
28
and 21, 22
extension (of a
predicate) 27
integer 3
predicate 16
prime 10
real number 12
set 25, 32
subset 43
type (of a vari-
able) 17
usage 2
a) {n | n 2 = 1} .
b) {n | n divides 12} .
a) {2, 1,1,1} c) {x | x 2 — 1 = 0}
b) { 1 , 2 , — 1 , x/4, | — 1 1 } d) {x | x 2 + 1 = 0}
(x e Z) A (x < 5) A (x > 2)
b) {n | n is a factor of 3} .
infinite 174
integer 3
predicate 16
real number 12
rule of inference 24
setbuilder nota-
tion 27
set 25, 32
type (of a vari-
able) 17
unit interval 29
usage 2
and
P(a) |- a e {x -P(x)}
(18.1)
a e {x P(x)} |- P(a)
(18.2)
18.1.14 Example
The set
(18.3)
30
and 21, 22
integer 3
predicate 16
rational 11
real number 12
set 25, 32
unit interval 29
I = {x 6 R | 0 < x < 1}
{n - 2 | n G A} = {—1,1,4}
{n 2 | n € Z} = {k \ (k = n 2 ) A (n G Z)}
and the set in Example 19.2.2 as
{n — 2 | n G A} = {m | (m = n-2)A(n£ A)}
19.2.4 Warning Care must be taken in reading such
expressions: for example,
the integer 9 is an element of the set {n 2 | n£ZAn/3},
because although 9 = 3 2 ,
it is also true that 9 = (— 3) 2 , and —3 is an integer
not ruled out by the predicate
on the right side of the definition.
a) R + = {x 2 | x G R}
b) N = {x 2 | x G N}
c) R = {x 3 | x G R}
a) {n — 1 G Z | n divides 12}
b) {n 2 G N | n divides 12}
c) {n 2 G Z | n divides 12}
a) {x + y | y = 1 — x}.
b) {3.x | x 2 = 1} .
31
have?
,, | x = — , -,—2,2}
x 2 1 2 2
closed interval 31
definition 4
open interval 31
real number 12
setbuilder nota-
tion 27
set 25, 32
usage 2
in Mathematica.
(a . . b) = {x G R | a < x < b}
(20.1)
for any specific real numbers a and b. A closed
interval includes its
endpoints, so is of the form
[a . . b] = {x G R | a < x < 6}
(20.2)
a) {0,1,— 1} d) {x | x 3 = — x}
b) {x | x = — x} e) [— 1..1]
c) {x | x 3 = x} f) (— 1..1)
32
real number 12
setbuilder nota-
tion 27
set 25, 32
specification 2
21.1.1 Remarks
33
{x | x 2 = 1} = {x | (x = 1) V (x = —1)}
A = {x | x 2 = 1} and B = {x \ (x = 1) V (x = —1)}
definition 4
empty set 33
extension (of a
predicate) 27
interval 31
or 21, 22
predicate 16
real number 12
set 25, 32
usage 2
a) {0}.
b) {0,0}-
c) {x G Z | x 2 < 0} .
d) {x G Z | x 2 = 2} .
34
definition 4
divisor 5
empty set 33
integer 3
positive integer 3
set 25, 32
singleton set 34
singleton 34
a) {1,-1} e) {x € R + | x < 1}
b) {x £ N | x < 1} f) {x € R | x 2 — 1 = 0}
c) {x G R | x 2 = 0} g) {x e R j x 3 + x = 0}
d) {x £ R | x 2 < 0}
a) {n | 1 < n < 2} .
b) {n j |n| < 2} .
35
and 21, 22
implication 35, 36
or 21, 22
predicate 16
real number 12
rule of inference 24
Russell’s Paradox 35
setbuilder nota-
tion 27
set 25, 32
type (of a vari-
able) 17
25. Implication
36
conditional sen-
tence 36
implication 35, 36
P Q
P => Q
logical connective 21
T T
T
material condi-
T F
tional 36
predicate 16
truth table 22
F T
F F
usage 2
c) m 2 =4 => m = 2.
37
conclusion 36
definition 4
divide 4
fourtunate 37
hypothesis 36
implication 35, 36
integer 3
natural number 3
odd 5
predicate 16
proposition 15
truth table 22
vacuously true 37
a) If 4 is odd then 3 = 3.
38
b) Q => (P => Q)
c) (P =*► Q) =► P
d) (P => Q) =>■ Q
WI.2 P only if Q.
WI.3 P implies Q.
27.1.2 Remarks
39
27.1.3 Exercise You have been given four cards each
with an integer on one side
and a colored dot on the other. The cards are laid
out on a table in such a way
that a 3, a 4, a red dot and a blue dot are
showing. You are told that, if any of
the cards has an even integer on one side, it has a
red dot on the other. What is
the smallest number of cards you must turn over to
verify this claim? Which ones
should be turned over? Explain your answer.
even 5
implication 35, 36
integer 3
positive real num-
ber 12
predicate 16
proposition 15
real number 12
rule of inference 24
40
biconditional 40
conclusion 36
definition 4
divide 4
equivalence 40
equivalent 40
hypothesis 36
implication 35, 36
predicate 16
rule of inference 24
truth table 22
(P, P => Q) \- Q
(28.1)
29. Equivalence
29.1 Definition: equivalence
41
PaaQ
T
This is the same as (P =4- Q) A (Q =>• P) .
equivalent 40
fact 1
implication 35, 36
logical connective 21
or 21, 22
predicate 16
theorem 2
truth table 22
usage 2
29.2 Theorem
Answer
P Q R P\JQ
T T T T
T T F T
TFT T
T F F T
F T T T
F T F T
F F T F
F F F F
T T T
F F F
T T F
F F F
T FT
F F F
F F F
F F F
(PAP) V(QAP)
a) P =>■ Q
b) ~^P\J Q
c) -.(PA -.<2)
contrapositive 42
converse 42
decimal expansion
decimal 12, 93
definition 4
equivalent 40
implication 35, 36
rational 11
real number 12
theorem 2
truth table 22
42
12
30.1
is
30.2 Theorem
30.4 Theorem
(P Q) (-■ Q ->P)
43
contrapositive 42
converse 42
decimal 12, 93
definition 4
divide 4
extension (of a
predicate) 27
implication 35, 36
include 43
integer 3
predicate 16
prime 10
rational 11
real number 12
rule of inference 24
set 25, 32
subset 43
theorem 2
type (of a vari-
able) 17
usage 2
31.1.3 Method
rem.
44
definition 4
equivalent 40
hypothesis 36
implication 35, 36
include 43
proof 4
properly included
set 25, 32
vacuous 37
31.2 Theorem
A = {1,2,3}
£ = { 1 , 2 , { 1 , 2 , 3 }}
(i) age,
(ii) X C Y , and
(iii) X = Y.
b) X={ 1 ,2} , Y= { 1 , { 1 , 2 } }
.
c) X={1,2}, Y={2,1,1}.
d) X={1,2,{1,3}}, Y={1,3,{1,2}}.
45
definition 4
include 43
nontrivial subset 45
proper subset 45
set 25, 32
subset 43
usage 2
31.5.1 Usage
a) 0 «E A
b) If A C 0 , then A = 0 .
c) If A = B , then A C B .
d) If 0 € A then A ^ 0.
46
definition 4
empty set 33
fact 1
include 43
powerset 46
rule of inference
set builder nota-
tion 27
set 25, 32
subset 43
BCA |- B € VA
and
B £ VA \- BCA
(32.1)
(32.2)
b) 0
c) {0}
d) {0,{0}}
a)
a)
b)
b)
c)
7 r
c)
{1,3,7}
d)
{1,3}
d)
{xGR x
e)
{3,tt}
e)
V(Z)
f)
f)
g)
g)
{Z,R}
47
48
complement 48
definition 4
fact 1
set difference 48
set of all sets 35
set 25, 32
subset 43
type (of a vari-
able) 17
universal set 48
usage 2
A — B = {x \ x&AAx^B} (34.1)
a)
AUB
f)
B-C
b)
AnB
g)
dn(BuC)
c)
BUC
h)
Bu(AnC)
d)
Bnc
i)
Bll(A-C)
e)
A-B
49
2) 4
3) 7
4) -2
5) 0
6) {2,4,5}
7) {1,3}
1) AUB
2) AnB
3) A-B
4) A- Z
5) B c
6) VA
7) V(AnB)
equivalent 40
first coordinate 49
include 43
integer 3
powerset 46
real number 12
second coordinate 49
set 25, 32
specification 2
type (of a vari-
able) 17
universal set 48
a) V{A)nV(B)=V(AnB)
b) V{A)uV{B)=V{AuB)
c) V(A)-V(B)=V(A-B)
((x,y) = (, x f ,y ')) 44 (x =
x' A y = y')
Thus we have a method:
50
coordinate 49
definition 4
integer 3
ordered pair 49
ordered triple 50
specification 2
tuple 50, 139, 140
union 47
usage 2
35.1.2 Method
a) (2,3), (3,2).
b) (3 , V / 4), (3,2).
c) (2,>/4), (V4,2).
36. Tuples
{i G N | 1 < i < n}
A tuple is a generalization of
the concept of ordered pair. A tuple satisfies this
specification:
A tuple of length n, or n
-tuple, is a mathematical object which
T.l has an ith entry for each i
6 n, and
T.2 is distinct from its
entries, and
i G n.
36.2.2 Usage
51
coordinate 49
empty set 33
equivalent 40
integer 3
null tuple 51
set 25, 32
theorem 2
tuple 50, 139, 140
usage 2
a = 6 44 (Vi:n)(ai = 6*)
a) (3,3), (3,3,3).
b) (2,3), (2,3,3).
c) (2,3,2), (3,2,2).
a)
b)
c)
52
Cartesian product
coordinate 49
definition 4
diagonal 52
factor 5
ordered pair 49
real number 12
set 25, 32
subset 43
theorem 2
tuple 50, 139, 140
and
37.2 Theorem
is | (x,y) | x € R A y = x 2
j , which could be written |(x,x 2 ) | x £ R j (recall the
discussion in Section 19.2).
53
Cartesian product 52
coordinate 49
definition 4
disjoint 47
ordered triple 50
powerset 46
proper subset 45
relation 73
set 25, 32
subset 43
tuple 50, 139, 140
union 47
D = {(m,n) | m divides n}
37.6.2 Ax B = B x A.
37.6.6 V{AxB)=V{A)xV{B).
54
Cartesian powers 54
Cartesian product 52
Cartesian square 54
implication 35, 36
include 43
powerset 46
set 25, 32
singleton 34
tuple 50, 139, 140
union 47
produces
CartesianProduct [{1 , 2} ,
{a,b, c} , {x,y}]
{{1, a, x>, {1, a, y>, {I, b,
x>, {1, b, y>, {1, c, x>, {1, c, y>,
{2, a, x>, {2, a, y>, {2, b,
x>, {2, b, y>, {2, c, x>, {2, c, y»
A n = Ax Ax ■■■ x A
37.9.1 Exercise
set:
Let
a)
A 0
f)
BxA
b)
A 1
g)
Ax AxB
c)
A 2
h)
Ax (AxB)
d)
A 3
i)
(AxB)uA
e)
AxB
j)
(Ax B)nA
55
1.
(3,5)
1. Ax A
Cartesian product 52
2.
(3,3)
2. A 3
diagonal 52
3.
(3,3,5)
3. Ax B
extension (of a
4.
{(3,5), (7,5)}
4. B x A
predicate) 27
intersection 47
5.
5. V(A x B)
powerset 46
6.
6. VA x VB
predicate 16
7.
(1,7,7)
7. B 2
real number 12
set 25, 32
subset 43
{{x,y) | x < y}
which is a subset of R x R .
Cartesian product 52
character 93
codomain 56
coordinate 49
domain 56
extension (of a
predicate) 27
integer 3
predicate 16
real number 12
set 25, 32
specification 2
string 93, 167
tuple 50, 139, 140
type (of a vari-
able) 17
value 56, 57
\{y,z,x) | x,y,z £ r|
38.2.2 x + y = x + l,inRxR.
(Answer on page 244.)
38.2.3 y = 1 , in R. (Answer on
page 244.)
38.2.4 x + y = z, in RxRxRxR.
(Answer on page 244.)
39. Functions
In analytic geometry or
calculus class you may have studied a real-valued function
such as G(x) = x 2 + 2x + 5 .
This function takes as input a real number and gives
a real number as value; for
example, the statement that G( 3) = 20 means that an
input of 3 gives an output of
20. It also means that the point (3,20) is on the
graph of the equation y =
G(x) .
A function F is a mathematical
object which determines and is com-
pletely determined by the
following data:
application 57
argument 57
codomain 56
dependent vari-
able 57
domain 56
evaluation 57
finite 173
function 56
independent vari-
able 57
input 57
output 57
real number 12
rule of inference 24
set 25, 32
usage 2
value 56, 57
58
codomain 56
divisor 5
domain 56
finite 173
function 56
powerset 46
prime 10
set 25, 32
A = {x | x £ G(x)}
59
codomain 56
domain 56
equivalent 40
function 56
theorem 2
F [1] := 4; F [2] := 5; F
[3] := 5 (39.3)
If Fj : Aj — >■ Bj , (i = 1,2),
are two functions, then
(Fi = F 2 ) ^
60
codomain 56
domain 56
equivalence 40
function 56
prove that F / G?
39.7.1 Method
61
Cartesian product 52
coordinate 49
definition 4
domain 56
fact 1
function 56
graph (of a func-
tion) 61
implication 35, 36
ordered pair 49
single- valued 61
subset 43
usage 2
r(G) = j(x,G(x)) | x € R j = |
(x,y) \ x G R A y = x 2 + 2x + 5|
which is a subset of R x R.
T(G) is of course what is usually called the graph of G
in analytic geometry — in this
case it is a parabola.
|(a,F(a)) | a G A j
62
Cartesian product 52
codomain 56
coordinate 49
functional prop-
erty 62
functional 62
function 56
graph (of a func-
tion) 61
implication 35, 36
include 43
opposite 62, 77, 220
ordered pair 49
usage 2
({a,b)£P A (a.i'Je?)
b = b'
(40.3)
Of course, Formula (40.1)
above says that the graph of a function is functional.
Conversely, if a set P of
ordered pairs is functional, then there are sets A and B
and a function F : B for
which T (F) = P . F is constructed this way:
40.2.7 Exercise If P C A x
B , then the opposite of P is the set P op = {(6, a) \
(a,b) £ P | . Give examples
of:
a) In mathematical texts in
complex function theory, and in older texts in general,
functions are not always
assumed single- valued.
63
binary operation 67
codomain 56
constant function 63
coordinate 49
diagonal 52
domain 56
empty function 63
empty set 33
function 56
graph (of a func-
tion) 61
identity function 63
identity 72
include 43
inclusion function 63
ordered pair 49
ordered triple 50
take 57
41.1.3 Inclusion
function If A C B , then there is an inclusion function
41.1.4 Constant
function If A and B are nonempty sets and b is a specific
element of B , then the
constant function Cf,: A — > B is the function that takes
every element of A to
6; that is, Cb(a) = b for all a £ A. A constant function from
R to R has a horizontal
line as its graph.
41.1.6 Coordinate
function If A and B are sets, there are two coordinate
functions (or
projection functions) pi : A x B — > A and p 2 : A x B -> B . The
function p t takes an
element to its i th coordinate ( i = 1,2). Thus for a £ A and
b 6 B , pi (a, b) = a
and p 2 {a,b) = b. More generally, for any Cartesian product
ntiA there are n
coordinate functions; the ith one takes a tuple (ai,... ,a n ) to
cii .
41.1.7 Binary
operations The operation of adding two real numbers gives a
function
+ : R X R ->• R
which is an example of
a binary operation, treated in detail in Chapter 45.
64
anonymous nota-
tion 64
constant function 63
function 56
graph (of a func-
tion) 61
identity function 63
identity 72
inclusion function 63
lambda notation 64
a) A = B = R, F is the
identity function.
b) A = B = R, F = C 42
(the constant function).
c) A = R+,B = R, F is
the inclusion function.
a) id, 4 .
b) The inclusion of B
into A.
c) The inclusion of B
into Z .
d) C 3 :A-+B.
e) pi : Ax B A.
The curly-brackets
notation for sets has the advantage that it allows you to refer to
a set without giving it
a name. For example, you can say, “{1,2,3} has three ele-
ments,” instead of,
“The set A whose elements are 1 , 2 and 3 has three elements.”
This is useful when you
only want to refer to it once or twice. A notation which
describes without
naming is called anonymous notation.
65
42.2 Barred arrow
notation
a) F : R — > R given by
F(x) = x 3 .
b) p\\ Ax B — >• A.
c) Addition on R.
anonymous nota-
tion 64
extension (of a
predicate) 27
fact 1
function 56
identity function 63
identity 72
integer 3
lambda notation 64
predicate 16
subset 43
43. Predicates
determine functions
43.1 Definition:
characteristic function
43.1.1 Example If A =
{1,2, 3, 4} and B = {1,4} then Xb(1) = TRUE and
Xs(2) = FALSE.
43.1.3 Predicates as
characteristic functions Since the extension of a predi-
cate is a subset of its
data type, the truth value of a predicate is the characteristic
function of its
extension. For example, the statement “n is even” (about integers)
is TRUE if n is even
and FALSE otherwise, so that the value of the characteristic
function of the subset
E of Z consisting of the even integers is the truth value of
the predicate “n is
even”.
66
Cartesian product 52
characteristic func-
tion 65
constant function 63
definition 4
extension (of a
predicate) 27
function 56
graph (of a func-
tion) 61
integer 3
odd 5
predicate 16
subset 43
As mathematical
entities, functions can be elements of sets; in fact the discovery of
function spaces, in
which functions are regarded as points in a space, was one of the
great advances of
mathematics.
44.1 Definition: D J ^
{2,4,5,6}{ 1,2,3 }
44.1.4 Example The
function + : R x R — > R is an element of R^ x ^ .
| (m,n) | m < j
of Z x Z .
a) Xb : A ->•{ TRUE,
FALSE}.
b) The predicate “n is
odd” where n is an element of A, regarded as a function
to {TRUE, FALSE}.
c) + : B x B Z.
67
a) id R 1) R R
b) the inclusion of A
in Z 2)
c) (1,2,1) 3) Rx Z x R
d) .t e- )• x 2 : R — >
R 4) (R+) R
5 .
binary operation 67
Cartesian product 52
codomain 56
complement 48
definition 4
divide 4
domain 56
function 56
identity 72
inclusion function 63
intersection 47
powerset 46
real number 12
right band 67
take 57
unary operation 67
(x, y) i-4 x + y : R x
R — > R
68
argument 57
binary operation 67
function 56
infix notation 68
negative integer 3
Polish notation 68
postfix notation 68
prefix notation 68
reverse Polish nota-
tion 68
take 57
46.1.1 Parentheses
around the argument Trigonometric functions like sinx
are also written in
prefix notation, but it is customary to omit parentheses around
the argument. (Pascal
and many other computer languages require the parentheses,
however, and
Mathematica requires square brackets). Many mathematical writers
omit the parentheses in
other situations too, writing “Ex” instead of “E(x)”. It is
important not to
confuse evaluation written like this with multiplication.
Writing functions of
two or more arguments using prefix notation and no paren-
theses is called Polish
notation after the eminent Polish logician Jan Lukasiewicz,
who invented the
notation in the 1920’s. Writing functions on the right which are
normally infixed,
without parentheses, is naturally called reverse Polish nota-
tion.
69
46.4.2 Example a + b +
c in reverse Polish notation can be written either as a b +
c+orasa6c + +.
Fix notation in
Mathematica Mathematica gives the user control over whether
a function is written
in infix notation or not. For example, we remarked in Sec-
tion 14.4 that in
Mathematica one writes Xor[p,q] for the expression pXORg.
However, by putting
tildes before and after the name of a function in Mathematica,
you can use it as an
infix; thus you can write p ~Xor~ q instead of for Xor [p,q] .
A function F can be
used in postfix form by prefixing it with //. For example,
one can write Sqrt [2]
or 2 // Sqrt.
47.1 Notation
In discussing binary
operations in general, we will refer to an operation A on a
set A ; thus A : A x A
— > A. This operation will be used in infix notation, the way
addition and
multiplication are normally written, so that we write aAb for A (a,b) .
Using an unfamiliar
symbol like ‘A’ avoids the sneaky way familiar symbols like
“+” cause you to fall
into habits acquired by long practice in algebra (for example,
assuming commutativity)
that may not be appropriate for a given situation.
47.1.2 Multiplication
tables We will sometimes give a binary operation A on a
small finite set by
means of a multiplication table: For example, here is a binary
operation on the set
{a,b,c}.
b
c
binary operation 67
Cartesian product 52
diagonal 52
finite 173
function 56
include 43
infix notation 68
multiplication
table 69
postfix notation 68
prefix notation 68
70
associative 70
binary operation
definition 4
function 56
intersection 47
multiplication
table 69
postfix notation
powerset 46
prefix notation 68
real number 12
right band 67
union 47
67
The value of x Ay is in
the row marked x and the column marked y . This means
for example that a A b
= c and c A a = a .
68
2
2
47.1.4 Exercise
{1,2,3}.
Give the
multiplication table for the right band on the set
47.1.5 Exercise
Give the multiplication table for the operation of union on the
powerset of
{1,2,3}.
48. Associativity
48.1 Definition:
associative
A binary operation
A is associative if for any elements x, y, z of A,
x A (y Az) = (x Ay)
Az (48.1)
48.1.1 Remark In
ordinary functional notation (prefix notation), the definition
of associative says
A(x,A (y,z) = A(A (x,y,),z)) . In postfix notation: x y A z A =
x y z A A.
48.1.5 Exercise
Prove that for any set S , union is an associative binary operation
on VS. (Answer on
page 245.)
48.1.6 Exercise
Prove that for any set S, intersection is an associative binary
operation on VS .
48.1.7 Exercise
Show that the right band operation on any set A is associative.
71
48.1.8 Exercise
Find a binary operation A on some set A with the property
that, for some
element a € A,
(a A a) A a) / a A
(a A a)
48.1.9 Exercise Is
the binary operation A given by this table associative? Give
reasons for your
answer.
a
a
associative 70
binary operation 67
commutative 71
definition 4
General Associative
Law 71
max 70
subset 43
48.1.10 Exercise
Prove that max: R x R — > R is associative (see Example 48.1.4).
If A is an
associative operation on A, then it is associative in a more general sense,
in that it
satisfies the General Associative Law: Any two meaningful products
involving A and
ai,a2,--,a n (names of elements of A) in that order denote the
same element of A.
48.2.1 Example If a
A (bA c) = (aAb)Ac, then all five meaningful ways of writ-
ing the product of
four elements are the same:
a A (b A (c A d)) =
aA((bAc)Ad) = (aAb)A(cAd)
=
((aAb)Ac)Ad=(aA(bAc))Ad
49. Commutativity
49.1 Definition:
commutative
A binary operation
A on a set A is commutative if for all x,y £ A,
x Ay = y Ax.
a) Show that A is
commutative.
72
associative 70
binary operation
commutative 71
definition 4
even 5
identity function
identity 72
integer 3
max 70
powerset 46
right band 67
unity 72
Do
50. Identities
50.1 Definition:
identity
If A is a binary
operation on a set A , an element e is a unity or
identity for A if
for all x G A,
xAe = eAx = x
(50.1)
50.1.1 Warning
Don’t confuse the concept of identity for a binary operation with
the concept of an
identity function in 41.1.1, page 63. These are two different ideas,
but there is a
relationship between them (see 98.2.3, page 141).
50.1.4 Exercise
Which of these binary operations (i) is associative, (ii) is com-
mutative, (iii) has
an identity?
A
a
c
c
( 1 ) ( 2 )
(Answer on page
245.)
50.1.5 Exercise
Show that the right band operation on a set with more than one
element does not
have an identity.
50.1.9 Exercise
Does max :RxR-^R have an identity? What about max : R + x
R + — > R + defined
the same way?
50.2 Theorem:
Uniqueness theorem for identities
If A is a binary
operation on a set A with identity e, then e is the only
identity for A .
50.2.1 Exercise
Give a rule of inference that allows one to conclude that a certain
object is an
identity for a binary operation A .
50.2.2 Exercise
(hard) Find all the binary operations on the set {a, b} , and
state whether each
one is associative, is commutative, and has an identity element.
51. Relations
The mathematical
concept of relation is an abstraction of the properties of relations
such as “=” and “<”
in much the same way as the modern concept of function was
abstracted from the
concrete functions considered in freshman calculus, as described
in Section 39.8.
associative 70
binary operation 67
Cartesian product
52
commutative 71
definition 4
equivalence 40
equivalent 40
fact 1
function 56
identity 72
predicate 16
proof 4
relation 73
rule of inference
24
subset 43
theorem 2
type (of a vari-
able) 17
usage 2
51.1 Definition:
binary relation
A binary relation a
from a set A to a set B is a subset of A x B . If
(a, b) G a , then
one writes a ab.
51.1.2 Fact
Definition 51.1 gives the following equivalence, which describes two
different ways of
writing the same thing:
a ab 44 (a, 6) G a
(51.1)
51.1.3 Usage A
relation corresponds to a predicate with two variables, one of
type A and the
other of type B : the predicate is true if a ab (that is, if (a, b) G a)
and false
otherwise. Logic texts often define a relation to be a predicate of this type,
but the point of
view taken here (that a relation is a set of ordered pairs) is most
common in
mathematics and computer science.
is a binary
relation from A to B . For this definition, we know 1 cc 5 and 2 a 1 but
it is not true that
1 a 2 .
74
Cartesian product
coordinate func-
tion 63
definition 4
digraph 74, 218
divide 4
empty relation 74
finite 173
function 56
include 43
ordered pair 49
powerset 46
relation 73
subset 43
total relation 74
52 51.1.5 Exercise
Write all ordered pairs in the relation from A to B:
a) A = {1,2,3} , B
= {1,3,5} . a is “/”.
b) A = {2, 3, 5,
7}, B = {1,2,3,4,5,6,7,8,9,10}, a is “divides”.
c) A = {0,1, 2, 3},
B = {1,2,3}, a is “divides”.
(Answer on page
245.)
51.2 Picturing
relations
A relation on a
small finite set can be exhibited by drawing dots representing the
elements of A and B
and an arrow from x to y if and only if x ay . Here is the
relation in Example
51.1.4 exhibited in this way:
1 2
v v
3 5
Such a picture is
called the digraph representing the relation. Digraphs are studied
in depth in
Chapters 144 and 151.
51.2.1 Example Two
not very interesting binary relations from A to B are the
empty relation 0 C
Ax B and the total relation Ax B . If E denotes the
empty relation,
then aE6 is false for any a £ A and b G B , and if T denotes the
total relation, aT6
is true for any a € A and b £ B .
51.2.2 Example In a
university, the pairs of the form (student, class) where the
student is
registered for the class form a relation from the set of students to the set
of classes.
51.3 Definition:
Rcl(A,i?)
51.3.1 Remark By
Definition 51.1, Rel(A,R) is the same thing as the powerset
V(A x B) ; the only
difference is in point of view.
51.4 The
projections from a relation
A relation a from A
to B is a subset of Ax B by definition, so there are func-
tions Pi : a — >■ A
, P2 : a — >■ B , which are the restrictions of the coordinate func-
tioncoordinate
(projection) functions (see 41.1.6, page 63) from Ax B to A and to
B.
51.4.1 Example If a
is defined as in Example 51.1.4, then : a — > {1,2, 3, 6}
and p2 : a ► {1,2,
3, 4, 5} . In particular, p“((l,5)) = 1 .
75
52. Relations on a
single set
52.1 Definition:
relation on a set
If ct is a relation
from A to A for some set A, then a is a subset of
Ax A. In that case,
a is called a relation on A.
52.1.2 Example A
particular relation that any set A has on it is the diagonal
A a ; A a = {(a, a)
\ a E A}. A a is simply the equals relation on A. Don’t confuse
this with the use
of A to denote an arbitrary binary operation as in Chapter 45.
a) aRb o a < b
b) aRb a = b
c) aR6 6 = 3.
(Answer on page
245.)
Cartesian product
52
codomain 56
definition 4
diagonal 52
domain 56
equivalent 40
functional prop-
erty 62
functional relation
75
function 56
graph (of a func-
tion) 61
implication 35, 36
odd 5
ordered pair 49
relation on 75
relation 73
subset 43
usage 2
53.1 Functional
relations
(a a b and a a b')
=4> b = b' (53.1)
A relation
satisfying Equation (53.1) is called a functional relation.
This requirement
can fail because there are ordered pairs (a, 6) and (a,b r ) in a
with 6 yf b' . Even
if it is satisfied, a may not be the graph of a function from A to
B , since there may
be elements a E A for which there is no ordered pair (a, 6) E a .
However, a
functional relation in Rel(A,L>) is always the graph of a function whose
domain is some
subset of A .
53.1.2 Exercise
Which of these are functional relations?
a) {(1,3), (2,3),
(3,4)}.
b) {(1,1), (1,2),
(2, 3)}.
c) {(x,y/x) | igR}.
d) {(y/x,x) | iGR}.
e) {(y/x,x) j x G R
+ } .
(Answer on page
245.)
76
definition 4
empty set 33
equivalent 40
function 56
integer 3
ordered pair 49
powerset 46
relation 73
singleton 34
subset 43
As we have seen,
the concept of relation from A to B is a generalization of the
concept of function
from A to B . In general, for a given a & A there may be no
ordered pairs ( a,b
) E a or there may be more than one. Another way of saying this
is that for a given
element a E A, there is a set {b E B \ (a,b) E a}. For a to be
a function from A
to B , each such set must be a singleton. In general, a relation
associates a
(possibly empty) subset of B to each element of A.
53.2 Definition:
relation as function to powerset
If a is a relation
from A to B, let a*:A-^-VB denote the function
defined by a* (a) =
{6 E B \ (a, b) E a} .
53.2.1 Remark
Definition 53.2 gives us a process that constructs a function from
A to the powerset
of B for each relation from A to B . For any a E A and b E B ,
b E a* (a) 44 aab
53.2.3 Exercise
Write the function a* : A -^VB corresponding to the relation in
Problem 51.1.5(a).
(Answer on page 245.)
Conversely, if we
have a function F : A— >VB , we can construct a relation:
53.3 Definition:
relation induced by a function to a pow-
erset
Given F : A — >
VB , the relation ap from A to B is defined by aapb if
and only if b E
F(a) .
53.3.1 Remark In
the preceding definition, it makes sense to talk about b E F(a ) ,
because F(a) is a
subset of B.
53.3.3 Exercise A
function F : Z — y PZ has F{ 1) = {3,4}, F{ 2) = {1,3,4},
F(— 666) = {0}, and
F(n) = 0 for all other integers n. List the ordered pairs
in the
corresponding relation a.p on Z. (Answer on page 245.)
77
54. Operations on
relations
54.1.1 Example On
R, the union of Ar and “<” is (of course!) “< ”, and the
intersection of “<”
and “>” is Ar. These statements translate into the obviously
true statements
r<s»(r<sVr = s)
and
(r<sAr>s)<S>r = s
definition 4
equivalence 40
equivalent 40
fact 1
function 56
include 43
intersection 47
near 77
54.2 Definition:
opposite
The opposite of a
relation a £ Rel(A,.E>) is the relation a op E Rel(.B, A)
defined by a op = j
(6, a) | (a, b) E aj.
ba op a aab
It follows that a i
— > a op : Rel(A,H) — >• Rel(H, A) is a function.
54.2.2 Example On R
the opposite of “>” is “<” and the opposite of “<” is
Of course, for any
set A, the opposite of Aq is Aq .
55. Reflexive
relations
55.1 Definition:
reflexive
Let a be a binary
relation on 1. a is reflexive if a a a for every
element a E A.
55.1.1 Example Aq
is reflexive on any set A, and the relation “< ” is reflexive
on R.
55.1.2 Example On
the powerset of any set the relation “C” is reflexive.
55.1.4 Example
Another important type of reflexive relation are the relations
like xM y \x — y\ <
0.1 , defined on R. “A7” stands for “near”. The choice of 0.1
as a criterion for
nearness is not important; what is important is that it is a fixed
number.
78
definition 4
divide 4
equivalent 40
fact 1
implication 35, 36
nearness relation
77
reflexive 77
relation 73
sister relation 77
symmetric 78, 232
vacuous 37
{( 1 , 1 ), ( 1 , 2
), ( 2 , 2 )}
is reflexive on
{1,2} but not on {1,2,3}.
55.1.7 Warning It
is wrong to say that the relation a of 55.1.6 is “reflexive at 1
but not at 3”.
Reflexivity and irreflexivity are properties of the relation and the
set it is defined
on, not of particular elements of the set on which the relation is
defined. This
comment also applies to the other properties of relations discussed in
this section.
55.1.9 Exercise
Which of these relations is reflexive?
a) a = {(1, 1),
(2,2), (3,3)} on {1,2,3}.
b) a = {(1,1), (2,
2), (3, 3)} on N.
c) “divides” on Z.
d) a on R defined
by xay x 2 = y 2 .
(Answer on page
245.)
56. Symmetric
relations
56.1 Definition:
symmetric
A relation a on a
set A is symmetric if for all a, b £ A,
a ab => baa
56.1.2 Warning It
is important to understand the precise meaning of the defini-
tion of symmetric.
It is given in the form of an implication: a ab =t- baa. Thus
(a) it could be
vacuously true (the empty relation is symmetric!) and (b) it does
not assert that a
ab for any particular elements a and b : that a is symmetric does
not mean (a ab) A
(6 a a) .
79
56.1.4 Exercise
Which of these relations is symmetric?
a) a = {<1,2), <2,
3), <1, 3), <2, 1), <4, 1)} on {1,2, 3, 4}.
(Answer on page
245.)
56.1.5 Exercise
Show that if a relation a on a set A is not symmetric, then A
has at least two
distinct elements.
antisymmetric 79
definition 4
divide 4
implication 35, 36
include 43
nearness relation
77
negation 22
powerset 46
relation 73
symmetric 78, 232
vacuous 37
57. Antisymmetric
relations
57.1 Definition:
antisymmetric
A relation a on a
set A is antisymmetric if for all a,b G A,
(a a b Aba a) =4- a
= b
57.1.1 Warning
Antisymmetry is not the negation of symmetry; there are rela-
tions such as A
which are both symmetric and antisymmetric and others such as
“divides” on Z
which are neither symmetric nor antisymmetric.
57.1.2 Exercise
Prove that on any set A, Aa is antisymmetric.
57.1.3 Exercise
Prove that on Z, “divides” is neither symmetric nor antisym-
metric.
57.1.5 Example
Antisymmetry is typical of many order relations: for example,
the relations “<”
and “<” on R are antisymmetric. Orderings are covered in
Chapter 134.
80
antisymmetric 79
definition 4
equivalent 40
implication 35, 36
include 43
nearness relation
77
relation 73
sister relation 77
symmetric 78, 232
transitive 80, 227
vacuous 37
57.1.9 Exercise
Which of these relations is antisymmetric?
a) a = {<1,2), <2,
3), <3, 1), <2, 2}} on N.
b) “divides” on N.
c) > on R.
(Answer on page
245.)
57.1.10 Exercise
Show that if a relation a on a set A is not antisymmetric, then
A has at least two
distinct elements.
57.1.11 Exercise
Let a be a relation on a set A. Prove that a is antisymmetric
if and only if afla
op C Aq. (Another problem like this is Problem 84.2.5, page 124.)
58. Transitive
relations
58.1
Definition: transitive
A relation a on
A is transitive if for all elements a, b and c of A,
(a a b Abac) =>
aac
58.1.1 Example
All the relations Aq , “<”, “<” and “C” are obviously tran-
sitive. That
equals is transitive is equivalent to the statement from high-school
geometry that
two things equal to the same thing are equal to each other.
58.1.2 Example
The sister relation S is not transitive, not even on the set of
all women. Thus
Agatha may be Bertha’s sister, whence Bertha is Agatha’s sister,
but Agatha is
not her own sister. This illustrates the general principle that when a
definition uses
different letters to denote things, they don’t have to denote different
things. In the
definition of transitivity, a, b and c may be but don’t have to be
different.
58.1.3 Example
Nearness relations are not transitive.
58.1.4 Example
Let A be the set {{1,2}, {3}, 2, 6, {{1,3}, {1,2}}} The relation
“G” on A is not
transitive, since 2 £ {1,2} and {1,2} £ {{1,3}, {1,2}}, but 2 ^
{{1,3}, {1,2}}.
58.1.5 Warning
Transitivity is defined by an implication and can be vacuously
true. In fact,
all the properties so far have been defined by implications except
reflexivity.
And indeed the empty relation is symmetric, antisymmetric and transi-
tive!
81
58.1.6 Remark
The digraph of a transitive relation must have the property that
every “path of
length two” , such as
must be
completed to a triangle, like this:
antisymmetric
79
definition 4
equivalent 40
irreflexive 81
negation 22
reflexive 77
relation 73
symmetric 78,
232
transitive 80,
227
Paths are
covered formally in Section 149.
58.1.7 Exercise
Give an example of a nonempty, symmetric, transitive relation
on the set
{1,2} that is not reflexive.
58.1.8 Exercise
State and prove a theorem similar to Problem 56.1.5 for non-
transitive
relations.
58.1.9 Exercise
Let the relation R be defined on the set {x £ R | 0 < x < 1} by
xRy ■&3t(x + t
= y and 0 < t < 1)
Is R
transitive?
58.1.10
Exercise (hard) If possible, give examples of relations on the set {1,2, 3}
which have
every possible combination of the properties reflexive, symmetric, anti-
symmetric and
transitive and their negations. (HINT: There are 14 possible com-
binations and
two impossible ones.)
59. Irreflexive
relations
59.1
Definition: irreflexive
A relation a is
irreflexive if a a a is false for every a € A.
59.1.1 Example
The “<” relation on R is irreflexive.
59.1.2 Warning
Irreflexive is not the negation of reflexive: a relation might be
neither
reflexive nor irreflexive, such as for example the relation
a = {(1,1),
(1,2), (2, 2)}
on {1,2,3}.
82
antisymmetric
79
definition 4
divide 4
div 82
equivalent 40
integer 3
irreflexive 81
mod 82, 204
positive 3
reflexive 77
relation 73
remainder 83
symmetric 78,
232
transitive 80,
227
(Answer on page
245.)
59.1.4 Exercise
List the properties (reflexive, symmetric, antisymmetric, transi-
tive, and
irreflexive) of each relation.
a) “not equals”
on R.
b) x a y 44 x 2
= y 2 on R
c) x a y ^ x =
—y on R
d) x a y 44 x <
y 2 on R
e) “divides” on
N
f) “leaves the
same remainder when divided by 3” on N
g) {(1,1),
(2,3), (3,2), (3,4)} on {1,2, 3, 4}
(Answer on page
245.)
59.1.5 Exercise
Let /? be an irreflexive, antisymmetric relation on a set S. Show
that at most
one of the statements u ai3b ” and “6/3a” holds for any pair of elements
a,b of S.
60. Quotient
and remainder
Let m and n be
positive integers with n / 0 . If you divide n into m you get a
quotient and a
remainder; for example, if you divide 4 into 14 you get a quotient 3
and a remainder
2 . We will write the quotient when m is divided by n as m div n
and the
remainder as mnrodn, so that 14 div 4 = 3 and 14 mod 4 = 2. The basis
for the formal
definition given below is the property that 14 = 3x4 + 2.
The
following formal definition allows m and n to be negative as well as positive.
This has
surprising consequences discussed in Section 61.3.
59.1.3
Exercise List the properties (reflexive, symmetric, antisymmetric, transi-
tive, and
irreflexive) of the relations given by each picture.
83
60.1
Definition: quotient and remainder
Let m and n
be integers. Then q = mdivn and r = mmodn if and
only if q
and r are integers that satisfy both the following equations:
Q.l m = qn
+ r, and
Q.2 0 < r <
\n\ .
If q =
mdivn, then q is the quotient (of integers) when m is divided
by n . If r
= m mod n , then r is the remainder when m is divided by
n.
definition
4
div 82
integer 3
mod 82, 204
quotient
(of inte-
gers) 83
remainder
83
60.1.1
Remarks
a) It
follows from the definition that the equation
m =
(mdivn)n + (mmodn) (60.1)
is always
true for n / 0 .
b) On the
other hand, if n = 0, Q.2 cannot be true no matter what r is. In other
words,
“mdivO” and “mmodO” are not defined for any integer m.
60.1.2
Exercise Find the quotient (of integers) and remainder when m is divided
by n:
a) m = 2 ,
n = 4 .
b) m = 0, n
= 4.
c) m = 24,
n = 12.
d) rn = 37,
n = 12.
(Answer on
page 245.)
60.1.3
Warning For q to be ?ndivn and r to be mmodn, both Q.l and Q.2
must be
true. For example, 14 = 2 x 4 + 6 (so Q.l is satisfied with q = 2 and r = 6),
but 14 mod
4 / 6 because Q.2 is not satisfied.
60.1.4
Exercise Suppose that a and b leave the same remainder when divided
by m. Show
that a — b is divisible by m. (Answer on page 245.)
60.1.5
Exercise Suppose that a — b is divisible by m. Show that a and b leave
the same
remainder when divided by m.
60.1.6
Exercise Suppose that adivm = 6divm. Show that \a — b\<\m\.
60.1.7
Exercise Is the converse of Exercise 60.1.6 true? That is, if \a — b\ < \m \ ,
must it be
true that arnodm = b mod rri ?
The
following theorem is what mathematicians call an “existence and uniqueness”
theorem for
quotient and remainder.
84
divide 4
div 82
function 56
integer 3
mod 82, 204
negative
integer 3
nonnegative
integer 3
proof 4
quotient
(of inte-
gers) 83
remainder
83
theorem 2
60.2
Theorem: Existence and Uniqueness Theorem for
quotient
and remainder
For given
integers rn and n with n / 0 , there is exactly one pair of
integers q
and r satisfying the requirements of Definition 60.1.
60 . 2.1
Remark This theorem says that when jj/ 0 there is a quotient and a
remainder,
i.e. , there is a pair of numbers q and r satisfying Q.l and Q.2, and that
there is is
only one such pair.
60 . 2.2
Worked Exercise Suppose that m = 3n + 5 and n > 7 . What is mdivn?
Answer m
divn = 3. The fact that m = 3n + 5 and n > 7 (hence n > 5) means
that q = 3
and r = 5 satisfy the requirements of Definition 60.1.
60 . 2.3
Exercise Suppose a, b, m . and n are integers with m and n nonnegative
such that m
= (a + l)n + b + 2 and m div n = a. Show that b is negative. (Answer
on page
245.)
60 . 2.4
Exercise Suppose n > 0, 0 < s < n and n\s. Show that s = 0. (Answer
on page
246.)
There is a
connection between these ideas and the idea of “divides” from Defini-
tion 4.1
(page 4):
60.3
Theorem
If n 7 ^ 0
and rn mod n = 0 , then n\m.
Proof If
mmodn = 0, then by Q.l, m = (mdivn)n, so by Definition 4.1 (using
mdivn for
q), n divides m.
60.4 Mod
and div in Mathematica
To compute
mdivn in Mathematica, you type Quotient [m,n] , and to compute
mmodn, you
type Mod[m,n], You can if you wish place either of these function
names
between the inputs surrounded with tildes: m "Quotient" n is the same as
Quotient
[m,n] , and m "Mod" n is the same as Mod[m,n] .
60.5 Proof
of uniqueness
We will
prove that the quotient and remainder exist in Section 104.3.2, page 156.
It is
worthwhile to see the proof that the quotient and remainder are unique, since
it shows
how it is forced by Definition 60.1.
Suppose m =
qn + r = q'n + r' and both pairs (q,r) and ( q',r '} satisfy Q.2. We
must show
that the two ordered pairs are the same, that is, that q = q’ and r = r'.
By Q.2 we
have 0 < r < \n\ and 0 < r' < |n|. Since r and r' are between 0
and \n\ on
the number line, the distance between them, which is |r — r'\ , must also
be less
than n. A little algebra shows that
\r — r'\ =
| q' — q | |n|
It then
follows from Definition 4.1, page 4, that | r — r'\ is divisible by |n| . But a
non-
negative
integer less than |n| which is divisible by \n\ must be 0 (Exercise 60.2.4).
85
So r = r
' . Since qn + r = q'n + r ' , it must be that q = q ' , too. So there can be only
one pair of
numbers q and r satisfying Q.l and Q.2.
This proof
uses the following method.
60.5.1
Method
To prove
that an object that satisfies a certain condition is unique,
assume
there are two objects A and A! that satisfy the condition and
show that A
= A' .
characterize 85
div 82
integer 3
mod 82, 204
quotient
(of inte-
gers) 83
remainder
83
well-
defined 85
60.5.2
Exercise Use Definition 60.1 and Theorem 60.2 to prove that when 37 is
divided by
5, the quotient is 7 and the remainder is 2. (Answer on page 246.)
60.5.3
Exercise Use Definition 60.1 and Theorem 60.2 to prove that 115 div 37 =
3.
60.5.4
Exercise Suppose that fn = 36q + 40 . What is m mod 36? (Answer on
page 246.)
60.5.5
Exercise Prove that if q, m and n are integers and 0 <m — qn< \n\,
then q = m
div n .
60.5.6
Exercise Show that if a and b are positive integers and amod4 = 6mod
4 = 3, then
ab mod 4 = 1.
60.5.7
Exercise Prove that for any integer c, c 2 mod3 is either 0 or 1.
60.6 More
about definitions
Observe
that Definition 60.1 defines “mdivn” and “mrnodn” without telling you
how to
compute them. Normally, you would calculate them using long division, but
the
uniqueness Theorem 60.2 tells you that if you can find them some other way
you know
you have the right ones. A mathematician would say that Theorem 60.2
ensures
that the quotient (of integers) m divn and the remainder mrnodn are well-
defined, or
that Definition 60.1 and Theorem 60.2 work together to characterize
the
quotient and remainder.
It is
typical of definitions in abstract mathematics that they characterize a con-
cept
without telling you how to compute it. The technique of separating the two
ideas,
“what is it?” and “how do you compute it?”, is fundamental in mathematics.
86
decimal 12,
93
definition
4
digit 93
div 82
fact 1
floor 86
greatest
integer 86
integer 3
mod 82, 204
quotient
(of inte-
gers) 83
real number
12
rule of
inference 24
trunc 86
usage 2
61. Trunc
and Floor
Many
computer languages have one or both of two operators trunc and floor which
are related
to div and are confusingly similar. Both are applied to real numbers.
61.1
Definition: floor
Floor (r),
or the greatest integer in r, is the largest integer n with
the
property n < r .
61.1.1
Example floor(3.1415) = 3, floor(7/8) =0, and floor(— 4.3) = —5.
61.1.2
Usage Floor(r) is denoted by |_rj in modern texts, or by [r] in older ones.
61.1.3
Exercise State a rule of inference for floor(?’) . (Answer on page 246.)
61.2
Definition: trunc
Trunc (r)
is obtained from r by expressing r in decimal notation and
dropping
all digits after the decimal point.
61.2.1 Fact
The function trunc satisfies the equation
trunc(r)
floor(r) r
> 0 or r an integer
floor(r) +
1 r < 0 and not an integer
61.2.2
Example trunc(— 4.3) = —4, but floor(— 4.3) = —5. On the other hand,
trunc(— 4)
= floor(— 4) = —4, and if r is any positive real number, trunc(r) =
floor(r) .
61.2.3
Exercise Find trunc(x') and floor(x) for
a) x = 7/5.
b) x =
-7/5.
c) x = — 7.
d) x = —
6.7.
(Answer on
page 246.)
61.3
Quotients and remainders for negative integers
61.3.1
Example According to Definition 60.1, — 17div5 = — 4 and — 17mod5 =
3, because
—17 = (—4) -5 + 3 and 0 < 3 < 5. In other words, the quotient is
floor(—
17/5) , but not trunc(— 17/5) .
87
61.3.2
Usage A computer language which has an integer division (typically called
div or
“/” ) which gives this answer for the quotient is said to have floored division.
Other
possibilities include allowing the remainder in Definition 60.1 to be nega-
tive when m
is negative. This results in the quotient being trunc instead of floor,
and, when
implemented in a computer language, is called centered division. That
is how many
implementations of Pascal behave. When n is negative the situation
also allows
several possibilities (depending on whether m is negative or not).
In this
book, integer division means floored division, so that it conforms to
Definition
60.1.
62. Unique
factorization for integers
62.1 The
Fundamental Theorem of Arithmetic
It is a
fact, called The Fundamental Theorem of Arithmetic, that a given
positive
integer m> 1 has a unique factorization into a product of positive primes.
Thus 12 = 2
x 2 x 3, 111 = 3 x 37, and so on. The factorization of a prime is that
prime
itself: thus the prime factorization of 5 is 5. The Fundamental Theorem of
Arithmetic
is proved in a series of problems in Chapter 103 as an illustration of the
proof
techniques discussed there.
The
factorization into primes is unique in the sense that different prime factor-
izations
differ only in the order they are written.
Here is the
formal statement:
62.2
Theorem
Let m be an
integer greater than 1 . Then for some integer n > 1 there
is a unique
list of primes p\,p 2 ,... ,p n and a unique list of integers
h,k
2 ,... ,k n such that
FT.l pi <
pi + i for 1 < i < n.
FT. 2 m =
p\ x p 2 2 ■ ■ -Pn 1 ■
62.2.1
Example
12 = 2x2x3
= 2x3x2 = 3x2x2
Theorem
62.2 specifically gives 12 = 2 2 x 3 1 . Here n = 2, p\ = 2, p 2 = 3, k\ = 2
and k 2 =
l.
62.2.2
Exercise Give the prime factorizations of 30, 35, 36, 37 and 38.
(Answer on
page 246.)
62.3
Definition: exponent of a prime in an integer
The largest
power of a prime p which divides a positive integer n is the
exponent of
p in n and is denoted e p (n) .
62.3.1
Example The exponent of 2 in 24 is 3; in other words, e2(24) = 3. You
can check
that e 37 (lll) = 1 and e 37 ( 110 ) = 0.
centered
division 87
definition
4
divide 4
div 82
exponent 87
floored
division 87
floor 86
Fundamental
Theo-
rem of
Arith-
metic 87
integer 3
negative
integer 3
positive
integer 3
prime 10
quotient
(of inte-
gers) 83
remainder
83
theorem 2
trunc 86
usage 2
88
coordinate
49
definition
4
divide 4
divisor 5
exponent 87
GCD 88
greatest
common
divisor 88
integer 3
least
common multi-
ple 88
nonnegative
integer 3
positive
integer 3
prime 10
theorem 2
62.3.2
Exercise Find the exponent of each of the primes 3, 7 and 37 in the
integers
98, 99, 100, 111, 1332, and 1369. (Answer on page 246.)
The fact
that the prime factorization is unique implies the following theorem:
62.4
Theorem
Let m and n
be positive integers. If m\n and p is a prime, then
e p (m) <e
p (n). Conversely, if for every prime p, e p (m) <e p (n), then
m\n.
62.5 Prime
factorization in Mathematica
62.5.1
Exercise Factor all the two-digit positive integers that begin with 9.
(Answer on
page 246.)
62.5.2
Exercise Show that for every positive integer k, there is an integer n that
has exactly
k positive divisors.
62.5.3
Exercise (hard) Prove Theorem 62.4.
62.5.4
Exercise (discussion) Type Factorlnteger [6/7] in Mathematica.
Explain the
answer you get. Should the name “Factorlnteger” be changed to
some other
phrase?
The
greatest common divisor or GCD of two nonnegative integers
m and n is
0 if m = n = 0 ; otherwise the GCD is the largest number
which
divides both of them.
63.2
Definition: least common multiple
The least
common multiple (LCM) of two nonnegative integers m
and n is 0
if either m or n is 0; otherwise it is the smallest positive
integer
which both m . and n divide.
63.2.1
Example It follows from the definition that GCD(0,0) = 0, GCD(0,4) =
GCD(4,0)
=4, GCD(16,24) = 8, and GCD(5,6) = 1. Similarly, LCM(0,0) = 0,
LCM(1, 1) =
1, LCM(8,12) = 24 and LCM(5,6) =30.
89
63.2.2
Exercise Find GCD(12,12), GCD(12,13), GCD(12,14), GCD(12,24),
and also
find the LCM’s of the same pairs of numbers. (Answer on page 246.)
63.2.3
Exercise Compute GCD(48,72) and LCM(48,72).
63.2.4
Exercise If m and n are positive integers and d = GCD(m,n) , must
GCD (m/d,n)
= 1? Explain your answer. (Answer on page 246.)
63.2.5
Exercise Let A = {1, 2, 3,4} . Write out all the ordered pairs in the relation
a on A
where a is defined by: aab 44 GCD (a, 6) = 1. (Answer on page 246.)
63.2.6
Exercise Let a be the relation on Z defined by aab 44 GCD(a,6) = 1.
Determine
which of these properties a satisfies: Reflexive, symmetric, transitive,
antisymmetric.
63.2.7
Usage Some texts call the GCD the Greatest Common Factor (GCF).
63.2.8
Remark In general, GCD(0,m) = GCD(m,0) = m for any nonnegative
integer m.
Note that Definition 63.1 defined GCD(0,0) as a special case. This
is
necessary because every integer divides 0, so there is no largest integer that
divides 0.
This awkward detail occurs because our definition is in a certain sense
not the
best definition. (See Corollary 64.2 below.)
63.3
Definition: relatively prime
If GCD(m,n)
= 1, then m and n are relatively prime.
63.3.1
Example 5 and 6 are relatively prime, but 74 and 111 are not relatively
prime since
their GCD is 37.
63.3.2
Exercise Show that for any integer n, n and n+1 are relatively prime.
(Answer on
page 246.)
63.3.3
Exercise
a) Show
that if n + 1 distinct integers are chosen from the set {1,2, .. . ,2n} , then
two of them
are relatively prime.
b) Show
that there is a way to choose n integers from {1,2,... ,2n} so that no
two
different ones are relatively prime.
63.3.4
Warning The property “relatively prime” concerns two integers. It makes
no sense to
speak of a single integer as being “relatively prime” .
63.4
Definition: lowest terms
A rational
number m/n is in lowest terms (see Definition 7.3, page 11)
if m and n
are relatively prime.
63.4.1
Exercise Prove that if m/n and r/s are rational numbers represented in
lowest
terms and m/n = r/s, then \m\ = \r\ and |n| = |s| .
definition 4
divide
4
equivalent 40
GCD 88
integer
3
lowest
terms 11
nonnegative integer 3
ordered
pair 49
positive integer 3
relation 73
relatively prime 89
usage 2
90
Cartesian product 52
commutative 71
corollary 1
divide
4
exponent 87
Fundamental Theo-
rem of
Arith-
metic
87
GCD 88
integer
3
lowest
terms 11
nonnegative integer 3
positive integer 3
prime
10
relatively prime 89
theorem
2
64.
Properties of the GCD
If in >
1 and n > 1 , and you know the prime factorizations of both of them, the
GCD and
LCM can be calculated using the following theorem, in which e p (m)
denotes
the exponent of p in m (Definition 62.3), min(r, s) denotes the smaller of r
and s
and max(r, s) the larger.
64.1
Theorem
Let p
be a prime and m and n positive integers. Then
e p
(GCD(m,n)) = min(e p (m),e p (n))
and
e p
(LCM(m,n)) = max(e p (m),e p (n))
64.1.1
Example 60 = 2 2 x 3 x 5 and 72 = 2 3 x 3 2 . Their GCD is 12 = 2 2 x 3, in
which 2
occurs min(2,3) times, 3 occurs min(l,2) times, and 5 occurs min(l,0)
times.
Their LCM is 360 = 2 3 x 3 2 x 5.
64.2
Corollary
Let m
and n he nonnegative integers. GCD(m,n) is the unique non-
a)
GCD(m,n) divides both m and n.
b) Any
integer e which divides both m and n must divide
GCD
(m,n) .
64.2.1
Remark The property of GCD given in this corollary is often taken as the
definition of GCD. Note that no special consideration has to be given to the case
m = n =
0 .
64.2.2
Exercise Prove Corollary 64.2. (This corollary can be proved without
using
the Fundamental Theorem of Arithmetic. See Exercise 88.3.8, page 130.)
(Answer
on page 246.)
64.2.3
Exercise Use Theorems 62.4 and 64.1 to prove these facts about the GCD
and the
LCM:
a)
GCD(m,n)LCM(m,ri) = mn for any positive integers m and n.
b) If m
and n are relatively prime, then LCM(m,n) =mn.
64.2.4
Exercise Prove that if d = GCD (m,n), then m/d and n/d are relatively
prime.
(Answer on page 246.)
64.2.5
Exercise Prove that every rational number has a representation in lowest
terms.
64.2.6
Exercise Prove that GCD is commutative: for all integers m and n,
GCD(m,
n) = GCD(n, m) .
91
64.2.7
Exercise Prove that GCD is associative:
Hint:
Use Theorem 64.1 and the fact that the smallest of the numbers x, y and z
is
64.2.8
Exercise (Mathematica)
a) Use
Mathematica to determine which ordered pairs ( a,b ) of integers, with
a € {1,
. . . , 10} , b £ {1, . . . , 10} , have the property that the sequence a + b,2a +
b) Let
(C) be the statement:
associative 70
commutative 71
definition 4
divide
4
function 56
GCD 88
integer
3
ordered
pair 49
predicate 16
prime
10
There
is an integer k > 0 for which ak + b is prime.
(The
integer k does not have to be less than or equal to 10.) Based on
the
results, formulate a predicate P(a,b) such that the condition (C) implies
P(a,b).
The predicate P should not mention k.
c)
Prove that (C) implies P(a,b).
Note:
Define a function by typing t [a_ , b_] : = Table [a k + b , {k , 1 , 10}] (notice
the
spacing and the underlines). Then if you type, for example, t[3,5], you will
get
{8,11,14,17,20,23,26,29, 32,35}. If L is a list, Select [L,PrimeQ] produces
a list
of primes occurring in L.
64.3
Extensions of the definition of GCD
GCD is
often defined for all integers, so that GCD(m,n) is GCD(|m| , |n|) . For
64.4
Definition: generalized GCD
Let
ni , ri 2 ,...,nfc be integers. Then GCD(rai, . . . T rik) is the largest
integer
that divides all the numbers |ni| , |ri 2 1 , ■ • ■ ,\rik\-
64.4.1
Example GCD(4,6, -8, 12) = 2.
64.4.2
Remarks
a)
Similar remarks can be made about the LCM.
b)
These functions are implemented in Mathematica using the same names. For
divide
4
div 82
Euclidean algo-
rithm
92
GCD 88
integer
3
nonnegative integer 3
proof 4
remainder 83
theorem
2
65.
Euclid’s Algorithm
Theorem
64.1 is fine for finding the GCD or LCM of two numbers when you know
their
prime factorization. Unfortunately, the known algorithms for finding the prime
factorization are slow for large numbers. There is another, more efficient method
for
finding the GCD of two numbers which does not require knowledge of the prime
For
all nonnegative integers m and n :
Proof Both parts of Theorem 65.1 follow from Definition 6.1, page 10. EA.l
largest integer dividing m and 0 is the same as the largest integer dividing m,
which of course is m.
To
prove EA.2, suppose d is an integer that divides both m and n. Since
r =
m — qn . where q = m div n , it follows from Theorem 5.4, page 8, that d divides
r.
Thus d divides both n and r.
Now
suppose e divides both n and r . Since m = qn + r, it follows that e divides
m.
Thus e divides both m and n.
In
the preceding two paragraphs, I have shown that m and n have the same
common divisors as n and r. It follows that m and n have the same greatest
process for determining the GCD . This process is the Euclidean algorithm. The
process always terminates because every time EA.2 is used, the integers involved
are
replaced by smaller ones (because of Definition 60.1(Q.2), page 83) until one of
65.1.2 Example
A
fragment of a Pascal program implementing the Euclidean algorithm is given
while N <> 0 do
begin
rem : = M mod N ;
M := N;
N := rem;
end;
{M=GCD(K,L)}
decimal 12, 93
integer 3
positive integer 3
specification 2
The number of states in the United States of America is an integer. In the usual
between numerals like ‘5’ and ‘0’ and the integers they represent. In particular,
the
sequence of numerals ‘50’ represents the integer which is the number of states in
the
Numerals, as well as letters of the alphabet and punctuation marks, are char-
acters. Characters are a type of data, distinct from integers or other numerical
types. In order to distinguish between a character like ‘5’ and the number 5 we put
characters which we are discussing in single quotes. Pascal has a data type CHAR
of which numerals and letters of the alphabet are subtypes. Single quotes are used
called a string.
66.2.1 Remarks
b) In this book we put strings in single quotes when we discuss them. Thus ‘cat’
animal!).
66.3 Bases
The decimal notation we usually use expresses an integer as a string formed of the
numerals ‘O’, ‘1’, ... ,‘9’. These numerals are the decimal digits. The word
“digit”
is often used for the integers they represent, as well. The notation is based on
the
fact that any positive integer can be expressed as a sum of numbers, each of which
258 = 2 x 10 2 + 5 x 10 1 + 8 x 10° .
94
base 94
decimal 12, 93
definition 4
digit 93
integer 3
least significant
digit 94
more significant 94
most significant
digit 94
nonnegative integer 3
octal notation 94
radix 94
The expression ‘258’ gives you the digits multiplying each power of 10 in decreas-
ing order, the rightmost numeral giving the digit which multiplies 1 = 10° .
octal notation, for example, the base is 8, and the octal digits are ‘O’,
‘1’, ... , ‘7’.
For example,
258 = 4 x 8 2 + 0 x 8 1 + 2 x 8°
notation by ‘402’ .
dm d m — 1 d m — 2 •••dido’ (66.1)
n = n m b m + n m -ib m ~ l 4 f n 0 b° (66.2)
(66.3)
66.4.1 Remarks
a) We will say more about the symbols d* below. For bases b < 10 these symbols
are normally the usual decimal digits,
discussed in Chapter 68. Note that you can do the exercises in this section
without knowing how to find the base- 6 representation of an integer — all you
66.4.2 Notation When necessary, we will use the base as a subscript to make
it clear which base is being used. Thus 258io = 402s , meaning that the number
66.5.1 Example The least significant digit in 258io is 8 and the most significant
is 2.
95
66.5.2 Remark For a given b and n, the following theorem says that the rep-
resentation given by definition 66.4 is unique, except for the choice of the
symbols
representing the rii . We will take this theorem as known.
66.6 Theorem
If n and b are positive integers with b > 1 , then there is only one
66.6.1 Worked Exercise Prove that the base 4 representation of 365 is 11231.
Note that in this answer we merely showed that 11231 fit the definition. That
is all that is necessary. Of course, if you are not given the digits as you were in
this
problem, you need some way of calculating them. We will describe ways of doing
246.)
integer such that the base b representation of n is 352. Prove using only the
35201.
66.7.2 Bases larger than 10 For bases b< 10, the usual numerals are used,
as mentioned before. A problem arises for bases bigger than 10: you need single
symbols for the integers 10, 11, .... Standard practice is to use the letters of
the
alphabet (lowercase here, uppercase in many texts): ‘a’ denotes 10, ‘b’ denotes 11,
in computing. For example, 95io is 5fi@, and 266io is hexadecimal lOaig (read
this “one zero a”, not “ten a”!) In texts in which decimal and nondecimal bases are
mixed, the numbers expressed nondecimally are often preceded or followed by some
symbol; for example, many authors write $10a or HlOa to indicate 266io expressed
hexadecimally.
base 94
binary notation 95
decimal 12, 93
digit 93
hexadecimal nota-
tion 95
hexadecimal 95
integer 3
positive integer 3
theorem 2
96
base 94
decimal 12, 93
digit 93
integer 3
least significant
digit 94
nonnegative integer 3
positive integer 3
prime 10
realizations 96
tion” here has a technical meaning, roughly made real or made concrete.) All the
tal or correct than another, although one may be more familiar or more convenient
than another.
There is also a distinction to be made between properties of an integer and
the number of states in the USA written in base 10 ends in ‘O’, but in base 3 it
ends
in ‘2’.
b, and n is an integer. When n is written in base b, how do you tell from the
digits
66.8.2 Exercise Would Theorem 66.6 still be true if the requirement that 0 <
rii < b — 1 for all i were replaced by the requirement that the n t be nonnegative?
digits are 1 .
ible by 3 .
are divisible by 3 . The conjecture should apply to all repunits, not just those
have a built-in integer variable BASE. Whatever integer you set BASE to will be
used
as the base for all numbers output. How would you discover the current value of
BASE in such a language? (Assume you print the value of a variable X by writing
PRINT (X)).
97
Among the first algorithms of any complexity that most people learn as children are
the algorithms for adding, subtracting, multiplying and dividing integers written
in
these processes.
67.1 Addition
The usual algorithm for addition you learned in grade school works for numbers in
other bases than 10 as well. The only difference is that you have to use a
different
67.1.1 Example To add 95a and b87 in hexadecimal you write them one above
the other:
95a
+b87
14el
• Calculate a+7 = 11m, with a carry of 1 since 11m > 10m- (Pronounce 10m
as “one-zero”, not “ten”, since it denotes sixteen, and similarly for 11m which
denotes seventeen. By the way, the easiest way to figure out what a + 7 is is to
• Then add 5 and 8 and get d (not 13!) and the carry makes e. e < 10m so there
is no carry.
• Finally, 9 + b = 14m-
So the answer is 14e lm • The whole process is carried out in hexadecimal without
67.1.2 Addition in binary The addition table for binary notation is especially
carry.
67.2 Multiplication
multiplication like
346 (multiplicand)
X527 (multiplier)
2422
173000
182342 (product)
you produce successive partial products, and then you add them. The partial prod-
decimal 12, 93
digit 93
hexadecimal nota-
tion 95
integer 3
98
base 94
digit 93
hexadecimal nota
tion 95
1101
X1101
1101
1101
1101
10101001
67.2.5 Exercise Show that in adding two numbers in base b, the carry is never
more than 1 , and in multiplying in base b , the carry is never more than b — 2.
67.2.6 Exercise (discussion) Because subtracting two numbers using pencil and
paper is essentially a solitary endeavor, most people are not aware that there are
two different algorithms taught in different public school systems. Most American
states’ school systems teach one algorithm (Georgia used to be an exception), and
many European countries teach another one. Ask friends from different parts of the
world to subtract 365 from 723 while you watch, explaining each step, and see if
you detect anyone doing it differently from the way you do it.
(Most people are taught in grade school to suppress the zeroes to the right of the
multiplying digit.)
tion. In binary notation, the only digits are 0, which causes a missing line, and
1,
which involves only shifting the top number. So multiplying one number by another
in binary consists merely of shifting the first number once for each 1 in the
second
99
68.1.1 Remark Given a nonnegative integer n and a base b, the most significant
by the largest power of b less than n. For example, in base 10, the most
significant
digit of 568 is 5, and indeed 5 = 568 div 100 (100 is the largest power of 10 less
than
integer.
base 94
digit 93
div 82
integer 3
most significant
digit 94
nonnegative integer 3
remainder 83
68.1.2 Method
■ ■ do , where di
d m = n div b m
and
d m - 1 = (n - d m b m ) div b m ~ l
(68.1)
where
n m = n
(68.2)
rii = n i+ 1 - di + ±b l+1
(68.3)
(here m = 2: note that the 5 in 568 is since we start counting on the right at 0).
which is correct for all i = 0,1,... ,m. The way (68.1) is written shows that the
c) 263div64 = 4.
d) 263-4 x 64 = 7.
100
base 94
digit 93
div 82
integer 3
octal notation 94
e) 7 div 8 = 0.
f) 7 — 0 x 8 = 7.
g) 7 div 1 = 7.
The algorithm just described is expressed in Pascal in Program 68.1. This algorithm
works as written for bases up to and including 10; to have it print out ‘a’ for 11,
‘b’
begin
begin
power := power*base
end;
begin
end
end
Another algorithm, which computes the digits backwards, stores them in an array,
and then prints them out in the correct order, is given in Program 68.2. It is more
efficient because it is unnecessary to calculate the highest power of the base less
than N first. This program starts with the observation that the least significant
and the number represented by the other digits, 56, is (568 — 8)/10.
In the program in Program 68.2, count and u are auxiliary variables of type
integer. The size longest of the array D has to be known in advance, so there
is a bound on the size of integer this program can compute, in contrast to the
previous algorithm. It is instructive to carry out the operations of the program in
Definition 66.4 (page 94), depends on the length of the string of digits
representing
101
begin
count : = 0 ; u : = N ;
while u<>0 do
begin
count := count+1
end;
while countoO do
begin
count := count- 1;
write D [count]
end
end;
base 94
digit 93
hexadecimal nota-
tion 95
integer 3
octal notation 94
n (the length is m + 1 because the count starts at 0). If you read the digits from
left
to right, as is usual in English, you have to read to the end before you know what
m is. On the other hand, the significance of the right digit do is known without
knowing the length m. In particular, the program in Program 68.1 has to read to
The fact that the significance of a digit is determined by its distance from the
right is the reason a column of integers you want to add is always lined up with
the
right side straight. In contrast to this, the sentences on a typewritten page are
lined
There is a good reason for this state of affairs: this notation was invented by
68.4.1 Exercise Represent the numbers 100, 111, 127 and 128 in binary, octal,
hexadecimal and base 36. (Answer on page 246.)
68.4.2 Exercise Represent the numbers 3501, 29398 and 602346 in hexadecimal
Exercises 68.5.1 through 68.5.4 are designed to give a proof of Formula (68.4),
page 99, so they should be carried out without using facts about how numbers
are represented in base b. In these exercises, all the variables are of type
integer.
68.5.1 Exercise Let b > 1 . Prove that if for all i > 0, 0 < d{ < b, then
68.5.2 Exercise Let 6>1 and n>0. Let n = d m b m + \-d\b + do with 0<
102
conjunction 21
defining condition 27
definition 4
div 82
equivalent 40
rule of inference 24
unit interval 29
68.5.3 Exercise Let b > 1 and n > 0 and let n = d m b m -\ \-d\b + do with 0 <
d m b m ~ l + d m -ib m ~ l ~ l -\ b di = n div b l
and
Consider what happens when you negate a conjunction. The statement — i(P A Q )
means that it is false that P and Q are both true; thus one of them must be false.
In other words, either —>P is true or — i Q is true. This is one of the two
DeMorgan
Laws:
DM.1 ~^{PAQ)
and
The unit interval I = {x | 0 < x < 1} , which means that x G I if and only if 0 < x
and x < 1 . Therefore to prove that some number a is not in I , you must prove the
negation of the defining condition, namely that it is not true that 0 < x and x < 1
.
103
69.2.1 Warning When proving that a conjunction is false, it is easy to forget the
DeMorgan Laws and try to prove that both negatives are true. In the preceding
example, this would require showing that both 0 > x and x > 1 , which is obviously
impossible.
In contrast, if you must prove that a disjunction P\/ Q is false, you must show
that both P and Q are false. An error here is even more insidious, because if you
are tempted to prove that only one of P and Q is false, you often can do that
is prime”. This statement is false. To show it is false, you must find a positive
and 21, 22
conjunction 21
even 5
integer 3
odd 5
positive integer 3
predicate 16
prime 10
real number 12
union 47
69.2.3 Method
To prove that P V Q is false, prove that ->P A~*Q is true. To prove that
69.2.4 Example Given two sets A and B , how does one show that 4/ B? By
must show that one of those two statements is false: you must show either that
there is an element of A that is not an element of B or that there is an element of
B that is not an element of A. You needn’t show both, and indeed you often can’t
show both. For example, {1,2} ^ {1,2,3}, yet every element of the first one is an
69.2.5 Worked Exercise Let A and B be sets. How do you prove x <£. AU B?
Answer To prove that x (ji Au B , you must prove both that x (j A and that
x B . This follows from the DeMorgan Law and the definition of union. To prove
Reword the predicates in Exercises 69.3.1 through 69.3.3 so that they do not begin
104
logical connective 21
predicate 16
propositional
form 104
propositional vari-
able 104
proposition 15
The letters P and Q in the DeMorgan Laws are called propositional variables.
They are like variables in algebra except that you substitute propositions or pred-
icates for them instead of numbers. Don’t confuse propositional variables with the
of the type of whatever you are talking about, presumably numbers in the case of
tions in the same way that x and y in the statement “x < y” vary over numbers.
Answer x / 7 V (x = 7 Ax / 5) .
Pascal does not have variables or expressions of type proposition. It does have
Boolean variables, which have TRUE and FALSE as their only possible values.
An expression such as ‘A < Y' has numerical variables, and a Boolean value
the program has already given values to X and Y). However, if B is a Boolean
variable, an assignment statement of the form B: = X <Y sets B equal to the truth
value of the statement ‘A < Y ’ at that point on the program; B is not set equal to
the proposition l X <Y\ If A and Y are later changed, changing the truth value
of ‘A <Y\ the value of B will not automatically be changed.
70.2.1 Example The following program prints TRUE. Here B is type BOOLEAN
X := 3;
B := X < 5;
X : = 7;
PRINT (B) ;
in DM.1 and DM.2 are examples of propositional forms. Two simpler ones are
P V —>P (70.1)
and
-i P V Q
(70.2)
You may also substitute predicates for the propositional variables in a proposi-
70.3.2 Example If you substitute the proposition “3 < 5” in formula (70.1) you
get (after a little rewording) “3 < 5 or 3 > 5” which is a proposition (a true one,
in
fact).
If you substitute x < 5 for P in formula (70.1) you get “x < 5 or x > 5”, which
is true for any real number x. This is not surprising because formula (70.1) is a
If you substitute x < 5 for P and x / 6 for Q in ->P V Q you get “x > 5 or
70.3.3 Remarks
a) This would be a good time to reread Section 12.1.4. Propositional forms are
algebraic expression the variables are some type of number and the output
when you substitute the correct type of data for the variables is a number.
false. And now in propositional forms the variables are propositions and when
proposition.
context-free grammar.
algebraic expres-
sion 16
definition 4
equivalent 40
expression 16
fact 1
predicate 16
propositional
form 104
propositional vari-
able 104
proposition 15
tautology 105
71. Tautologies
71.1 Discussion
Each DeMorgan Law is the assertion that a certain propositional form is true no
matter what propositions are plugged in for the variables. For example, the first
DeMorgan Law is
true statement.
71.1.1 Example let P be the statement x < 5 and Q be x = 42. Then the first
71.2.1 Fact The truth table for a tautology S has all T’s in the column under S .
106
equivalence 40
equivalent 40
implication 35, 36
middle 106
predicate 16
propositional vari-
able 104
proposition 15
real number 12
tautology 105
truth table 22
71.2.2 Example Both DeMorgan laws are tautologies, and so is the formula (70.1),
which is called The law of the excluded middle. Both lines of its truth table
have T.
P -.P PV-.P
~T F T
FT T
71.2.3 Warning Don’t confuse tautologies with predicates all of whose instances
is true no matter which propositions are substituted for the variables. Expres-
sion (70.2) is not a tautology, but some instances of it, for example “not x > 5
or x > 3” are predicates which are true for all values (of the correct type) of the
variables.
71.2.4 Example Formula (70.2) (page 104) is not a tautology. For example,
let P be “4 > 3” and Q be “4 > 5”, where x ranges over real numbers; then
Formula (70.2) becomes the proposition “(not 4 > 3) or 4 > 5”, i.e. , “4 < 3 or 4 >
page 247.)
a) P A Q 44 — 1 ( — 'P V — 'Q)
b) (P A —iP) => Q
c) P =4- (Q V -i Q)
d) Pv(P =s> Q)
f) P A (Q V R) => PV(QAP)
71.2.7 Remark Many laws of logic are equivalences like the DeMorgan laws. By
tables for the two expressions are identical. Thus the truth tables for -i(PaQ) and
— i P V -i Q are identical:
P Q PAQ
T T T
T F F
FT F
F F F
-i(PAQ) -i P -i Q
F F I 7
T FT
T T F
T T T
—>P V —i Q
71.2.8 Example You can check using this method that -> P\/Q (i.e., For-
107
72. Contradictions
72.1.1 Fact The truth table for a contradiction has all F’s.
a) ~<(P V —<P) ■
c) Q A -i (P => Q ) .
associative 70
commutative 71
complement 48
contradiction 107
definition 4
fact 1
idempotent 143
implication 35, 36
intersection 47
predicate 16
propositional calcu-
lus 107
propositional vari-
able 104
proposition 15
truth table 22
universal set 48
Tables 72.1 and 72.2 give lists of tautologies. Table 72.1 is a list of tautologies
involving “and” , “or” and “not” . Because union, intersection and complementation
for sets are defined in terms of “and”, “or” and “not”, the tautologies correspond
to universally true statements about sets, which are given alongside the
tautologies.
ponens rule, the major role implication plays in logic is to provide successive
steps
in proofs. These laws can be proved using truth tables or be deriving them from
the laws in Table 72.1 and the first law in Table 72.2, which allows you to define
‘ =>■ ’ in terms of ‘ — > ’ and ‘V’. It is an excellent exercise to try to
understand why
the tautologies in both lists are true, either directly or by using truth tables.
The laws in Tables 72.1 and 72.2 allow a sort of computation with propositions in
the
way that the rules of ordinary algebra allow computation with numbers, such as the
distributive law for multiplication over addition which says that 3(x + 5) = 3x +
15.
uses the word “calculus” in its older meaning “computational system”. (What is
called “calculus” in school used to be taught in two parts called the “differential
predicate) when constants are substituted for all its variables. Thus when
predicates
are substituted for the propositional variables in these laws, they become
predicates
108
equivalent 40
(consistency)
J J
t t
u c = $
Q) C = U
(unity)
P AT AA P
PVFO P
Anu = A
AuQ) = A
(nullity)
PAFaa f
P\J T aaT
II H
si 15
C D
(idempotence)
PAPaaP
P\j P aaP
II II
C D
^1 ^1
(commutativity)
P AQ AA Q AP
PV QaaQm P
AnB=BnA
AUB = BUA
(associativity)
pa(Qar)
aa(paQ)ar
PV(QVP)
4A (PVQ) VP
An(BrC)
= (AnB)nC
AU{BUC)
= {AUB)UC
(distributivity)
P A (Q V P)
4A(PAQ)V(PAP)
pv(Qap)
4A (P V Q) A (P V P)
An{BuC)
= {AnB)u{AnC)
Au{BnC)
= ( AuB)n{Auc )
(complement)
E-i tin
$ $
CL, eg
r r
> <
eg eg
it* ^
D C
it* it*
o o
II II
s s;
(double negation)
^P4VP
(A C ) C = A
(absorption)
PA(PVQ)4AP
PV(PAQ)4AP
it* it*
C D
D C
II II
it* it*
(DeMorgan)
(AUB) C = (A c )n(B c )
{AnB) c ={A c UB c )
109
(‘ => ’-elimination)
(transitivity)
(modus ponens)
(modus tollens)
(inclusion)
(simplification)
(cases)
(P =4- Q) 44 (- 1 PV Q)
(( P =4 Q) A (Q =4 R)) =4 (P =4 P)
(PA(P =4 Q)) =4 Q
P => (PvQ)
(PAQ) => P
(n?A(PVQ)) =4 Q
Q =>• (P =>• Q)
iP => (P => Q)
implication 35, 36
logical connective 21
truth table 22
73.1.1 Example When you substitute x > 7 for P and x = 5 for Q i n the second
absorption law PV(PAQ)<t>P you get, in words, “Either r >7 or both x > 7
and x = 5” is the same thing as saying “x > 7”. This statement is certainly true:
“x > 7” and “x = 5” .
73.1.2 Exercise Define the logical connective NAND by requiring that PNAND
b) Write a statement equivalent to “PNAND Q” using only ‘A’, ‘V’, ‘-T, ‘P’,
‘ Q ’ and parentheses.
c) Give statements equivalent to P”, “PAQ” and “PVQ” using only ‘P’,
73.1.3 Exercise Do the same as Problem 73.1.2 for the connective NOR, where
73.1.4 Exercise Show how to define implication in terms of each of the connec-
73.1.5 Exercise Let denote the operation XOR discussed in Chapter 11.
a) P * Q Q * P .
b) P*(Q*P)4A(P*Q)*P.
c) PA(Q*P)4A(PAQ)*(PAP).
a) Show that there are 16 possible truth tables for a Boolean expression with
two variables.
110
equivalent 40
implication 35, 36
logical connective 21
modus ponens 40
proof 4
propositional
form 104
proposition 15
rule of inference 24
tautology 105
theorem 2
truth table 22
b) Produce Boolean expressions with and “ =>■ ” as the only logical connec-
tives that give each of the possible truth tables. Both variables must appear
PV{QAR) 4A (PVQ)A(PVP)
Let be defined as in Problem 73.1.5. Give examples showing that of the four
possible distributive laws combining with ‘A’ or ‘V’, the only correct one is that
in Problem 73.1.5(c).
P, P => Q b Q
This rule is closely related to the tautology also called modus ponens in section
71:
This tautology is a propositional form which is true for any proposition P and Q .
This is a special case of the general fact that, roughly speaking, any implication
F u ...,F n b G
is a tautology.
(74.1)
(74.2)
Proof If the rule of inference (74.1) is correct, then whenever all the
propositions
one of F{,. . . ,F n is true, so G must be true. This means that (74.2) must be a
On the other hand, if (74.2) is a tautology, then whenever T\, . . . , F n are all
true,
Ill
V v / logical connective 21
is a tautology, the validity of the rule of inference called modus ponens follows
by modus ponens 40
the Tautology Theorem from the tautology called modus ponens. propositional
form 104
74.1.2 Remark Not all rules of inference come from tautologies - only those rule of
inference 24
tautology 105
74.1.3 Warning The Tautology Theorem does not say that “|— ” is the same
way “ =4- ” can be. For example you may write P A (P =4- Q) but not P A (P |- Q) .
For problems 74.2.1 to 74.2.6, state whether the given rule is a valid rule of
inference.
247.)
74.2.8 Exercise Show that the following statements are not tautologies by giving
a) (P 44 Q) => P
74.2.9 Exercise Use the Tautology Theorem to prove that the following rules of
a) Q \- P =4 Q
b) P, Q b PAQ
c) PAQ h P
d) ^P (- P =4 Q
e) nQ,P4()h -P
112
counterexample 112
definition 4
implication 35, 36
real number 12
universal quanti-
fier 112
75. Quantifiers
Q(x) is true for every value of the variable x. The symbol V is called
75.1.1 Example Let P(x) be the statement (x > 5) =>• (x > 3) . P(x) is uni-
versally true, that is, it is true for every real number x. Therefore, the
expression
(Vx)-P(x) is true.
75.1.2 Showing the types of the variables A short way of saying that x is
of type real and that (Mx)Q(x) is to write (Vx:R)Q(a:) , read “for all x of type R,
75.1.3 Example The statement (Vn:Z)((n > 5) is false because “n > 5” is false
75.1.4 Example The statement (Vn:Z)((n > 5) V (n < 5)) is false because the
statement “(n > 5) V (n < 5)” is false when n = 5. Note that in contrast to Exam-
ple 75.1.3, n = 5 is the only value for which the statement “(n > 5) V (n < 5)” is
false.
A statement like (\/x)Q(x) is true if Q(x) is true no matter what is substituted
for
x (so long as it is of the correct type). If there is even one x for which Q(x) is
to have a name:
75.2.1 Example (Vx:N)((x < 5) V (x > 6)) is true, but (V.x:R)((a: < 5) V (x > 6))
is false (counterexample: ).
75.2.3 Exercise Find a universal statement about integers that has exactly 42
counterexamples .
75.2.4 Exercise Find a universal statement about real numbers that has exactly
42 counterexamples.
113
value of x for which the predicate Q{x ) is true. The symbol 3 is called
75.3.1 Remark One may indicate the type of the variable in an existential state-
75.3.2 Example Let x be a real variable and let Q{x ) be the predicate x > 50.
This is certainly not true for all integers x . Q(40) is false, for example.
However,
Q(62) is true. Thus there are some integers x for which Q(x) is true. Therefore
75.3.3 Exercise Find an existential statement about real numbers with exactly
42 witnesses.
counterexample 112
definition 4
even 5
existential quanti-
fier 113
existential state-
ment 5, 113
implication 35, 36
infinite 174
integer 3
natural number 3
predicate calcu-
lus 113
predicate 16
prime 10
propositional calcu-
lus 107
usage 2
witness 113
75.3.4 Exercise In the following sentences, the variables are always natural num-
bers. P(n) means n is a prime, E{n) means n is even. State which are true and
b) (Vn)(L(n)VP(n))
75.3.5 Exercise Which of these statements are true for all possible one-variable
predicates P(x) and Q(x)? Give counterexamples for those which are not always
true.
75.3.6 Exercise Do the same as for Problem 75.3.5 with ‘V’ in the statements in
place of ‘A’.
75.3.7 Exercise Do the same as for Problem 75.3.5 with ‘ =t- ’ in the statements
in place of ‘A’.
75.3.8 Usage The symbols V and 3 are called quantifiers. The use of quantifiers
which allows one to say things about an infinite number of instances in a way that
114
divide 4
GCD 88
implication 35, 36
integer 3
predicate 16
proposition 15
If a predicate P{x) has only one variable x in it, then using any quantifier in
front
of P{x) with respect to that variable turns the statement into one which is either
76.1.2 Predicates with more than one variable When a predicate has more
than one variable, complications ensue. Let P(x,y) be the predicate (x > 5) V (5 >
y) . Let Q(y) be the predicate (Vx:N )P(x,y). Then Q(y) is the statement: “For
every integer x , x > 5 or 5 > y.” This is still not a proposition. It contains one
an integer for x in Q(y) (what would “For all 14, 14 > 5 or 5 > y” mean?) which
expression is bound in the sense of 20.2. A logical expression in which all vari-
ables are bound is a proposition which is either true or false. If there are one or
(x = y) V (x > 5)
each case if (Vm:N)Q(m, 12) and (3n:Z)Q(3,ro) are true and give a counterexample
b) GCD(m,n) = l.
c) (m | n) =>■ (m | 2 n) .
115
Archimedean prop-
erty 115
implication 35, 36
integer 3
proof 4
real number 12
rule of inference 24
theorem 2
trunc 86
In other words, “For any real number x there is an integer n bigger than x.”
Proof If you are given a real number x, then trunc(x) + 1 is an integer bigger
than x.
is false. It says there is an integer which is bigger than any real number. That is
certainly not true: if you think 456,789 is bigger than any real number, then I
reply,
“It is not bigger than 456,790”. In general, for any integer n, n + 1 is bigger —
and
As these examples illustrate, in general, (\/x)(3y)P(x,y) does not mean the same
On the other hand, two occurrences of the same quantifier in a row can be
interchanged:
77.2 Theorem
(Vx)(Vy)P(x,y) |- (Vy)(Vx)P(x,y)
(77.3)
and
(\/y)(\/x)P(x,y) |- (\/x)(Vy)P(x,y)
(77.4)
and similarly
(3x)(3y)P(x,y) \- (3y)(3x)P(x,y)
(77.5)
and
{3y)(3x)P(x,y) |- (3x)(3y)P(x,y)
(77.6)
77.2.1 Exercise Are these statements true or false? Explain your answers. All
a) (Vx)(3y)(x>y).
b) (3x)(Vy)(x>y)
variables. The ordering of the quantifiers matters. The subtleties involved can
be confusing.
real numbers.
116
counterexample 112
divide 4
equivalence 40
equivalent 40
implication 35, 36
integer 3
negation 22
positive integer 3
predicate 16
prime 10
proof 4
proposition 15
real number 12
theorem 2
77.2.2 Exercise Are these statements true or false? Explain your answers. All
a) (Vm)(3n)(m | n) .
b) (3m)(Vn)(m | n) .
77.2.3 Exercise Are these statements true or false? Give counterexamples if they
are false. In these statements, p and q are primes and m and n are positive
integers.
77.2.4 Exercise (hard) Are these equivalences true for all predicates P and Q1
Assume that the only variable in P is x and the only variables in Q are x and y.
Proof We give the argument for Q.l; the argument for Q.2 is similar.
For (3 x:A)P(x) to be false requires that P(x) be false for every x of type A;
in other words, that —>P(x) be true for every x of type A. For example, if P(x) is
the predicate (x > 5) A (x < 3) , then (Bx:R)P(x) is false. In other words, the
rule
Q.l is valid.
78.1.1 Remark Finding the negation of a proposition with several quantifiers can
be done mechanically by applying the rules (Q.l) and (Q.2) over and over.
78.1.2 Example The negation of the Archimedean property can take any of the
c) (3x:R)(Vn:N)(x > n)
The last version is easiest to read, and clearly false — there is no real number
bigger than any integer. It is usually true that the easiest form to understand is
the
117
78.1.3 Worked Exercise Express the negation of (Vx)(x < 7) without using a
78.1.4 Exercise Express the negation of (3x)(x < 7) without using a word or
of
equivalent 40
implication 35, 36
negation 22
nonnegative integer 3
predicate calcu-
lus 113
predicate 16
real number 12
of the expression “(3x)(P(x) =$■ -> Q(x))" without using ‘3’, ‘ =$■ ’ or ‘-i’.
An annoying fact about the predicate calculus is that even when you get pretty
good at disentangling complicated logical statements, you may still have trouble
reading mathematical proofs. One reason for this may be unfanriliarity with certain
techniques of proof, some of which are discussed in the next chapter. Another is
the variety of ways a statement in logic can be written in English prose. You have
already seen the many ways an implication can be written (Section 27).
Much more about reading mathematical writing may be found in the author’s
works [Wells, 1995], [Bagchi and Wells, 1998b], [Bagchi and Wells, 1998a], and
[Wells, 1998].
with the (x) on the far right side denoting “Vx”. Sometimes (x) is used instead of
118
implication 35, 36
integer 3
predicate 16
real number 12
79.1.2 Warning The words “any”, “all” and “every” have rather delicate rules of
usage, as well. Sometimes they are interchangeable and sometimes not. The Archi-
medean axiom could be stated, “For every real x there is an integer n > x,” or “For
any real x there is an integer n > x.” But it would be misleading, although perhaps
not strictly wrong, to say, “For all real numbers x there is an integer n > x ,”
which
could be misread as claiming that there is one integer n that works for all x.
79.1.3 Warning Observe that the statements in (a), (c) and (e) have no obvious
English word corresponding to the quantifier. This usage there is somewhat similar
to the use of the word “dog” in a sentence such as, “A wolf mates for life”,
meaning
Students sometimes respond to a question such as, “Prove that an integer divis-
ible by 4 is even” with an answer such as, “The integer 12 is divisible by 4 and it
is even”. However, the question means, “Prove that every integer divisible by 4 is
even.” This blunder is the result of not understanding the way a universal
quantifier
79.1.4 Example Consider the well-known remark, “All that glitters is not gold.”
rather than
In other words, it means, “Not all that glitters is gold.” (We do not say the
logic.)
d) You can fool all of the people some of the time and some of the people all of
the time, but you can’t fool all of the people all of the time.
79.1.7 Exercise Write the statement in GS.2, page 61, using quantifiers.
119
ering the ways in which an implication can be proved. We consider two common
If you can deduce Q from P , then P =>- Q must be true. That is because the only
line of the truth table for ‘ => ’ (Table 25.1) which has an ‘F’ is the line for
which
P is true and Q is false, which cannot happen if you can deduce Q from P . This
gives:
divide 4
Fundamental Theo-
rem of Arith-
metic 87
hypothesis 36
implication 35, 36
integer 3
positive integer 3
prime 10
proof 4
theorem 2
truth table 22
80.1.2 Remark Normally, in proving Q, you would use other facts at your dis-
80.2 Theorem
ization.
m = pf 1 x ... x p^f
n = 2 xpf 1 x ... x p
Arithmetic.
would not think up the proof by thinking up P\,p 2 ,. . . in order. What happens
usually is that you think of statements which imply Q, statements which imply
them (backing up), and at the same time you think of statements which P implies,
statements which they imply (going forward), and so on, until your chain meets in
the middle (if you are lucky) . Thinking up a proof is thus a creative act rather
than
80.2.2 Exercise Prove by the direct method that for any integer n, if n is even
so is n 2 .
120
conclusion 36
contrapositive 42
divide 4
equivalent 40
even 5
hypothesis 36
implication 35, 36
integer 3
odd 5
positive integer 3
prime 10
proof 4
theorem 2
universal generaliza-
tion 6
is equivalent to Q => -cP” , you can prove " P =$■ Q” by using the direct method
81.0. 4 Warning This method is typically used in math texts without mentioning
that the contrapositive is being used. You have to realize that yourself.
81.0. 5 Example The proof of the following theorem is an illustration of the use
of the contrapositive, written the way it might be written in a math text. Recall
81.1 Theorem
Proof Let n be odd. Then 2 does not occur in the prime factorization of n. But
when you saw that a proof of a theorem which says “if n 2 is even then n is
be proved is, “If n is odd, then n 2 is odd.” The proof of the contrapositive
b) The contrapositive of Theorem 80.2 is used in the proof of Theorem 81.1. That
theorem says that if n is even, then its prime factorization contains 2. Here
we are using it in its contrapositive form: if 2 does not occur in the prime
factorization of n, then n is not even, i.e., n is odd. Again, the proof does
not mention the fact that it is using Theorem 80.2 in the contrapositive form.
arbitrary positive integer satisfying the hypothesis, then it must satisfy the
conclusion. In such a proof, we are not allowed to make any special assump-
tions about n except that it satisfies the hypothesis. On the other hand,
if we suspected that the theorem were false, we could prove that it is false
merely by finding a single positive integer n satisfying the hypothesis but not
This phenomenon has been known to give students the impression that prov-
ing statements is much harder than disproving them, which somehow doesn’t
seem fair.
121
81.1.2 Exercise Prove by the contrapositive method that if n 2 is odd then so
is n.
is a tautology. Thus to prove that an implication is false, you must show that
its hypothesis is true and its conclusion is false. In particular, the negation of
an
esis 121
conclusion 36
definition 4
quent 121
divisor 5
equivalent 40
fallacy 121
hypothesis 36
implication 35, 36
negation 22
prime 10
rule of inference 24
tautology 105
=*. Q |_ P\/ Q
(81.2)
is a valid inference rule. (A proof using this rule would typically begin the proof
of
P^Q,Q^R^P^R
81.2.4 Exercise (hard) Use the methods of this chapter to prove that n is prime
if and only if n > 1 and there is no divisor k of n satisfying 1 < k < \/n.
fallacy.
F.2 assuming that from P => Q and —> P that you can derive —>Q (“A cow eats
82.1.2 Remark You will sometimes hear these fallacies used in political argu-
ments. F.l is called affirming the hypothesis and F.2 is called denying the
consequent.
both the hypothesis and the conclusion might accidentally be correct. Fallacious
tions.
122
conclusion 36
contrapositive 42
equivalence 40
equivalent 40
even 5
hypothesis 36
implication 35, 36
integer 3
odd 5
positive integer 3
prime 10
82.1.4 Example The statement, “A prime number bigger than 2 is odd. 5 is odd,
“Any prime is odd”, is false. The latter is a case of “getting the right answer for
the wrong reason,” which is a frequent source of friction between students and math
teachers.
In Problems 82.2.1 through 82.2.5, some arguments are valid and some are
fallacious.
Some of the valid ones have false hypotheses and some do not. (The hypothesis is in
square brackets.) State the method of proof used in those that are valid and
explain
82.2.1 [n > 5 only if n> 3]. Since 17 > 5, it must be that 17 > 3. (Answer on
page 247.)
82.2.2 [n > 5 only if n > 3]. Since 4 > 3, it must be that 4 > 5. (Answer on page
247.)
82.2.3 [If n is odd, then n / 2], 6 is not odd, so 6 = 2. (Answer on page 247.)
82.2.4 [n is odd only if it is prime]. 17 is odd, so 17 is a prime. (Answer on page
247.)
82.2.5 [If n is even and n > 2, then n is not prime]. 15 is odd, so 15 is prime.
83.1.1 Method
and Q =4- P.
83.1.2 Remark Remember the slogan: To prove an equivalence you must prove
two implications.
83.1.3 Remark Quite commonly the actual proof proves (for example) P => Q
and -i P =4- -iQ (the contrapositive of Q =4- P), so the proof has two parts: the
first part begins, “Assume P” , and the second part begins, “Assume —>P...”
123
83.1.4 Example Here is an example of a theorem with such a proof. The proof
avoids the use of the Fundamental Theorem of Arithmetic, which would make it
paragraph.
83.2 Theorem
For any integer n, 2 | n if and only if 4 | n 2 .
n 2 = 4 k 2 , so n 2 is divisible by 4.
Now suppose 2 does not divide n , so that n is odd. That means that n = 2k + 1
contrapositive
method 120
divide 4
equivalent 40
even 5
Fundamental Theo-
rem of Arith-
metic 87
implication 35, 36
integer 3
odd 5
positive integer 3
proof 4
theorem 2
83.2.1 Remark The preceding proof is written the way such proofs commonly
appear in number theory texts: no overt statement is made concerning the structure
of the proof. You have to deduce the structure by the way it proceeds. In this
proof,
proof proceeds to prove first (before the phrase “Now suppose”) that P =>■ Q by
the direct method, and then to prove that Q => P by the contrapositive method,
83.2.2 Exercise Prove that for all integers m and n, m + n is even if and only
if rn — n is even.
only if C a .
if and only if
a n a op C Aq
Some theorems are in the form of assertions that three or more statements are
equivalent.
84.2 Theorem
D.l n is divisible by 4.
124
conclusion 36
div 82
equivalent 40
implication 35, 36
include 43
integer 3
nonnegative integer 3
positive integer 3
gers) 83
relation 73
remainder 83
rule of inference 24
implications, not six, provided the three are chosen correctly. For example, it
would
be sufficient to prove P => Q , Q => R and R => P . Then for example Q => P
84.2.2 Warning Theorem 84.2 does not say that n is divisible by 4. It says that
if one of the statements is true, the other two must be true also (so if one is
false
(P 44 Q) A (Q 44 R) A (P 44 R)
for certain statements P, Q and R. That is the same as asserting six implications,
84.2.3 Exercise Write out careful proofs of Theorem 84.2 in two ways:
a) (D.l) => (D.2), (D.2) =$■ (D.3), and (D.3) =4- (D.l), and
84.2.4 Exercise Prove that the following three statements are equivalent for any
sets A and B:
a) AC B
b) AU B = B
c) AnB = A
84.2.5 Exercise Let a be a relation on a set A. Prove that the following three
a) a is symmetric.
b) a C a op .
c) a = a op .
In a particular system such as the positive integers, any uniqueness theorem gives
a
rule of inference. Such a rule only applies to the data type for which the
uniqueness
theorem is stated.
85.1.1 Example Theorem 60.2 says that the quotient and remainder are uniquely
integers:
85.1.2 Remark The conclusion of this rule of inference can be worded this way:
2 = 50 mod 12. You do not have to do a long division to verify that; it follows
from
Rule (85.1).
125
page 247.)
85.1.4 Exercise Use Rule (85.1) to prove that if r = mmodn and r' = m/rnodn,
85.1.5 Exercise Use Rule (85.1) to prove that if r = mmodn, then n\m — r.
85.1.6 A rule for GCD’s For positive integers m and n, the greatest common
divisor GCD(m,?r) is the largest integer dividing both m and n; this definition was
also given in Chapter 60. This obviously determines the GCD uniquely — there
cannot be two largest integers which divide both m and n. This can be translated
divide 4
div 82
exponent 87
GCD 88
implication 35, 36
integer 3
positive integer 3
prime 10
rule of inference 24
tautology 105
theorem 2
85.1.7 Example Let’s use the rule just given to prove Theorem 64.1. We must
prove that the number d which is the product of all the numbers p mm ( e p( m )> e
p( n ))
we have verified two of the three hypotheses of Rule (85.2). As for the third,
suppose
e | m and e\n. Then e p (e) < e p (m ) and e p (e) < e p (n) , so e p (e) < min(e p
(m),e p (n)) ,
so e | d. But if e\d, then e < d, so the third part of Rule (85.2) is correct.
Hence
85.1.8 Exercise State and prove a rule like Rule (85.2) for LCM(m,?i).
86.1 Theorem
( 86 . 1 )
86.1.1 Remarks
(-.QA(P Q )) -i P
b) This rule says that to prove -i P it suffices to prove ~>Q and that P =f- Q .
126
decimal 12, 93
divide 4
even 5
factor 5
finite 173
Fundamental Theo-
rem of Arith-
metic 87
implication 35, 36
infinite 174
integer 3
odd 5
prime 10
proof by contradic-
tion 126
proof 4
rational 11
real number 12
reductio ad absur-
dum 126
remainder 83
rule of inference 24
theorem 2
usage 2
86.1.2 Usage A proof using the inference rule of Theorem 86.1 is called proof
86.1.3 Remarks
goes into proving P =t- Q . Thus a proof of —> P by contradiction might begin,
“Suppose P is true ... ” !
b) Authors typically don’t tell the reader they are doing a proof by contradiction.
It is generally true that mathematical authors are very careful to tell the reader
which previous or known theorems his proof depends on, but says nothing at
86.2 Theorem
V2 is not rational.
86.2.1 Remarks
colony in ancient Italy caused quite a scandal, because the “fact” that any
real number could be expressed as a fraction of integers was one of the beliefs
is not exactly equal to any fraction of integers whatever. The fact that y/2
has a nonterminating decimal expansion does not of course prove this, since
How on earth do you prove an impossibility statement like that? After all,
you can’t go through the integers checking every fraction m/n. It is that sort
Proof Here is the proof, using the Fundamental Theorem of Arithmetic. Suppose
Every prime factor in the square of an integer must occur an even number of times.
odd, a contradiction.
86.2.2 Remark In fact, n (and many other numbers used in calculus) is not
of primes: suppose that p\,p 2 ,... ,Pk are all the primes. Let m = p\ -p 2 ■ ■ -pk
+ 1 •
Then the remainder when m is divided by any prime is 1 . Since no prime divides
of Arithmetic.
127
86.2.5 Exercise Prove that for all rational numbers x, ( x 2 < 2) ( x 2 < 2) .
86.2.7 Exercise Use proof by contradiction to prove that if r and s are real
86.2.9 Exercise (hard) Use Problem 86.2.8 to prove that the kth. root of a
definition 4
equivalent 40
even 5
Fundamental Theo-
rem of Arith-
metic 87
integer 3
nation 127
odd 5
positive integer 3
prime 10
proof by contradic-
tion 126
rational 11
86.2.10 Exercise (hard) Show that there are infinitely many primes p such that
p mod 4 = 3. Hint: Use proof by contradiction. Assume there are only finitely
many such primes, and consider the number m which is the product of all of them.
Consider two cases, rn mod 4 = 1 and mmod4 = 3, and ask what primes can divide
771 + 2 or 777 + 4. Use problem 60.5.6, page 85 and other similar facts. Note that
the
similar statement about p mod 4 = 1 is also true but much harder to prove.
The Fundamental Theorem of Arithmetic, that every integer greater than one has a
It actually follows from certain facts about the GCD by a fairly complicated proof
by
contradiction. This proof is based on Theorem 87.2 below, a theorem which is worth
knowing for its own sake. The proof of the Fundamental Theorem is completed in
3x10-2x14 = 2
However, 1 is not an integral linear combination of 10 and 14, since any integral
87.1.2 Remark Note that in the definition of integral linear combination, the
128
divide 4
Euclidean algo-
rithm 92
Fundamental Theo-
rem of Arith-
metic 87
GCD 88
integer 3
nation 127
intersection 47
positive integer 3
theorem 2
cise 88.3.7.)
87.1.4 Exercise Show that if d\m and d\n then d divides any integral linear
combination of m and n.
87.2.1 Remark Bezout’s Lemma should not be confused with Bezout’s Theorem,
which is a much more substantial mathematical result concerning intersections of
87.2.3 Proof of Bezout’s Lemma We prove this without using the Fundamental
Theorem of Arithmetic, since the lemma will be used later to prove the Fundamental
Theorem.
First, we show that d < e. We know that d \ m and d\n, so there are integers h
divisor ; hence e <d. Combined with the previous result that d < e, we see that
d = e, as required.
The preceding proof of Bezout’s Lemma does not tell us how to calculate the
integers
a and b for which am + bn = GCD (m,n). For example, see how fast you can find
program 65.1, page 93, based on Theorem 65.1, which says that for any integers rn
129
becomes 0 is the GCD. This lemma shows how being an integral linear combination
88.1 Lemma
n.
div 82
Euclidean algo-
rithm 92
GCD 88
integer 3
nation 127
lemma 2
positive integer 3
proof 4
Proof B.l is trivial: m=lxm + 0xn and n = 0xm+lxn. As for B.2, suppose
Then
We now describe a method for calculating the Bezout coefficients based on Lemma
88.1.
and w = am + bn .
1. Put u = m, v = n, w = mrnodn in the first row, and in the last column put
2. Make each succeeding row v! , v' , w' , w' = a' m + b'n by setting u! =v (the
entry under v in the preceding row) , v' = w and w' = v mod w , and solving
for a' and b' by using the equation w' = v! — (u' divv')v' and the equations in
the preceding rows. Note that the entry in the last column always expresses
w in terms of the original m and n, not in terms of the u and v in that row.
3. Continue this process until the entry under w is GCD(?n,n) (this always
happens because the first three columns in the process constitute the Euclidean
algorithm) .
88.2.1 Example The following table shows the calculation of integers a and b
u v w
so that a = 4 , 6 = — 11.
130
constructive 130
divide 4
Fundamental Theo-
rem of Arith-
metic 87
GCD 88
infinite 174
integer 3
nation 127
nonconstructive 130
relatively prime 89
rule of inference 24
The two proofs we have given for Theorem 87.2 illustrate a common phenomenon
integers a and 6 exist but does not tell you how to get them. The second proof is
and b.
12
16
4
12
16
26
30
26
30
26
30
51
100
(Answer on page 247.)
88.3.3 Exercise (M. Leitman) Suppose a, b, m and n are integers. Prove that
if m and n are relatively prime and am + bn = e, then there are integers a' and b'
that if GCD(m,n) = 1 and m \ nr then m\r . (Use Bezout’s Lemma, page 128.)
88.3.5 Exercise Suppose that a, b and c are positive integers for which c =
88.3.6 Exercise Prove that the following rule of inference is valid (use Bezout’s
(It follows that the statement “e < d” in Rule (85.2) can be replaced by “e | d” .)
and n then there are an infinite number of different pairs of integers a and 6 for
which d = am + bn .
88.3.8 Exercise Use Bezout’s Lemma (page 128) to prove Corollary 64.2 on
131
89. The image of a function
a value of F . For example, the function x >— > x 2 : R — > R takes only
nonnegative
values.
Irn(F) .
codomain 56
definition 4
equivalence 40
equivalent 40
fact 1
function 56
image 131
include 43
real number 12
take 57
usage 2
(3a)(F(a) = b) 44 feelrnF
89.1.2 Fact For any function F, Im(F)CcodF.
89.1.3 Usage Many authors use the word “range” for the image, but others use
89.1.4 Example The image of the squaring function x i — > x 2 : R — > R is the set
of
set of real numbers > 4 , and determining the image of more complicated functions
page 247.)
89.1.9 Exercise Find the image of the function x>— > x 2 — 1 : R — >-R.
89.1.10 Exercise Find the image of the function x>— )-x 2 + a: + l:R— >-R.
132
definition 4
function 56
image function 132
image 131
include 43
interval 31
powerset 46
The word “image” is used in a more general way which actually makes the image a
function itself.
function of F .
90.1.3 Warning The image function is not usually distinguished from F in nota-
tion. A few texts use F* : VA — > VB , and so would write F(x) for x G A but F*(C)
for a subset CCA. In this text, as in almost all mathematics texts, we simply write
F(C). Context usually disambiguates this notation (but there are exceptions!).
90.1.5 Exercise Let F be defined as in Example 90.1.2. What are F({2,3}) and
What is FQ-1..1])?
90.1.7 Exercise Let F be defined as in Example 90.1.2. How many ordered pairs
{acA | F(a) € C }
91.1.1 Example Let F : {1,2,3} — > {2, 4, 5, 6} be defined (as in Example 89.1.5)
133
and
F- 1 ([0..1]) = {0}
91.1.3 Inverse image as function Like the image function, this inverse image
function can also be defined as a function F :VB — > V A (note the reversal), where
91.1.5 Example For the function of Example 91.1.2, F _1 (3) = {— \/2, V2)} .
codomain 56
definition 4
fact 1
function 56
tion) 61
image 131
include 43
onto 133
powerset 46
real number 12
surjection 133
surjective 133
union 47
usage 2
91.1.6 Exercise Let F : R -> R be defined by F(x) = x 2 + 1 . What is F 1 ({1,2})?
What is F- 1 ^!.^))?
91.1.7 Exercise For any function F : A-+ B , what is F 1 (0)? What is F 1 (B)7
92. Surjectivity
Im (F) = B.
92.1.1 Fact F : A—t B is surjective if and only if for every element element b 6 B
92.1.4 Example For the two functions S : R — > R and T : R — > R + of 39.7.3, with
say that every nonnegative real number has a square root. Authors who do not
its graph.
134
contrapositive 42
converse 42
coordinate func-
tion 63
definition 4
fact 1
function 56
identity function 63
identity 72
image 131
implication 35, 36
inclusion function 63
injection 134
injective 134
powerset 46
reflexive 77
relation 73
surjective 133
take 57
usage 2
92.1.6 Exercise How do you prove that a function F : A->- B is not surjective?
92.1.8 Exercise (hard) Show that there for any set S , no function from S to
No argument that says anything like “the powerset of a set has more elements than
the
set” can possibly work for this problem, and therefore such arguments will not be
given
even part credit. The reason is that we have developed none of the theory of what
it means
to talk about the number of elements of an infinite set, and in any case this
problem is a
Let’s be more specific: One such invalid argument is that the function that takes x
to
{cc} is an injective function from S to VS , and it clearly leaves out the empty
set (and
the function from N to N that takes n to 42n. This is injective and leaves out lots
of
integers, so does N have more elements than itself?? (In any case you can come up
with
93. Injectivity
F(a') =4- a = a' for all a, a' € A (the contrapositive of the definition).
one.
93.1.3 Example The squaring function S : R — > R is not injective since S(x) =
c) id, 4 .
135
h) pi : A x B — > A.
i) + : B x B ^ Z.
A.
a) x 3x — 4 : R — >■ R .
b) x 1 — y x 3 : R — )■ R.
c) F = Xx.(x 2 + 1) : R -» R.
d) ii->2-s 2 :R-^R.
93.1.6 Exercise Let F : A—> B be a function of the type indicated. Give a precise
description of all the sets A and B for which F is injective, and a precise
description
a) An identity function.
b) An inclusion function.
c) A constant function.
d) An empty function.
e) A coordinate function.
93.1.7 Exercise How do you prove that a function F : A B is not injective?
tive.
93.1.9 Exercise Give an example of a function F : R — > R with the property that
characteristic func-
tion 65
constant function 63
coordinate func-
tion 63
empty function 63
even 5
function 56
identity function 63
inclusion function 63
injective 134
lambda notation 64
predicate 16
surjective 133
136
bijection 136
bijective 136
Cartesian product 52
coordinate func-
tion 63
definition 4
functional relation 75
function 56
tion) 61
identity 72
injective 134
dence 136
ber 12
relation 73
restriction 137
subset 43
surjective 133
usage 2
94. Bijectivity
to one correspondence.
94.1.3 Example For any set A, id^:A — > A is bijective. Another example is the
is a bijection.
G{n)
— | n even
^±1 n odd
94.1.5 Exercise Show how to construct bijections (3 as follows for any sets A, B
and C.
a) (3: AxB^-BxA.
c) f3 : {1} x A -» A.
b) Prove that a is the graph of a function from A to B if and only if the first
94.1.9 Exercise (hard) Let F : A — >■ B be a function. Prove that the restriction
function is a bijection.
137
94.1.11 Exercise (hard) Let /3:Kel(A,B) — >■ (' PB)^ be the function which takes
as input a pair of functions (f,g) , with / : A—t B and g : A — >• C , and outputs
a
function f3(f,g) from A to B x C . Here is the definition of (3: for all a & A,
/3{f,g)(a) = ( f(a),g(a ))
bijection 136
definition 4
function 56
identity 72
include 43
permutation 137
powerset 46
relation 73
restriction 137
take 57
usage 2
95. Permutations
95.1 Definition: permutation
95.1.1 Example The fact just noted that id/i is a bijection says that id^ is a
rangement of the set {1,2, .. . ,n} for some n. If the ith entry in the list is a*
that
95.1.4 Example The permutation of Example 95.1.2 would be given in the list
notation as (2,1,3) .
95.1.5 Worked Exercise List all the permutations of {1,2, 3, 4} that take 1 to
3 and 2 to 4.
a € A' is F(a) .
96.1.1 Remark Note that the codomain of the restriction is the codomain of the
function.
138
codomain 56
constant function 63
coordinate 49
definition 4
domain 56
function 56
tion) 61
identity 72
inclusion function 63
injective 134
integer 3
lambda notation 64
positive integer 3
predicate 16
restriction 137
subset 43
surjective 133
usage 2
96.1.2 Example Let F : {1,2,3} — > {2, 4, 5, 6} be defined by F(l) = 4 and F(2) =
F|{1,3} has graph |(1,4), (3,5)| . Observe that F|{2,3} is a constant function and
96.2.1 Remark Note that both “restriction” and “extension” have to do with the
domain.
96.2.2 Example Let F : {1,2,3} — > {2, 4, 5, 6} be defined by F(l) = 4 and F(2) =
96.2.3 Example The absolute value function ABS :R — > R is an extension of the
96.2.4 Usage The meaning just given of “extension” is a different usage of the
word from the meaning used in Definition 18.1 of the set of data items for which a
predicate is true.
You may wonder how the word “extension” got two such different meanings.
The answer is that the concept of extension of a predicate was named by logicians,
a) xH’i 2 .
b) \x.x-\-l.
c) Ax.l — x.
n = {1,2,... ,n}
An n-tuple
a — (ai , • • • , a n )
function i i-y a t with domain n and codomain A. Conversely, any such function
139
When a £ A\ x A 2 x • • • x A n , so that different components are in different
sets,
function from n — >• C. In this case, however, not every such function is a tuple
in
a : n -> Ai U A 2 U • • • U A n
Cartesian product 52
coordinate 49
decimal 12, 93
definition 4
digit 93
domain 56
function 56
tion) 61
set 25, 32
union 47
97.1.1 Example The tuple (2,1,3) is the function 1 1 — > 2 , 2 1 — >• 1 , 3 1 — >3
(compare
Section 95.1.3).
97.1.2 Example The tuple (5, 5, 5, 5) is the constant function C§ : {1,2, 3, 4} — >
Z.
97.1.3 Exercise Write the domain and the graph of these tuples regarded as
b) <7T, 5, 7T — 1, x/2) .
97.1.4 Example A simple database might have records each of which consists of
the name of a student, the student’s student number, and the number of classes the
Modeling detabases this way is the principle behind relational database theory.
97.1.5 Remark In the case that all the Ai are the same, so that a E A n , we
now have the situation that A n (the set of functions from n to A, where n =
{1,2,... , n}) and A n (the set of n-tuples in A ) are essentially the same thing.
That is the origin of the notation B ^ .
The discussion above suggests that by regarding a tuple as a function set, we can
140
tions) 140
definition 4
domain 56
family of elements
of 140
functional composi-
tion 140
function 56
indexed by 140
infinite 174
integer 3
set 25, 32
element of .
97.2.3 Example This is another look at Example 97.1.4. The point of view
that a triple (Jones, 1235551212,4) is a function with domain {1,2,3} has an arbi-
trary nature: it doesn’t matter that the name is first, the student number sec-
ond and the number of classes third. What matters is that Jones is the name,
1235551212 is the student number and 4 is the number of classes. Thus it would
be conceptually better to regard the triple as a function whose domain is the set
{Name,StudentNumber,NumberOfClasses}
ments of A indexed by S .
a) F : {1,2, 3,4, 5} — >■ R, T(E) = { (2,5), (1,5), (3,3), (5,-1), (4, 17)} .
obtained by feeding the output of one into the input of the other. Suppose F: A—> B
98.1.2 Remarks
141
in dornG, and many authors allow the composite G°F to be formed in that
ing F , then G — in other words, the notation “G°F” is read from right to left.
98.2 Theorem
H°(G°F) = (H°G)°F
and similarly
so H°(G°F) = {H°G)°F.
(yT denotes the nonnegative square root of x.) Let ABS denote the absolute
(ii) (SQRT°SQ)|R+ = id R+ .
(iii) SQ°SQRT = id R + .
(ii) id b ° F = F.
This is analogous to the property that an identity element for a binary operation
has (see 50.1), but in fact composition of functions is not a binary operation
since
associative 70
binary operation 67
codomain 56
commutative 71
tions) 140
composition (of
functions) 140
domain 56
function 56
identity 72
include 43
proof 4
take 57
theorem 2
142
bijective 136
codomain 56
composition (of
functions) 140
domain 56
function 56
tion) 61
include 43
inclusion function
injective 134
surjective 133
98.2.4 Example If A C B and BCC, and i:A^-B and j : B — >■ C are the
e) F = p\ : R X R — >• R, G:rH’(3,i):R-tRxR.
d) If G°F is surjective, so is G.
e) If G°F is injective, so is F .
98.2.8 Exercise Give examples of functions F and G for which G°F is defined
and
C 1 C 1
b) Prove that if H : B — >■ C is a function and A has more than one element, then
TD
143
F twice is the same as doing it once: If you do F , then do it again, the second
time
nothing happens.
Note the close connection between this function and the first coordinate function
p\ : R x R y R .
Cartesian product 52
coordinate func-
tion 63
definition 4
function 56
idempotent 143
identity 72
image 131
injective 134
surjective 133
theorem 2
usage 2
99.1.3 Example Let S be a set of files that contains a sorted version of every
file in the set. Then “sort” is a function that takes each file in the set to a
possibly
different file. Sorting a file that is already sorted does not change it (that is
true
of many sorting functions found on computers, but not all). Thus sorting and then
99.1.4 Usage Following Example 99.1.2, the word “projection” is used in some
id .4 •
F if F{x) = x.
99.3 Theorem
is a fixed point of F .
99.3.2 Exercise Use Theorem 99.3 to show that if F : A — > A is surjective and
144
codomain 56
commutative
gram 144
definition 4
domain 56
function 56
identity 72
dia-
(100.1)
If the two ways of evaluating functions along paths from A to C in this diagram
A diagram with the property that any two paths between the same
diagram.
100.1.1 Example To say that the following diagram commutes is to say that
F
*■ B
(100.2)
100.1.2 Remarks
as U H°F = K°G ” than the statement itself shows (in particular it shows
what the domains and codomains are), and moreover they exhibit it in a
commutative law for operations such as addition are distinct and not very
100.1.3 Example Example 98.2.3 on page 141 says that for any function F , this
diagram commutes:
(100.3)
145
100.1.4 Example Theorem 98.2 says that if both triangles in this diagram com-
mute,
■>■ B
(100.4)
then the whole diagram commutes. Thus the associative law for for functional
in a certain way.
a) The square of the square root of a nonnegative real number is the number
itself.
b) The positive square root of the square of a real number is the absolute value
of the number.
commutative dia-
gram 144
composition (of
functions) 140
equivalent 40
function 56
idempotent 143
identity 72
ber 12
powerset 46
real number 12
relation 73
take 57
100.1.6 Exercise Draw commutative diagrams which express each of the follow-
ing facts. No one arrow should be labeled with a composite of two functions -
is a set B and functions G : A — > B and H : B — > A such that both the following
diagrams commute:
100.1.8 Exercise (hard) Let /? be defined as in Problem 94.1.11, page 137. Let
H:Rel{A,B)-^Rel{A , ,B')
be the function which takes a to the relation a! defined by a' a' b' 44 F(a') a
G(b') .
Let /
be the function which takes r : A — >■ VB to the function r' : A! -^r VB' defined
by
r'(a') = G~ 1 (r(F(a))
146
commutative 71
composition (of
functions) 140
definition 4
fact 1
function 56
identity 72
invertible 146
powerset 46
usage 2
Show that the following diagram commutes.
Rel(A,B)
Re\(A',B')
(VB)
(VB
'i\A!
The number 1/2 is the “multiplicative inverse” of the number 2 because their prod-
composition is not normally commutative, one has to specify which way the com-
posite is taken.
a right inverse to G. if
G°F = id a (101.1)
FoG = id B (101.2)
is an inverse to G.
101.1.3 Fact The definition of inverse function can be expressed in other ways
a) G is the inverse of F if and only if for all a £ A, G(F(a )) = a and for all
(101.3)
147
101.1.4 Example Let F : {1,3,5} — > {2,3,4} be the function that takes 1 to 3,
101.1.5 Example Example 98.2.2(3) above says that the squaring function is a
left inverse to the square root function: squaring the positive square root gives
you
what you started with. It is not the inverse, however: taking the square root of
the
square won’t give you the number you started with if it is negative. On the other
hand, the cubing function is the inverse of the cube root function.
A function can have more than one left inverse (Problem 101.2.6) but not more than
one inverse:
floor 86
function 56
tion) 61
identity 72
ber 12
proof 4
rule of inference 24
take 57
theorem 2
usage 2
F.
Proof The proof uses the definition of inverse, Theorem 98.2 and Example 98.2.3:
101.2.1 Usage The fact that if a function has an inverse, it has only one, means
that we can give the inverse a name: The inverse of F, if it exists, is denoted F^
1 .
101.2.2 Remark The uniqueness theorem also means we have a rule of inference:
101.2.3 Exercise Which of the following functions have inverses? If it has one,
d) m->2n:N->N.
e) n i-4 n+ 1 : N — » N.
f) 1 : Z Z.
101.2.4 Exercise Which of the functions in Exercise 101.2.3 have (a) left inverses,
101.2.5 Exercise Show that if a function G has an inverse F , then it has only
148
composition (of
functions) 140
function 56
identity 72
inclusion function 63
infinite 174
theorem 2
101.2.6 Exercise Let I :R + — »• R denote the inclusion function. Show that I has
The inverse of the composite of two functions which have inverses is the composite
(G°F)- 1 = F- 1 °G~ 1
101.3.1 Remark The name comes from the fact that the inverse of putting on
your socks and then putting on your shoes is taking off your shoes and then taking
and
(101.5)
(101.6)
and then apply Rule (101.4), page 147. To prove Equation (101.5), we note that
the following diagram commutes: the left and right triangles are the diagrams in
Figure (101.3), and the middle triangle is the left triangle in Figure (100.3).
(101.7)
101.4 Theorem
101.4.1 Remark Another way of saying this is that a function is the inverse of
149
useful.
Proof I will go through the proof in some detail since it ties together several
of the ideas of this chapter. We have to prove an equivalence, which means two
implications.
a = F~ 1 (F(a)) = F~ 1 (F(a')) = a
(The first and last equations follow from 101.1.3a and the middle equation from the
Since F is injective there is exactly one such a. Let G(b) = a. Since F(a) = b,
that says that G(F(a)) = a, which is half of what we need to show to prove (using
Definition 101.1) that G = F _1 . The other thing needed is that F(G(b)) = b. But
101.5.2 Remarks
a) The second part of the proof says this: If F(a) = b , then F _1 (6) = a, and if
b) You might experiment with proving the contrapositives of the two implications
101.5.3 Exercise Write a formula for the inverse of each of these bijections.
a) in’! 2 : R + R + .
b) iH’S-LRH’R.
c) x i — y 2x : R — y R.
d) x i — y (1/x) : R — y R .
101.5.4 Exercise Prove that a function has a left inverse if and only if it is
injec-
tive.
101.5.5 Exercise Prove that a function has a right inverse if and only if it is
surjective.
bijection 136
bijective 136
contrapositive 42
domain 56
equivalence 40
function 56
implication 35, 36
injective 134
surjective 133
theorem 2
150
Cartesian product 52
definition 4
expression 16
function 56
GCD 88
injective 134
integer 3
powerset 46
relation 73
surjective 133
take 57
are being asked to give the right inverse explicitly, not merely show it exists.)
101.5.7 Exercise Show that GCD:N + x N + — > N + does not have a left inverse.
is surjective.
101.5.9 Exercise (hard) Let F:A—>B be a function and suppose A has more
than one element. Show that if F has exactly one left inverse then the left inverse
101.5.10 Exercise (hard) Let A and B be sets. Let /3 : Rel(A,R) — > (VB)^
defined in Problem 94.1.11, page 137. Let 7 : ( VB )^ — >• Rel {A,B) be the
function
(defined in Definition 53.3, page 76) that takes a function F : A — > VB to the
relation
ap defined by
In this section we introduce a notation for sums and products that may be familiar
to you from calculus. This will be used in studying induction in Chapter 103.
bers in the sequence and the expression nf=i a * denotes the product
Hl =1 b = b-b-b-b = b i .
102.1.5 Remark The numbering of the sequence does not have to start at 1.
151
102.1.6 Exercise What are Y%= i 2 ^ Ylt= o 2 (& + l) an d J2k= o 2 ^+l? Two of
direct method 119
implication 35, 36
integer 3
odd 5
positive integer 3
in many Mathematica commands. The range expression {x,a,b}- means that the
E 2 *- 1
k = 1
1 = 1, 1+3+5+7 = 16,
In general it appears that the sum of the first n odd positive integers is n 2 .
This
The subject of this section is an inference rule allowing the proof of such state-
ments. Before the rule is stated, we will reformulate Q{n) and see why it is true.
J2( 2k ~l ) = n 2
k = 1
(You should check that 2k — l is indeed the fcth odd positive integer.) Clearly
Q( 1)
is true: it says 1 = 1.
I will now prove that for any positive integer n, Q(n) =+ Q(n + 1), using the
direct method. The direct method requires us to assume the hypothesis is true, so
suppose we knew that Q(n) is true, that is that the sum of the first n odd integers
(the sum of the first n odd integers) + (the n+lst odd integer)
We know the left term is n 2 because we are assuming Q(n) , and the right term is
a) Q(l).
152
contrapositive
method 120
divide 4
implication 35, 36
induction hypothe-
sis 152
induction 152
integer 3
negative integer 3
nonnegative integer 3
positive integer 3
rule of inference 24
theorem 2
usage 2
Using these facts, you should be able to convince yourself that Q(n) is true for
any
positive integer, since Q( 1) is true, and the implication Q(n) => Q(n + 1) allows
you to see that Q( 2) is true, Q(3) is true, . . . , jacking the proof up, so to
speak, until
you get to any positive integer. You need to know both Q(l) and the implication
For any statement about the positive integers, this rule of inference is
valid:
an inductive proof. The proof that P(l) is true is the basis step and that
103.2.2 Remarks
a) The induction step is sometimes stated as P(n — 1) => P(n) , which must hold
b) The proof of the induction step, which is an implication, may be carried out
If it is carried out by the direct method, one assumes that P(n ) is true and
deduces P(n + 1). In doing this, P(n) is called the induction hypothesis.
statement about all positive integers. You still have to be clever somewhere in
the proof. In the example just given, algebraic cleverness was required in the
induction step.
about all positive integers. One can similarly prove statements about all
nonnegative
or negative. For example, if you prove P(— 47) and P(n) => P(n + 1) for n > —47,
then P(n) is true for all n > —47.
One could also go down instead of up, but we won’t do that in this text.
103.3.1 Example Let’s prove that for all nonnegative integers n, 3 | n 3 + 2n.
153
Induction step: assume 3|n 3 + 2n. (This is the induction hypothesis.) Then
(n+ l) 3 + 2(n + 1) = n 3 + 3n 2 + 3n + 1 + 2n + 2
= n 3 + 2n + 3n 2 + 3n + 3 (103.1)
= 3(fc + n 2 + n + 1)
so is divisible by 3 as required.
you know it for positive integers, the proof for negative integers is easy:
substitute
— n for n in the statement and do a little algebra. This trick often works for
proving
is not a valid method of proof for proving statements about all integers.
103.3.3 Example A statement about the value of a sum or product can often be
n 1
^2 k = 2 n ( n+1 )
k = 1
Induction step:
Efci i k = ra+l + EL i k
= {\n + l)(n + 1)
This proof uses a basic trick: separate out the term in the sum (or product) of
highest index, in this case n + 1 . Then the rest of the sum can be evaluated using
103.3.4 Remark In all proofs by induction you should label the basis step, the
induction step and the induction hypothesis. If you find yourself writing “and so
on...” or “continuing in this way...” or anything like that, you are not doing an
inductive proof.
103.4.2
U ( —
£(-i)‘* = l T±i)
k= 1 2
(Answer on page 249.)
divide 4
even 5
induction hypothe-
sis 152
induction 152
integer 3
negative integer 3
odd 5
positive integer 3
proof 4
(n even)
(n odd)
154
counterexample 112
even 5
induction 152
integer 3
nonnegative integer 3
positive integer 3
theorem 2
universal quanti-
fier 112
usage 2
well-ordered 154
103.4.7 ELi^ 3 = •
Proof by induction as described in Chapter 103 is based on a very basic fact about
the positive integers that has wider applications. Suppose P(n) is a statement
about positive integers, and suppose the statement (Vn:N + )P(?r) is false. Then
there is a counterexample m, a positive integer for which P(m) is false. Among all
Counterexample
Every false statement of the form (Vn:N + )P(?r) about the positive inte-
104.1.1 Usage This property of the positive integers is often referred to by saying
104.1.2 Remark Of course, one can replace the positive integers by the nonneg-
ative integers, or by the set of all integers greater than a particular one, in the
other data types, least counterexamples need not exist. For example, the statement,
“All integers are even” is a false universally quantified statement about the
integers
155
proved using the principle of the least counterexample. The proof is by contradic-
tion.
Suppose that the hypotheses of the theorem are true: P(l) , and
P(k) is true if k < m but P(m) is false. Now we have two cases.
the theorem.
P(m — 1) is true. It follows from the truth table for implication that the
statement P(m— 1) => P(m) is false. But that means the hypothesis
counterexample 112
equivalent 40
Fundamental Theo-
rem of Arith-
metic 87
implication 35, 36
induction hypothe-
sis 152
induction 152
integer 3
least counterexam-
ple 154
proof by contradic-
tion 126
So in either case, one of the hypotheses of Theorem 103.2 must be false. There-
The principle of mathematical induction and the principle of the least counterex-
The principle of the least counterexample is useful in its own right for proving
things.
For example, it is used in Problems 104.3.3 and 104.4.4 to prove the Fundamental
Theorem of Arithmetic.
The principle allows you to assume as a kind of induction hypothesis that P(k)
is true for all k <n, not just for n — 1. This is stated formally in Exercise
104.3.1
below. It is handy for proving things about factoring integers, since the prime
more general approach is often called strong induction, and another statement of
it is in Problem 104.3.1.
In this book, proofs using this technique are usually presented as direct appli-
divide 4
finite 173
Fundamental Theo-
rem of Arith-
metic 87
GCD 88
implication 35, 36
integer 3
least counterexam-
ple 154
nonnegative integer 3
positive integer 3
prime 10
Principle of Strong
Induction 156
proof by contradic-
tion 126
gers) 83
remainder 83
rule of inference 24
104.3.1 Exercise Use the principle of the least counterexample to prove the fol-
lowing rule of inference for positive integers n. This rule is called the Principle
of
Strong Induction.
Principle of the Least Counterexample to prove the existence half of Theorem 60.2,
page 84. That is, we will prove that for given integers m and n with n / 0, there
Q.l m = qn + r, and
That there is only one such pair of integers was proved on page 84.
We will give the proof for m > 0 and n > 0 and leave the other cases to you
(Exercise 104.3.4). Let S be the set of all nonnegative integers of the form m —
xn.
the other half, suppose for the purpose of proof by contradiction that r > n. Then
least element of S .
104.3.3 Exercise (hard) Show that if m is any integer greater than 1 , then there
is a finite list of primes pi,... ,Pk and integers ei, . . . ,e& for which m = n!
°=iPi’ • Use
the principle of the least counterexample. Do not use the Fundamental Theorem of
Arithmetic. Note that if m is prime, then this holds for k = 1, p\ = m, and e\ = 1.
104.3.4 Exercise Complete the proof that the quotient (of integers) and remain-
104.4.2 Exercise Show that if p is a prime and m and n are integers for which
p | mn but p does not divide m, then p\n. (Hint: Use Problem 104.4.1 and Bezout’s
Suppose p is prime, p\mn, but p does not divide m. Then GCD (p,m) = 1,
for which mn = pk . Putting these facts together, n = anp + bmn = anp + bkp =
( an + bk)p , so n is divisible by p.
157
104.4.4 Exercise (hard) Show that if p\ < p 2 < ■ ■ ■ < Pk in the prime factor-
Problem 104.4.3 to obtain a prime which occurs in both factorizations. Then divide
divide 4
function 56
integer 3
iterative 157
positive integer 3
prime 10
recursive 157
Many functions are defined in such a way that the value at one input is defined in
105.1.1 Example One way of defining the function F : N — > N for which F(n) =
2 n would be to say
for all n € N .
BEGIN
IF N=0 THEN TWOREC := 1
END;
Program 105.1 simply copies Definition 105.1. Since the function TWOREC calls
itself during its execution, this program is also said to be recursive. Program
105.2
105.1.2 Remark Many common algorithms are easily to define recursively, so the
computer science. Very often, the iterative implementation like Program 105.2 is to
may be the preferred method for writing the first attempt, since the iterative
version
158
divide 4
function 56
inductive defini-
tion 159
integer 3
BEGIN
COUNT := 0; POWER := 1;
BEGIN
POWER := 2*P0WER;
COUNT := COUNT+1
END
TWO IT := POWER
END;
105.1.3 Exercise Find the values for n = 1 through 5 of the functions defined as
follows:
. f 0 if 3 1 n
c) F(n ) = <
( 1 + F(n + 1) otherwise
F(n) = ^a k
k = 1
f Sfc=l a k — a \
l Sfcil a k = a n+ 1 + ^2k= 1 a k
(105.2)
f n fe =i a k =
i re;i«»=on + i'(nhi«b
(105.3)
I 0 ! = 1
\ (n + 1)! = (n+ 1) • n\
(105.4)
159
Thus for n > 0 , n\ = H£ =1 k ; you can prove this by induction because both n\ and
the product are defined by induction (Exercise 105.2.1). The factorial function
will
induction. For example, let us use induction to prove that n\ > 2" for n > 3 . We
for n = 4. For the induction step, suppose n ! > 2 n and n > 4. It is necessary to
prove that (n + 1)! > 2 n+1 . Both these functions are defined by induction, so we
defined by induc-
tion 159
domain 56
function 56
induction hypothe-
sis 152
induction 152
inductive defini-
tion 159
integer 3
ninety-one func-
tion 159
positive integer 3
recursive defini-
tion 157
105.2.2 Exercise Prove that for all integers n > 0, 2 n < 2(n!) .
105.2.3 Exercise Find constants C and D for which for all integers n > 0 , 3 n <
Definition 105.1 gives the value at n in terms of the value of the function at a
smaller
values -F(0),-F(1),. . . ,F(k) are defined and for each n£N, F{n- 1-1) is defined
in
terms of some or all of the preceding values F(0),F(1), . . . ,F(n). Thus inductive
subject, the phrase “in terms of” would have to be precisely defined.
Recursive definitions which are not inductive may involve domains other than N
which have no natural ordering (so that “in terms of smaller values” makes no
sense)
F(n) =
(n < 100)
(n > 100)
(106.1)
This is a well defined function. It has the property that F{n) = 91 if n < 100 and
160
Collatz function
definition 4
even 5
Fibonacci func-
tion 160
function 56
odd 5
( 1 (if n = 1)
Looking at the formula, there is no reason to believe that the computation wouldn’t
loop forever for some value of the input, but no one has ever been able to discover
such a value or to prove that such a value does not exist. (Every input that has
ever
been computed does in fact given an answer, namely 1 .) In other words, although
Note that if you change the ‘3n+ 1’ to ‘3n — 1’ in the third line, then T( 5) is
not
defined. There is much more about this in [Guy, 1981], Problem E-16, page 120 and
in [Lagarias, 1985].
106.1.3 Exercise (hard) Prove that the ninety-one function defined by Equa-
tion (106.1) on page 159 satisfies F(n ) = 91 if n < 100 and F(n) = n— 10 if n >
100.
r f(o)=o
{ F( 1) = 1
(107.1)
107.1.1 Remarks
described it in 1220 AD. He was the son (Fi, short for Figlio) of Bonaccio.
b) The Fibonacci function has traditionally been described as the formula for the
number of pairs of rabbits you have after n months under these assumptions:
initially you have just one pair of rabbits, and every month each pair of rabbits
over one month old have a pair of children, one male and one female. And
Suppose you buy (trap?) the first pair of rabbits at the beginning of
the equation
since the F{n— 1) rabbits you had one month ago are still around and you
have a new pair for each of the F(n — 2) pairs born two or more months ago.
161
This explanation bears no relation to reality since rabbits take six months,
not one, to mature sexually, and they do not reliably produce one male and
107.1.2 Example The Perrin function is defined with three starting points:
P(0) = 3
P(1) = 0
P( 2) = 2
(107.2)
For integers larger than 1 up to a fairly large number, this function has the
property
n | P(n) n is prime.
The smallest integer > 1 for which this is false is apparently 271,441 , which is
521 2 ,
Since the Fibonacci function has domain N, it is the same as an infinite sequence
(see
Example 97.2.2). The values F(0),F(1),F(2),... are often called the Fibonacci
divide 4
domain 56
equivalent 40
Fibonacci func-
tion 160
Fibonacci num-
bers 161
induction 152
inductive defini-
tion 159
infinite 174
integer 3
odd 5
Perrin function 161
Perrin pseudo-
prime 161
recurrence rela-
tion 161
recurrence 161
/o = 0
/l = l
fn = fn— 1 T fn—2
(107.3)
some recurrence relations. For example, the statement that the sum of the first
n odd integers is n 2 can be reworded to say that the solution to the recurrence
relation
is s n = n 2 .
If you can guess a solution to a recurrence relation, you can often prove it is
in Problem 107.3.11.
162
divide 4
div 82
even 5
GCD 88
integer 3
nonnegative integer 3
positive integer 3
107.3.1 Exercise Prove that for all nonnegative integers n, f%+i ~ fnfn +2 =
107.3.2 Exercise Prove that for all nonnegative integers n, f n is even if and only
if 3 | n.
107.3.3 Exercise Prove that for all [positive integers n, / n +idiv/ n = l and
,/n+l mod fn = f n —l .
107.3.5 Exercise Prove that for all nonnegative integers n, GCD(/ n +i,/ n ) = 1.
(Hint: You can use Exercise 107.3.3, or you can look at Exercise 107.3.4 and
meditate
upon Bezout.)
SLl/fc = fnfn+1
fn + 2 > (|)"
and y = f n +i ■ (Be careful: You are not being asked to show that (f n ,f n + i)
is a
solution of the equation for each n — that is what the Problem 107.3.8 asks for.
You are being asked to show that no other pair of integers is a solution.)
107.3.10 Exercise (hard) (Matijasevich) Show that for all nonnegative integers
where r and s are the two roots of the equation x 2 — x — 1 = 0 and r > s.
'F(O) = 0
< .F(l) = 1
163
f F(0) = F(l) = 1
Show
function 56
integer 3
natural number 3
odd 5
successor func-
tion 163
take 57
107.3.14 Exercise (hard) (Myerson and van der Poorten [1995]) Define a func-
tion G: N^N by G(l) = G(3) = G(5) =0, G(0) = G(4) = 8, G(2) = 9, and G(n +
and
otherwise.
107.3.15 Exercise (Myerson and van der Poorten [1995]) Define a function G:
G'(n)
— ^ n even
^ odd
a function of two variables for all values of one variable by induction on the
other
variable.
defined by
f m- 0 = 0
\ m ■ (n + 1) = m ■ n + m
(108.1)
108.1.2 Exercise The successor function s : N — > N is the function which takes
each natural number to the next one: s(n) = n + 1 . Show how to define addition
108.1.3 Exercise Show how to define the operation (m,n) i->- m n inductively in
ple 108.1.1).
164
definition 4
GCD 88
head 164
recursive defini-
tion 157
recursive 157
tail 164
108.1.4 Example Theorem 65.1, page 92, gives a recursive definition of the GCD
BEGIN
ELSE
ELSE
END;
' A(0,y) = 1
< - 4 ( 1 ) 0 ) = 2
A(x,y) = A(A(x-l,y),y-l)
d) Calculate A(4,4).
109. Lists
to last, with order and repetition mattering. We will write them using the same
not the same list as (1,4, 3, 2) or as (4, 1,3, 3, 2) . A particular list is the
empty list,
denoted () .
However, the specification for lists is different from that for tuples, so our
formal
with head a and tail (&i,... , &&) is denoted (a,bi ,... , bjf) . The list with
empty list.
165
109.1.1 Remark The head of a nonempty list is not a list, but the tail is a list.
109.1.2 Example () , (5), (2,1,1,— 3) and (3,3,3) are all lists of elements of Z
(lists of integers). The head of (2,1,1,— 3) is 2 and the tail is (1,1,— 3). The
head
cons 165
definition 4
integer 3
function 165
list 164
recursive 157
union 47
109.2.1 Example Let A be the English alphabet. Then the lists (), (a, a, 6)
and (c,a,t,c,h) are all elements of A*. The list (2,2) is an element of N*, and
Most concepts connected with lists are defined recursively using Definition 109.1.
To make this easy, we introduce the list constructor function cons :SxS*^S +
(note carefully the domain and codomain of this function), which is defined by
requiring
is defined by
LL.l |()|=0.
|<c,a,t)|
|cons(c, (a,t))|
|cons(c,cons(a,cons(f, ())))|
1 + |cons(a,cons(f, ()))|
1 + 1 + 1 + IOI
1 + 1 + 1 + 0 = 3
166
cons 165
definition 4
induction hypothe-
sis 152
induction 152
list 164
proof 4
recursive 157
theorem 2
109.4.2 Remark It can be proved by induction on the length of a list that a list
of length k satisfies the specification for a fc-tuple (Definition 36.2, page 50).
Nev-
ertheless, the recursive definition of list given above has provides a useful
alternative
109.5 Concatenation
Informally, the concatenate of two lists is obtained by writing the entries of one
follows:
CL.l ()N = N
109.6.1 Example
(c,a,t)(c,h)
cons(c, ( a,t))(c,h )
cons(c, (a,t)(c,h))
cons(c,cons(a,cons(f, (})(c,h)))
cons(c, (a,t,c,h))
( c,a,t,c,h )
109.6.2 Remark Definition 109.6 implies that, for example, ( )(c,a,t ) = (c,a,t).
We would expect that (c,a,t)() = (c, a,f) as well. This can be proved by induction:
109.7 Theorem
Proof If L has length 0, that is, if L = () , then L() = ()() = () by CL.l. Other-
wise, assume the theorem is true for lists of length k and let L have length k +
1 .
Then L = cons (a, L') for some element a and list L' of length k, and
167
109.8 Theorem
Concatenation is associative. Precisely, for any lists L, M and N,
(. LM)N = L(MN ).
= cons (a,L'M)N
by CL. 2
= cons (a,(L'M)N)
by CL. 2
= cons (a,L'(MN))
induction hypothesis
= cons (a,L')(MN)
by CL. 2
= L(MN)
109.8.1 Exercise Prove by induction that the length of the concatenate of two
lists is the sum of the lengths of the lists. Use Definitions 109.4 and 109.6
explicitly.
associative 70
character 93
cons 165
definition 4
digit 93
induction hypothe-
sis 152
induction 152
inductive defini-
tion 159
list 164
proof 4
real number 12
theorem 2
usage 2
109.8.2 Exercise Give an inductive definition of the last entry of a list. (Answer
on page 249.)
of real numbers. It should satisfy max(l,3, 17,2) = 17 and max(5) = 5, for example.
109.8.4 Exercise Give an inductive definition of the sum of the entries of a list
of real numbers. It should satisfy SUM(3,4,2,3) = 12 and SUM(42) = 42. The sum
109.8.5 Exercise (hard) Prove that a list of length k satisfies the specification
110. Strings
down next to each other and enclosing them in quotes. We will use single quotes.
Thus ‘cat’ is another notation for the string (c,a,t). We specifically regard ‘ cat
’
and ( c,a,t ) as the same mathematical object written using two different
notations.
110.1.3 Remarks
a) Note carefully that ‘cat’ is a string, “cat” is an English word, and a cat is a
b) The alphabet can be any set of characters. For example ‘0101’ is a string in
168
concatenate (of
lists) 166
cons 165
even 5
induction 152
inductive defini-
tion 159
odd 5
Strings are often denoted by lowercase letters, particularly those late in the
alphabet. For example, let w = ‘cat' and x = ‘doggie'. Then wx = ‘catdoggie ' ,
here is the name of a string, from ‘w' which is a string of length one.
The empty string could be denoted ”, but this makes it hard to read, so we will
follow common practice and use a symbol to denote the empty string. In this text,
110.3.2 Remark Note carefully that ‘cat' is a string, but that “A” is the name
of a string.
Note in particular that ‘O’ 3 = ‘000’ and ‘ 1 ,2 ‘0’ 4 = ‘110000’. We always take w
1 = w
and w° = A.
a) w = ‘Oil’, x = ‘1010’ d) w = x = A.
b) w = A, x = ‘Oil’ e)
c) w = ‘011’, x = A. f)
w = ‘Oil’, x = w 2 .
x = ‘011’, w = x 2 .
110.4.3 Exercise Let A = {a, 6} and let E be the set of strings in A* of even
length. Give an inductive definition of E . (Answer on page 249.)
odd length.
should exist for strings of length k or greater but not for strings of length less
than
169
111.1.1 Usage
a) In the research literature, this concept of language is often call “formal lan-
guage” .
one says that L is a “language in A" . This is common terminology but may
111.1.2 Remark The definition says that a language is a subset of A* . Note that
111.1.3 Example The empty language is the set 0. No strings are elements of
111.1.4 Example Another example is the language {A} whose only element is
the empty string. It is important to distinguish this from the empty language 0.
111.1.7 Example The set of strings in {0,1}* with 1 in the second place is a
language. Note that ‘0110’ is in the language but ‘1’ and ‘100’ are not in the
language.
111.1.9 Example The set L of strings in {0,1}* which read the same forward
and backward is a language. For example, ‘0110’ G L, but ‘10010’ ^ L. Such strings
111.2 Theorem
A* = A 0 U A 1 U • • • U A n U • • • (111.1)
the union of the infinite sequence of languages A 0 , A 1 ,... ,A n ,... .
Proof This follows from the fact that every string in A* has some length n.
definition 4
finite 173
infinite 174
integer 3
language 169
positive integer 3
proof 4
subset 43
theorem 2
union 47
usage 2
170
definition 4
induction 152
inductive defini-
tion 159
infinite 174
integer 3
it as the union of an infinite sequence of sets. This follows from the definition
of
of A* given previously.
111.3.1 Example Let L be the set of strings in {0,1} of the form 0 fc l fc , for k
= 1 ,
Let A be a set.
PAL.l The empty string A is a string in P .
171
112.1.1 Usage A variant of this concept is to consider a set whose elements are
sets. For some authors, a family of sets is a set of sets instead of a tuple of
sets.
112.1.2 Example Let A\ = {1,2,3}, A 2 = {2,3,4,5} and A 3 = {3, 4, 5, 7}. Then
of a family of sets
Archimedean prop-
erty 115
coordinate 49
definition 4
infinite 174
real number 12
subset 43
union 47
usage 2
112.2.2 Example This notation is frequently used for infinite sets. As an exam-
ple, recall that ( a..b ) denotes the subset {r £ R | a < r < b} of the reals. Then
if
OO OO
n=l n — 1
symbol denotes the union of all the sets A* for each positive integer i ,
(if such a thing has been defined) is not included in the union.
There is notation analogous to that of Definition 112.2 for a set of sets (in
contrast
to a tuple of sets).
112.3
If T is
of a set of sets
and
(112.4)
172
empty set 33
equivalent 40
hypothesis 36
implication 35, 36
intersection 47
powerset 46
subset 43
union 47
vacuous 37
112.3.1 Example Let J 7 = {{1,2, 3}, {2, 3}, {3, 4}}. Then = {1,2, 3, 4} and
rv !••*}•
b) U“i(-l/i"V0
c) n“i("l/i-l + (V0)
d)
e)
(V5)(5e.A ^ xeS)^x&T
words, T = B . Thus we define the intersection of the empty set of subsets of a set
property:
Also, any set 5 is an element of some other set, for example of {5} .
112.4.2 Exercise Give an explicit description of IJiF and |"| J- for each of these
families of subsets of R:
173
We begin by giving a mathematical definition of the idea that a set has n elements.
allows us to prove theorems about the number of elements of a set that have turned
In this definition we use the set n = {?' £ N | 1 < i < ra} (Definition 36.1,
page 50).
bijection 136
cardinality 173
definition 4
divisor 5
empty set 33
finite 173
integer 3
nonnegative integer 3
positive integer 3
of a finite set
to the set. Thus the formal definition captures the usual meaning of number of
elements: if a set has 5 elements, the process of counting them — “This is the
first
element, this is the second element, ...” — in effect constructs a bijection from n
to the set.
113.1.2 Exercise Give an explicit proof that the set of positive divisors of 8 has
integer.
113.2.1 Example The empty set is finite, since it has 0 elements, and the set
The number of elements of a finite set is the cardinality of the set. For
B is finite.
113.3.3 Exercise Show that a subset of a finite set is finite. Make sure you use
174
bijection 136
countably infi-
nite 174
definition 4
finite 173
independent 174
infinite 174
integer 3
nonnegative integer 3
positive integer 3
A set which is not finite is infinite. Sets such as N, Z and R are infinite. Since
“infinite” merely means “not finite”, to say that R (for example) is infinite means
just that there is no nonnegative integer n for which the statement “R has n
elements” is true. This is certainly correct in the case of R, since if you claim
(for
example) that R has 42 elements, all I have to do is add up the absolute values of
those 42 numbers to get a number which is bigger than all of them, so is a 43rd
element.
We do not go into the extensive theory of infinite sets in this book, but it is
important to understand the difference between “finite” and “infinite” since many
theorems, such as the ones in this section, concern only finite sets.
113.4.1 Warning It is tempting when faced with proving a theorem about pos-
sibly infinite sets to talk about one set having “more elements than another” .
Such
arguments are often fallacious. For example: “There cannot possibly be an injec-
tive function from N x N to N since N x N has more elements than N.” But there
are such functions: see Exercises 93.1.8 and 113.5.3. Compare the extended hint to
Exercise 92.1.8.
113.5.1 Exercise Show that the set N + of positive integers is countably infinite.
(Answer on page 249.)
soning illustrated in the following argument: You are at a restaurant whose menu
has three columns, A, B and C. To have a complete meal, you order one of the three
items in column A, one of the five items in column B, and one of the three items in
order, and, for each i = 1,2, . . . , k, there are n t ways of doing task 7) .
Suppose furthermore that doing T t in any particular way does not change
the number nj ways of doing any later task Tj . Then we say that the
175
Multiplication of Choices
Suppose there are k independent tasks Ti (i = 1, . . . ,k) and suppose that
If you have one task Ti which can be done in ri\ different ways, Theorem 114.2
Now suppose the theorem is true for k tasks. Assume you have k + 1 tasks
Ti,... ,T k ,T k+ i, and for each i there are n* ways of doing task T % . Let m be
the
total number of ways of doing the tasks Ti, . . . ,T k in order. Suppose you have
done
them in one of the m ways. Then you can do T k+ \ in any of ni+i ways. Thus
for each of the m ways of doing the first k tasks, you have ni + \ ways of doing
the
ways of doing the k + 1 tasks. This means that there are m x m+ 1 ways to do
Ti,... ,T k+ 1 in order.
By induction hypothesis, m = n!=i n i > so the number of ways of doing the tasks
Ti,... ,T k+ 1 is
n k+ 1 • (J^n*)
1=1
114.2.1 Worked Exercise How many three-digit integers (in decimal notation)
tasks in a row:
according to Theorem 114.2, there are 810 ways to do T.l, T.2, T.3 in order.
Answer This requires us to look at the problem in a slightly different way from
one a requires us to
a) Choose which of n possible locations to put the one and only a (n ways to
do this).
decimal 12, 93
digit 93
induction hypothe-
sis 152
induction 152
integer 3
proof 4
theorem 2
176
digit 93
even 5
finite 173
include 43
integer 3
powerset 46
theorem 2
114.2.3 Exercise Find the number of 5-digit integers with ‘3’ in the middle place.
114.2.4 Exercise Find the number of even 5-digit integers. (Answer on page
249.)
114.3.2 Exercise Find a formula F{n) for the number of strings in A* of length
114.3.4 Exercise Find a formula H{n ) for the number of strings in A* of length
114.3.5 Exercise Find a formula for the number of strings in A* of length n> 2
digits, the first two of which cannot be 0 or 1 . How many possible local telephone
Almost every operation associated with set theory has a corresponding combinatorial
principle or counting technique applicable to finite sets associated with it. Some
of
these are obvious, others are more subtle. The first example has to do with
inclusion:
115.1 Theorem
115.1.1 Exercise Show that if A and B are finite then |Anl?| < |A|.
177
115.2 Theorem
Proof The easiest proof of this theorem uses the Principle of Multiplication of
Choices (Theorem 114.2). If A has n elements and you want to describe a subset of
A, you may go through the n elements of A one by one and say whether each one
is in the subset. There are two choices (yes or no) for each element and n
elements,
so the Principle of Multiplication of Choices says that you can make 2 n choices
altogether.
115.2.1 Remark As is the case with any counting technique based on the Prin-
Cartesian product 52
even 5
induction 152
Multiplication of
Choices 175
odd 5
powerset 46
proof 4
singleton 34
subset 43
theorem 2
115.2.2 Worked Exercise How many subsets with an even number of elements
Answer A set S with n elements has 2 n ~ 1 subsets with an even number of ele-
ments. Proof: To give a subset A of S, for each element of S except the last one
choices. You have no choice concerning the last element: if at that point the
subset
has an odd number of elements so far, you must include the last one, and if it has
an even number so far, you must not include the last one.
115.2.3 Exercise Let S be an ra-element set. How many elements do the follow-
115.3 Theorem
115.3.1 Exercise If A has m elements and B has n elements, how many ele-
a) Ax A
b) V(AxA)
c) V(A x B)
178
family of sets
finite 173
function 56
proof 4
subset 43
theorem 2
union 47
c) Prove that the symbols ‘ < ’ in (a) and (b) cannot be replaced by ‘ < ’ .
115.3.5 Exercise Let A be a finite set and F:A—$B a function. Prove that
\T(F)\ = \A\.
116.1 Theorem
Proof This follows from the fact that the expression |T| + \B\ counts the elements
which are in both sets twice, so to get the correct count for \AlJB\, you have to
subtract \AnB\.
116.1.1 Remark More generally, if C and D are also finite sets, then
and
-\Bnc\-\BnD\-\cnD\
+ \AnBnC\ + \AnBnD\
+ \AnCnD\ + \BnCnD\
-\AnBnCnD\
(116.2)
(116.3)
general principle which requires some notation to state properly. Let T be a family
of n distinct finite sets. For each k = 1,2,. . . ,n, let Fk be the set of fc-
element
F 3 = {{A,B,C},{A,B,D},{A,C,D},{B,C,D}}
Then we have:
179
W = £1*1- £ |nG|
+ £ |nG| - ...
(116.4)
XeT G&X 2
G&T . 3
-(-P E i n °i +
Ge^fe
•••-(-I) n |n^|
116.2.1 Remarks
a) The first sum is over the elements of T (which are themselves sets), whereas
the others are over intersections of subfamilies G of J- , with a plus sign for
subfamilies with an odd number of elements and a minus sign for those with
b) You should check that Equations (116.1)— (116.3) are special cases of this Prin-
ciple.
c) The Principle of Inclusion and Exclusion will not be proved here, but you
should be able to see with no trouble why it is true for families of three or
four sets.
tion, so you can solve for one of its terms if you know all the others.
For example, suppose there was a party with 9 people, including 5 Norwegians.
There was only one man at the party who was neither a vegetarian nor a Norwe-
gian. All the vegetarians were Norwegians and two of the women were Norwegians.
Exactly one woman was a vegetarian. How many women were at the party?
To solve this, let W be the set of women, N the set of Norwegians, and V
the set of vegetarians. The party had 9 people, and only one was not in W U
were Norwegians, |WnIV| =2, and since one woman was a vegetarian and every
\NHV\.
\wnN\-\wnv\-\Nnv\ + \wnNnv\
we have
or since |H| = \N D V \ ,
8 = \ W\ + 5 — 2 = \ W\ + 3
even 5
sion 179
intersection 47
odd 5
theorem 2
definition 4
fact 1
finite 173
implication 35, 36
partition 180
subset 43
union 47
usage 2
116.2.3 Exercise You have a collection of American pennies. Three of them are
zinc pennies and eight of them were minted before 1932. What do you have to know
to determine the total number of pennies? Explain your answer! (Answer on page
249.)
116.2.4 Exercise A, B and C are finite sets with the following properties: A U
and C are disjoint; and there is just one element in A that is also in B . Show
that
116.2.5 Exercise Suppose that A, B and C are finite sets with the following
properties:
116.2.6 Exercise Cornwall Computernut has 5 computers with hard disk drives
and one without. Of these, several have speech synthesizers, including the one
with-
out hard disk. Several have Pascal, including all those with synthesizers. Exactly
3
of the computers with hard disk have Pascal. How many have Pascal?
117. Partitions
of C if
117.1.1 Usage The elements of the partition n are called the blocks of n. If
igC, the block of n that has x as an element is denoted [x]n> or just [x] if the
117.1.2 Fact P.2 says the blocks of n (remember that these subsets of C) are
117.1.3 Fact P.l and P.2 together are equivalent to saying that every element of
C is in exactly one block of n.
117.1.4 Example Here are three partitions of the set {1,2, 3, 4, 5}:
a) n 1 = {{l,2},{3,4},{5}}.
b) H 2 = {{1},{2},{3},{4},{5}}.
c) n 3 = {{1,2, 3, 4, 5}}.
181
117.1.6 Example Let S be any nonempty set and A any proper nontrivial subset
117.1.7 Example The empty set has a unique partition which is also the empty
117.1.8 Exercise Why does Example 117.1.6 have to require that A bea proper
nontrivial subset of A?
block 180
empty set 33
finite 173
infinite 174
nontrivial subset 45
partition 180
proper subset 45
union 47
usage 2
117.1.9 Worked Exercise Let S be a nonempty finite set with n elements. How
Answer There are 2 n — 1 nonempty subsets of S and, except for S itself, each one
induces a two-block partition as in Example 117.1.6. This does not mean that there
are 2 n — 2 two-block partitions because that would count each two-block partition
twice (a subset and its complement each induce the same two-block partition). So
l(2 n -2) = 2 n - 1 -l
two-block partitions.
117.1.10 Warning One of the commonest mistakes made by people just begin-
117.1.11 Exercise Find a formula for the number of partitions with exactly three
117.1.12 Usage A partition with a finite number of blocks (even though the
Even so, if n' is another partition which is the same as n except for ordering,
they
are regarded as the same partition even though they are different tuples. We will
a)
b)
c)
d)
{A,B} e) {S}
{A,C,D} g) {C,S-C}
{A,H,0} h) {AuC,D}
182
block 180
finite 173
floored division 87
sion 179
infinite 174
integer 3
negative integer 3
partition 180
positive integer 3
remainder 83
theorem 2
This partition is denoted Z/n. The blocks of Z/n are the n sets
for 0 < r < n. For negative m floored division must be used. (Observe that the
notation “ C r ” requires you to depend on context to know what n is.) Thus Z/n =
117.3.1 II has at least one block with exactly three elements. (Answer on page
250.)
117.3.3 II has at least one finite block and at least one infinite block.
and Exclusion, the sums over families with more than one element disappear. This
118.1 Theorem
This Theorem together with the phenomenon of Example 117.1.6 gives a method:
183
118.1.1 Method
complement S — A.
118.1.2 Worked Exercise How many strings of length n in {a,b,c}* are there
that there are 2 n strings with no a and n ■ 2 n ~ 1 strings with one a. Since
there are
block 180
definition 4
partition 180
surjective 133
take 57
usage 2
118.1.3 Exercise How many strings of length n in {a, b}* are there that have
118.1.4 Exercise How many strings of length n in {a, b}* are there that satisfy
118.1.5 Exercise How many strings of length n in {a,b,c}* are there that have
exactly two different letters in them (so each one is either all a’s and 6’s, all
a’s
118.1.6 Exercise In the USA the identifying name of a radio station consist of
are not distinguished. How many legal identifying names are there?
119. The class function
{3,4,5}.
119.1.2 Usage A common notation for the class function is [] : A — > n; in Exam-
119.1.4 Warning Note that in Example 119.1.1, [3] = [4] = [5] , but [2] / [3] . In
mathematics, the fact that two different names are used does not mean they name
119.1.5 Example If n is the partition Z/3, then [2] = [5] = [—1] = C' 2 , and [3] =
C 0 .
119.1.6 Exercise Prove that for any set S with partition n, the class function
184
block 180
definition 4
family of sets 171
floored division 87
function 56
image 131
integer 3
list 164
negative integer 3
partition 180
function) 184
remainder 83
take 57
theorem 2
120.1 Theorem
{F _1 (6) | belmF}
is a partition of A .
set of F .
120.2.2 Example The quotient set (of a function) of the squaring function S :
Every block of R/S has two elements with the exception of the block {0}. The
notation “{{r,— r} | r G R}” for R/S 1 lists {0} as {0,-0}, but that is the same
set as |0j. Note that every set except |0| is listed twice in the expression
“{{r,-r} | r G R}” .
fixed integer n. This function takes an integer k to its remainder when divided by
n.
(As earlier, we use floored division for negative k). For a particular remainder r,
the set of integers which leave a remainder of r when divided by n is the set we
called C r earlier in the section. Thus the quotient set of R n is the set we
called
Z /n.
We must show that the blocks of A/F are nonempty and that every element of A
That the blocks are nonempty follows the fact that A/F consists of those 1 ?_1 (6)
for which b G ImF; if b G ImF, then there is some a G A with F(a) = b, which
set S/F which is true if and only if F is injective. (Answer on page 250.)
185
120.3.2 Exercise Give examples of two functions F : N — > N and G : N — >■ N with
the property that F is surjective, G is not surjective and F and G have the same
120.4.1 R /F has at least one block with exactly three elements. (Answer on
page 250.)
elements of B . Suppose also that |A| = 7, |£>| = 4, ImF = B — {y} , and that the
function F | (A — F~ 1 (x) s ) is injective.
b) Give an example to show that the set {CnB \ C 6 n} need not be a partition
of B .
of n . For any block C € 4> , let Be be the union of all the blocks Bg n for which
It seems incomprehensible at first, but when you finally figure out what the
notation
block 180
finite 173
function 56
image 131
injective 134
partition 180
subset 43
186
bijection 136
block 180
codomain 56
function 56
image 131
injective 134
surjective 133
theorem 2
The following theorem forms a theoretical basis for very important constructions in
abstract mathematics:
for functions
121.1.1 Example For the function F : {1,2,3} — > {2, 4, 5, 6} defined by F(l)=4
121.1.2 Remark The input to the bijection is a set, namely a block of A/F , and
means that when you plug {2,3} into (5f ( not when you plug 2 in or 3 in!) you
get 5.
121.2 Proof of Theorem 121.1
It is easy to see that (5f really is a bijection. If b £ Irn F , then there is some
element
a £ A for which F(a) = b, so 1 ?_1 (6) is nonempty and hence an element of A/F .
If F _1 (6) F-\c), then there is some element a £ A for which a £ 1 ? ^ 1 (6) but
a $/ F~ x {c) (or vice versa). The statement a £ 1 ?_1 (6) means that F(a) = b, and
121.2.1 Exercise Let A = {1,2, 3,4,5} . For each function F : A R given below,
write out all the values of the bijection fip '■ A/F — > ImP given by Theorem
121.1.
a) F(l) = F( 3) = F( 5) = 4, F( 4) = 6, F( 2) = 0.
187
functions between them. The facts about finite sets A and B in the following
theorem are not difficult to see using examples. We give part of the proof and
leave
122.1 Theorem
function G : T — > B .
bijection 136
bijective 136
composition (of
functions) 140
finite 173
function 56
image 131
injective 134
proof 4
function) 184
subset 43
surjective 133
theorem 2
Proof By Definition 113.1, if A and B both have n elements then there are
bijections (3 : n — > A and f3':n—^B. Then, using Theorem 101.5, page 149, Theo-
rem 101.3, page 148 and Exercise 98.2.7 of Chapter 98, (3 ' ° (3~ l : A -» B is a
bijection.
To finish the proof of (a), we must show that if there is a bijection (3: T — >■ B
then
We also leave (b) as an exercise, and prove half of (c). Suppose A has m
elements and B has n elements with m>n> 0 . Then there are bijections f3 : m — >
A and f3' : n — >■ B . Let us define a function F : m — > n by: F(k) = k if k < n,
and F(k) = n if k > n. F is surjective, because if 1 < i < n, then F(i) = i . Then
122.1.2 Exercise Use the principles of counting for finite sets that we have intro-
122.2 Theorem
If A and B are finite sets and \A\ = \B\ , then a function F : A—> B is
Proof Let F : T — >■ B be injective. Then ImL, being a subset of B , has no more
than \B\ elements by Theorem 115.1. Since F is injective, ImF has at least |T|
elements by Theorem 122.1(a). Since |T| = |L>|, it follows that ImL has exactly
Conversely, if F is not injective, then the quotient A/F has fewer elements
than A. The fundamental bijection theorem (Theorem 121.1) says that then ImF
has fewer elements than A, so it has fewer elements than B since |T| = |L>|. That
188
bijection 136
decimal 12, 93
digit 93
finite 173
function 56
include 43
infinite 174
injective 134
integer 3
Multiplication of
Choices 175
powerset 46
proof 4
surjective 133
theorem 2
122.2.1 Warning Observe that if |A| = \B\, then Theorem 122.1(a) says there
from A to B . But Theorems 122.1(a) and (b) do not say that the injection and
you don’t have to test both. However, you have to test both for infinite sets. For
example, the shift function m- )-n+l:N— >N is injective but not surjective (0
is not a value) and 0 i — 0 , nun - 1 for n > 0 defines a function N — > N which is
122.3 Theorem
If A = n and \B
other words,
b a
II
Proof To construct an element of B , that is, a function from A to B, you have
to say what F(a) is for each element of A. For each a you have m choices for
B(a) since F(a) has to be an element of B and B has m elements. There are
n elements a of A for each of which you have to make these choices, so by the
122.3.1 Exercise How many ways are there of assigning a letter of the alphabet
to each decimal digit, allowing the same letter to be assigned to different digits?
122.3.2 Exercise
b) Show that the statement in (a) can be false if A and B are infinite.
is a set with n elements, and let G(n ) be the number of functions from S to its
189
123.1 Theorem
For any finite sets A and B , if |A| > \B\ , then no function from A to
B is injective.
\A\ > \B\, and you put each pigeon in a pigeonhole (thereby giving a function from
A to B ) , then at least one pigeonhole has to have two pigeons in it (the function
is
not injective). For this reason, Theorem 123.1 is called the Pigeonhole Principle.
block 180
contrapositive 42
function 56
injective 134
partition 180
Pigeonhole Princi-
ple 189
recurrence 161
subset 43
theorem 2
that in any room containing 367 people, two of them must have the same birthday.
Note that the Pigeonhole Principle gives you no way to find out who they are.
123.1.3 Worked Exercise Let S = {n:N | 1 < n < 10}. Show that any subset
T of S with more than 5 elements contains two numbers that add up to 11.
Answer The following are all the two-elenrent subsets of S whose elements add
up to 11: {1,10}, {2,9}, {3,8}, {4,7}, {5,6}. They form a partition of S with
five blocks. Every element of T is in one of these subsets, and since T has more
than five elements, by the Pigeonhole Principle two different elements must be in
and \T\ > 4 then there are two different elements of T that have the same remainder
when divides by 3.
123.1.5 Exercise Let A = {n : N | 1 < n < 12} . Find the least integer n so that
the following statement is true: If T C A and |T| > n, then T contains two distinct
Many counting formulas can be derived as recurrence relations. In many cases, you
can then find a closed formula which evaluates the recurrence relation, but even
if you cannot do that, the recurrence relation gives you a way of evaluating the
124.1 Theorem
190
bijection 136
definition 4
even 5
odd 5
proof 4
recurrence 161
subset 43
124.2 Theorem
Proof Let P(n) be the number of bijections between two n-element sets. Then
P(0) = P(l) = 1. Let A and B be two sets with n+ 1 elements. Let a G A. Then
B — {b} . These are both n-element sets, so there are P(ji) of these, by definition
of P(n) . Hence
P(n + 1) = (n + 1) • P(n)
This is the recurrence relation which (with P(0) = 1) defines n! (see Section
105.1.6,
124.2.1 Worked Exercise Derive a formula or recurrence relation for the number
There are Fiji) strings of length n with an even number of ones and 2 n — Fiji)
with an odd number of ones. (Note that there is no justification at this point for
assuming that the number of strings of length n with an even number of ones and
the number with an odd number of ones are the same.) You can adjoin a 0 to a
string of the first type and a 1 to a string of the second type to get a string of
length
124.2.2 Exercise Derive a formula or recurrence relation for the number of ways
to arrange n people around a circular table. (All that matters is who sits on each
124.2.3 Exercise Derive a formula or recurrence relation for the amount of money
set with 4 elements), (7(4,1) = 4 (there are four singleton subsets of a four-
element
191
125.2 Theorem
For all n> 0 and k> 0 ,
a) C(n, 0) = 1 .
b) C(n,n) = 1.
c) C(n,k) = C(n,n— k) .
d) C(n,k) = 0 ifk>n.
Proof
a) There is exactly one empty subset of any set, so C(n, 0) = 1 for any n.
b) An n-element set clearly has exactly one subset with n elements, namely
itself.
c) This follows from the fact that for a particular k there is a bijection between
d) Obvious.
125.3 Theorem
(x + y) n = J2C(n,k)x n - k y k (125.1)
k = 0
n that occur) and using y from those factors and x from the n — k other factors.
We can get a recurrence relation for C(n,k) which will allow us to calculate it.
Suppose, for a fixed k, we want to know C(n + 1 ,k) , the number of k -element
other hand, every A’ -element subset of A that does not contain a as an element is
theorem:
binomial coeffi-
cient 191
empty set 33
proof 4
recurrence 161
subset 43
theorem 2
192
recurrence rela-
tion 161
theorem 2
125.5 Theorem
(7(71,0) = 1
125.5.1 Example
= 1 + 2 -(7(2,1) + (7(2,2)
= l + 2- 2 + l = 6
(125.4)
(125.5)
125.5.2 Example The recurrence relation for C(n,k) can be used to give an
(x + y)° = ^(7(O,£0*-y
k = 0
The sum on the right has only one term, namely (7(0, 0)x°y° , which is 1, as is the
(x + y) n = Y,C(n,k)x n - k y k
k = 0
We must prove
n + 1
k = 0
to be 0.
(■ x + y) n+1 = ( x + y)(x + y) n
k= 0
n n
k= 0 k= 0
n n
k= 0 k= 0
n n+l
fc=0 fc=l
n+l
k= 0
n+l
= y^C(n + l,fc)g w+1 ~ fc y fc by Theorem 125.5
fc=0
Note that I changed the limits on the sum in the next to last line of this proof,
using
There is a sense in which this proof forces you to believe Theorem 125.3, but
the earlier proof (on page 191) explains why it is true. Mathematicians sometimes
The following theorem gives an explicit formula for the binomial coefficient.
125.6 Theorem
77 1
Answer Now that we have the function C(n,r) we can solve this using the idea of
Worked Exercise 114.2.2. To construct such a string, we must choose two locations
in the string where the two a’s will be. There are C(n, 2) ways of doing this. Then
there are two choices (b or c) for each of the other locations, so the answer is
n ( n ~ 1) on- 2
2
conceptual proof 193
theorem 2
194
binomial coeffi-
cient 191
identity (predi-
cate) 19
recurrence rela-
tion 161
recurrence 161
ber of identities are known for the binomial coefficient. We consider one here to
illustrate how one goes about proving such identities. The identity is
k = 0
This can be proved using the recurrence relation of Theorem 125.5, but the
proof is rather tedious. I quail with terror at the idea of using the formula in
choosing n balls from a set of 2 n balls. Now suppose that we have 2 n balls and
n of them are red and n of them are green. Then an alternative way of looking at
the task of choosing n balls from this set is that we must choose k red balls and
n — k green balls for some integer k such that 0 < k < n . For a particular k there
are C(n,k)C(n,n — k) ways of doing this. By Theorem 125.2(c), this is the same as
5 Z C (n,k ) 2
k = 0
possibilities.
definition, namely Definition 125.1, and a method of calculating it, in this case
two
of them: Theorems 125.5 and 125.6. It is generally good advice to try the
conceptual
approach first.
mial (Formula 125.1), and in fact that formula allows a faily easy second proof of
Formula (125.7).
71 — 2
C(n,3) = — -C(n,2)
bit complicated.)
195
strings of length n in {a, b}* with the same number of a’s as b 's.
125.6.11 Exercise (hard) Find a recurrence relation for the number of partitions
all a € A and c € C ,
a(a ° (3)c 36 £ B (o a b A b /3 c)
126.1.1 Example Let A = {1,2, 3, 4, 5}, B = {3,5, 7, 9} and C = { 1,2, 3,4, 5, 6},
with
and
Then
ao/3= {(1,1), (1,2), (1,3), (2, 4), (3, 4), (3, 5), (3, 6), (5, 4)}
126.1.2 Usage As you can see, although functions are composed from right to
left, relations are composed from left to right. It is not hard to see that if F :
A — > B
T(G°F) = r(F)°T(G)
126.1.3 Exercise Let A = {2,3, 4, 5}, B = {6, 7, 8, 9}, C = {a,b, c,d, e} , and a€
c) a ={(2,7), (2, 8), (3, 7), (3, 9), (4, 8), (4, 9)} and
P= |(6,a),(6,6),(7,c),(8,c),(9,c),(9,d),(9,e)}
block 180
definition 4
divide 4
equivalent 40
function 56
ordered pair 49
partition 180
recurrence 161
relation 73
theorem 2
usage 2
196
associative 70
tions) 195
composition pow-
ers 196
definition 4
functional relation
include 43
interpolative 196
proof 4
relation 73
126.2 Theorem
126.3.1 Exercise For each relation R in Exercise 52.1.3, page 75, determine
126.3.2 Exercise Prove that if F:A—*B and G : B — >• C are functions, then
T(G°F) = T(F)°T(G).
relation.
and only if a 0 a C a .
interpolative.
197
127. Closures
Given any relation a on S, and any property P that a relation can have there
C.2 a.C/3.
127.1.1 How to think of closures ft is the “smallest” (in the sense of inclusion)
127.1.2 Fact The reflexive, symmetric, and transitive closures of relations always
127.2 Theorem
Proof To prove this formally you must show that it fits Definition 127.1; that is,
that
RC.l and RC.2 are obvious. As for RC.3, suppose that a C 7 and 7 is reflexive.
If i(aUAs)z then either x a z or x = z (that is, rAsz). In the first case ary z
so a U As C 7 , as required.
127.3 Theorem
a s = a U a op
page 250.)
definition 4
fact 1
implication 35, 36
include 43
P-closure 197
proof 4
reflexive 77
relation 73
subset 43
theorem 2
union 47
198
include 43
integer 3
intersection 47
ordered pair 49
positive integer 3
proof 4
relation 73
theorem 2
union 47
127.4 Theorem
Finally, we must show that (3 is transitive. Suppose x(3z and z(3y. Then for
x(3y as required.
positive integers k.
a U A g is the only reflexive closure of a . That is why we could use the notation
127.5 Theorem
Proof By C.2 of Definition 127.1, a C. (3 and a C (3' . Then by C.3, f3 C f3' and
the P-closure easy to calculate, but it does give a conceptual description useful
for
199
IC.2 For any set S of relations on A, all of which have property P, the
128.1.1 Remark The set Ax A can be regarded as the intersection of the empty
definition 4
empty set 33
include 43
intersection-
closed 199
intersection 47
proof 4
relation 73
subset 43
theorem 2
128.2 Theorem
tion a, the P-closure of a exists and is the intersection of the set of all
set. We must verify C.l, C.2 and C.3. (3 has property P because P is intersection-
section of all the relations with property P that contain a as a subset. Finally,
the
128.2.1 Exercise Prove that for any property P, if a has property P then the
P-closure of a is a itself.
128.2.2 Exercise Show that the following hold for any relation a:
a) a RS = a SR .
b) a R1 = a TR .
128.2.3 Exercise
2/31. On the set S = {1,2}, let a = {(1,1)}. Let /3 = {(1,1), (1,2)} and 7 =
{(1, 1), (2, 1)} . Then /3 and 7 both include a and both have property P. On the
other hand, a does not have property P. Does this contradict Theorem 127.5?
128.2.5 Exercise Show that a relation need not have an “antisymmetric closure” .
200
definition 4
equivalence rela-
tion 200
equivalence 40
equivalent 40
even 5
natural number 3
nearness relation 77
odd 5
partition 180
predicate 16
proposition 15
reflexive 77
relation 73
union 47
respect. And surely a is like itself — in every respect! Thus if you want to give
alike in some respect, two of the properties you could require are reflexivity and
symmetry. Relations with those two properties are studied in the literature (the
nearness relation J\f in Section 55.1.4 is such a relation), but here we are going
to
require the additional property of transitivity, which roughly speaking forces the
objects to fall into discrete types, making a partition of the set of objects being
studied.
relation on S .
129.1.1 Remark This is an abstract definition — you don’t have to have some
the set A:
129.1.4 Example The relation “has the same parity as” on the set N of natural
numbers is an equivalence relation. Two numbers have the same parity if they are
129.1.5 Example The relation of being in the same suit on a deck of cards is an
equivalence relation.
129.1.6 Example Both the congruence relation and the similarity relation on the
the set of predicates is an equivalence relation. (This example requires that the
set
In questions 129.2.1 through 129.2.9, let E be the relation defined in the question
201
129.2.5 mE?r 44 fn 2 = n 2
129.2.6 mEn 44 m \ n A n \ m
129.2.8 mEn 44 12 | (m — n+ 1) .
In questions 129.3.1 through 129.3.6, let E be the relation defined in the question
on R. Is i? an equivalence relation?
congruent (mod
k) 201
definition 4
divide 4
equivalence rela-
tion 200
equivalent 40
floor 86
integer 3
modulus of congru-
ence 201
positive integer 3
relation 73
remainder 83
union 47
usage 2
129.3.4 rEs 44 r + s = 1 .
129.3.5 rE.s 44 r — s G N.
129.3.6 rEs 44 r — s G Z
130. Congruence
130.1.2 Usage
a) In the phrase “m = n (mod k ) n , k is called the modulus of congruence.
b) The syntax for “mod” here is different from that of the operator “MOD” used
“5 = 2 (mod 3)”, on the other hand, is a sentence that is either true or false.
202
divide 4
equivalence rela-
tion 200
hypothesis 36
integer 3
positive integer 3
proof 4
gers) 83
remainder 83
theorem 2
130 . 1.3 Exercise List all the positive integers < 100 that are congruent to 3 mod
24. (Answer on page 250.)
130 . 1.4 Exercise List all the positive integers < 100 that are congruent to —3
mod 24.
130 . 1.5 Remark Recall that the remainder when m is divided by k is the unique
integer r with 0 < r < \k\ for which there is an integer q such that m = qk + r.
Then
we can prove:
130.2 Theorem
k and r' the remainder when n is divided by k. Then there are quotients q and
Since r and r' are both between 0 and k (not including k ) , this means r = r' , as
required.
130.3 Theorem
Proof Here is the proof that it is transitive; the rest is left to you. Suppose
that
remainders are unique, m leaves the same remainder as p when divided by k, so,
by Theorem 130.2 m = p (mod k ) .
Congruence has an important special property connected with addition and multi-
130.4 Theorem
k | m — in and k\n — n
Then (in + n) — (m' + n') = m — m' + n — n! is the sum of two numbers divisible
mn — mn' + mn' — m'n' = m(n — n') + n'(m — m') , again the sum of two numbers
203
130.4.1 Remark The consequence of Theorem 130.4 is that if you have an expres-
sion involving integers, addition and multiplication, you can freely substitute
inte-
gers congruent to the integers you replace and the expression will evaluate to an
value.
5 2 = 25 = 9 (mod 16)
5 8 = (5 4 ) 2 = l 2 = 1 (mod 16)
definition 4
divide 4
domain 56
equivalence rela-
tion 200
equivalent 40
fact 1
function 56
integer 3
kernel equiva-
lence 203
relation 73
remainder func-
tion 203
remainder 83
130.4.3 Remark This ability to compute powers fast is the basis of an important
technique in cryptography.
b) 5 12 (mod 10)
c) 5 12 (mod 16)
K ( F ) , is defined by
equivalence relation.
are kernel equivalences. Let A: be a fixed integer > 2. The remainder function
Theorem 130.2, reworded, says exactly that the relation of congruence (mod k ) is
block 180
definition 4
division 4
empty set 33
equivalence rela-
tion 200
fact 1
include 43
partition 180
proof 4
an equivalence
relation) 204
remainder 83
subset 43
theorem 2
of S can be collected together into subsets, with two elements in the same subset
an equivalence relation
132.1.1 Example The quotient set of the equivalence relation a defined in 129.1
132.2 Theorem
class [x\e for some iGS; since x G [x\e , [x\e is not empty.
As for (b) , x G [x] e ; if also x G [y\E for some y G S , then we have to show
that
(h) \x\eQ\v\e-
For (i), let z G [v]e- Then zEy by definition. Since x G \v\ei xEy. By symmetry
For (ii), let z G [x\e- Then zEx . Since x G [v]e, xEy. So by transitivity, zEy .
132.2.1 Fact The equivalence class [x\e is a block of the partition S/E.
205
Answer
{{1,3, 4}, {2}, {5}}
E = As U {<1,3), (3, 1), <3, 4), <4, 3), <1 , 4) , <4, 1), <2, 5), <5, 2)}
132.2.4 Exercise Let S = {1,2, 3, 4, 5}. Find two different equivalence relations
E and E' with the property that the subset {1,2} is an element of both S/E and
{x £ R | 0 < x < 1}
block 180
equivalence rela-
tion 200
equivalent 40
identifies 205
partition 180
proof 4
an equivalence
relation) 204
reflexive 77
relation 73
theorem 2
union 47
is one of the equivalence classes of E.
132.2.6 Exercise Let S = {1,2, 3, 4, 5}. Find two different equivalence relations
elements of S . One often says that one identifies equivalent elements. Here,
“iden-
tify” means “make identical” rather than “discover the identity of” .
Mathematicians
For a partition n of a set S , we will use the notation [x]n or just [x] if the
context
makes clear which partition is being used, to denote the (unique) block of n that
the definition:
xE n y (x £ [y]n)
(133.1)
133.1 Theorem
If n is a partition of a set S , then the relation En defined by (133.1)
is an equivalence relation.
Proof To see that xEnx requires x £ [x], which is true by definition of [x] . Hence
En is reflexive. If xEn y then x £ [y] . That means [x] = \y\ , since by definition
of
partition an element is in only one block. Since y £ [y\ by definition and [x] = [y
\ ,
we know that y £ [x] , so yEnx . Hence En is symmetric. Note that we now know
that xEn y if and only if x and y are in the same block of n . To prove
transitivity,
206
antisymmetric 79
bijection 136
block 180
definition 4
domain 56
equivalence rela-
tion 200
function 56
include 43
irreflexive 81
ordering 206
partition 180
function) 184
relation) 204
reflexive 77
relation 73
subset 43
suppose xEn y and yE-^z. Then x and y are in the same block, and y and z are
we now have functions E e-)- S/E : E(S) — > ttS and II >-)• En : nS — > E(S ) ,
where En
is defined in formula (133.1) above. The basic fact about these constructions is
that
these two functions are bijections and each is the inverse of the other. This fact
is
set S/E, which is a partition, and then construct the equivalence relation E s / e
corresponding to that partition, you get the equivalence relation E you started
with. And if you have a partition II of S , construct the corresponding equivalence
relation En, and then construct the quotient set S'/En of E, you get the partition
II back again. The proof of the fundamental theorem involves the same sort of
133.2.2 Exercise Prove that any partition of a set A is the quotient of some
134. Orderings
between numbers and the relation of inclusion between subsets of a set. Here is the
formal definition:
134.1.1 Example The relation “<” on a set of numbers is a weak ordering, and
207
134.1.3 Remark Essentially all the orderings considered in this text are either
weak orderings or strict orderings, but the more general concept is occasionally
useful.
134.2.1 Example (R, <) and (R, >) are posets, and so is (' VA,C. ) for any set
(V(SxS),Q.
134.2.2 Usage In many texts, a weak ordering is called a partial ordering, and
antisymmetric 79
definition 4
divide 4
include 43
integer 3
ordered set 207
poset 207
positive integer 3
powerset 46
reflexive 77
relation 73
theorem 2
usage 2
134.2.3 Example Not only are “<” and “<” orderings on R, but so are “>”
and “>”.
proving that if m\n and n \ p then rn \ p . and antisymmetry is the almost obvious
for some positive integer k . Thus m = kn = khm . If m / 0 you can cancel m and
of T defined this way: t a u if task t must be done before task u can be started.
This is obviously transitive. If a were not antisymmetric, that would say there are
two different tasks t and u, each of which had to be done before the other, so that
it
is in fact impossible to perform the set of tasks. Thus for any reasonable
collection
134.3 Theorem
one says that “a is smaller than 6” . This phraseology has to be used with caution
—
one would not use it, for example, for the relation “>” on R. More subtle problems
with this terminology arise with other orderings. For example, in the poset (N, |),
3 is smaller than 6 but 3 is not smaller than 5 . Nor, for that matter, is 5
smaller
than 3. You have to be very clear that “smaller” here is not the usual relation “<”
on N.
208
definition 4
divide 4
include 43
powerset 46
reflexive 77
relation 73
ing 208
theorem 2
trichotomy 208
usage 2
The following Theorem, whose proof is left to you, shows that a relationship analo-
gous to that between “<” and “<” holds for all orderings.
134.4 Theorem
An ordering a on a set A with the property that for any pair of elements
135.1.2 Example The relations “<” and “>” are total orderings on R, as well
previously, 3 and 5 are not related to (do not divide) each other.
135.1.4 Example If A has more than one element, then (VA, C) is not a totally
ordered set.
135.2 Theorem
statements hold:
(i) a a b
(ii) baa
(iii) a = b.
135.3.1 Remark This definition has the consequence that a strict total ordering
of Definition 135.1.
209
transitive on Z .
page 250.)
a) Assume that a is a strict total ordering in the sense of Definition 135.3. Prove
135.3.4 Exercise How many total orderings of an n -element set are there? Prove
135.3.5 Exercise For any natural number n, let D(n ) denote the set of positive
136. Preorders
antisymmetric 79
definition 4
divide 4
divisor 5
equivalence rela-
tion 200
equivalent 40
function 56
natural number 3
positive integer 3
preordering 209
preorder 209
prime 10
function) 184
reflexive 77
relation 73
ing 208
usage 2
136.1.1 Usage Sometimes “quasi-ordering” is used for “preordering”, but that
136.1.2 Remark Every preorder can be converted into a partial order by a pro-
is an equivalence relation.
[x]A[y] 44 xay
Prove that A is well-defined, that is, that if [x\ = [V] , [y] = \y'], and [x]A[y],
then [x']A[y'].
210
divide 4
division 4
divisor 5
Hasse diagram 210
include 43
ordering 206
poset 207
positive integer 3
relation 73
subset 43
using a different sort of picture called a Hasse diagram. The elements of the set
are represented as dots, as before, and the diagram is drawn so that when there is
a rising line from a to b, then a a b. (“Rising” means toward the top of the page.)
The rising line from a to b does not have to go directly from a to b, but may pass
through other nodes; this makes use of the fact that the relation is transitive.
Note
that the diagram does not show whether a node is related to itself. In this text,
(137.1)
137.1.1 Example The two Hasse diagrams in Figure 137.1 show the inclusion
relation on the set of subsets of {1,2,3} and the relation of division on the set
{1,2, 3, 4, 5, 6}.
137.1.2 Remark Note that b can be higher on the page than a without it being
137.1.3 Exercise Draw the Hasse diagram of the indicated poset (A, a):
a) A = {1,2, 3, 4, 5} ,
a = {(1,1), <2, 2), <3, 3), <4, 4), <5, 5), (1,2), (2, 3), (1,3), (5, 4), (4, 3),
(5, 3)}
b) A = {0,{1},{2},{1,2},{2,3}}, a is inclusion.
137.1.4 Exercise Which of the posets in Exercise 137.1.3 are total orderings?
137.1.5 Exercise Draw the Hasse diagram for the relation “divides” on:
211
x in A* .
definition 4
finite 173
infinite 174
138.2.1 Example If A is the English alphabet with the usual ordering, ‘car’
‘card’, and ‘car’ comes before ‘cat’ because the first place where ‘car’ and ‘cat’
differ
ordering on {0,1}*, where {0,1} is ordered so that 0 comes first. The first few
elements of {0,1}* are A, ‘O’, ‘00’, ‘000’, ‘0000’, ‘00000’, ... Thus if you go
through
the strings in order, there are strings such as ‘1’ that you can’t get to in a
finite
amount of time: there are an infinite number of strings in {0,1}* before ‘1’.
138.2.3 Exercise Prove that the lexical ordering on {0, 1}* (with 0 < 1 ) is a
total
ordering.
212
base 94
canonical order-
ing 212
definition 4
fact 1
finite 173
include 43
integer 3
The canonical ordering, defined below, is often used on infinite sets of strings to
remedy the problem described in Example 138.2.2. It is the most commonly used
ordering on {0,1}*.
notation.
139.1.1 Example 1110 comes before 00001 because it is shorter, and 0011 comes
A, 0, 00, 01, 10, 11, 000, 001, 010, 011, 100, ...
139.1.3 Fact The canonical ordering is linear and, unlike the lexical ordering,
there are only a finite number of strings between any two strings.
139.1.4 Remark This idea can obviously be extended to strings in the alphabet
A = {00,01,110, 111,0101,0111,10101,10111,01111}
in the lexical ordering and in the canonical ordering. (Answer on page 251.)
139.1.6 Exercise Prove that the canonical ordering on {0, 1}* is a total ordering,
and that there are only a finite number of strings between any two given strings.
140.1.1 Remark Note that the upper bound a of Definition 140.1 need not be
in B.
140.1.2 Example In the right poset in Figure 137.1, 6 is an upper bound (in fact
the only one) of {1,2,3} and the set {1,2, 3, 4} has no upper bound.
213
140.1.3 Example {1,2, 3, 4} has many upper bounds in the poset (N, |) , for
6am.
140.3 Theorem
definition 4
divide 4
fact 1
include 43
least upper
bound 213
minimum 213
proof 4
rule of inference 24
subset 43
supremum 213
theorem 2
and so it would have to be the case that m a m' and m f a m . Then antisymmetry
forces m. = m'.
6 E B . A similar proof shows that a subset B has at most one minimum. Note that
140.3.2 Exercise Find all the maxima and minima of the posets in Exer-
140.3.3 Exercise What are the maxima and minima, if any, of (N, | ) ? Of (N —
141. Suprema
The two ideas of upper bound and minimum combine to form a concept that is more
upper bounds of B .
141.1.1 Fact The supremum m must be unique if it exists, and it may or may
bound of B and m a a for every other upper bound a of B. This gives rise to a
rule of inference.
214
definition 4
divide 4
division 4
fact 1
implication 35, 36
infhnum 214
interval 31
join 214
meet 214
ordering 206
positive integer 3
powerset 46
prime 10
rule of inference 24
subset 43
supremum 213
theorem 2
141.2 Theorem
141.2.1 Fact Note that m is the “least” upper bound in the sense of the ordering
unrelated to m.
141.2.3 Example The supremum in (R, <) of the open interval (0 . . 1) is 1 , which
have to be its supremum in R, too, but the supremum in R is \/2, which is not
in Q.
which
141.3.2 Exercise Find the suprema and infima, if they exist, of the subset S of
a) S = {3,4,5} , T = N, a is “<”.
b) S = {3,4,5}, T = N, a is “divides”.
141.3.3 Least upper bounds of two elements There is a special notation for
suprema and infima of subsets of two elements. If (A, a) is a poset and a,b € A,
then the supremum of {a,b} is denoted a V b and called the join of a and b, and
the infimum is denoted a/\b and called the meet of a and b. Using this notation,
215
T , then n <m.
of A in S.
141.3.5 Exercise (hard) Show that if a and ft are real numbers and
J = {t£Q\a<t<b}
be the supremum of J in Q. Use Problem 141.3.4 to show that ft < n. Now assume
b < n and use the Archimedean property to get an integer k for which 1 /(n — b ) <
k ,
142. Lattices
A poset (A, a) with the property that for any two elements a and b,
a/\b and a Vft always exist, is called a lattice. If a Aft always exists, but
not necessarily aVft, then (A, a) is called a lower semilattice, and if
Archimedean prop-
erty 115
definition 4
include 43
integer 3
join 214
lattice 215
max 70
meet 214
minimum 213
min 70
powerset 46
rational 11
real number 12
subset 43
supremum 213
union 47
unit interval 29
142.1.1 Remark Some texts require that a lattice have a minimum and a mini-
mum, as well.
142.1.2 Example The following are Hasse diagrams of lattices. Note that, for
(142.1)
the join r Vs with respect to the usual weak ordering < always exist, and in fact
142.1.4 Example Let A be a set and B and C subsets of A. Then in (VA, C),
216
divide 4
divisor 5
finite 173
GCD 88
include 43
infimum 214
integer 3
lattice 215
minimum 213
natural number 3
positive integer 3
powerset 46
proof 4
relation 73
subset 43
supremum 213
theorem 2
Thus (N, | ) is a lattice. This follows immediately from Corollary 64.2, page 90.
a) (N, <) .
b) (Z,<).
c) (R, <)•
d) ( A , |) , where A is the set of positive divisors of 25.
142.1.7 Exercise Prove that for any set A, (PA,C) is a lattice. (Answer on
page 251.)
142.1.9 Exercise Show that in the lattice (N — {0}, |) , every subset has an infi-
mum and every finite subset has a supremum, but not every subset has a supremum.
142.1.10 Exercise Let n be a positive integer. Show that the set of positive
143.1 Theorem
a) aVa = a (idempotence).
b) aVb = bVa (commutativity).
a) a Aa = a.
b) aAb=bAa
c) a A (b A c) = (a A b) A c.
Proof We will prove the associativity of A and leave the rest as an exercise. This
proof involves applying the definition of infimum repeatedly to prove that each
side
of the equation is the infimum of the set {a,b,c}, and using the uniqueness of the
infimum. I will show that a A (6 Ac) =inf{a,6, c} and leave the other side to you.
The definition of infimum tells us that all the following are true:
217
( 1 ) b Acab
(2) bAcac
(3) a A (b Ac) a a
( 4 ) aA(bAc)abAc.
Putting (1), (2) and (4) together and using transitivity gives that
(5) aA(bAc)ab
( 6 ) a A(b Ac) ac
( 7 ) a A (b Ac) a inf{a, b , c} .
(8) inf{a,6,c} a 6
so
( 10 ) inf{a,6,c} a bAc.
Also
( 11 ) inf- {a, b, c} a a
The proof that A and V are associative is rather long, although conceptually not
difficult. The value is that having done it once, we know it is true for every
situation
142.1.5, that max and min, intersection, union, and GCD and LCM are all
rem 143.1 and the corresponding fact for sups, the associativity doesn’t need
proof.
GCD and LCM and made them into axioms', then any theorem derived from those
axioms is true in all the cases all at once. This is an example of the axiomatic
method in mathematics. The axiomatic method is largely responsible for the power
of modern mathematics.
associative 70
axiomatic
method 217
commutative 71
equivalent 40
GCD 88
idempotent 143
intersection 47
max 70
min 70
218
arrow 218
definition 4
function 56
graph 230
infinite 174
source 218
target 218
connections between things. There are two main types of graphs, the kind called
“undirected graph” in which only the connection between two things matters, and
the kind called “directed graph” or “digraph” in which the direction of the connec-
tion matters. Each of these main types occurs in numerous subvarieties, only some
varied; it is probably true that if two graph theory books by different authors use
the same terminology, one of the authors was the graduate student of the other one.
The terminology in this text is similar to the usage in many (but not all) computer
or graph theorists.
In this book, “graph” means undirected graph and “digraph” means directed
graph. All graphs here are finite; although the definitions work for infinite
graphs,
many of the theorems are not true as stated for the infinite case.
144.1.1 Digraphs Informally, a digraph is a bunch of dots called nodes with
arrows going from some nodes to others. Here are two examples.
x < ^ y
I b
(144.1)
and two functions source :Gi — > Go and target \G\ — > Go-
using dots or labels for the nodes, and an (actual) arrow going from node x to node
a) The graph with nodes {A,B,C, D} and exactly one arrow from each node
to A.
219
sets Go, Gi and the source and target functions, is called the abstract
144.3.1 Remark We will frequently encode the abstract description for a digraph
of nodes, Gi the set of arrows, and s and t are the source and target functions.
144.3.2 Example The abstract description of the digraph on the left of Fig-
target (a) = target (6) = target (e) = source (it) = target (it) = y
the abstract definitions and the pictures is analogous to that between the formula
The pictures are more suggestive and comprehensible than the abstract definition,
have the most general case. It may also be difficult or wasteful (or both) to store
pictures directly in the computer. The abstract treatment is both more rigorous
144.5.1 Example Digraphs provide a natural way to encode data about certain
kinds of complex systems. The flow chart of a program, for example, is a digraph.
labeled digraphs. However, the information concerning the composites of the func-
digraph.
144.5.2 Example Digraphs are the natural way to model the sequencing of a
task and there is an arrow from task a to task b if task a must be completed before
task b can be started. For example, the task of computing log(x 2 + y 3 ) can be
arrow 218
commutative dia-
gram 144
tions) 140
definition 4
divide 4
function 56
graph 230
labeling 221
source 218
target 218
220
arrow 218
definition 4
function 56
graph 230
indegree 220
loop 220
outdegree 220
source 218
start
calculate x 2
calculate y 3
(144.2)
This graph shows, for example, that if you had two people or two processors to
perform the squaring you could speed up the computation. Digraphs arising in this
144.5.3 Exercise Draw the digraph modeling the computation of the truth value
of the equation
2 , 2 2
x + xy = x — y
145. Miscellaneous topics about digraphs
An arrow a from a node to itself, in other words a : x — > x for some node
x, is called a loop.
The number of arrows that have a node as source is called the outdegree
of the node, and the number of arrows that have the node as target is
the indegree.
145.2.1 Example The node y in the left graph of Figure (144.1) has indegree 4
and outdegree 1 .
The opposite of a digraph G is the digraph with the same nodes and
G°v = {G 0 ,G 1 ,t,s).
221
145.3.1 Example
A »- B
C D
A* B
C D
145.4 Labeling
arrows. As an example, the digraph below shows the cost of traveling by rail in a
(mythical) mountainous country between three cities A, B, and C . (The fare for
arrow 218
definition 4
digraph 74, 218
function 56
injective 134
integer 3
labeling 221
real number 12
(145.1)
The nodes are labeled by {A, B,C} and the arrows are labeled by integers repre-
You can see that the labeling of the nodes is injective but the labeling of the
arrows
is not. When the labeling of the nodes is injective, there is usually no harm in
tak-
ing the attitude that the labels are actually the nodes; a similar remark applies
to
source(fe) or target (a) ^ target (6) . In other words, only one arrow can
way.)
146.1.1 Example The left graph in Figure (144.1), page 218, is not a simple
146.1.2 Exercise What is the largest number of arrows a simple digraph with n
999
arrow 218
Cartesian product 52
coordinate func-
tion 63
coordinate 49
definition 4
fact 1
include 43
relational descrip-
tion 222
source 218
subset 43
target 218
only for simple digraphs; those that allow more than one arrow from a node to a
A simple digraph can be given a much simpler (!) abstract description (of a graph).
Since there can be at most one arrow from a node to another one, all you have to do
to describe the digraph is to give the set Go of nodes and the subset A of Go x Go
of ordered pairs of those nodes that have an arrow going from the first node to the
146.2.1 Remark We saw this correspondence between simple digraphs and rela-
146.2.2 Example In the case of the right graph in Figure (144.1), which is simple,
146.2.3 Exercise Which of the digraphs in Exercise 144.2.2 are simple? Give the
146.2.4 Exercise Give the relational description of the graph (147.1), page 223.
146.2.5 Fact The relational description can be converted to the original definition
of digraph by calling a pair (x,y) in A an arrow from x to y; thus the source is
To sum up:
you get the relational description (G, A) of the same graph by taking G = Go
and
223
147. Isomorphisms
The two digraphs below are abstractly identical in a sense that can be made
precise.
The idea is that node a in the left digraph plays the same role as node 2 in the
right digraph, and similarly b and 1 match up and c and 3 match up. “Playing
the same role” means precisely that if you match node x in one digraph to node m
in another, and similarly node y to n, then the arrows from x to y must match
up with the arrows from m to n. (You should check these two digraphs to see that
this happens).
c
Pi: G i — >• G\ with the property that a:x — >• y in G if and only if
147.1.1 Remark Since there is rarely any problem with ambiguity, the subscripts
147.1.2 Example In Figure 147.1 there is an isomorphism P from the left figure
/3(a) = 2 P(f)=v
P{b) = 1 P(g) = u
P(c) = 3 P(h) = w
P(k) = x
147.1.4 Exercise (hard) Show that two digraphs are isomorphic if and only if
there is an ordering of their nodes for which their adjacency matrices are
identical.
147.1.5 Exercise Draw both (nonisonrorphic) simple digraphs that have only one
node, and all ten (nonisonrorphic) simple digraphs that have two nodes.
Prove that Pq\Gq^- G’q and Pi : Gi — > G' x constitute an isomorphism if and only
if
bijection 136
definition 4
isomorphism 223,
235
224
adjacency
automorphism 224
Cartesian product 52
definition 4
identity function 63
integer 3
positive integer 3
ism from G= (Go,Gi,s,t) to G' = {G' 0 ,G \ , s' ,t') . Show that (3~ l , i.e. , (Pq
1 ,^ 1 ),
morphism.
The digraphs in Figure 147.1 each have two automorphisms, the identity and one
other.
let G' be a digraph isomorphic to G . Show that there are exactly n isomorphisms
from G to G'.
147.2.4 Exercise (hard) For any positive integer n, show how to construct a
x to y .
148.1.1 Example For the left digraph in Figure 144.1 the adjacency matrix is
x y z w
x 0 2 1 0
2/0100
z 1 1 0 0
0 0 0 0
148.1.2 Remark The adjacency matrix depends on the way the nodes are
ordered; thus if you permute the nodes you get a different adjacency matrix for
the same graph. Note that the adjacency matrix does not contain the information
225
definition 4
divide 4
equivalent 40
node 218, 230
prime 10
148.1.5 Uses of the adjacency matrix You can use the adjacency matrix of a
(ii) It has no loops if the entries down the main diagonal (the one from upper left
(iii) The outdegree of a node is the sum over its row and the indegree is the sum
The adjacency matrix will be used in the next section to calculate which nodes
148.1.6 Exercise Give the adjacency matrices of the digraphs in Figure 147.1.
148.1.7 Exercise Draw this digraph and give its adjacency matrix: The nodes
are the numbers 1,2,3,4,6,12 and there is an arrow from a to b if and only if a and
b have the same prime factors (in other words, for all primes p. p \ a 44 p \ b).
12 3 4
10 111
2 0 0 1 1
3 0 10 1
4 10 0 0
P.l source(ai) = p;
149.1.1 Remarks
directed walk of length n will thus make n + 1 visits to nodes, counting the
start and finish nodes, and the same node may be visited more than once.
226
definition 4
function 56
recursive 157
simple directed
path 226
a) The walk (u) on the left digraph is of length one and touches the node y
twice.
b) The empty walk () from y to y is also a walk (of length 0); it is not the same
as (u) .
d) The walk (c, d, c, d) goes from z to z and touches each of x and z twice.
e) (e,a,d) is not a directed walk because an arrow goes the wrong way.
all different.
149.3.2 Example In the digraph (149.1), the only directed circuits are the three
149.4.1 Example The only simple directed paths from z to y in the digraph (149.1)
in which the nodes are the procedures and functions and there is an arrow from P
149.4.3 Exercise Find all the simple directed paths from 1 to 3 in the digraph
s(c) = s(d ) = 2, t(a) = 2, t(b ) = t(c) = 1, and t(d) = t(e) = 3. (This is the
same as
and y — » z, there must be an arrow x—>z. Show that a digraph is transitive if and
The adjacency matrix of a digraph can be used to compute directed walks from one
node to another. This involves the concepts of matrix addition and multiplication,
associative 70
Cartesian product 52
commutative 71
definition 4
fact 1
function 56
integer 3
positive integer 3
usage 2
150.1.1 Example ( 3 , 5 , - 1 , 0 ) • ( 1 , 2 , 3 , 4 ) = 10 .
150.1.2 Usage The scalar product is also called the “dot” product. You may be
familiar with its geometrical meaning when the tuples represent vectors.
150.1.3 Remark The scalar product is only defined for two tuples of the same
whose (i,j ) th entry is the scalar product of the zth row of A and the
(AB)ij = Y% =l A ik B kj ( 150 . 1 )
150.2.1 Example
/ 1 3 0
\2 2 2
2 10 5
3 - 21-1
5 110
11 -5 3 2 \
20 0 4 8 )
( 150 . 2 )
matrices A and B for which AB ^ BA. (Note that if AB and BA are both
228
associative 70
commutative 71
definition 4
induction hypothe-
sis 152
induction 152
integer 3
proof 4
theorem 2
defined.
150.3.1 Remark Two matrices can be added if and only if they have the same
dimensions.
150.3.2 Example
(150.3)
In the following, we will use powers of square matrices with integer coefficients.
If
151.1 Theorem
entry of M k .
Suppose it is true that for all nodes p and q, the (p,q) th entry of M k is the
229
Or — 3 Clr — 2 — 1 ®r+s— 1 ®r+s+ 2 ®r+s+3
corollary 1
nonnegative integer 3
proof 4
reachable 229
digraph; in other words, if there are n nodes in the digraph, the total number of
walks is
E? =1 |(MVK,M rg j (151.1)
151.2 Reachability
there is at least one directed walk of some length (possibly zero) from p to q.
Since a directed walk of length k touches k + 1 nodes, it follows from the pigeon-
hole principle that a directed walk of length n or more in a digraph G with n nodes
must touch some node twice. Suppose such a walk (gi,... ,«*) touches a node x
twice; say arrow a r has source x and arrow a r + s (with s > 0) has target x. Then
an obvious way.)
Clearly, by successively eliminating circuits, one can replace the walk by a path
151.3 Corollary
K = I + M + M 2 + . . . + Af n_1 is nonzero.
Proof If there is a directed walk from p to q, then the argument before the state-
ment of the Corollary shows that there must be one of length n — 1 or less. This
Since all the entries in these matrices are nonnegative, this means that the (p,q)
th
230
definition 4
even 5
finite 173
function 56
graph 230
implication 35, 36
reachability
matrix 230
subset 43
transitive
(digraph) 227
151.3.1 Exercise Use matrix multiplication to find all the directed walks of
(151.3)
The matrix
K = I + M + M 2 + ... + M n ~ l
151.4.1 Exercise Calculate the reachability matrices for the digraphs in Fig-
151.4.2 Exercise Let G be the digraph whose set of nodes is {1,2, 3, 4}, with an
In Chapters 144 through 151, we considered digraphs that consisted of nodes and
arrows between some of the nodes. The graphs considered in this section have nodes
with edges between them, but the edges have no direction assigned to them.
called edges.
231
(a)
(b)
definition 4
edge 230
graph 230
injective 134
subset 43
152.2.1 Exercise Which of the graphs in Table (152.1) are simple? (Answer on
page 251.)
152.2.3 Drawing graphs One draws a graph by using dots for the nodes, and
drawing a line between nodes p and q for each edge e for which T(e) = {p, q} . In
common with most of the literature on the subject, our graphs do not have loops:
the requirement that T have values in the set of two-element subsets rules out the
possibility of loops.
232
adjacency
adjacent 232
definition 4
fact 1
graph 230
incident 232
152.2.4 Example The figure below shows two graphs; the one on the right is
simple.
In the left graph the set of nodes is {q,r,s,t}, the set of edges is {a,b,
u,v,x,w,y} ,
are adjacent. If n edges connect two nodes the nodes are said to be
and columns are indexed by the set of nodes, with A(p,q) =the number
152.4.1 Fact It follows from the definition that for any (multi)graph with adja-
cency matrix A,
(ii) for any nodes p and q, A(p,q) = A(q,p) (this says A is symmetric); and
(iii) if the graph is simple, A has only 0’s and l’s as entries.
152.4.2 Remark Because of 152.4. l(i) and (ii), all the information about the
graph is contained in the triangular matrix consisting of the entries A(p,q) with
p < q.
152.4.3 Example The adjacency matrix of the left graph in Figure (152.1) is
0
l
s
0
233
152.5.1 Example The degree of the node c in the right graph in Figure (152.1),
152.5.2 Fact The degree of a node is the sum over the row (and also over the
152.5.3 Exercise Show that the sum of the degrees of the nodes of a graph is
Two special kinds of graphs that will be referred to later are given in the
following
definitions.
153.1 Definition: complete graph on n nodes
153.1.2 Exercise Give a formula for the number of edges of I\ n for n > 0.
A bipartite graph G is a graph whose nodes are the union of two dis-
joint nonempty subsets A and B , called its moieties, with the property
153.2.1 Fact It follows from Definition 153.2 that no two nodes of A are adjacent,
bipartite graph for which A has m elements and B has n elements with
m<n is denoted K m ^ n .
iu
adjacency
complete bipartite
graph 233
complete graph on n
nodes 233
definition 4
degree 233
edge 230
fact 1
graph 230
moiety 233
subset 43
(153.1)
234
definition 4
fact 1
full 234
function 56
graph 230
restriction 137
subgraph 234
subset 43
usage 2
153.3.2 Exercise Which of the graphs in Table (152.1), page 231 are complete
153.3.3 Exercise Which of the graphs in Table (152.1), page 231 are bipartite
1 53.3.4 Exercise Give a formula for the number of edges of the complete bipartite
graph K rnn .
154. Subgraphs
154.1.1 Usage For some authors, “subgraph” means what we call a full subgraph.
154.1.2 Fact If G' is a subgraph of G, the edge function T 7 for G' is the restric-
154.1.3 Example The following graph is a non-full subgraph of the left graph in
(154.1)
155. Isomorphisms
it captures the idea that two graphs are the same in their connectivity — there is
a
235
155.1.1 Usage In electrical engineering, isomorphic graphs are said to have the
“same topology” .
155.1.2 Example In general there may be more than one isomorphism between
G and H . The graphs below are isomorphic. Altogether, there are 12 isomorphisms
between them.
adjacent 232
bijection 136
complete bipartite
graph 233
definition 4
function 56
graph 230
identity function 63
integer 3
isomorphic 235
isomorphism 223,
235
moiety 233
usage 2
155.1.3 Example The left graph below is not isomorphic to the right graph. The
identity map is a bijection on the nodes, and if nodes are adjacent in the left
graph,
they are adjacent in the right graph, but there are nodes in the right graph that
are adjacent there but not in the left graph. The definition of isomorphism
requires
that p and q be adjacent if and only if j3(p) and /3(q) are adjacent.
(155.2)
155.1.4 Exercise Group the graphs in Table (152.1), page 231 according to which
155.1.5 Exercise In Table (152.1), page 231, show that (b) is isomorphic to a
full subgraph of (c), and to a nonfull subgraph of (c). (Answer on page 251.)
155.1.6 Exercise
c) Prove that for fixed integers m and n, two complete bipartite graphs, each of
which has one moiety with m nodes and the other moiety with n nodes, are
isomorphic.
236
circuit 236
connected compo-
nent 236
connected 236
cycle 236
definition 4
edge 230
fact 1
graph 230
isomorphic 235
isomorphism 223,
235
length 236
list 164
path 236
theorem 2
walk 236
155.1.7 Exercise
isomorphic) is simple.
c) Prove that for simple graphs your definition of isomorphism is the same as
Definition 147.1.
We talk about walks, paths and circuits in graphs in much the same way as for
digraphs.
a circuit in which no nodes are repeated except that the beginning and
any two nodes. If p is a node in a graph, let C (p) denote the set
and q. The sets C (p) are called the connected components of the
graph G.
156.4.1 Fact Part (a) of the theorem below implies that two nodes in a graph are
joined by a path if and only if they are in the same connected component. A graph
237
156.5 Theorem
Let G be a graph.
is a path from q to r .
Otherwise, just connect the path from p to q to the path from p to r. The result
might only be a walk, but by eliminating circuits, you get a path. That proves (a).
from g to r, so (b) follows. Finally, any node p is an element of C(p) ; this and
(b)
implies that every node is in exactly one set C (p) , so the sets C (p) form a
partition
circuit 236
cycle 236
definition 4
diameter 237
distance 237
edge 230
graph 230
partition 180
path 236
proof 4
theorem 2
walk 236
156.6 Definition: distance
156.6.1 Example In the right graph of Figure (152.1), the distance between
nodes d and / is 3 . There are of course simple paths of length 4 and 5 between
A graph need not have an Eulerian circuit. For example, the graph in Fig-
ure (152.1) has no Eulerian circuit. There is a simple criterion for whether a
graph
circuit 236
connected 236
converse 42
definition 4
degree 233
edge 230
even 5
fact 1
finite 173
graph 230
Hamiltonian cir-
cuit 238
incident 232
integer 3
proof 4
157.2 Theorem
Proof Suppose G has an Eulerian circuit. As you go around the circuit, you
have to hit every edge exactly once. Every time you go through a node, you must
therefore leave by a different edge from the one you entered. So for each node p.
you can divide the edges incident to p into two groups: those you enter p on and
those you leave p on. Since you enter and leave p the same number of times, these
two groups of edges must have the same number of elements. Thus the number of
Now for the converse: suppose every node of G has even degree. To construct
an Eulerian circuit, pick a node p. If that is the only node in G you are finished.
Otherwise, there is an edge on p. Travel along that edge to some node q and mark
the edge so you won’t use it again. Because there are an even number of edges
incident on q . there is an unmarked edge. Leave on the edge and repeat the process
because you are marking the ones you use, and because of finiteness you have to
return to p sometime. However, the circuit may not pass over every edge. If it does
not, there is an unmarked edge e incident on some node q already in your circuit,
because G is connected. Start with that node and that edge and repeat the process,
continuing until you return to q. This will give another circuit containing q. Note
that the second circuit may hit nodes of the first circuit, but there will always
be
an unmarked edge to leave on because each node in the first circuit has even degree
and an even number of marked edges. You now can put these two circuits together
into a big circuit — go around the first circuit starting at p until you get to q,
go
around the second circuit until you return to q, and then continue around the first
circuit until you get back to p. If you still don’t hit all the edges, you can
repeat
this process a second time, and so on until all the edges are used up. The result
will
be an Eulerian circuit.
This problem was first solved by Leonhard Euler, who was asked whether it was
possible to walk around the city of Konigsberg (then in Prussia, now in Russia and
called Kaliningrad) in such a way that you could traverse each of its seven bridges
exactly once. The arrangement of bridges in Euler’s time is represented by the left
graph in Figure (152.1), page 232 (each edge represents a bridge), which clearly
has
no Eulerian circuit since in fact none of its nodes has even degree.
157.2.2 Exercise For which integers m and n does K m , n have Eulerian circuit?
exactly once.
239
trast their theory with that of Eulerian circuits: there is no known simple
criterion
to determine whether a graph has a Hamiltonian circuit or not. The problem is com-
circuit?
Exercises 157.4.1 through 157.4.3 concern the graphs in Table 152.1, page 231.
definition 4
diameter 237
edge 230
embedded in the
plane 239
graph 230
Hamiltonian cir-
cuit 238
integer 3
planar 239
157.4.2 Which of the graphs has an Eulerian circuit? (Answer on page 252.)
157.4.3 Which of the graphs has a Hamiltonian circuit? (Answer on page 252.)
in a printed circuit that no two lines (edges of the graph) cross each other. This
is
158.1.2 Example The left graph in Figure (155.1), page 235, can be embedded
158.1.3 Warning The fact that a graph is drawn with edges crossing does not
mean it is not planar. For example, K 4 is planar, in spite of the way it is drawn
in
240
complete bipartite
graph 233
definition 4
edge 230
embedded in the
plane 239
graph 230
planar 239
subdivision 240
subgraph 234
theorem 2
158.1.4 Exercise Which graphs on page 231, are planar? (Answer on page 252.)
158.1.5 Example Not all graphs can be embedded in the plane. For example,
the complete graph on 5 vertices (left graph below) cannot be embedded in the
plane. Another such graph is the utility graph, the right graph below (which is
the complete bipartite graph 143 , 3 ). It arises if you have three houses a, b and
c
that must each be connected to the water, sewer and gas plants (w, s and g ). If it
(158.1)
k 5
A',3,3
lowing process zero or more times: take an edge e connecting two nodes
x and y and replace it by a new node z and two edges e! and ef' with
(158.2)
158.3.1 Remark This theorem has a fairly technical proof that will not be given
here. Note that it turns a property that it would appear difficult to verify into
one
241
Some very difficult questions arise concerning labeling the node of a simple graph.
some finite set) with the property that if nodes p and q are adjacent,
then L(p) ^ L(q ) . In this context the elements of S are called colors.
159.1.1 Remark This terminology arises from the problem of coloring a map
of countries in such a way that countries with a common border are colored with
different colors. In the (very large) literature on coloring problems, two states
or
countries that have only a point on their borders in common, such as Arizona and
Colorado in the U.S.A., are regarded as not bordering each other. The common
characteristic func-
tion 65
chromatic num-
ber 241
coloring 241
color 241
definition 4
edge 230
finite 173
graph 230
labeling 221
odd 5
159.1.2 Example The state of Kentucky in the U.S.A., and the seven states
bordering it, require four colors to color them in such a way that adjoining states
do not have the same color. This is turned into a problem of graph theory by
drawing a graph with one node for each state and an edge between two nodes if the
MO TN
(159.1)
a subset of a set.
159.2.1 Example The chromatic number of the graph in Figure (159.1) is 4, and
159.2.2 Exercise Show that a graph with at least one edge is bipartite if and
159.2.3 Exercise Show that a graph has chromatic number 2 if and only if it has
242
bipartite graph 233
chromatic num-
ber 241
coloring 241
color 241
rem 242
graph 230
Kuratowski’s Theo-
rem 240
moiety 233
planar 239
subgraph 234
subset 43
a) The complete graph on n nodes has chromatic number n, since every node is
b) A bipartite graph has chromatic number 2 (if it has any edges): since none
of the nodes in one of the moieties are adjacent to each other, they can all
be colored the same color, and the nodes in the other moiety can be colored
another color.
c) It is known that any planar graph has chromatic number < 4. This fact is
Color Theorem, observe that the graph of states in Figure (159.1) has chromatic
Figure (159.1) that all border each other (thus turning into a copy of K 4 in
(159.1)),
it nevertheless takes four colors to color the whole graph. It follows that you
can’t
use Kuratowski’s Theorem to prove the Four Color Theorem: the fact that no
planar graph contains K 5 as a subgraph does not rule out the possibility that a
159.2.6 Exercise Give an example of a graph with chromatic number 3 that does
159.2.7 Exercise Find a place in the world with four political subdivisions that
all border each other. (There are no four states in the U.S.A. like this, although
you
will observe that North Carolina, South Carolina, Georgia and the Atlantic Ocean
n nodes in a cycle and another node connected to each node in the cycle, and no
b) Find the chromatic number of a Kempe graph. (It will depend on n.)
159.2.9 Garbage routes The effort to prove the Four Color Theorem resulted in
the discovery of fast coloring algorithms and of a lot of detailed information
about
graph coloring. This has other applications besides coloring maps. For example,
consider the following problem: A city is divided into a number of garbage pickup
routes. Some of the routes overlap, because businesses must be picked up more
often than residences and therefore are assigned to two or more routes. What is
the best way to distribute the routes among the five working days of the week, with
If each route is regarded as a node, with two routes adjacent if they overlap,
the graph would be a start towards finding a good schedule. Note that this problem
243
by Definition 4.1.
5 . 5.2 Suppose 0 < k < n and suppose k is divisi-
well.
112 ,232
- + - = - and - - = -
12 . 2.6 x 2 — | + 4x > 2x .
false.
makes it false.
4.
13 . 2.7 (a) and (b) are true, and the others are
14 . 2.3
2 6
T T
T T
T T
5.
d) True: Any n.
17 . 1.4 3.
Remark 8.1.3.)
20 . 1.3 (a) and (c) are the same, and so are (b)
and (d).
tons.
positive integer n.
(b) and (c) are false. For example, (b) is false for
to = — 2 .
26 . 1.5 a) True: n = 6, for example (this is vacu-
possible.
27 . 2.1 (a), (c), (d) and (e) say the same thing,
244
=
a)
b)
c)
d)
N
N
e)
32.1.6
a: 4.
b: 0
. c
: 1. d:
2.
32.1.7
{0,{5},{6},
{7}, {5
',6}
,{6,
7}, {5
',7}, {5,6,7}}
32.1.8
cl
e
b
Y
N
N
N
N
g
N
33.2.2
{1,
2,3}
U {2,3,4,
5}
= {1,2,3
,4,5}
and
{1,2,3} n
{2,3
,4,5}
{2,3}
33.2.3
NU
Z = Z
and NflZ
= N
33.2.7
By
Definition 31.
1,
we :
must
show
that
if x € An B ,
then
GiU
B.
By
Definition
33.2
(of intersection), x
cAnB
implies
that
x £ A
and
x G AuB.
N — Z = 0.
to and n.
d) 2,9. e) 2, {1,2}. f) 4, Z.
true if 4 = 0.
sets C , . . . ”
37.9.1
(a) A
(b) 1,2
( 2 , 1 , 1 ), ( 2 , 1 , 2 ), ( 2 , 2 , 1 ), ( 2 , 2 , 2 )
(g) (1,1, 3), (1,1, 4), (1,1, 5), (1,2, 3), (1,2, 4), (1,2, 5),
(2, 1,3), (2, 1,4), (2, 1,5), (2, 2, 3), (2, 2, 4), (2, 2, 5)
(2, (1,5)), (2, (2, 3)), (2, (2, 4)), (2, (2, 5))
(i) (1,3), (1,4), (1,5), (2, 3), (2, 4), (2, 5), 1,2
(j) 0
37.9.2
4
5
N
Y
N
N
6
N
N
38.2.1 j(a:,n) | a: > ?rj C R x N.
R j C R x R
245
F(2) = {{2},{1,2},{2,3},{1,2,3}}.
41.1.8 F( 2) F(4)
a) 2 4
b) 42 42
c) 2 4
b) (2,2), (3,3)
c) (2,2), (3,3)
a + b R. x R. — y R.
c) ((2, 2), 4), ((2, 3), 5), ((3, 2), 5), ((3, 3), 6)
46.4.3 35 22 + 6 5 +*.
If x £ B U C , then either x £ B or x £C . If x £ B ,
that (A U B) U C C A U (B U C) . Therefore by
Method 21.2.1, A U (B U C) = (A U B) U C.
S, AU0 = 0UA = A.
51 . 1.5
b) (2, 2), (2, 4), (2, 6), (2, 8), (2, 10), (3, 3),
52 . 1.3
56 . 1.4 (b) and (c) are symmetric, (a) and (d) are
not.
59 . 1.3
ref
sym i
N
b
cl
Y
f
59 . 1.4
ref
sym
c
N
cl
N
N
concerning (d):
2 <
3 2 , 3 <
60 . 1.2
a: q -
= 0, r
= 2. b:
r = 0. d:
q = 3
, r =
1.
ant
trs
irr
Y
N
N N Y
N Y N
N N N
N N N
Y Y N
N Y N
N N N
2 2 , 8 < 3 2 .
g = 0, r = 0. c: q = 2,
246
ble by to.
too.
have.)
of type integer.
61 . 2.3 a: trunc(7/5) = floor(7/5)
= 1.
b: trunc(— 7/5) = — 1;
floor (— 7/5) =
= -2.
c: trunc(— 7) = floor (-
-7) = -7.
d: trunc(— 6.7) = — 6;
floor (— 6.7) =
-7.
62 . 2.2 30 = 2 1 x 3
1 x5 1 , 35 =
5 1 x7 1 , 36
2 2 x 3 2 , 37 = 37 1 , 38 =
= 2 1 x 19 1 .
62 . 3.2
prime 98 99
1369
3 0 2
0 1
7 2 0
0 0
0
37 0 0
0 1
62 . 5.1
90 =
2 1 x 3 2 x 5 1
91 =
7 1 x 13 1
92 =
2 2 x 23 1
93 =
3 1 x 31 1
94 =
2 1 x 47 1
95 =
5 1 x 19 1
96 =
2 5 x 3 1
97 =
97 1
98 =
2 1 x 7 2
99 =
3 2 x ll 1
63 . 2.2
PAIR
GCD
LCM
12, 12
12
12
12, 13
156
12, 14
84
12, 24
12
24
63 . 2.4
False:
for
GCD(2,2)
= 2. If
you said
n = d m b m -\ 1- dib 1 + dob 0
so
d) 1010111100.
68 . 4.1
247
DEC
OCT
HEX
BASE
36
BINARY
100
144
64
2s
1100100
111
157
6f
33
1101111
127
177
7f
3j
1111111
128
200
80
3k
10000000
P Q
PVQ =P
~^Q
—iP A —iQ
-1 ( _, P A —iQ)
T T
T F
F
T
F T
F F
T
F
71.2.9
P Q -
P V Q P => Q
_i Q PA-iQ -i(PA-.Q)
T T
F F
T F
F
F
T T
F T
F F
F F
T F
T
same.
74.2.1 Valid.
74.2.2 Valid.
74.2.3 Invalid.
Counterexample: 3.
and Q to be x <7 .
quence.
quence.
must be true.
claim is correct.
88.3.1 a b c
12
16
Impossible, since
12
16
4= 16-12.
26
30
2 = 7x 26-6 x 30.
26
30
4 = 14 x 26 - 12 x 30
26
30
-2 = 6 x 30 -7x 26.
51
100
1 = 25 x 100-49 x 51
248
inj?
surj?
image
a)
B
b)
{2,3}
c)
d)
e)
N
B
f)
{3}
g)
{TRUE, FALSE}
h )
i)
N
{4, 5, 6, 7, 8}
j)
{TRUE, FALSE}
inj?
surj?
image
a)
b)
Y
c)
{r € R r > 1}
d)
{r € R r < 2}
implication
in other words
7^ a'
A F(a) =
F(a’)
domain
R+
inj'
? surj?
inj?
surj?
a)
b)
c)
Y
N
c) Domain: {1,2,3}.
c) (1,4,9,16,25,36).
98.2.6
b) G° F : R — x R , (G° F)(x) = 2x 3 .
c) G° F : R — x R , (G°F)(x) = 8x 3 .
d) n t-x (n/2) : N — X R.
e) (i,|/)i->(3,i):RxR->RxR.
X I X Jx
R+ *-R +
graph {(3,1), (4, 2), (6, 3), (5, 4)}. For (f) it is n i-x
n — 1 : Z — x Z .
L°(G°F) = (L°G)°F = id A °F = F.
101.5.3
a) a; i— x y/x .
b) x i— x x + 1 .
c) xi->x/2.
n+l .. j n 1
^ jfe(jfe + l)
(n + l)(n + 2) 4-^fc(fc + l)
1 n
(n + l)(n + 2) n + l
1 + n(n + 2)
(n + 1) (n + 2)
n 2 + 2?r + 1
(n + 1) (n + 2)
(n + l) 2
(n + 1) (n + 2)
n + l
n + 2
as required.
k = 1
fe=l
= -(n + l) + -
= ^ (n — 2n — 2)
—n — 2
-(n + l + 1)
n+l n
E(-l)+ = (n + l) + E(-l) fe fc
k— 1 fc=l
. n + l
= n + l —
n + l
105 . 2.1 1! = 1, and (n + l)! = (n+l)n! which by
{n + mi^k = JT k t\k
as required.
Then
= fn+1 fn fnfn+1
fn + fn—lfn+1
110 . 4.3
EV.l The empty string A is a string in E .
ceding rules.
112 . 4.2
a) = {1,2, 3, 4, 5}, f+ = 0-
c) = (—1.. 3) — {1,2}, n^ = 0-
again as required.
p and m, so GCD(p,m) = 1.
2
3
a)
-3
-6
-18
-72
-360
b)
14
30
55
c)
d)
11
18
e)
1
2
44
114 . 3.1 2 n — 1 .
G(n) = 3” -2 .
104 . 4.2
105 . 1.3
250
115 . 2.3 (a) 2” — 1 . (b) n. (c) 2 ^ .
-\AnB\ + \znAnB\
Since
we have
b) 0 f {A) = 3.
c) Pp({n}) = n for n£ A.
/? f ({5}) = 55.
122 . 3.1 26 10 .
126 . 1.3
b) 0
1 R 2 3?
1 R 3 3?
3R 2 1?
Y
N
Y
127 . 2.1
C.l aU a op is symmetric.
C.2 a C aU a op .
a U a° p C 7 as required.
130 . 4.4 a) 1. b) 5. c) 1.
E ' :
E S/E
As U {(1, 2), (2, 1), (3,4), (4,3)} {{1,2}, {3, 4}, {5}}
A s U { (1, 2) , (2, 1) , (3, 5), (5, 3)} {{1,2}, {3, 5}, {4}}
As U {(1, 2), (2, 1), (4,5), (5,4)} {{1,2}, {3}, {4, 5}}
251
137 . 1.3
20
{1,2} {2,3}
10
25
/ \
/ 1
2 4
{1} {2}
2"
5
/
1 5
\ /
. /
(a)
(b)
(c)
(d)
137 . 1.4
Only (d).
139 . 1.5
01,
0101,
0111,
show
144 . 2.2
BCD
%/ \d
• ' a
(b)
3
(a) is:
G 0 = {A,B,C,D}
Gi = {(A,A),(B,A),(C,A),(D,A)}
148 . 1.3
1 2
3 ^4
148 . 1.4
Go = {1,2, 3, 4}
Gi. = {(1,2), (1,3), <1, 4), <2, 3), (2,4), (3,2), (3,4), (4,1)}
148 . 1.6
(left) a b c
a 0 1 1
6 10 1
c 0 0 0
(right) 12 3
10 11
2 10 1
3 0 0 0
ple.
unc C G.
DCBHC.
151 . 3.1
(a) 1 of length 1 , 1 of length 2 , 2 of length 3 , 2
of length 4 .
of length 4 .
a: 2 10 2 0 121
2/0400 001
^ 2 8 2 0
w 0 0 0 1
252
tite.
Bibliography
At the end of each entry, the pages on which that entry is cited are listed in
parentheses.
html. (117)
Hofstadter, D. (1979). Godel, Escher, Bach: An Eternal Golden Braid. Basic Books,
(vi, 159)
Knuth, D. E. (1971). The Art. of Computer Programming, Volume 2. Addison- Wesley.
Myerson, G. and A. J. van der Poorten (1995). “Some problems concerning recurrence
sequences”. American
Rosen, K. H. (1992). Elementary Number Theory and its Applications, Third Edition.
Addison- Wesley.
matical Monthly, volume 102, pages 397-408. Also available by web browser from URL:
http://www.
Sons. (35)
253
Index
The page number(s) in boldface indicate where the definition or basic explanation
of the word is found.
The other page numbers refer to examples and further information about the word.
1 -tuple, 51
abstract description
examples, 219
graph), 219
11
examples, 224
adjacent, 232
232
algorithm, 97
97, 98
AllFactors, 9
alphabet, 93 , 167
examples, 21
anonymous notation, 64
antecedent, 36
antisymmetric, 79
examples, 79
application, 57
argument, 57
arrow, 218
associative, 70 , 71
automorphism, 224
base, 94
examples, 99
162
biconditional, 40
examples, 136
binary operation, 67 , 69
binary relation
examples, 74
192
bit, 95
boldface, 4
calculus, 107
examples, 212
cardinality, 173
examples, 173
carry, 97, 98
Cartesian powers, 54
177
Cartesian square, 54
CartesianPoduct, 54
centered division, 87
character, 93
characteristic function, 65
examples, 65
characterize, 85
circuit, 236
examples, 183
closed interval, 31
closure, 197
codomain, 56 , 131
color, 241
coloring, 241
commutative, 71
examples, 71
examples, 145
complement, 48 , 108
examples, 67
233
composite, 10 , 140
examples, 10
examples, 195
composite integer, 10
composition, 195
Comprehension, 28
comprehension, 27 , 29
conclusion, 36
conditional sentence, 36
congruence, 200
connected, 236
cons, 165
consequent, 36 , 121
constant function, 63
constructive, 130
contain, 45
contradiction, 107
contrapositive, 42
254
255
converse, 42
examples, 42
coordinate, 49 , 143
coordinate function, 63 , 74
examples, 74
corollary, 1
decimal, 12 , 93
decimal expansion, 12
15
defining condition, 27
definition, 1, 4 , 25
examples, 15
degree, 233
DeMorgan law
dependent variable, 57
diagonal, 52 , 69
diameter, 237
digit, 14, 93
disjoint, 47
disjunction, 21 , 103
distance, 237
div, 82
divide, 4 , 6, 8, 207
examples, 4
divides
examples, 5
DividesQ, 9
division, 4 , 87
divisor, 5
domain, 56
edge, 230
empty function, 63
empty relation, 74
empty tuple, 51
examples, 200
Euclidean algorithm, 92
evaluation, 57
even, 5 , 200
examples, 5, 10
example, 1
existential bigamy, 9
exponent, 87
examples, 87
exponential notation, 54
strings, 168
expression, 16 , 105
examples, 138
55
examples, 28, 55
fact, 1
factor, 5 , 9
Factorlnteger, 88
factorization, 87
fallacy, 121
examples, 171
examples, 173
first coordinate, 49
floor, 86
examples, 86
floored division, 87
formula, 16
Forth, 69
fourtunate, 37
free variable, 32
full, 234
Function, 65
function as algorithm, 60
examples, 66
functional, 62
functional property, 62 , 75
functional relation, 75
functions in Mathematica, 58
Fundamental Theorem of
Arithmetic, 87 , 127
GCD, 91
graph, 230
examples, 138
greatest integer, 86
Hamiltonian circuit, 238
examples, 210
head, 164
hexadecimal, 95
hexadecimal notation, 95 , 97
hypothesis, 36
idempotent, 143
identifies, 205
256
identity, 72
examples, 72
tion), 72
identity (predicate), 19
examples, 20
72, 141
image, 131
examples, 131
incident, 232
207, 208
inclusion, 79
examples, 179
inclusive or, 22
indegree, 220
examples, 220
independent, 174
independent variable, 57
examples, 214
infinite, 174 , 182
infinity symbol, 12
infix notation, 68
examples, 211
injection, 134
input, 57
instance, 16
examples, 3
integer variable, 18
IntegerQ, 15
127 , 129
examples, 127-129
interpolative, 196
intersect
199, 217
178
intersection-closed, 199
interval, 31
examples, 31, 33
examples, 147
irreflexive, 81
examples, 81
isomorphic, 235
examples, 223
iterative, 157
join, 214
examples, 215
examples, 203
labeling, 221
lambda notation, 64
examples, 64
language, 169
lattice, 215
examples, 215
law, 19 , 39
106
LCM, 88, 90
LCM, 91
lemma, 2
length, 236
examples, 165
examples, 211
List, 69
examples, 165
list notation
examples, 26
list notation (for sets), 26 , 32
logical connective, 21 , 35
loop, 220
examples, 220
lowest terms, 11
examples, 11
mapping, 57
material conditional, 36
175
meet, 214
examples, 215
member, 25
method, 2
min, 70 , 215
Mod, 84
mod, 82 , 204
modulus of congruence, 201
moiety, 233
more significant, 94
examples, 94
multidigraph, 222
257
227
98
multiplication of rational
numbers, 11
multiplication table, 69
N, 15
NAND, 109
natural number, 3
near, 77
200
negation, 22 , 23
negative, 3
negative integer, 3
nonconstructive, 130
nonnegative, 3
nonnegative integer, 3
nontrivial subset, 45
NOR, 109
null tuple, 51 , 54
set, 173
examples, 173
octal notation, 94
odd, 5, 200
onto, 133
open interval, 31
open sentence, 16
opposite, 62 , 77 , 220
examples, 77
examples, 21
ordered triple, 50
ordering, 206
examples, 206-208
outdegree, 220
examples, 220
output, 57
P-closure, 197
palindrome, 169
parameter, 32
examples, 180-183
226
path, 236
permutation, 137
examples, 137
Perrin function, 161
examples, 189
planar, 239
Polish notation, 68
poset, 207
examples, 207
positive, 3
positive integer, 3
postfix notation, 68
power set
examples, 207
prefix notation, 68
preorder, 209
preordering, 209
Prime, 10, 58
examples, 10
prime factorization, 87, 92
examples, 87
PrimeQ, 10
Exclusion, 179
examples, 179
Principle of mathematical
induction, 152
Principle of Multiplication of
Choices, 175
156
terexample, 154
Product, 151
proof, 2, 4, 4
proper subset, 45
properly included, 44
Quotient, 84
184
examples, 184
examples, 204
rabbit, 160
radix, 94
range, 131
14, 15
addition, 11
multiplication, 11
representation, 11
reachable, 229
115
258
real variable, 18
realizations, 96
recurrence, 161
examples, 191
164, 170
reflexive, 77
examples, 77
relation on, 75
relatively prime, 89
examples, 89
184
examples, 184
remark, 2
representation, 15 , 96
number), 11
examples, 138
110
Russell’s Paradox, 35
second coordinate, 49
second coordinate function, 63
Select, 31
semicolons in Mathematica, 59
sentence, 15
set difference, 48
examples, 48
set of functions
examples, 140
examples, 27-29, 33
sets of numbers, 25
sex, 161
show, 2
significant figures, 12
simple, 231
single- valued, 61
singleton, 34
singleton set, 34
solution set, 28
161
sorting, 143
source, 218
specification, 2
statement, 19
examples, 206
string, 93 , 167
examples, 167
StringLength, 58
subdivision, 240
subgraph, 234
substitution, 17
Sum, 151
examples, 214
surjection, 133
examples, 78
Table, 27, 31
tail, 164
take, 57
target, 218
tautology, 105
examples, 106
terrible idea, 45
theorem, 2
examples, 208
total relation, 74
examples, 80
109
trichotomy, 208
trunc, 86, 86
examples, 86
truth table, 22
TruthTable, 23
140
turnstile, 24
29, 104
unary operation, 67
examples, 67
under, 57 , 132
unit interval, 29
unity, 72
Universal Generalization, 6
universal generalization, 6
Universal Instantiation, 7
universal instantiation, 7
universally true, 19 , 39
examples, 19, 20
259
examples, 212
usage, 2
vacuous, 37
vacuously true, 37
examples, 37
value, 56 , 57
variable, 8, 16, 17
vertices, 218
walk, 236
warning, 2
examples, 206
well-defined, 85
well-ordered, 154
witness, 113
Xor, 22
xor, 22
yields, 24
zero, 3-5, 33
260
Index of Symbols
23, 158
to | n 4
:= 59
(A, a) 207
to mod n 83
X 65
NOR 109
(a..b) 171
n! 158, 189
Xi 65
M 77
(x)F 68
n (mod k) 203
= 201
N+ 25
/ 5
PAQ 21
cons 165
o 140, 195
// 69
P <=>Q 40
A 69
C 45
0 4, 5
P => Q 36
52, 77
() 51, 225
pvg 21
div 82
102, 108
{a, b) 49
pop 62
1 4
A 48
(&i)i£ n 51
K 63, 74
n 180
(xi,...,x n ) 51
R n 184
4A 40, 109
n 205
A' 48
5/P 204
3 113
n?=i 150
A-B 48
w n 168
(3 x:Q)(x) 113
nLi 158
A/F 184
xF 68
e p 87
PA 46
A\B 48
x i-a f(x) 65
E n 205
V 46
A c 108
[a., b] 31
floor 86
Q 25
AcB 26
[a] 183
V 20, 26, 112
R 25, 52
AC B 43
[r] 86
B A 66
Rel(A,P) 74
AnB 47
r 6i
R+ 25
Ac B 45
[x] E 204
r(p). 6i
R++ 25
A(^B 44
[x] n 205
{x | P(x)} 27
Ax B 52
& 65
I 29
44
AuB 47
&& 21
kU 63
‘cat’ 93
flVfc 215
\A\ 173
rr=i 150
aAb 215
a 73
G 26, 80
EL i 158
A* 165, 211
a* 76
C 43
sup 213
A+ 165
cxf 76
oo 12
els 183
A c 48
a° p 195
n 47, 108
x 52
A n 54
A 211
-> 57
B A 188
a" 196
A x.f(x) 64
trunc 86
C(n,k) 190
197
A 51, 168
U 47
C b 63
a s 197
A 64
U 108
C r 182
a T 198
LCM 88
U 48, 108
F(a) 57
(Vx:Z)P(x) 26
\A\ 187
h 24
F-.A-+B 57
(Vx)P(x) 112
< 206
V 215
F~ l 147
(Vx)Q(x) 112
[rj 86
A 215
F* 133
< 206
Z 25
F~ l 132, 184
^ 65
max 70
Z/n 184
G° F 140
Pf 186
min 70
Z„ 182
i:A—>B 142
171
mod 82
{xi, — ,x n } 26
K(F) 203
mu ^ 171
N 25
| 27
m = n 201
IJJ 17 171
n 50, 173
II 21
to div n 83
Uti A i 171
NAND 109