Download as pdf or txt
Download as pdf or txt
You are on page 1of 182

Discrete Mathematics with Applications

to Computer Science
for csc318, Spring 2012
January 30, 2012
Jan Plaza
SUNY Plattsburgh
Computer Science Department
101 Broad Street
Plattsburgh, NY 12901
U.S.A.
jan.plaza@plattsburgh.edu
http://faculty.plattsburgh.edu/jan.plaza/
(518) 564-2781
COMMENTS WELCOME
c _2004-2010 Jan Plaza
Instructors who wish to use any part of these materials in their courses
must contact the author in order to obtain a free license.
I am dedicating this project to
Adam andAnna
Jan Plaza
Contents
Title page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
Dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
To the reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
1 Overview of basic notions 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Ordered tuples and Cartesian products . . . . . . . . . . . . . 11
1.4 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2 Sets 31
2.1 Notions of a set and membership . . . . . . . . . . . . . . . . 31
2.2 Axiom of pairing . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3 Equality of sets . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4 Finite sets and the sets of numbers . . . . . . . . . . . . . . . 34
2.5 Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.6 Separation schema . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.7 Union, intersection, dierence, complement . . . . . . . . . . . 41
2.8 Properties of set operations . . . . . . . . . . . . . . . . . . . . 44
2.9 Powersets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.10 Families of sets . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Basic denitions . . . . . . . . . . . . . . . . . . . . . . . . 52
Unions and intersections of families . . . . . . . . . . . . . 52
Families closed under unions and intersections . . . . . . . 54
2.11 Families ordered by inclusion . . . . . . . . . . . . . . . . . . 56
Hasse diagrams of families of sets . . . . . . . . . . . . . . 56
Comparable sets . . . . . . . . . . . . . . . . . . . . . . . . 56
Minimal, maximal, smallest and greatest sets . . . . . . . . 57
Smallest and greatest sets versus big unions and intersections 63
2.12 Ordered pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
2.13 Ordered tuples . . . . . . . . . . . . . . . . . . . . . . . . . . 66
2.14 Cartesian products . . . . . . . . . . . . . . . . . . . . . . . . 67
2.15 Cartesian products of n sets . . . . . . . . . . . . . . . . . . . 72
iii
3 Introduction to binary relations 73
3.1 Basic denitions . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.2 Important binary relations . . . . . . . . . . . . . . . . . . . . 75
3.3 Set operations on relations . . . . . . . . . . . . . . . . . . . . 78
3.4 Inverse relation . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.5 Relative product and composition . . . . . . . . . . . . . . . . 80
3.6 Powers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4 Functions 84
4.1 Basic denitions . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.2 One-to-one and onto functions . . . . . . . . . . . . . . . . . . 87
4.3 Restrictions and extensions . . . . . . . . . . . . . . . . . . . . 89
4.4 Important functions . . . . . . . . . . . . . . . . . . . . . . . . 90
4.5 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Function composition versus relation composition . . . . . 92
4.6 Inverse function . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.7 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.8 Mappings (Optional) . . . . . . . . . . . . . . . . . . . . . . . 96
5 Partitions and equivalence relations 98
5.1 Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.2 Reexivity, symmetry, transitivity . . . . . . . . . . . . . . . . 99
5.3 Equivalence relations versus partitions . . . . . . . . . . . . . 103
6 Closures of binary relations 109
6.1 Reexive closure (Optional) . . . . . . . . . . . . . . . . . . . 109
6.2 Transitive closure (Optional) . . . . . . . . . . . . . . . . . . . 110
7 Orders 113
7.1 Anti-reexivity and anti-symmetry . . . . . . . . . . . . . . . 113
7.2 Partial ordering . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.3 Hasse diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7.4 Connected relations . . . . . . . . . . . . . . . . . . . . . . . . 120
7.5 Linear ordering . . . . . . . . . . . . . . . . . . . . . . . . . . 121
7.6 Lexicographic and anti-lexicographic orders . . . . . . . . . . . 122
Ordering of X
1
X
2
. . . . . . . . . . . . . . . . . . . . . . 122
Ordering of X
n
. . . . . . . . . . . . . . . . . . . . . . . . . 125
Ordering of X

. . . . . . . . . . . . . . . . . . . . . . . . . 126
7.7 Maximal and greatest elements, upper bounds . . . . . . . . . 127
8 Introduction to combinatorics 131
8.1 Multiplication, addition and division principles . . . . . . . . . 131
8.2 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
8.3 Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
8.4 k-permutations . . . . . . . . . . . . . . . . . . . . . . . . . . 135
8.5 k-combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
9 Philosophy of mathematics and science 139
9.1 Structure of mathematics . . . . . . . . . . . . . . . . . . . . . 139
9.2 Developing mathematics . . . . . . . . . . . . . . . . . . . . . 144
10 Methodology of scientic research 147
10.1 Modelling (Optional) . . . . . . . . . . . . . . . . . . . . . . 147
10.2 Average seek time of a computer disc (Optional) . . . . . . . 152
A Summaries 162
A.1 Sets of numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 162
A.2 Equivalences and equalities useful in proofs . . . . . . . . . . 163
Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Binary relations . . . . . . . . . . . . . . . . . . . . . . . . 164
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Equivalence relations and partitions . . . . . . . . . . . . . 166
Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
A.3 English versus logic . . . . . . . . . . . . . . . . . . . . . . . . 167
A.4 Logical equivalences useful in proofs . . . . . . . . . . . . . . 170
Eliminating a connective or quantier . . . . . . . . . . . . 170
Simplifying a negation . . . . . . . . . . . . . . . . . . . . . 170
Other logical equivalences useful in proofs . . . . . . . . . . 171
A.5 Constructing proofs and counter-examples . . . . . . . . . . . 172
A.6 Reading mathematical symbols . . . . . . . . . . . . . . . . . 174
A.7 Greek alphabet . . . . . . . . . . . . . . . . . . . . . . . . . . 174
A.8 Arity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
To the reader
A customized, electronic version of this book is available at your instructors
web page. The electronic version is in the PDF format. It can be searched
for a given keyword and it contains hyperlink bookmarks and cross refer-
ences.
The book is under revision. As its sections are revised they will be up-
dated in the on-line version. We do not recommend printing out the entire
on-line version as some of its sections have not been yet revised.
While reading this book, when you encounter an exercise,
you should solve it, or at least make sure you know how to solve it,
before you read on. If you are not able to solve an exercise, re-read the
material leading to it, and make sure you have solved the preceding
exercises.
It will be useful for you to form a study group with your class-
mates. Study groups involving two or three persons are most eective.
Members of a study group should challenge each other to state deni-
tions, theorems and proofs from the material which is discussed in your
course. Inventing examples to illustrate various concepts and theorems
is another task for a study group. Yet more interesting is inventing
counter-examples which show that for some theorems no assumption
can be dropped or weakened.
Some items in this book are labelled as optional or extra credit.
You may read such items to expand your knowledge and understanding
of the subject, however, on the rst reading skip all the optional
and extra credit items, and read them only after you fully under-
stand the basic material.
A denition or theorem is often grouped together with examples or
explanatory notes. To understand the nuances of the denition or
theorem read the entire group more than once and make connections
between the details of the example or explanatory note, on one side,
and details of the denition or theorem, on the other side. To fully
understand a section you may need to read it several times.
The version of the book you are reading contains material selected by the
instructor of your course. If you are interested in learning about issues be-
yond your current course, you can nd the full version of this book at
http://faculty.plattsburgh.edu/jan.plaza/dm.pdf
Chapter 1
Overview of basic notions
Contents
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Ordered tuples and Cartesian products . . . . . . 11
1.4 Relations . . . . . . . . . . . . . . . . . . . . . . . . 17
1.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . 23
Introduction 1.1
1.1.1 Explanatory Note
This chapter presents an informal introduction to sets, ordered tuples, re-
lations, functions, sequences, and indexed families. These notions are used
in all branches of mathematics. In order to study mathematics, science or
engineering you need to understand the basic terminology related to these
notions. The chapter also introduces, so called, words and strings which are
used in some computer science considerations.
1.1.2 Explanatory Note
Objects of mathematics include:
numbers (such as 0, -23,
2
3
, 1.2,

2, , 2 3i),
points on a line, plane, or in a space,
straight lines, triangles, rectangles, cubes, spheres, etc.
In mathematics applied to computer science we use also other objects, in-
cluding:
characters (such as a, b, c, +, :).
1
If we need more characters than in the Latin alphabet or on the standard
computer keyboard, we introduce:
symbols (such as a
0
, a
1
, a
2
, ..., a
n
, for some non-negative integer n).
All such objects may be used as components of more complex objects.
1.1.3 Programming Remark (Optional)
In programming languages such as C++, Ada and Java, there are some pre-
dened types (such as int and float) but programmers may dene their
own types. An object constructed from other objects has a type dierent
from the types of the component objects. For instance, in a computer pro-
gram, it is possible to represent a triangle by specifying the three points
which serve as its vertices, and the triangle will be an object of a dierent
type than the points.
1.1.4 Explanatory Note
In 1908, Bertrand Russell proposed a hierarchy of types intended for classi-
cation of all mathematical objects. He further developed this idea together
with A. N. Whitehead in their famous Principia Mathematicae.
Although subsequent work has shown that foundations of mathematics
can be easier developed without considering explicit types, it is still useful
to informally distinguish types of mathematical objects. For instance, you
should think that numbers are of a dierent type than triangles, and the
function which assigns the area to a triangle is of a dierent type than either
numbers or triangles.
In our discussion, we will write type, using quotes in order to empha-
size that we have not dened this term formally.
1.1.5 Programming Remark (Optional)
While reading about sets, tuples, sequences, strings and indexed families
notice a partial analogy with container data structures.
Sets 1.2
1.2.1 Explanatory Note
1. Intuitively,
a set is a collection of arbitrary objects, where no object may have
multiple occurrences, and the order of the objects does not matter.
The word family is sometimes used instead of the word set; we can talk
about families of sets, families of functions, families of spaces, but for
collections of numbers or points one uses the term set, not family.
2. The objects in a set do not have to be homogenous (i.e. of the same
type) for instance, you could place numbers and triangles in the
same set. However, in most situations when sets are constructed, a set
will contain objects of the same type. For example, the following are
some typical sets used in mathematical considerations: the set of all the
right triangles on a given plane, and the set of all the real numbers which
satisfy a given inequality.
3. The objects in a set X are called members of X or elements of X .
4. When a set is formed, it constitutes a new object, and it may be used
as a member of another set. A member of a member of a set X is not
considered to be a member of X it would be wrong to say this book
is a set of chapters and every chapter is a set of sections, so this book is
a set of sections.
5. If x is a member of a set X we write x X ; otherwise we write x , X .
On rare occasions, instead of x X we write X x , and instead of
x , X we write X , x .
6. Aset which has n elements for some natural number n is called a nite set .
A set which is not nite is called an innite set .
7. Any nite set can be written by listing its elements; for instance, 5, 2, 7
denotes the set whose elements are exactly 5, 2 and 7. This notation is
practical only for sets with few elements. While using this notation, it is
legal to repeat elements, writing for instance 1, 2, 1, but this represents
the same set as 1, 2, and the later version is preferred.
8. The set in which x is the only member is denoted x and it is called
the singleton of x .
9. The set with no members is denoted or and it is called the empty set .
1.2.2 Example
In geometry, any segment on a plane may be represented as a set containing
the two endpoints. (If you need to use points which are between the end-
points you know how to nd them they do not need to be included in the
set representing the segment.)
Any triangle may be represented as a set containing the triangles three
vertices.
1.2.3 Explanatory Note
Sets X and Y are equal, denoted X = Y , if they contain exactly the same
elements: every element of X is also an element of Y , and vice versa.
1.2.4 Example
1. 1, 2=2, 1 because both sets have the same elements.
2. 1, 1=1 because both sets have the same elements.
3. 2,
4
6
=
4
2
,
2
3
because both sets have the same elements.
4. A set can be a member of another set.
,= because is a member of the set on the left hand side and it is
not a member of the set on the right hand side.
1.2.5 Explanatory Note
Let X and Y be sets.
1. We say that X is a subset of Y and write X Y if every element of
X is also an element of Y ; this means, X consists of some elements of Y ,
possibly of all elements of Y , possibly of no elements. Instead of X Y
we can write Y X and say that Y is a superset of X .
2. If X is not a subset of Y we write X _ Y . Instead of X _ Y we can
write Y _ X .
3. If X is a subset of Y but sets X and Y are not equal, we say that
X is a proper subset of Y and write X _ Y . Instead of X _ Y we
can write Y _ X and say that Y is a proper superset of X .
1.2.6 Example
1. 1, 3 0, 1, 2, 3.
1, 3 _ 0, 1, 2, 3.
These are illustrated by the following diagram.
1 3
0
2
2. 0, 1, 2, 3 0, 1, 2, 3.
It is not the case that 0, 1, 2, 3 _ 0, 1, 2, 3.
These facts are illustrated by the following diagram.
1 3
0
2
3. 1, 5 _ 0, 1, 2, 3.
It is not the case that 1, 5 _ 0, 1, 2, 3.
These facts are illustrated by the following diagram.
5 1 3
0
2
4. 0, 1, 2, 3, 5 _ 0, 1, 2, 3.
It is not the case that 0, 1, 2, 3, 5 _ 0, 1, 2, 3.
These facts are illustrated by the following diagram.
5 1 3
0
2
5. 4, 5 _ 0, 1, 2, 3.
It is not the case that 4, 5 _ 0, 1, 2, 3.
These facts are illustrated by the following diagram.
4 5 1 3
0
2
1.2.7 Fact
Let X be any set. Then:
1. X.
2. X X.
1.2.8 Exercise
List all the subsets of 1, 2, 3. Hint: There are eight such subsets.
1.2.9 Explanatory Note
to _ for sets is like to < for numbers.
We have: X X and x x
but not X _ X and not x < x.
1.2.10 Exercise
1. Disprove: For any X we have _ X.
2. Disprove: For any X, Y , at least one of the following holds:
X _ Y , Y _ X, X = Y .
3. Disprove: For any X, Y , at least one of the following holds: X Y ,
Y X
4. Disprove: For any X, Y , if X Y then X _ Y .
5. Disprove: For any X, Y , if X Y then Y _ X.
6. Disprove: For any X, Y , if X and Y do not have any elements in common
then X _ Y .
Hint: In order to disprove any of the statements above specify sets X and
Y which violate the condition in the statement. In particular, to disprove
for any X, Y if condition1 then condition2 specify X and Y such that
condition1 is true and condition2 is false.
1.2.11 Programming Remark (Optional)
There is an analogy between the notion of subset as understood in set theory
and the notion of subclass as understood in object oriented programming.
One can imagine a set V of motor vehicles, and its subsets C and B
where C is the set of all cars in V and B is the set of all motorbikes in V .
Object-oriented programming languages introduce a concept of inher-
itance. For instance, the class B of cars and the class C of motorbikes
can inherit from the class of motor vehicles V . (In such a case V is called
a superclass or a parent class and B and C are called subclasses or child
classes.) Members of classes are called objects. Objects are dened by values
of their member elds (i.e properties or attributes) and they are equipped
with methods (i.e. functions) which can be applied to them. An object in
a subclass typically has more member elds and more methods than the
objects in the superclass. In our example, the subclass of cars inherits from
its parent class of motor vehicles the member eld containing the engines
horsepower and also inherits a method for accessing such a value.
In set theory objects do not carry methods but it is obvious that
objects in a subset may have more properties and applicable methods than
objects in a superset; For instance the property of being odd or even applies
to all integers but not to all reals.
1.2.12 Denition
1. Z stands for the set of all integers.
2. Z
+
stands for the set of all positive integers.
3. N stands for the set of all natural numbers , i.e. the set of all non-
negative integers.
4. stands for the set of all rational numbers.
5. 1 stands for the set of all reals (i.e. real numbers).
6. C stands for the set of all complex numbers.
1.2.13 Explanatory Note
1. 1, 2, 3 Z
+
but 0, 1, 2, 3,
1
2
,

2, , Z
+
.
2. 0, 1, 2, 3 N but 1, 2, 3,
1
2
,

2, , N.
Every member of Z
+
is also a member of N.
3. 3, 2, 1, 0, 1, 2, 3 Z but
1
2
,

2, , Z.
Every member of N is also a member of Z.
4. consists of all the numbers which can be represented by fractions.
3, 2, 1, 0, 1, 2, 3,
1
2
but

2, , .
Every member of Z is also a member of .
5. Reals are all the numbers which can be written using decimals, with
possibly innitely many digits after the decimal point; they correspond
to all the points of a straight line (the real line).
3, 2, 1, 0, 1, 2, 3,
1
2
,

2, 1.
Every member of is also a member of 1.
6. Complex numbers are all the numbers which can be written as a+b

1
where a and b are reals; they correspond to all the points of a plane.
0 +

1 C but 0 +

1 , 1.
Every member x of 1 is also a member of C because x = x +0

1.
7. Z
+
_ N _ Z _ _ 1 _ C.
All these sets are innite.
Z
+
N
Z

1
C
1 2 3 ... 0 -1 ...
1
2
...

2 ... i ...
1.2.14 Explanatory Note
1. The letter Z used in the symbol Z for the set of all integers is the rst
letter of the word Zahl which means number in German.
2. The letter Q used in the symbol for the set of all rational numbers is
the rst letter of the word quotient. Notice that rational numbers can be
written as quotients of integers.
1.2.15 Explanatory Note
A number can be a positive integer, a natural number, an integer, a rational
number, a real number, a non-negative real number, a complex number, etc.
However, strictly speaking, there is no such a thing as a binary number.
The correct term should be binary representation of a number. A number
is an abstract entity, which can be represented in a variety of ways. Every
number, whether an integer, rational, real or complex can be represented in
the binary (i.e. base two) system and in decimal (i.e. base ten) system. 11
in base 2 represents is the same number as 3 in base 10.
1.2.16 Explanatory Note
Let X be a set and p(x) be a condition. The set of those elements x from
X for which p(x) is true, is denoted x X : p(x) .
This is read the set of elements x from X such that P(x) or
the set of elements x from X such that x has property P or
the set of those elements x from X that P(x) or
the set of those elements x from X for which P is true.
1.2.17 Example
x Z :
kZ
x = 2k Z, i.e.
x Z : there exists an integer k such that x = 2k Z, i.e.
the set of even integers is a subset of the set of integers.
1.2.18 Fact
Let X be any set and let p be any property. Then:
1. x X : p(x) X.
2. x X : = X.
3. x X : = .
( stands for true; stands for false)
1.2.19 Exercise
Write the following sets listing explicitly all their elements.
1. k N : k < 2
2. k N : k < 1
3. k N : k < 0
1.2.20 Exercise
Write the following sets listing explicitly all their elements.
1. k Z : 3 k 4
2. k Z : 3 k 3
3. k Z : 3 k 2
Notice that m k n means m k and k n.
1.2.21 Denition
Let m, n be arbitrary integers. We dene m..n to be the set
k Z : m k n.
1.2.22 Explanatory Note
The notation m..n is not commonly used in mathematics, however it is
common in programming languages.
1.2.23 Exercise
Write the six sets from the last two exercises using the notation m..n.
1.2.24 Explanatory Note
Let X, Y be any sets.
1. By the union of X and Y we understand the set which contains all
members of X and all members of Y but no other members. The union
of X and Y is denoted X Y .
The union of two sets can be visualized as consisting of the points in the
three checked areas of the diagram below.
X Y

We can write X Y = z : z X or z Y .
For instance, 1, 2 2, 3 = 1, 2, 3.
2. By the intersection of X and Y we understand the set which contains
exactly those elements which belong to both X and Y . The intersection
of X and Y is denoted by X Y .
The intersection of two sets can be visualized as follows.
X Y
X Y
We can write X Y = z : z X and z Y .
For instance, 1, 2 2, 3 = 2.
3. By the dierence of X and Y we understand the set which contains
exactly those elements which belong to X but do not belong to Y . The
dierence of X and Y is denoted by X Y .
The dierence of sets can be visualized as follows.
X Y
X Y
We can write X Y = z : z X and z , Y .
For instance, 1, 2 2, 3 = 1 and 2, 3 1, 2 = 3.
4. Assume that X U. By the complement of X with respect to U we
understand the set which contains exactly those elements which belong
to U but do not belong to X. Assuming that the set U is known from
the context, the complement of X with respect to U is denoted by X .
The complement of a set can be visualized as follows.
U
X X
We can write X = U X = u : u U and u , X.
For instance the complement of with respect to 1 is the set of all
irrational numbers.
1.2.25 Programming Remark (Optional)
1. A nite set of strings can be implemented as a dynamic hash table: a
string belongs to the set i it is a key in the hash table. (To form
sets of other objects, associate with each object a distinct string.) In the
implementation of sets as dynamic hash tables, the operations of inserting
an element, deleting an element, and checking if an element is in the set
can be performed eciently. Also, union, intersection and dierence of
sets can be computed eciently.
2. Let N be a non-negative integer. Subsets of the set
U = n N : n < N can be implemented as bit vectors of length
N. For any A U, n A i the n-th bit in the corresponding bit
vector is 1. For instance, with N = 8 we can represent any subset of
0, 1, 2, 3, 4, 5, 6, 7 as a bit vector of length 8; the set 0, 2 being repre-
sented as 10100000. C and C++ programming languages are equipped
with bitwise Boolean operations which can be used to compute unions,
intersections and complements of sets implemented in this way.
Ordered tuples and Cartesian products 1.3
1.3.1 Explanatory Note
1. Intuitively,
by an (ordered) tuple we understand a sequential arrangement of
a nite number of arbitrary objects, in which the order matters, and
in which the same object may occur at dierent positions.
As indicated by parentheses, instead of an ordered tuple we can just
say a tuple .
2. A tuple of length n is also called an n-tuple . An n-tuple t consists of
the 1
st
component of t , the 2
nd
component of t , ...,
the n
th
component of t .
3. The n-tuple with consecutive components x
1
, x
2
, ..., x
n
is denoted
x
1
, ..., x
n
) .
4. The objects in a tuple do not have to be homogenous (i.e. of the same
type) for instance, you can place numbers and triangles in the same
tuple.
5. Two n-tuples are equal i their corresponding components are equal:
x
1
, x
2
) = y
1
, y
2
) i x
1
= y
1
and x
2
= y
2
,
x
1
, x
2
, x
3
) = y
1
, y
2
, y
3
) i x
1
= y
1
, x
2
= y
2
and x
3
= y
3
,
etc.
1.3.2 Example
1, 5, 1, 3),=1, 1, 3, 5) because 2
nd
components are dierent.
This is in contrast with sets, where 1, 5, 1, 3=1, 1, 3, 5=1, 3, 5.
1.3.3 Explanatory Note
For tuples, x
1
, x
2
) = y
1
, y
2
) i x
1
= y
1
and x
2
= y
2
.
For sets, x
1
, x
2
= y
1
, y
2
i
(x
1
= y
1
and x
2
= y
2
) or (x
1
= y
2
and x
2
= y
1
).
1.3.4 Denition
A 2-tuple is also called an ordered pair .
A 3-tuple is also called a triple .
A 4-tuple is also called a quadruple .
A 5-tuple is also called a quintuple .
A 6-tuple is also called a sextuple .
A 7-tuple is also called a septuple .
An 8-tuple is also called an octuple .
1.3.5 Explanatory Note
1. The word tuple comes from the suxes of the words quintuple, sex-
tuple, septuple and octuple.
2. While referring to an ordered pair a, b) you should not omit the adjective
ordered because the word pair, alone, is sometimes used to refer to
a two-element set such as a, b.
1.3.6 Example
1. Points on a plane can be represented as ordered pairs of real numbers.
5
3
5, 3)
Points in a three-dimensional space can be represented as ordered
triples of real numbers.
Any circle on a plane can be represented as an ordered pair c, r) where c
is the point which is the center of the circle and r is the number being its
radius. Another representation of a circle on a plane is a triple x, y, r)
where x and y are the coordinates of the center and r is the radius.
2. Sometimes it is useful to think of a tuple as a row in a table.
For instance, this is the case with tuples whose consecutive components
are: customer name, account number, account balance. Such tuples can
become rows in a table.
Name Account Balance
Tom Smith A232323 145.30
Jane Brown A456711 2340.88
1.3.7 Programming Remark (Optional)
If all the components of a tuple are the same type, the tuple can be
implemented using an array. If components of an n-tuple are not of the
same type, it can be implemented as a record with n elds (or an object
of a class with n member elds and with appropriate methods for accessing
these elds).
1.3.8 Programming Remark (Optional)
In computer science, a multiset or a bag is a collection of arbitrary ob-
jects, where objects may have multiple occurrences, and the order of the
objects does not matter. If an object x has one or more occurrences in a mul-
tiset X we say that x is a member of X and write x X . Two multisets
are equal if for any object they contain the same numbers of occurrences of
this object. For multisets X and Y , we dene X is a submultiset of Y if
for any object, the number of occurrences of this object in X is not bigger
than the number of its occurrences in Y .
The notion of a multiset is a generalization of the notion of a set: any
set is considered a multiset in which its every member has one occurrence.
Assume that for any x the number of occurrences of x in a multiset
X is n
x
; then, in mathematics, the multiset X can be represented as the
following set of ordered pairs: x, n
x
) : x X. In programming, this
multiset can be implemented as a hash table in which x is a key and n
x
is
the corresponding value.
1.3.9 Denition
1. Let X and Y be sets. We dene the Cartesian product of X and Y
to be the set containing all the ordered pairs x, y) where x X and
y Y . The Cartesian product of X and Y is denoted by X Y .
2. By the Cartesian plane we understand 1 1.
1.3.10 Explanatory Note
The Cartesian plane is a plane with a Cartesian coordinate system.
y
x
5
3
5, 3)
Traditionally, the horizontal axis of the coordinate systemis called the x-axis ,
and the vertical one is called the y-axis . Also, the rst component of
an ordered pair representing a point a is called the x-coordinate of a and
the second component is called the y-coordinate of a . The line which
consists of points whose x-coordinate is the same as the y-coordinate is
called the main diagonal of the coordinate system ; in the diagram above
it is shown as a dotted line.
1.3.11 Exercise
Label the eight points in the following diagram with their coordinates.
y
x
1
1
1.3.12 Explanatory Note
If X, Y are sets of real numbers, the Cartesian product of X Y can be
visualized using the graph of X Y on the Cartesian plane .
Here are some examples.
1. Let X = 1, 4, 5 and Y = 1, 3.
X Y = 1, 4, 5 1, 3 = 1, 1), 1, 3), 4, 1), 4, 3), 5, 1), 5, 3).
This can be visualized using a graph of X Y on the Cartesian plane,
as follows.
0
1
2
3
0 1 2 3 4 5
Note that the values of rst components of the pairs are required to be
found on the horizontal axis and the values of second components on
the vertical axis.
2. The segment on the number line with endpoints a, b (which includes a
and b and all the points between them) is denoted by [a, b]. With this
notation, [5, 6][1, 3] is a rectangle with vertices 5, 1), 5, 3), 6, 3), 6, 1)
on the Cartesian plane.
0
1
2
3
0 1 2 3 4 5 6
3. [5, 6] 1, 3 consists of the points belonging to two segments on the
Cartesian plane.
0
1
2
3
0 1 2 3 4 5 6
1.3.13 Explanatory Note
If X, Y are nite sets, the Cartesian product of X Y can be visualized
using a discrete Cartesian diagram of X Y .
Here are some examples.
1. Let X = 1, 4, 5 and Y = 1, 3.
X Y = 1, 4, 5 1, 3 = 1, 1), 1, 3), 4, 1), 4, 3), 5, 1), 5, 3).
This can be visualized using a discrete Cartesian diagram of X Y , as
follows.
1
3
1 4 5
The values of rst components of the pairs are required to be listed in
a row below or above the main part of the diagram and the values of
second components in a column to the left or the right of the main
part of the diagram.
In discrete Cartesian diagrams the order in which the rst components
are listed is arbitrary, and the same about the order of the second com-
ponents. So, the diagram above could be rearranged as follows.
3
1
4 5 1
However, if there are conventional linear orders on the sets X, Y then in
a discrete Cartesian diagram for X Y we prefer to list rst and second
components in these orders.
2. We are going to use discrete Cartesian diagrams to visualize Cartesian
products of also those sets which contain elements other than numbers
and such that there is no conventional linear order of elements. For
instance, think of a set X of particular three people. Assume that ev-
erybody writes a note to everybody else and also everybody writes a
(reminder) note for himself/herself. Now, the notes can be visualized as
dots in a discrete Cartesian diagram for X X.
1.3.14 Exercise
Assume that X, Y below represent sets.
1. If X has m members and Y has n members, how many members are
there in X Y ?
2. What is X ?
3. Disprove: For any X, Y , we have X Y = Y X.
4. Disprove: For any X, Y , we have X Y ,= Y X.
Hint: In order to disprove for any X, Y , condition C holds specify sets X
and Y which violate C.
Relations 1.4
1.4.1 Explanatory Note
1. Let n be a non-negative integer. Let X be a set. Intuitively,
an n-argument relation over X associates with every tuple
x
1
, ..., x
n
) of elements from X either the value true or the value false.
2. If a relation R associates value true with x
1
, ..., x
n
) we say that
x
1
, ..., x
n
satisfy R or x
1
, ..., x
n
fulll R or x
1
, ..., x
n
obey R and we
write R(x
1
, ..., x
n
) .
3. In the case of 2-argument relation, if x
1
, x
2
satisfy R we can use the
inx notation x
1
Rx
2
instead of the prex notation R(x
1
, x
2
). (The inx
notation is preferred.)
4. A 1-argument relation over X can be also called a property over X .
In the case of 1-argument relation, we can write x R instead of R(x).
1.4.2 Explanatory Note
Let X be a set. By the equality on X we understand the two-argument
relation which with any x
1
, x
2
from X associates value true i x
1
and x
2
are
one and the same object.
1.4.3 Example
1. Let us dene a 3-argument relation over Z: R(x, y, z) i x + y = x z.
We have R(1, 2, 3) but not R(3, 2, 1).
2. The following table denes a 3-argument relation bank over the set of all
strings.
Name Account Balance
Tom Smith A232323 145.30
Jane Brown A456711 2340.88
bank(Tom Smith, A232323, 145.30)
and bank(Jane Brown, A456711, 2340.88) are true,
however bank(Peter Jones, A456711, 145.30) and
bank(Jane Brown, A456711, 200.00) are not true because such rows
are not present in the table.
1.4.4 Example
Let us dene a 1-argument relation (i.e. a property) even over Z:
even(n) i there exists an integer k such that n = 2k.
The number 30 has this property even(30), because 30 = 2 15.
The number 31 does not have this property even(31) does not hold,
because there is no integer k such that 31 = 2k.
This relation can be represented by the set of all the even integers. You
may think of this property as actually being this set, and you may write
30 even and 31 , even.
1.4.5 Explanatory Note
A 0-argument relation does not take any arguments but has a truth value.
So, there are just two such relations: one which has value true and another
which has value false. These relations are seldom used but we mention them
for completeness of the discussion.
1.4.6 Explanatory Note
1. + is not a 2-argument relation over 1 because given two numeric argu-
ments + associates with them a number, not a truth value.
1.4.7 Example
1. The rule with any real numbers x
1
, x
2
associate the value true i x
1
is
greater than x
2
denes a 2-argument relation over 1; it is called the
greater-than relation on 1 and it is denoted >. Traditionally, we use
the inx notation, x
1
> x
2
, rather than the prex notation, >(x
1
, x
2
).
For this relation, the graph on the Cartesian plane is the half-plane
below the main diagonal, without the edge.
x
1
x
2
@@@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@@@
2. The rule with any x
1
, x
2
associate value true i x
1
is greater than x
2

does not dene a relation until you state what universe x


1
, x
2
are in.
If x
1
, x
2
are allowed to be real numbers, this rule denes the greater-than
relation on real numbers. If x
1
, x
2
are only allowed to be integers, this
rule denes the greater-than relation on integers. Such two relations are
considered to be dierent.
1.4.8 Example
Consider the 2-argument relation greater-than on 2, 0, 5. This exam-
ple introduces several important types of diagrams which allow to visualize
relations.
1. To dene an n-argument relation over X, instead of listing all possible
tuples of n elements from X together with the associated truth values, it
is enough to list only those for which the associated value is true, and it
will be understood that for the remaining tuples the associated value is
false.
Our relation can relation greater-than on 2, 0, 5 can be dened by
means of the following table (in which x
1
is grater than x
2
). (The order
of the rows in the table does not matter.)
x
1
x
2
0 2
5 2
5 0
This relation can be visualized in a discrete Cartesian diagram , as
follows.
-2
0
5
-2 0 5
x
2
_

_
. .
x
1
The diagram shows all the ordered pairs of the Cartesian product
2, 0, 5 2, 0, 5. Black dots represent ordered pairs which satisfy
the relation.
As mentioned before, in a Cartesian diagram for X Y , the orders in
which we list elements of sets X and Y are arbitrary, so the same relation
could be also visualized as follows, although the previous version of the
discrete Cartesian diagram is preferred.
-2
0
5
5 -2 0
x
2
_

_
. .
x
1
2. Another way to visualize this relation is by using a generalized directed
graph. The graph has vertices labelled -2, 0, 5 and there is a directed
edge (i.e. an arrow) from node a to node b exactly when a > b.
-2 5
0
3. A yet dierent way to visualize this relation is given by the following
elements maps diagram . Such a diagram shows two copies of the
set 2, 0, 5 and shows for every element how the element is mapped by
the relation.
-2
0
5
-2
0
5
We are allowed to drop from the diagram those set elements which are
neither beginnings or ends of the arrows:
0
5
-2
0
1.4.9 Explanatory Note (On visualizing relations)
1. A table.
This applies to any relation.
You can think of any relation as a table, similar to the bank table above,
but possibly with innitely many rows if the relation is over an innite
set. The order of rows in such a table does not matter, so in fact we
treat the table as a set of tuples. (In fact, an n-argument relation can be
dened formally as a set of n-tuples.)
2. A subset of the Cartesian plane.
This applies to any 2-argument relation over 1.
You can think of any 2-argument relation over 1 as a subset of the Carte-
sian plane: Any subset of the Cartesian plane is a graph of a 2-argument
relation over 1 and vice versa.
3. A subset of a discrete Cartesian diagram.
This applies to any 2-argument relation over a nite set.
You can think of any 2-argument relation over a nite set X as a subset
of the discrete Cartesian diagram X X: Any subset of the Cartesian
product XX is a graph of a 2-argument relation over X and vice versa.
4. A generalized directed graph.
This applies to any 2-argument relation over a nite set.
You can think of any 2-argument relation R over a nite set X as a
generalized directed graph. The vertices of the graph are labelled by the
elements of X. There is a directed edge from a vertex x to a vertex y
exactly when xRy. (If a particular element x is related to itself, xRx, in
the graph there will be a loop-like edge from x to x.)
5. Elements maps diagram.
This applies to any 2-argument relation over a nite set.
6. A set.
This applies to any 1-argument relation.
You can think of any 1-argument relation as a property, i.e as a set of
objects which have this property.
1.4.10 Exercise
Consider the smaller-than-or-equal relation on the set 1, 2, 3, 4.
1. List in a table the tuples which satisfy this relation.
2. Show this relation in a discrete Cartesian diagram.
3. Show this relation as a generalized directed graph.
Hint: As 1 1, the graph will involve a loop-like edge from 1 to 1.
1.4.11 Exercise
Andrew and Betty have a son, Charlie. Diana is Charlies wife. Charlie and
Diana have two children: Elizabeth and Frank.
1. List in a table the tuples which satisfy the parent-child relation.
2. Show this relation in a discrete Cartesian diagram.
3. Show this relation as a generalized directed graph.
1.4.12 Programming Remark (Optional)
In relational databases, data is stored in tables, i.e. in relations. Relations
such as the relation bank in the example above, (involving customer name,
account number and balance), can be implemented as les of records. To
allow ecient searches, the le can be indexed by self-balancing trees (such
as B
+
-trees). Ecient implementations of searches and other operations on
relations are important for relational database management systems.
1.4.13 Programming Remark (Optional)
In programming, relations are often implemented as Boolean values func-
tions. Such an implementation does not allow for an ecient computation
of y : xRy for a given x.
If a relation is implemented as a hash table in which for every key x
the corresponding value is a list of all y such that xRy, then computing
y : xRy for any given x is ecient. (This implementation is used often
for graphs, where for every node x we want to eciently access the nodes
which can be reached from x in one step.
Functions 1.5
1.5.1 Explanatory Note
1. Let n be a non-negative integer. Let X, Y be sets. Intuitively,
an n-argument function on X with values in Y associates with ev-
ery tuple x
1
, ..., x
n
) of elements from X exactly one member of Y .
2. We use the notation f(x
1
, ..., x
n
) to represent the unique value the
function f associates with x
1
, ..., x
n
. We say that f maps the tuple
x
1
, ..., x
n
) to the value f(x
1
, ..., x
n
).
3. Let f be a function on X. The set x, f(x)) : x X is called
the graph of f .
1.5.2 Explanatory Note
1. Notice that, according to the denition, f is a function on X with values
in Y if and only if
for every x from X, f maps x to a value in Y , and
for every x from X, f maps x to only one value.
2. Vertical line tests on the Cartesian plane.
Let G be a subset of the Cartesian plane.
G is the graph of a function on 1 with values in 1 i every straight line
parallel to the y axis intersects G in exactly one point.
G is the graph of a function on a subset of 1 with values in 1 i every
straight line parallel to the y axis intersects G in at most one point.
3. Vertical line tests in discrete Cartesian diagrams.
Let G be a subset of X Y in a discrete Cartesian diagram.
G is the graph of a function on X with values in Y i every column in
the diagram contains exactly one point of G.
G is the graph of a function on a subset of X with values in Y i every
column in the diagram contains at most one point of G.
1.5.3 Example
1. The following is (a fragment of) the graph of a function on 1 with values
in 1.
x
2. The relation with the following graph is not a function on 1 because 0 is
not mapped to any value it fails the vertical line test in which we use
the y-axis as the vertical line. The relation with this graph is however a
function on x 1 : x,=0.
x
3. The relation with the following graph is not a function on 1 because
certain values of x are mapped to more than one value.
x
The dotted line shows how the vertical line test can be applied.
4. In the following, the diagram on the left is not a graph of a function
because a certain value of x is mapped to more than one value. The
diagram on the right is (a fragment of) the graph of a function on 1 with
values in 1.
x x
The dotted line shows how the vertical line test can be applied.
1.5.4 Exercise
Consider the formula y =

x. (Recall that for x = 9 we have just y = 3.


The number 3 is not a square root of 9 because square root is required
to be non-negative; the word root in the phrase square root of a real
number has a dierent meaning than in a root of an algebraic equation,
indeed 3 and 3 are both roots of y
2
= 9.)
1. Does this formula dene a function on 1 with values in 1? If not, explain
why.
2. Does this formula dene a function on u 1 : u 0 with values in 1?
If not, explain why.
3. Does this formula dene a function on u 1 : u 0 with values in ?
If not, explain why.
4. Does this formula dene a function on u 1 : u 0 with values in
u 1 : u 0? If not, explain why.
1.5.5 Example
1. The following table denes a function on 1, 0, 1 with values in the set
of integers.
x f(x)
1 1
0 0
1 1
This table can be turned into the following elements maps diagram.
(Such a diagram shows for every element how the element is mapped by
the function.)
-1
0
1
.
.
.
0
1
The following is a discrete Cartesian diagram showing the same function.
-1
0
1
-1 0 1
. .
x
This function could be described as the function on 1, 0, 1, given
by the formula f(x) = x
2
. It could be also described as a function on
1, 0, 1, given by the formula f(x) = x
4
.
2. The following table does not dene a function because the value associ-
ated with 1 is not unique.
x
1 0
0 1
1 2
The table can be turned into the following elements maps diagram
0
1
0
1
2
This diagram does not represent a function because there are two arrows
starting at 1.
For another view, let us use the following discrete Cartesian diagram.
0
1
2
0 1
. .
x
The diagram does not represent a function because it fails the vertical
line test: the column for x = 1 contains two black dots.
3. Of the following tables only the one on the left denes a 2-argument
function on 3, 4. The table in the middle fails to assign a value to
x
1
= 4, x
2
= 4. The table on the right, assigns more than one value to
x
1
= 4, x
2
= 4.
x
1
x
2
f(x
1
, x
2
)
3 3 5
3 4 7
4 3 3
4 4 0
x
1
x
2
3 3 5
3 4 7
4 3 3
x
1
x
2
3 3 5
3 4 7
4 3 3
4 4 0
4 4 2
1.5.6 Explanatory Note
You should think of any function in a way similar to those presented in the
example above.
1. You may think of any function as a table, similar to those above, but
with innitely many rows if the function is on an innite set.
2. You may think of a function on 1 with values in 1 as a subset of the
Cartesian plane which passes the vertical line test.
3. You may think of a function on a nite set X with values in Y as a subset
of XY in a discrete Cartesian diagram which which passes the vertical
line test.
4. You may think of any function on X with values in Y as an elements
maps diagram in which every element of X is mapped to one and only
one element of Y .
1.5.7 Example
1. The rule with any two real numbers associate their sum denes a 2-
argument function on 1; it is called the addition function (or operation)
on 1 and it is denoted +. Traditionally, the value of this function for
arguments x
1
, x
2
is written using the inx notation, x
1
+x
2
, not the prex
notation, +(x
1
, x
2
).
2. The rule with any x
1
, x
2
associate their sum x
1
+x
2
does not dene a
function until you state what set x
1
, x
2
are in.
If x
1
, x
2
are allowed to be real numbers, this rule denes the addition
function on reals. If x
1
, x
2
are only allowed to be integers, this rule denes
the addition function on integers. Such two functions are considered to
be dierent.
3. Consider the rule: with any rational number
m
n
, associate the num-
ber m + n. This rule does not dene a function because it associates
more than one value with 0.5: the symbols 0.5,
1
2
,
2
4
represent the same
number, yet the rule assigns 3 to
1
2
while it assigns 6 to
2
4
.
4. Consider the rule: with any real numbers x
1
, x
2
associate their quotient
x
1
/x
2
. This rule does not dene a function on 1 because it fails to
assign a value to x
1
= 1, x
2
= 0.
5. The rule with any positive real numbers x
1
, x
2
associate their quotient
x
1
/x
2
denes a 2-argument function on the set of positive real numbers.
1.5.8 Denition
Let f be a 1-argument function on X. Let X
0
X.
By the restriction of f to X
0
we understand the unique 1-argument func-
tion f
0
on X
0
such that for every x X
0
, f
0
(x) = f(x).
1.5.9 Example
1. In the following diagram the entire sloped line (both dotted and solid
parts) is a graph of a function f on 1 with values in 1. The solid part
of that line is the graph of f
0
which is the restriction of f to the interval
[x
1
, x
2
].
x
x
1
x
2

2. Consider the following function on 2, 1, 0, 1, 2:


x f(x)
2 2
1 1
0 0
1 1
2 2
Here is its restriction to 1, 0, 1:
x f
0
(x)
1 1
0 0
1 1
Here is the original function f graphed in a discrete Cartesian diagram:
0
1
2
-2 -1 0 1 2
. .
x
And here is f
0
, the restriction of f to 1, 0, 1:
0
1
2
-1 0 1
. .
x
1.5.10 Exercise
Show in separate discrete Cartesian diagrams all two-argument relations
over 0, 1. Find among the graphs the familiar relations <, >, , , =, ,=
over 0, 1, and label them as such. Find among the graphs all those which
are graphs of functions on 0, 1, and label them as such. Hint: There are
16 two-argument relations over 0, 1; Four of them are functions on 0, 1.
1.5.11 Programming Remark (Optional)
1. To implement a 1-argument function f on i N : i < n declare an
array indexed by i N : i < n and store f(i) at the place i in the
array.
2. A 1-argument function on a set of strings can be implemented as table
(more specically, as a hash table).
1.5.12 Programming Remark (Optional)
In object-oriented programming, an accessor method returns a value of a
(private) member eld in an object. So, in mathematical terms, an accessor
method can be thought of as a function on the set of all objects of a particular
type.
Chapter 2
Sets
Contents
2.1 Notions of a set and membership . . . . . . . . . 31
2.2 Axiom of pairing . . . . . . . . . . . . . . . . . . . 32
2.3 Equality of sets . . . . . . . . . . . . . . . . . . . . 33
2.4 Finite sets and the sets of numbers . . . . . . . . 34
2.5 Subsets . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.6 Separation schema . . . . . . . . . . . . . . . . . . 39
2.7 Union, intersection, dierence, complement . . . 41
2.8 Properties of set operations . . . . . . . . . . . . . 44
2.9 Powersets . . . . . . . . . . . . . . . . . . . . . . . . 49
2.10 Families of sets . . . . . . . . . . . . . . . . . . . . 52
Basic denitions . . . . . . . . . . . . . . . . . . . . . . 52
Unions and intersections of families . . . . . . . . . . . 52
Families closed under unions and intersections . . . . . 54
2.11 Families ordered by inclusion . . . . . . . . . . . 56
Hasse diagrams of families of sets . . . . . . . . . . . . 56
Comparable sets . . . . . . . . . . . . . . . . . . . . . . 56
Minimal, maximal, smallest and greatest sets . . . . . . 57
Smallest and greatest sets versus big unions and inter-
sections . . . . . . . . . . . . . . . . . . . . . . . . 63
2.12 Ordered pairs . . . . . . . . . . . . . . . . . . . . 64
2.13 Ordered tuples . . . . . . . . . . . . . . . . . . . . 66
2.14 Cartesian products . . . . . . . . . . . . . . . . . 67
2.15 Cartesian products of n sets . . . . . . . . . . . . 72
Notions of a set and membership 2.1
31
2.1.1 Explanatory Note
The notions of a set and membership are primitive. They are not introduced
by denitions; instead, their properties are known from axioms. (Notice
that saying that a set is a collection is not a formal denition, because
the notion of collection is vague what a collection is, neither has been
dened, nor properties of collections have been described in axioms.)
2.1.2 Primitive Notion
We take as a primitive notion a binary construct . For any object X and
any set Y we can write X Y ; depending on X and Y this formula is either
true or false.
2.1.3 Denition
1. is called the membership relation .
2. We say that X is a member of Y or X is an element of Y
or X is in Y or X belongs to Y or Y contains X if X Y .
3. We write X , Y if it is not the case that X Y .
2.1.4 Convention
1. In a less formal notation,
X, Y Z means that X Z and Y Z;
V, X, Y Z means that V Z, X Z and Y Z,
etc.
2. In a less formal notation,
X, Y , Z means that X , Z and Y , Z;
V, X, Y , Z means that V , Z, X , Z and Y , Z,
etc.
3. In a less formal notation,
X Y Z means that X Y and Y Z;
V X Y Z means that V X, X Y and Y Z,
etc.
2.1.5 Exercise
Show that X, Y , Z is not equivalent to the negation of X, Y Z.
Axiom of pairing 2.2
2.2.1 Explanatory Note
Logical axioms (i.e. axioms of the rst-order predicate logic) imply that the
universe is non-empty:
x
or
x
x = x, so there exists an object.
2.2.2 Axiom (of Pairing)

x
1
,x
2

Y

y
y Y y = x
1
y = x
2
2.2.3 Explanatory Note
1. The Axiom of Pairing says that for all objects x
1
, x
2
there exists a set Y
containing exactly x
1
, x
2
as members:
for every y, y Y y = x
1
y = x
2
.
2. In the point above we used the word exactly in the phrase containing
exactly x
1
, x
2
, meaning containing x
1
, x
2
and nothing else.
2.2.4 Fact
For any object x there exists a set which contains x as its only member:

Y

y
y Y y = x.
Proof
Use Axiom of Pairing taking elements x and x (again).
(Here is an additional explanation.
In predicate calculus,
x
1
,x
2
p(x
1
, x
2
) implies
x
p(x, x),
so, Axiom of Pairing implies
x

Y

y
y Y y = x y = x,
which is logically equivalent to
x

Y

y
y Y y = x.)
Equality of sets 2.3
2.3.1 Axiom (of Extensionality)

X,Y
(X = Y
u
(u X u Y ))
2.3.2 Explanatory Note
1. The Axiom of Extensionality says that for any sets X, Y we have
X = Y i X and Y have the same elements.
2. It would be enough to use a reversed implication in the Axiom of Exten-
sionality, instead of the equivalence:

X,Y
(X = Y
u
(u X u Y )).
This is because, the formula

X,Y
(X = Y
u
(u X u Y ))
follows from axioms of equality which are assumed among logical axioms.
2.3.3 Explanatory Note
Although the Axiom of Pairing guarantees that for any x
1
, x
2
there exists
a set which contains exactly x
1
, x
2
it does not guarantee that such a set is
unique. (We have seen also that the axiom of pairing guarantees that for any
x there exists a set which contains exactly x, but again it does not guarantee
that such a set is unique.) The possibility that there could be many dierent
sets each containing exactly x
1
, x
2
and the possibility that there there could
be many dierent sets each containing exactly x are excluded by the Axiom
of Extensionality.
2.3.4 Fact
1. For any objects x
1
, x
2
, the set which contains exactly x
1
, x
2
is unique:

y
(y Y y = x
1
y = x
2
)
z
(z Z z = x
1
z = x
2
) Y = Z.
2. For any object x, the set which contains exactly x is unique:

y
(y Y y = x)
z
(z Z z = x) Y = Z.
2.3.5 Explanatory Note
The formula in the point 1 of the fact above expresses the uniqueness of
the set which contains exactly x
1
, x
2
by saying: if Y is a set which contains
exactly x
1
, x
2
and if Z is a set which contains exactly x
1
, x
2
then Y = Z.
This is the standard way of expressing uniqueness.
Proof
By the Axiom of Extensionality.
Finite sets and the sets of numbers 2.4
2.4.1 Denition
Let x
1
, x
2
be any objects (not necessarily dierent). We will write x
1
, x
2

or x
2
, x
1
to denote the set which contains exactly x
1
and x
2
.
2.4.2 Explanatory Note
The set x
1
, x
2
has two members i x
1
,=x
2
, otherwise it has just one
member.
2.4.3 Denition
Let x be any object. By the singleton of x we understand the set which
has x as its only member, and we denote it by x .
2.4.4 Example
The following are consequences of the Axiom of Extensionality.
1. 1, 2=2, 1 because both sets have the same elements.
2. 1, 1=1 because both sets have the same elements.
3. 2,
4
6
=
4
2
,
2
3
because both sets have the same elements.
2.4.5 Explanatory Note
Sets should be thought of as collections in which elements do not repeat
(and their order does not matter). The set notation allows for repetitions
of an element the notation 1, 1 is legal, however the same set could be
written simply as 1, and the simpler version is preferred.
2.4.6 Explanatory Note
To see why in the set notation has been dened in a way which allows
repetitions of the same element, notice that such repetitions are sometimes
unavoidable. For instance, when we write =
m
n
1 : m, n Z and n,=
0, then both
1
3
and
2
6
satisfy the condition m, n Z and n,=0, and as they
represent the same number, this number is considered (at least) twice in the
construction of the set .
2.4.7 Explanatory Note
The Axiom of Pairing together with other axioms of set theory guarantee
that not only sets with one or two elements exist, but that for any nite
number of objects there exists a set containing exactly these objects. The
following formulas are consequences of these axioms:

Y

y
y Y false

x
1

Y

y
y Y y = x
1

x
1
,x
2

Y

y
y Y y = x
1
y = x
2

x
1
,x
2
,x
3

Y

y
y Y y = x
1
y = x
2
y = x
3

x
1
,x
2
,x
3
,x
4

Y

y
y Y y = x
1
y = x
2
y = x
3
y = x
4
etc.
Further, the Axiom of Extensionality guarantees that for any nite number
of objects the set containing exactly these objects is unique.
2.4.8 Denition
By the empty set we understand the set with no members, and denote it
by or .
2.4.9 Fact
Y =
y
y , Y
2.4.10 Example
By Extensionality, , =. This is because the two sets do not have the
same members: but , .
2.4.11 Convention
Finite sets with more than two members can be written by listing their
elements (in any order, with possible repetitions), separated by commas
and by enclosing the entire list by a pair of curly braces.
2.4.12 Example
1. 1, 5, 7 is a set with members 1,5,7.
5 1, 5, 7 but 3 , 1, 5, 7.
2. , 1, 2, 1, 2 is a set whose members are four sets.
3. , 1, 2, 5, a, red is a set with ve members.
2 1, 2 , 1, 2, 5, a, red
2 , , 1, 2, 5, a, red
2.4.13 Explanatory Note
As in the example above, sets can be members of other sets. For comparison,
in the real world, you may think of organizations as sets of people, but there
are also organizations (called federations) whose members are organizations.
2.4.14 Fact
1.
y
y false
2.
x
1
,y
y x
1
y = x
1
3.
x
1
,x
2
,y
y x
1
, x
2
y = x
1
y = x
2
4.
x
1
,x
2
,x
3
,y
y x
1
, x
2
, x
3
y = x
1
y = x
2
y = x
3
5.
x
1
,x
2
,x
3
,x
4
,y
y x
1
, x
2
, x
3
, x
4
y = x
1
y = x
2
y = x
3
y = x
4
etc.
2.4.15 Fact
1.
x
x ,
2.
x
x x
2.4.16 Explanatory Note
Axioms of set theory guarantee that the following familiar sets of numbers
exist and are unique: Z
+
, N, Z, , 1, C.
Subsets 2.5
2.5.1 Denition
Let X and Y be sets.
1. We say that X is a subset of Y or Y is a superset of X if

x
(x X x Y ). This is denoted by X Y or Y X .
2. We say that X is a proper subset of Y or
Y is a proper superset of X if X Y but X,=Y . This is denoted by
X _ Y or Y _ X .
3. We will write X _ Y or Y _ X if it is not the case that X Y .
4. is called inclusion .
5. _ is called proper inclusion .
2.5.2 Explanatory Note
X Y i every element of X is also an element of Y .
2.5.3 Convention
1. Informally, we will write A
1
A
2
A
3
to mean A
1
A
2
and A
2
A
3
.
Similarly for more than three sets. Similarly for _.
2. Informally, we will write A
1
, A
2
B to mean A
1
B and A
2
B.
Similarly for more than two sets and similarly for _ and _.
2.5.4 Example
Z
+
_ N _ Z _ _ 1
2.5.5 Fact
Let X, Y, Z be any sets.
1. X.
2. If X then X = .
3. X X.
4. (X _ X).
5. x Y and Y Z implies x Z.
6. X Y Z implies X Z.
Proof
We will prove point 1; the remaining proofs are left for the reader.
Let X be any set. We need to show that X.
By the denition of it is enough to show that
z
(z z X).
Consider an arbitrary z.
The implication z z X is true because z is false (by the
denition of ).
2.5.6 Fact
X = Y i X Y and X Y .
Proof
The implication to the right follows from the the fact that X = X. The
implication to the left follows from the Axiom of Extensionality and the
denition of .
2.5.7 Explanatory Note
We will see that the proposition above is very useful: often, when we have
to prove equality of two sets, instead, we will be proving two inclusions.
2.5.8 Example
1. Disprove: X Y Z implies X Z.
Solution.
Take X = 0, Y = 0 and Z = 0.
We have 0 0 0 but 0 , 0.
Conclusion.
For some sets X, a member of a member of X is not a member of X.
2. Disprove: X Y Z implies X , Z.
Solution.
Take X = 0, Y = 0 and Z = 0, 0.
We have 0 0 0, 0 and 0 0, 0.
Conclusion.
For some sets X, a member of a member of X is a member of X.
2.5.9 Example
We will show that neither of and implies the other, however there
are cases where both of these relations hold and cases where neither one
holds.
1. Disprove: X Y implies X Y , for any sets X, Y .
Solution.
but _ .
2. Disprove: X Y implies X Y , for any sets X, Y .
Solution.
5, 7 5, 7, 9 but 5, 7 , 5, 7, 9.
3. Prove: there exist X, Y s.t. X Y and X Y .
Solution.
and .
4. Prove: there exist X, Y s.t. neither X Y nor X Y .
Solution:
1 , 2 and (1 2).
2.5.10 Exercise
1. Disprove: X Y implies X _ Y , for any sets X, Y .
2. Disprove: X _ Y implies X Y , for any sets X, Y .
3. Prove: there exist X, Y s.t. X Y and X _ Y .
4. Prove: there exist X, Y s.t. neither X Y nor X _ Y .
2.5.11 Exercise
1. Determine which of the relations , , _ holds between
, and , , , .
2. Show that _ implies but not vice-versa. Show also that there are cases
when both of these relations hold and cases when neither of them holds.
2.5.12 Exercise
Let X _ 1.
1. Disprove: x X : P(x) x X : Q(x) i
xR
(P(x) Q(x))
2. Disprove: x X : P(x) = x X : Q(x) i
xR
(P(x) Q(x))
3. Complete: x X : P(x) x X : Q(x) i ...
4. Complete: x X : P(x) = x X : Q(x) i ...
Hint: Instead of X _ 1 consider X _ 1 1 and draw a diagram showing
X, x : P(x), x : Q(x).
Separation schema 2.6
2.6.1 Axiom (Separation Schema)
Let P(z, p
1
, ..., p
n
) be any rst-order formula. Then the following axiom is
assumed:
p
1
,...,pn

Y

z
(z Y z X P(z, p
1
, ..., p
n
)).
2.6.2 Explanatory Note
The following is the most commonly used consequence of the Separation
Schema. Let P(z) be any rst-order formula with exactly one free variable;
then:
X

Y

z
(z Y z X P(z)).
2.6.3 Explanatory Note
By the Separation Schema and the Axiom of Extensionality, for any set X
and any rst-order formula P with exactly one free variable there exists
unique set Y such that z Y z X P(z).
2.6.4 Denition
Let X be a set and let P be a rst-order formula with exactly one free
variable. Then the set Y such that z Y z X P(z) will be denoted
by z X : P(z) .
This is read the set of elements z from X such that P(z) or
the set of elements z from X such that z has property P or
the set of those elements z from X that P(z) or
the set of those elements z from X for which P is true.
2.6.5 Explanatory Note
1. A formula such as that required by the Separation Schema is sometimes
called a property or a propositional function .
2. Why is Separation Schema called a schema? Notice that you can use
Separation Schema with any suitable formula P. For every such formula
you obtain the corresponding Separation Axiom. So, Separation Schema
is a schema for obtaining axioms.
3. Separation Schema should be understood as follows. Let X be any set;
let P be any rst-order formula with exactly one free variable such that
for every x X, P(x) is true or false, depending on x. Then there exists
a set Y containing exactly those elements of X which make P true.
2.6.6 Example
1. The property of being an odd integer is represented by the formula

kZ
n = 2k+1 with a free variable n, and due to the Separation Schema
and Extensionality Axiom we can dene the set of odd integers: n
Z :
kZ
n = 2k + 1. We will write this set in a less formal way as
n Z : n is odd.
2. The property of being a prime number is represented by the formula k >
1
m,nN
(k = mn (m = 1n = 1)) with a free variable k ranging over
integers, and due to the Separation Schema and Extensionality Axiom
we can dene the set of primes:
k Z : k > 1
m,nN
(k = mn (m = 1 n = 1)). We will write
this set in a less formal way as k Z : k is prime.
3. By Separation Schema and Extensionality Axiom, the following is a set:
a 1 : a = 2 a < 0.
4. Let us remark that the constructions above use N, Z, 1 whose existence
results from other axioms besides Separation and Extensionality.
2.6.7 Fact
x z X : P(z) i x X and P(x).
2.6.8 Explanatory Note
Existence of the empty set results from the separation axiom, as follows.
So called, logical axioms imply that the universe is non-empty that there
exists a set; let us call that set X. Now, by separation and extensionality,
Y = x X : exists and is unique. (Recall that means false.) It is
easy to see that Y has no members, so Y is the empty set.
2.6.9 Explanatory Note
1. Although x
1
, ..., x
5
is a convenient informal abbreviation for
x
1
, x
2
, x
3
, x
4
, x
5
, we discourage you from using ellipsis within the set
notation.
2. If you write 2, 4, 6, ..., it is not clear if this represents the set 2, 4, 6, 8,
or 2, 4, 6, 1, or the set of all positive even integers, etc. If the set of
all positive even integers is needed, it should be written as n Z
+
:
n is even. If the set of all non-negative even integers is needed, it should
be written as n Z : n 0 n is even.
2.6.10 Explanatory Note
Gottlob Frege tried to use the following Comprehension Schema as an axiom
of set theory: Let P(x) be any property; then there exists a set x : P(x)
of all objects x which have the property P.
Comprehension Schema is more general than Separation Schema because
x X : P(x) = x : x X P(x).
Burali-Forti, Cantor, Russell and Zermelo discovered that this schema is
false that it leads to contradictions.
Of the several ways to obtain a contradiction, Russells Paradox is
most famous. Consider the property P(x) given by the formula x , x. By
the Comprehension Schema, there would exist a set Y = x : x , x. Is
Y a member of Y ? When we assume that Y Y , Y must satisfy property
P, so Y , Y . When we assume that Y , Y , Y must not satisfy property
P, so (Y , Y ), i.e. Y Y . In both cases we obtained a contradiction.
So, neither Y Y nor Y , Y . This is a contradiction (because p p
is a tautology). This contradiction shows that x : x , x is not a set.
However surprising it may sound, we have just seen that not every collection
x : P(x) is a set. Consequently the Comprehension Schema is false.
To explain better the paradox above, Russell formulated also a version
called a Barbers Paradox . In a very small kingdom, with just a handful
of men, the king ordered the barber to shave exactly those men who do not
shave themselves. The barber is a man. Is the order possible to fulll? We
see that if the order is fullled, the barber shaves himself if and only if he
does not shave himself. This is impossible. Notice an analogy of kings order
to the order to create a set of all sets which are not their own members.
The reader should also notice an analogy between Russells Paradox,
Barbers Paradox and the Liar Paradox whose idea evolved from consid-
erations of an ancient Greek philosopher Epimenides. A man says: I am
lying; is he lying or telling the truth?
2.6.11 Explanatory Note
One of the axioms of ZFC set theory (the Axiom of Regularity) implies that

x
x , x. So, x : x , x is actually the collection of all the sets. As this
collection is not a set, there is no set of all sets, which means that there
is no set of all the objects. This can be stated as there is no universal set.
2.6.12 Convention
If there exists a set X such that P(z) z X,
we will write z : P(z) instead of z X : P(z).
This is read the set of elements z such that P(z) or
the set of elements z such that z has property P or
the set of those elements z that P(z) or
the set of those elements z which have property P.
Union, intersection, dierence, complement 2.7
2.7.1 Explanatory Note
Axioms of set theory (which we did not state) imply the following formula:

X,Y

Z

u
(u Z u X u Y ).
This should be understood as follows: let X, Y be any sets; then there exists
a set Z which contains exactly those elements which are members of X or
of Y .
2.7.2 Denition
Let X, Y be any sets. By the union of X and Y we understand the set Z
such that
u
(u Z u X u Y ) and denote it by X Y .
2.7.3 Explanatory Note
Using the term union, we could rephrase the Explanatory Note above,
saying that axioms of set theory guarantee that the union of any two sets
exists.
You should think that XY = u : u Xu Y . However, notice that
the formal approach of the axiomatic set theory requires that we specify a
set from which the elements u are chosen: XY = u Z : u Xu Y ;
the existence of such a set Z is guaranteed by the axioms.
2.7.4 Denition
Let X and Y be any sets.
1. By the intersection of X and Y we understand the set
z : z X and z Y . This set is denoted by X Y .
2. By the dierence of X and Y we understand the set
z : z X and z , Y . This set is denoted by X Y .
2.7.5 Exercise
In order to show that X Y and X Y are properly constructed sets
(assuming that X, Y are sets), we need to obtain them from the Separation
Schema, i.e. we need to represent them as z A : z X and z Y and
z B : z X and z , Y . Specify appropriate sets A and B (depending
on X, Y ).
2.7.6 Fact
1. z X Y i z X or z Y
z , X Y i z , X and z , Y
2. z X Y i z X and z Y
z , X Y i z , X or z , Y
3. z X Y i z X and z , Y
z , X Y i z , X or z Y
2.7.7 Denition
Let U be a set. Let X U.
By the complement of X with respect to U we understand the set UX.
2.7.8 Convention
If set U is known from the context and X U, the complement of X with
respect to U is denoted by X .
2.7.9 Fact
If X, Y U then X Y U, X Y U, X Y U, and X U.
2.7.10 Explanatory Note
If, in a particular problem P, we are concerned only with subsets of a non-
empty set U then U can be called a universe (of discourse) for P .
Notice that operations of union, intersection, dierence, symmetric dif-
ference and complement with respect to U, when performed on subsets of
U, produce subsets of U.
For instance, in problems which concern only sets of numbers, 1 is the
universe of discourse. In problems concerning sets of points on a plane, the
set of all points of that plane is the universe of discourse.
From Russells Paradox we know that there is no universal set, i.e. there
is no set of all sets, i.e. there is no set of all objects. So, there is no
universal universe of discourse for all the problems. For every problem we
need to consider its specic universe of discourse.
2.7.11 Programming Remark (Optional)
Consider a universe U = a
0
, ..., a
7
. Now any subset A of the universe can
be represented as a bit vector of length 8 which contains a 1 at position k i
a
k
A. For instance, the subset A = a
0
, a
1
, a
3
is represented by the bit
vector 11010000. The same idea can be used to implement subsets of any
nite universe (unless the number of elements in the universe exceeds the
capacity of computers memory). In C, an array of unsigned long integers
can be used as a bit vector. With this representation, bitwise operations
&, |, ~ correspond to set operations , , . Because bitwise operations
on machine words can be executed in a single machine instruction, this
implementation of set operations will be very ecient.
2.7.12 Denition
Let X, Y be any sets. We say that X and Y are disjoint or
X is disjoint from Y if X Y = .
2.7.13 Fact
If X, Y are disjoint then X Y = X.
2.7.14 Exercise
1. Disprove: if X Y = then X _ Y .
2. Complete: if ... and X Y = then X _ Y .
2.7.15 Exercise
Prove: if X
1
X
2
and Y
1
Y
2
and X
2
Y
2
= then X
1
Y
1
= .
(This means, subsets of disjoint sets are disjoint.)
2.7.16 Explanatory Note
The intersection of two sets can be visualized as follows.
X Y
X Y
The dierence of sets can be visualized as follows.
X Y
X Y
The complement of a set can be visualized as follows.
U
X X
Properties of set operations 2.8
2.8.1 Proposition
Let X, Y, Z U. Then
1. (Identity Laws)
X = X
U X = X
2. (Dominance Laws)
X =
U X = U
3. (Idempotence Laws)
X X = X
X X = X
4. (Associativity Laws)
(X Y ) Z = X (Y Z)
(X Y ) Z = X (Y Z)
5. (Commutativity Laws)
X Y = Y X
X Y = Y X
6. (Distributivity Laws)
X (Y Z) = (X Y ) (X Z)
X (Y Z) = (X Y ) (X Z)
7. (Absorption Laws)
X (X Y ) = X
X (X Y ) = X
8. (De Morgan Laws)
(X Y ) = X Y
(X Y ) = X Y
9. (Double Complement Law)
(X) = X
10. (Complement Laws)
X X = U
X X =
Proof
Here, we will prove only distributivity of the union with respect to the
intersection: X(Y Z) = (XY ) (XZ), leaving the remaining proofs
to the reader. Recall that,
1. z X Y i z X or z Y ,
2. z X Y i z X and z Y ,
as we stated in Fact 2.7.6.
By the Axiom of Extensionality it is enough to prove that
for every u, u X (Y Z) is equivalent to u (X Y ) (X Z).
In order to prove it, consider arbitrary u.
We have the following equivalences.
u X (Y Z)
i (by point 1)
u X u (Y Z)
i (by point 2)
u X (u Y u Z)
i (because x (y z) (x y) (x z) is a tautology)
(u X u Y ) (u X u Z)
i (by point 1)
(u X Y ) (u X Z)
i (by point 2)
u (X Y ) (X Z).
To complete the proof, one needs to verify, using a truth table, that
x (y z) (x y) (x z) is a tautology; we leave this for the reader.
2.8.2 Explanatory Note
In the proof above we have shown that u X (Y Z) is equivalent to
u (XY ) (XZ). Proofs of such equivalences are often constructed by
working from both ends, hoping that the two pieces will meet. In the proof
above, for the two sequences of equivalences to meet we need x (y z)
(xy) (xz) to be a tautology. We verify that this formula is a tautology
using a truth table. Once all the steps of the proof are clear, we rewrite
them in an appropriate order, to make the presentation better.
2.8.3 Explanatory Note
A proof is like a bridge. While a bridge spans to pieces of land, a proof
spans a new theorem with those theorems which were established earlier.
Big bridges are often constructed from both ends, so are proofs.
2.8.4 Explanatory Note
The laws of set operations above correspond exactly to the laws of proposi-
tional calculus with the following translation of symbols:
sets logic
U



=


Notice however that in order to obtain this correspondence, no other sym-
bols may occur in the formula, except variables, and exactly one of the
symbols =, , must occur in the set formula while exactly one of the
symbols , , must occur in the logic formula and it must be the main
connective.
2.8.5 Exercise
There is a partial correspondence between the laws of set operations and
arithmetic given by the following translation of symbols.
sets arithmetic
U 1
0
+


= =


under the assumption that no other symbols may occur in the formula,
except variables, and exactly one of the symbols =, , , occurs in the
formula and it occurs exactly once.
Translate the laws of set operations in 2.8.1 into arithmetic and state
which of them are true after the translation. For those translations which
are false give a numeric counter-example.
2.8.6 Explanatory Note
There is an internal symmetry in the laws of set operations. This symmetry
is called a duality and it relies on the following replacement of symbols
symbol dual symbol
U
U


= =


under the assumption that no other symbols may occur in the formula,
except variables. For every law of set operations in this section the reader
should write the dual form and verify that it is a valid law.
2.8.7 Fact
1. If X
1
X
2
and Y
1
Y
2
then X
1
Y
1
X
2
Y
2
.
2. If X
1
X
2
and Y
1
Y
2
then X
1
Y
1
X
2
Y
2
.
3. If X
1
X
2
and Y
1
Y
2
then X
1
Y
1
X
2
Y
2
.
2.8.8 Exercise
1. Disprove: The implication converse to point 1 of the fact above is true.
2. Disprove: The implication converse to point 2 of the fact above is true.
3. Disprove: The implication converse to point 3 of the fact above is true.
4. Disprove: If X
1
X
2
and Y
1
Y
2
then X
1
Y
1
X
2
Y
2
.
2.8.9 Fact
1. If X Y then Z Y Z X.
2. X Y i Y

.
2.8.10 Exercise
Disprove: If Z Y Z X then X Y .
2.8.11 Exercise
1. Prove: X X Y and Y X Y .
2. Prove: X X Y and Y X Y .
2.8.12 Proposition
1. X Y i X Y = Y .
X Y i X Y = Y .
2. X Y Z i X Z and Y Z.
X Y Z i X Z and Y Z.
Proof
We will prove only the rst item in point 2:
X Y Z i X Z and Y Z.
Proofs of the remaining items are left to the reader.
)
Assume X Y Z.
Goal: X Z and Y Z.
Consider any x X and any y Y .
The new goal is: x Z and y Z.
As x X, we obtain x X Y ,
and as X Y Z we obtain x Z.
Similarly, as y X, we obtain y X Y ,
and as X Y Z, we obtain y Z.
)
Assume X Z and Y Z.
Goal: X Y Z.
Consider any z X Y .
The new goal is z Z.
As z X Y , we obtain z X or z Y .
Case 1: z X.
As X Z, we obtain z Z.
Case 2: z Y .
As Y Z, we obtain z Z.
2.8.13 Exercise
1. Prove: X Y = Y X i X = Y .
2. Prove: If A, B U then (AB)

= A

B.
Powersets 2.9
2.9.1 Axiom (Powerset Axiom)

Y

u
u Y u X
2.9.2 Denition
Let X be any set. By the powerset of X or
the set of all subsets of X or the family of all subsets of X we un-
derstand the set Y such that
u
(u Y u X) and denote it by T(X) .
2.9.3 Explanatory Note
Powerset Axiom should be understood in the following way.
Let X be any set. Then there exists a set Y which contains exactly those
elements which are subsets of X.
By the denition of powerset, this set Y is the powerset of X.
2.9.4 Example
T(0, 1, 2) = , 0, 1, 2, 0, 1, 0, 2, 1, 2, 0, 1, 2.
This is illustrated by the following diagram.
0, 1, 2
0, 1 0, 2 1, 2
0 1 2

2.9.5 Fact
If X, Y T(Z) then X Y, X Y, X Y, X

Y T(Z).
2.9.6 Exercise
1. List all the subsets of .
2. List all the subsets of 0.
3. List all the subsets of 0, 1.
4. List all the subsets of 0, 1, 2.
5. List all the subsets of 0, 1, 2, 3.
2.9.7 Theorem
If a set X has n elements then T(X) has 2
n
elements.
Proof
Consider the following property p(n) of a natural number n:
every set with n elements has 2
n
subsets.
We will prove that every natural number has this property.
Proof by induction on n.
Base case.
Goal: p(0), i.e. every set with 0 elements has 2
0
subsets.
Take any set X with 0 elements. X = .
has only 1 subset, namely . So X has 2
0
subsets.
Inductive case.
Take an arbitrary natural number n.
Assume p(n): every set with n elements has 2
n
subsets; this is the
inductive hypothesis.
Goal: p(n +1), i.e. every set with n +1 elements has 2
n+1
subsets.
Take any set X with n +1 elements.
As n N, this implies that X has at least one element.
Select any x X.
X can be written as Y x where Y = X x.
As x , Y , Y has n elements.
By inductive hypothesis, T(Y ) has 2
n
elements.
Now we will count the subsets of X.
First, let us count those subsets of X which do not contain x:
every such subset of X is a subset of Y and vice versa,
so there are 2
n
such subsets.
Second, let us count those subsets of X which contain x:
every such subset X
0
can be written as Y
0
x for some Y
0
Y ;
so their number is the same as the number of subsets of Y , i.e. 2
n
.
Notice that in this way every subset of X was counted exactly once.
So, the total number of subsets of X is 2
n
+2
n
= 2
n+1
.
2.9.8 Explanatory Note
The induction in the proof above is based on a generalization of the obser-
vation that the subsets of, say, 1, 2, 3 fall into two groups:
1. the subsets which do not contain the element 3: , 1, 2, 1, 2;
2. the subsets which contain the element 3: 3, 1, 3, 2, 3, 1, 2, 3.
Notice that the sets in the rst group are exactly the subsets of 1, 2.
Notice that the sets in the second group can be obtained from the sets of
the rst group by adding the element 3:
3 = 3,
1, 3 = 1 3,
2, 3 = 2 3,
1, 2, 3 = 1, 2 3.
2.9.9 Explanatory Note
1. Subsets of 0, ..., n1 (or any n-element set) correspond to sequences of
length n whose members are zeros and ones. A subset X of 0, ..., n1
is represented as a sequence of a
i

n1
i=0
in which a
k
= 1 i k X.
2. For instance, the subsets of 0, 1, 2 are represented as sequences of length
3, as follows:
is represented by 0, 0, 0,
0 is represented by 1, 0, 0,
1 is represented by 0, 1, 0,
2 is represented by 0, 0, 10,
0, 1 is represented by 1, 1, 0,
0, 2 is represented by 1, 0, 1,
1, 2 is represented by 0, 1, 1,
0, 1, 2 is represented by 1, 1, 1.
3. Instead of counting subsets of 0, ..., n 1 (or any n-element set) it
is enough to count the sequences of length n whose members are zeros
and ones. There are 2
n
such sequences. (The proof of that requires
mathematical induction.) So, there are 2
n
subsets of 0, ..., n 1.
2.9.10 Programming Remark (Optional)
Assume that subsets of 0, ..., 31 are represented as bit vectors of length 32.
Then, the members T(0, ..., 31) are all possible bit vectors of length 32,
i.e. 32-bit integers. So, we can think of T(0, ..., 31) as the type of 32-bit
integers.
2.9.11 Programming Exercise (Extra credit)
Write a program which asks the user to input a natural number n and then
prints out all the subsets of 0, ..., n 1.
1. In a recursive version which follows the idea from the inductive proof of
2.9.7.
2. In a version which uses a recursive function to generate all the sequences
of zeros and ones of length n and prints out the corresponding subsets of
0, ..., n 1.
3. In a version which a generates all the sequences of zeros and ones of
length n, starting from the sequence of zeros, and applying a function
which given a sequence produces the next sequence. For every sequence,
the program outputs the corresponding subset of 0, ..., n 1.
2.9.12 Exercise
1. Prove: T(X) T(Y ) = T(X Y ).
2. Prove: T(X) T(Y ) T(X Y ).
3. Disprove: T(X) T(Y ) T(X Y ).
4. Disprove: T(X) T(Y ) T(X Y ).
5. Disprove: T(X) T(Y ) T(X Y ).
2.9.13 Exercise
Prove: if X Y then T(X) T(Y ).
Families of sets 2.10
Basic denitions
2.10.1 Denition
1. By a family of sets we understand any set whose members are sets.
2. Let X be a family of sets. By a subfamily of X we understand any Y
such that Y X.
2.10.2 Example
1. 0, 1, 2, 1, 2, 3, 5 is a family of sets.
2. is a family of sets.
3. is a family of sets.
4. For any set X, T(X) is a family of sets.
Unions and intersections of families
2.10.3 Axiom (Union Axiom)

Y

u
(u Y
z
(z X u z))
2.10.4 Denition
1. Let X be a family of sets. By the union of X we understand the set Y
such that
u
(u Y
z
(z X u z)) and we denote it by

X .
2. Let X be a non-empty family of sets. By the intersection of X we
understand the set Y such that
u
(u Y
z
(z X u z)) and
we denote it by

X .
The operation is referred to as binary union operation . In contrast,

is referred to as family union or big union or
generalized union .
The operation is referred to as
binary intersection operation . In contrast,

is referred to as
family intersection or big intersection or
generalized intersection .
2.10.5 Explanatory Note
1. The Union Axiom should be understood in the following way. Let X be
a family of sets. Then, there exists a set Y whose members are exactly
the members of the sets of the family X, i.e. there exists a set Y whose
elements are exactly those which are members of some set in the family
X.
2. The formula which denes

X should be understood in the following
way. Let X be a non-empty family of sets. Then, there exists a set Y
whose elements are exactly those which are members of every set in the
family X.
3. In the denition of the intersection we require that X is non-empty be-
cause otherwise the formula
z
(z X u z) which denes Y is
satised by any object u, and we know from Russells Paradox that there
is no set of all objects.
2.10.6 Example
Let X = 0, 1, 2, 1, 2, 3, 2, 3, 4. Then:

X = 0, 1, 2 1, 2, 3 2, 3, 4 = 0, 1, 2, 3, 4.

X = 0, 1, 2 1, 2, 3 2, 3, 4 = 2.
2.10.7 Fact
1.

X
1
, X
2
, X
3
= X
1
X
2
X
3
.

X
1
, X
2
, X
3
= X
1
X
2
X
3
.
2.

X
1
, X
2
= X
1
X
2
.

X
1
, X
2
= X
1
X
2
.
3.

X
1
= X
1
.

X
1
= X
1
.
4.

= .

is undened.
2.10.8 Explanatory Note
With a grain of salt, the fact that

X = X can be stated as the big union


shaves the mustaches (i.e. removes curly braces). Similarly, the fact that

X = X can be stated as the big intersection shaves the mustaches.


This applies only to singletons.
2.10.9 Exercise
What is

T(X) ?
What is

T(X) ?
What is

(T(X) X) if X has not more than 1 element?
What is

(T(X) X) if X has at least 2 elements?
2.10.10 Proposition
1. If x X then x

X.
2. If x X then

X x.
3. If X Y then

X

Y .
4. If X Y then

Y

X.
5.

X

X.
Proof
We will prove only point 3. The proofs of other points are left for the
reader.
Assume that X Y . Goal:

X

Y .
Take any u

X. Goal: u

Y .
As u

X, there exists x X such that u x.


As x X Y , we have x Y .
As, u x and x Y , we have u

Y .
2.10.11 Exercise
1. Disprove: If X Y then

X

Y .
2. Disprove:

X

X.
3. Prove the proposition above.
2.10.12 Exercise
Prove: X Y i T(X) T(Y ).
2.10.13 Denition
Let X be a family of sets. X is pairwise disjoint if every two dierent
sets in X are disjoint.
2.10.14 Example
1. , 1, 2, 3, 4, 5, 6 is a pairwise disjoint family of sets.
2. n : n N is a pairwise disjoint family of sets.
2.10.15 Fact
1. Sets X, Y are disjoint i the family X, Y is pairwise disjoint.
2. For any set X, the singleton family X is pairwise disjoint.
3. The empty family is pairwise disjoint.
2.10.16 Exercise
Complete: if X is a non-empty pairwise disjoint family of sets then

X = ...
Families closed under unions and intersections
2.10.17 Denition
Let X be a family of sets.
1. X is closed under nite unions if for all x
1
, x
2
X, x
1
x
2
X.
2. X is closed under nite intersections if for all x
1
, x
2
X, x
1
x
2

X.
3. X is closed under arbitrary unions if for all Y X,

Y X.
4. X is closed under arbitrary intersections if for all Y X,

Y
X.
2.10.18 Fact
Let X be a family of sets.
1. If X is closed under arbitrary unions then X is closed under nite unions.
2. If X is closed under arbitrary intersections then X is closed under nite
intersections.
3. If X is closed under arbitrary unions then X.
4. If X is closed under arbitrary intersections then

X X.
2.10.19 Example
1. Consider the family X of all the nite sets of natural numbers. X is closed
under nite intersections and nite unions. X is closed under arbitrary
intersections but not under arbitrary unions.
2. Consider the family X of all the conite sets of natural numbers (i.e. sets
of natural numbers whose complements are nite). X is closed under
nite intersections and nite unions. X is closed under arbitrary unions
but not under arbitrary intersections.
3. The family of all closed intervals of real numbers is closed under arbitrary
intersections but not under nite unions.
4. The family of all open intervals of real numbers is closed under nite
intersections but not under arbitrary intersections and not under nite
unions.
2.10.20 Exercise
1. Disprove: If a family of sets is closed under nite intersections then it is
closed under arbitrary intersections.
2. Disprove: If a family of sets is closed under nite unions then it is closed
under arbitrary unions.
2.10.21 Exercise
1. Is the family of complements of open intervals of real numbers closed
under nite intersections, arbitrary intersections, nite unions, arbitrary
unions?
2. Is the family of complements of closed intervals of real numbers closed
under nite intersections, arbitrary intersections, nite unions, arbitrary
unions?
Families ordered by inclusion 2.11
Hasse diagrams of families of sets
2.11.1 Explanatory Note
Let X be a nite family of sets.
By a Hasse diagram of X we understand a diagram in which
1. every x X is represented by a node (i.e. vertex), possibly labelled with
x,
2. For x, y X, if x _ y and there is no z X s.t. x _ z _ y then the
node representing y is above the node representing x, and there is an
edge between the nodes representing x and y.
2.11.2 Example
The following is a Hasse diagram of T(1, 2, 3).
1, 2, 3

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
1, 2 1, 3 2, 3

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
1 2 3
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

Comparable sets
2.11.3 Denition
Let a and b be sets.
1. x and y are comparable with respect to if x y or y x.
2. x and y are incomparable with respect to if x and y are not com-
parable with respect to .
2.11.4 Example
1. Sets 1, 2 and 1, 2 are comparable.
2. Sets 1 and 2 are incomparable.
3. Sets 1, 2 and 1, 3 are incomparable.
4. Any two dierent sets among the following sets are comparable: , 1,
1, 2 and 1, 2, 3.
5. Any two dierent sets among the following sets are comparable: N, N
0, N 0, 1, N 0, 1, 2.
2.11.5 Exercise
Give an example of a family consisting of four sets such that every two
dierent set in that family are incomparable.
2.11.6 Fact
Let X and Y be any sets.
1. If X and Y are comparable then Y and X are comparable.
2. and X are comparable.
3. X and X are comparable.
2.11.7 Exercise
1. Disprove: If X, Y are comparable and Y , Z are comparable then X, Z
are comparable.
2. Disprove: Any two sets which are disjoint are incomparable.
3. Complete: Any two sets which are disjoint and ... are incomparable.
Prove your statement.
4. Disprove: Any two sets which are non-empty and incomparable are dis-
joint.
Minimal, maximal, smallest and greatest sets
2.11.8 Denition
Let X be a family of sets.
1. x is smallest in X with respect to or least in X with respect to
if x X and
yX
x y.
2. x is greatest in X with respect to or largest in X with respect to
or biggest in X with respect to if x X and
yX
y x.
3. x is minimal in X with respect to if x X and
yX
(y _ x).
4. x is maximal in X with respect to if x X and
yX
(x _ y).
2.11.9 Convention
For brevity we can say x is minimal in X instead of x is minimal in X
with respect to .
If the family X is known from the context we can say x is minimal instead
of x is minimal in X.
Similar conventions are used for maximal, smallest and greatest.
2.11.10 Explanatory Note
If x y, we think of x as smaller than or equal to y, and of y, as greater
than or equal to x.
If x _ y, we think of x as smaller than y, and of y, as greater than
x.
1. x is smallest in X if every set in X is a superset of x,
i.e., intuitively, if every set in X is greater than or equal to x.
2. x is greatest in X if every set in X is a subset of x,
i.e., intuitively, if every set in X is smaller than or equal to x.
3. x is minimal in X if no set in X is a proper subset of x,
i.e., intuitively, if no set in X is smaller than x.
4. x is maximal in X if no set in X is a proper superset of x,
i.e., intuitively, if no set in X is greater than x.
2.11.11 Example
1. Consider the family T(1, 2, 3) .
1, 2, 3

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
1, 2 1, 3 2, 3

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
1 2 3
In this family:
there is no smallest set;
there are exactly three minimal sets, namely 1, 2, 3;
there is exactly one greatest set, namely 1, 2, 3;
there is exactly one maximal set, namely 1, 2, 3.
2. Consider the family 1, 2, 3.
The Hasse diagram of this family has three nodes and no edges:
1 2 3
In this family:
there is no smallest set;
there are exactly three minimal sets, namely 1, 2, 3;
there is no greatest set;
there are exactly three maximal sets, namely 1, 2, 3.
3. Consider the family of all non-empty sets of natural numbers.
In this family:
there is no smallest set;
the minimal sets are 0, 1, 2, ...;
there is exactly one greatest set, namely N;
there is exactly one maximal set, namely N.
2.11.12 Exercise
Let X be T(1, 2, 3) 1, 2, 3 (where T is the powerset construct).
Specify all smallest, greatest, minimal and maximal sets in X or state that
such sets do not exist.
2.11.13 Fact
For any set X, in the family T(X):
there is exactly one smallest set, namely ;
there is exactly one minimal set, namely ;
there is exactly one greatest set, namely X;
there is exactly one maximal set, namely X.
2.11.14 Fact
Let X be a family of sets.
1. If a smallest set exists in X, it is comparable to every set in X.
2. If a greatest set exists in X, it is comparable to every set in X.
2.11.15 Proposition
1. a. There exists a family of 0 sets with 0 minimal sets and 0 smallest sets.
2. a. There exists a family of 1 set with 1 minimal sets and 1 smallest set.
3. a. There exists a family of 2 sets with 1 minimal set and 1 smallest set.
b. There exists a family of 2 sets with 2 minimal sets and 0 smallest sets.
4. a. There exists a family of 3 sets with 1 minimal set and 1 smallest set.
b. There exists a family of 3 sets with 2 minimal sets and 0 smallest sets.
c. There exists a family of 3 sets with 3 minimal sets and 0 smallest sets.
5. Let k, n be any natural numbers such that 1 < k n.
a. There exists a family of n sets with 1 minimal set and 1 smallest set.
b. There exists a family of n sets with k minimal sets and 0 smallest sets.
6. Let k be any natural number such that 1 < k.
a. There exists a family of innitely many sets with 0 minimal sets and
0 smallest sets.
b. There exists a family of innitely many sets with 1 minimal set and 0
smallest sets.
c. There exists a family of innitely many sets with 1 minimal set and 1
smallest set.
d. There exists a family of innitely many sets with k minimal sets and
0 smallest sets.
e. There exists a family of innitely many sets with innitely many min-
imal sets and 0 smallest sets.
2.11.16 Explanatory Note
The proposition above is summarized by saying that there exist families of
sets as in the following chart, where k/l means that there are k minimal sets
and l smallest sets.
Family size Number of minimal sets and smallest sets
0 0/0
1 1/1
2 1/1 or 2/0
3 1/1 or 2/0 or 3/0
.
.
.
.
.
.
n 1/1 or 2/0 or 3/0 or ... or n/0
.
.
.
.
.
.
innity 0/0 or 1/0 or 1/1 or 2/0 or 3/0 or ... or innity/0
Proof
We will prove only point 6 (concerning innite families of sets).
For any i N, dene n
i
= k N : k < n.
(So, n
0
= , n
1
= 0, n
2
= 0, 1, n
3
= 0, 1, 2, etc.)
For any i N, dene N
i
= N n
i
.
(So, N
0
= N, N
1
= k N : k 1, N
2
= k N : k 2, etc.)
For any i N, dene m
i
= i.
(So, m
0
= 0, m
1
= 1, m
2
= 2, m
3
= 3, etc.)
We will use these sets in the following constructions of families of sets which
satisfy conditions 6a 6b.
a. The family N
i
: i N has 0 minimal sets and 0 smallest sets.
b. The family 1 N
i
: i N has 1 minimal set and 0 smallest sets.
c. The family n
i
: i N has 1 minimal set and 1 smallest set.
d. The family m
i
: 1 i < k n
i
: i N has k minimal sets and 0
smallest sets.
e. The family m
i
: i N has innitely many minimal sets and 0 smallest
sets.
2.11.17 Exercise
Specify all the minimal and smallest sets in the families constructed in points
a - e of the proof above.
2.11.18 Exercise
Prove points 1 - 5 of the proposition above.
2.11.19 Proposition
1. No family of sets has two dierent smallest sets.
2. Any two dierent minimal sets are incomparable.
3. If there exists a smallest set, it is also a minimal set, and it is the only
minimal set.
4. In any nite family of sets, its every member has a subset which is mini-
mal.
5. Every nite non-empty family of sets has at least one minimal set.
6. In a nite family of sets, if there is exactly one minimal set then it is the
smallest set.
7. There are no cases of families of sets other than those described in the
previous proposition.
Proof
1. Assume that a family of sets has two dierent smallest sets x
1
and x
2
.
Our goal is to obtain contradiction.
As, x
1
is smallest, x
1
x
2
.
As, x
2
is smallest, x
2
x
1
.
As, x
1
x
2
and x
2
x
1
, we have x
1
= x
2
contradiction.
2. Assume that x
1
and x
2
are two dierent minimal sets and they are com-
parable.
Our goal is to obtain contradiction.
As x
1
and x
2
are comparable, x
1
x
2
or x
2
x
1
.
We will consider two cases.
Case: x
1
x
2
. As x
2
is minimal we must have x
1
= x
2
contradiction.
Case: x
2
x
1
. As x
1
is minimal we must have x
1
= x
2
contradiction.
3. First we will prove that if x is smallest then x is minimal. (Later we will
still need to prove that there are no minimal sets other than x.)
Assume that x is smallest.
To prove that x is minimal, take any y and assume that y _ x.
The goal is to obtain contradiction.
As y _ x, we obtain that y x and y,=x.
As x is smallest, x y.
As x y and y x we obtain that x = y contradiction.
Now, we will prove that if x is smallest and z is minimal then x = z.
Assume that x is smallest and z is minimal.
The goal is to show that x = z.
We proved above that x is minimal.
As x and z are minimal, by point 2, they are incomparable.
So, x _ z this contradicts the assumption that x is smallest.
4. Consider the following condition:
(*) every member of the family has a subset which is minimal.
Assume that there exists a nite family of sets which violates (*).
The goal is to obtain contradiction.
As there exists a nite family that violates condition (*), among all such
families there is a family X which has the smallest number of elements:
X is nite and there exists a set x X with no subset which is minimal.
In particular, x is not minimal.
So, there exists a proper subset of x which belongs to X.
So, the family Y = y X : y _ x is non-empty.
Y violates condition (*).
Y has less elements than X contradiction.
5. From item 4.
6. Take any nite family X of sets with a single minimal set x.
We will show that x is smallest.
Take any y X.
We need to show x y.
By point 4, y has a subset which is minimal.
As x is the only minimal set in X, we must have x y.
7. This follows from the previous items in this theorem but the proof is left
to the reader.
2.11.20 Exercise
Explain why the assumption that the family is nite is essential for points
4, 5, 6 of the proposition above.
2.11.21 Exercise
Explain why family Y constructed in point 4 of the proof above violates
condition (*).
2.11.22 Exercise
Prove point 6 of the proposition above.
2.11.23 Exercise
Formulate statements about maximal and greatest sets analogous to those in
propositions above and prove them. Hint: To construct families of sets with
a particular number of minimal, smallest, maximal and greatest sets start
from drawing diagrams involving unlabelled nodes and edges where every
node represent (an unspecied set) and edges going up indicate inclusion;
later construct sets which can label the nodes of your diagrams, so that they
become Hasse diagrams of families of sets.
2.11.24 Exercise
1. Disprove: Any minimal set and any maximal set are comparable.
2. Disprove: There are at least two minimal sets i there is no smallest set.
Smallest and greatest sets versus big unions and intersections
2.11.25 Proposition
Let X be a family of sets. Then:
1. x is smallest in X with respect to i x X and x =

X.
2. x is greatest in X with respect to i x X and x =

X.
Proof
We will prove only point 1. The proofs of the other point is left for the
reader.
)
Assume that x is smallest in X.
Then, x X, and it remains to prove: x =

X.
As x X, we have

X x, so it remains to prove: x

X.
Take any u x. Goal: u

X.
Take any v X. Goal: u v.
As v X and x is smallest in X, we have x v.
As u x and x v, we have u v.
)
Assume that x X and x =

X.
Goal: x is smallest in X.
Take any v X. Goal: x v.
As v X, we have

X v.
As x =

X and

X v, we have x v.
2.11.26 Corollary
1. If a non-empty family of sets is closed under arbitrary intersections then
it has the smallest element.
2. If a non-empty family of sets is closed under arbitrary unions then it has
the greatest element.
2.11.27 Exercise
1. Disprove: x is smallest in X with respect to i x =

X.
2. Prove: x is smallest in X with respect to i x X and x

(Xx).
3. Disprove: x is smallest in X with respect to i x X and x _

(X
x).
4. Disprove: If a non-empty family of sets has the smallest set then it is
closed under arbitrary intersections.
5. Formulate statements analogous to those above concerning the greatest
set.
prove or disprove each statement.
Ordered pairs 2.12
2.12.1 Primitive Notions
1. Binary construct whose value for any a, b is written as a, b).
2. Unary construct rst.
3. Unary construct second.
2.12.2 Explanatory Note
We assume that these constructs are primitive; they cannot be dened
there are no more primitive notions which could be used to dene them.
Properties of primitive constructs are stated in axioms.
2.12.3 Denition
1. Let a, b be any objects.
a, b) will be called the ordered pair formed from a and b .
2. Let p = a, b). We call a the rst component of p .
3. Let p = a, b). We call b the second component of p .
2.12.4 Axioms
1. rst(a, b)) = a.
2. second(a, b)) = b.
3. For every ordered pair p there exist a and b such that p = a, b).
2.12.5 Proposition
If p is an ordered pair then p = rst(p), second(p)).
Proof
Assume that p is an ordered pair.
By Axiom 3, there exist a, b such that
(*) p = a, b).
We will apply operation rst to both sides of this equality and use Axiom 1:
(**) rst(p) = rst(a, b)) = a.
Similarly, using second and Axiom 2, we obtain:
(***) second(p) = second(a, b)) = b.
So, from (**), a = rst(p) and from (***), b = second(p).
Substituting these values for a and b in (*) we obtain:
p = rst(p), second(p)).
2.12.6 Proposition (Crucial property of ordered pairs)
a, b) = c, d) i a = c and b = d.
Proof
)
Obvious. (Every construct must give a unique result, so this is also the case
with forming an ordered pair. If one object is known under names a and c
and second object is known under names b and d then a, b) and c, d) are
ordered pairs formed from the same objects and they are the same.)
)
Assume that a, b) = c, d).
We will apply rst to both sides of this equality:
rst(a, b)) = rst(c, d)).
By Axiom 1, this means a = c.
Similarly, applying second, by Axiom 2, we obtain b = d.
2.12.7 Example
The proposition above implies that ordered pairs are very dierent from
unordered pairs (i.e. two-element sets): 1, 2),=2, 1) but 1, 2=2, 1.
2.12.8 Exercise
Prove: a, b) = b, a) i a = b.
2.12.9 Example
1. In analytic geometry, every point on the plane is represented as an ordered
pair of real numbers.
5
3
5, 3)
2. On a computer, every possible location of the cursor in a text window is
represented as an ordered pair of positive integers whose rst component
is the column number and the second component is the row number.
2.12.10 Programming Exercise (Extra credit)
In your favorite object-oriented language implement a class OrderedPair
with a constructor which takes two parameters and with methods first
and second.
2.12.11 Explanatory Note
A program variable, during an execution of a computer program, can be
modelled, in a simplied way, as an ordered pair
VARIABLE-NAME, VALUE). This model is not sucient for considera-
tions concerning references situations in which we want to be able to tell
if two variables refer to the same object (i.e. to the same memory address
where the object is stored). A more accurate model involves two sets of
ordered pairs. The rst set contains pairs of the form
VARIABLE-NAME, MEMORY-ADDRESS) and the second set contains
pairs of the form MEMORY-ADDRESS, VALUE). With this approach it
is possible to model situations in which two variables refer to the same object
(in the same memory location), as well as situations in which two variables
refer to equal objects in dierent memory locations.
Ordered tuples 2.13
2.13.1 Denition
1. By an ordered 2-tuple we understand an ordered pair.
2. For any integer n > 2 we dene
the ordered n-tuple with components a
1
, ..., a
n
, recursively, as follows:
a
1
, ..., a
n
) = a
1
, ..., a
n1
), a
n
).
Ordered n-tuples beyond n=2 have alternative names derived from Latin
numerals:
ordered 3-tuple ordered triple ,
ordered 4-tuple ordered quadruple ,
ordered 5-tuple ordered quintuple ,
ordered 6-tuple ordered sextuple ,
ordered 7-tuple ordered septuple ,
ordered 8-tuple ordered octuple .
2.13.2 Explanatory Note
In analytic geometry, every point in the 3-dimensional space is represented
as an ordered triple of real numbers.
2.13.3 Proposition
a
1
, ..., a
n
) = b
1
, ..., b
n
) i a
1
=b
1
and ... and a
n
=b
n
.
2.13.4 Exercise
Disprove: a
1
, ..., a
m
) = b
1
, ..., b
n
) implies m=n.
2.13.5 Explanatory Note
Unlike for tuples, for sequences, if sequences a
0
, ..., a
m
and b
0
, ..., b
n
are equal
then m = n and a
0
=b
0
and ... and a
n
=b
n
.
2.13.6 Programming Exercise (Extra credit)
Design a representation for ordered triples dierent from that used in the
denition above. Compare the space (i.e. memory) usage under each repre-
sentation.
Cartesian products 2.14
2.14.1 Denition
1. Let A and B be sets. We dene the Cartesian product of A and B
as: a, b) : a A b B and denote it by AB .
2. Let A be a set. We dene the Cartesian second power of A as AA
and denote it by A
2
.
2.14.2 Explanatory Note
1. A B = a, b) : a A b B is read: Cartesian product of sets A
and B is equal to the set of all ordered pairs in which the rst component
is a member of A and the second component is a member of B.
2. In proofs involving Cartesian products it will be convenient to use the
following equivalence:
x AB i there exist a A and b B such that x=a, b).
2.14.3 Explanatory Note
In analytic geometry, every point on the plane is represented as an ordered
pair of real numbers, and the plane is identied with 1
2
.
5
3
5, 3)
2.14.4 Example
Consider A = x 1 : 5 x 6 and B = y 1 : 1 y 3.
0
1
2
3
0 1 2 3 4 5 6
The grey rectangle is the graph of the Cartesian product AB.
2.14.5 Exercise
1. What is A ? What is A ?
2. How many elements are there in A B if A has m elements and B has
n elements?
3. Disprove: AB = B A.
2.14.6 Fact
If A
1
A
2
and B
1
B
2
then A
1
B
1
A
2
B
2
.
2.14.7 Programming Exercise (Extra credit)
Write a program which asks the user for two natural numbers m, n and then
displays all ordered pairs in i Z
+
: i m j Z
+
: j n.
2.14.8 Proposition
A(B C) = (AB) (AC)
Proof
In order to prove equality of sets, we need to prove two inclusions.
)
We need to prove A(B C) (AB) (AC).
In order to prove an inclusion, we need to show that every member of
the left-hand side is also a member of the right-hand side:
Assume that (*) x A(B C).
The goal is to show that x (AB) (AC).
From (*), by the deniton of Cartesian product,
x = a, y) for some a A and y B C.
By the denition of union, this can be rewritten as
x = a, y) for some a A and (y B or y C).
We will consider two cases.
Case: y B)
We have: x = a, y), a A and y B.
So, x AB.
By the denition of union, also x (AB) (AC).
We have reached our goal.
Case: y C)
We have: x = a, y), a A and y C.
So, x AC.
By the denition of union, also x (AB) (AC).
We have reached our goal.
)
We need to prove (AB) (AC) A(B C).
Assume that (**) x (AB) (AC).
The goal is to show that x A(B C).
From (**), by the denition of the union, x (AB) or x (AC).
We will consider two cases.
Case: x (AB))
By the denition of Cartesian product,
x = a, b) for some a A and b B.
By the denition of union, this can be rewritten as:
x = a, b) for some a A and b B C.
By the denition of Cartesian product, x A(B C).
We have reached our goal.
Case: x (AC))
By the denition of Cartesian product,
x = a, c) for some a A and c C.
By the denition of union, this can be rewritten as:
x = a, c) for some a A and c B C.
By the denition of Cartesian product, x A(B C).
We have reached our goal.
Proof
(Abbreviated version)
)
Assume (*) x A(B C).
Goal: x (AB) (AC).
From (*), x = a, y) for some a A and y B C.
So, x = a, y) for some a A and (y B or y C).
Case: y B)
We have: x = a, y), a A and y B.
So, x AB.
So, x (AB) (AC).
Case: y C)
We have: x = a, y), a A and y C.
So, x AC.
So, x (AB) (AC).
)
Assume (**) x (AB) (AC).
Goal: x A(B C).
From (**), x (AB) or x (AC).
Case: x (AB))
We have: x = a, b) for some a A and b B.
So, x = a, b) for some a A and b B C.
So, x A(B C).
Case: x (AC))
We have x = a, c) for some a A and c C.
So, x = a, c) for some a A and c B C.
So, x A(B C).
2.14.9 Exercise
1. Prove: A(B C) = (AB) (AC).
2. Disprove: A (B C) = (A B) (A C)
3. Prove: A(B C) = (AB) (AC)
4. Disprove: A (B C) = (A B) (A C)
5. Prove: A(B C) = (AB) (AC)
6. Disprove: A(B C) = (AB) (AC)
2.14.10 Exercise
Prove: AB = B A i A=B A= B=.
Hint: consider two cases: AB = and AB,=.
Cartesian products of n sets 2.15
2.15.1 Denition
1. Let A
1
, A
2
, A
3
, ... be sets. For any integer n 1 we dene
Cartesian product of A
1
,...,A
n
, recursively, as follows:

1
i=1
A
i
= A
1

n+1
i=1
A
i
= (
n
i=1
A
i
) A
n+1
Instead of
n
i=1
A
i
we also write A
1
... A
n
.
2. If all the component sets are the same we call
n
i=1
A
the n-th Cartesian power of A and denote it by A
n
.
2.15.2 Explanatory Note
The Cartesian product of A
1
,...,A
n
is a generalization of previously dened
Cartesian product of two sets. This is because
2
i=1
A
i
= A
1
A
2
.
2.15.3 Fact

n
i=1
A
i
= A
1
... A
n
= a
1
, ..., a
n
) : a
1
A
1
... a
n
A
n

2.15.4 Explanatory Note


In analytic geometry, every point in the 3-dimensional space is represented
as an ordered triple of real numbers. The 3-dimensional space is identied
with 1
3
.
Nobody has ever seen an n-dimensional space for n > 3 but such a space
can be dened as 1
n
.
2.15.5 Programming Exercise (Extra credit)
Write a program which asks the user to input any number of natural numbers
n
1
, ..., n
k
and then displays all the ordered k-tuples in

k
i=1
m Z
+
: m n
i
.
2.15.6 Denition
Let X be a set. For any integer n 1 we dene
the n-th Cartesian power of X , recursively, as follows.
X
1
= X
X
n+1
= X
n
X
Chapter 3
Introduction to binary
relations
Contents
3.1 Basic denitions . . . . . . . . . . . . . . . . . . . . 73
3.2 Important binary relations . . . . . . . . . . . . . 75
3.3 Set operations on relations . . . . . . . . . . . . . 78
3.4 Inverse relation . . . . . . . . . . . . . . . . . . . . 79
3.5 Relative product and composition . . . . . . . . . 80
3.6 Powers . . . . . . . . . . . . . . . . . . . . . . . . . 83
Basic denitions 3.1
3.1.1 Historical Remark (Optional)
The world abounds in relationships. Parent-child relationship, origin-destination
relationship, smaller-than relationship are just a few examples. Relation-
ships of the real world are formalized in mathematics as relations. The
theory of binary relations was founded by an American logician Charles
Saunders Pierce (1839-1914) and a German logician Ernst Schroder (1841-
1902). It become fundamental for the 20th century mathematics.
3.1.2 Denition
1. By a binary relation we understand any set of ordered pairs.
2. Let R be a binary relation and a, b any objects. We say that
a is related to b by R or a is related to b in the sense of R if a, b)
R, and denote it by aRb or sometimes by R(a, b) .
73
3.1.3 Example
1. Let A = 0, 1, 2. We dene a binary relation
A
as the following set
of ordered pairs: 0, 0), 0, 1), 0, 2), 1, 1), 1, 2), 2, 2). This is a formal
presentation of the familiar smaller-than-or-equal relation on the set A.
It is an established practice to write a
A
b rather than a, b)
A
.
2. Let A = 0, 1, 2. We dene a binary relation <
A
as the following set of
ordered pairs: 0, 1), 0, 2), 1, 2). This is a formal presentation of the
familiar smaller-than relation on the set A. It is an established practice
to write a <
A
b rather than a, b) <
A
.
3.1.4 Denition
Let R be a binary relation.
1. By the domain of R we understand the set a :
b
a, b) R and
denote it by domain(R) .
2. By the range of R we understand the set b :
a
a, b) R and denote
it by range(R) .
3. By the eld of R we understand the set domain(R) range(R) and de-
note it by eld(R) .
4. Let A be a set. Let R be a binary relation. We say that R is over A if
R AA.
3.1.5 Exercise
Let <
A
be dened as the following set of ordered pairs: 0, 1), 0, 2), 1, 2).
What are domain(<
A
), range(<
A
) and eld(<
A
) ?
3.1.6 Explanatory Note
Notice that for a binary relation R the sets domain(R), range(R) and eld(R)
are uniquely determined. By contrast, a set A such that R is a binary
relation over A is not unique. When we say that R is a binary relation
over A there is no requirement that every element of A is involved in an
ordered pair belonging to the relation, so the relation 0, 1), 1, 1) is a
binary relation over 0, 1 but also over 0, 1, 2. This is expanded upon in
the following fact.
3.1.7 Fact
Let R be any binary relation.
1. R is over eld(R).
2. R is over X i eld(R) X.
3.1.8 Explanatory Note
One can visualize a binary relation using two kinds of diagrams:
1. a subset of Cartesian product,
2. a generalized directed graph, in which there is an arrow from a to b i
aRb.
3. an elements maps diagram which shows separately the domain and range
of the relation, and has arrows from an element a in the domain to an
element b in the range whenever aRb.
3.1.9 Explanatory Note
If X, Y are any sets such that R XY , then domain(R) is the projection
of R onto X and range(R) is the projection of R onto Y .
3.1.10 Exercise
Assume that A is a set with n elements. How many binary relations over A
are there?
Important binary relations 3.2
3.2.1 Denition
Let A be a set.
1. By the total binary relation on A we understand the binary relation
AA and denote it by Tot
A
.
2. By the empty relation we understand .
3. By the equality relation on A or the relation = on A or
the binary diagonal relation on A we understand the binary rela-
tion a, a) AA : a A and denote it by =
A
or
A
.
4. By the disequality relation on A or the unequality relation on A
or the relation not equal on A we understand the binary relation
a, b) AA : (a =
A
b) and denote it by ,=
A
.
Explanatory Note
We do not call ,=
A
an inequality relation because this term is reserved for
relations , , <, >.
3.2.2 Exercise
Let A = 1, 2, 3, 4, 5. Make separate graphs of the binary relations dened
above representing them as subsets of the Cartesian product A A. What
does =
A
have to do with a diagonal?
3.2.3 Denition
1. The less-than-or-equal relation on 1 is
a, b) 1 1 :
xR
b = a +x
2
and it is denoted it by
R
.
2. The greater-than-or-equal relation on 1 is
a, b) 1 1 : b
R
a and it is denoted it by
R
.
3. The less-than relation on 1 is
a, b) 1 1 : a
R
b a,=b. and it is denoted it by <
R
.
4. The greater-than relation on 1 is
a, b) 1 1 : b <
R
a and it is denoted it by >
R
.
3.2.4 Explanatory Note
1. Notice that x
2
for x 1 is non-negative, and any non-negative real can
be represented as x
2
for some x 1. So, we said that a
R
b i b is the
sum of a and some non-negative real.
2. The binary relations
R
,
R
, <
R
and >
R
are the familiar ways of com-
paring real numbers. Most often they are written without the subscript
1.
3.2.5 Denition
1. Let A 1. We dene the smaller-than-or-equal relation on A as

R
(AA) and denote it by
A
.
2. Let A 1. We dene the greater-than-or-equal relation on A as

R
(AA) and denote it by
A
.
3. Let A 1. We dene the smaller-than relation on A as
<
R
(AA) and denote it by <
A
.
4. Let A 1. We dene the greater-than relation on A as >
R
(A
A) and denote it by >
A
.
3.2.6 Explanatory Note
In the denition above you can take A to be Z
+
, N, Z, or any other nite
or innite subset of 1.
3.2.7 Exercise
Let A = 1, 2, 3, 4, 5. Make separate diagrams of binary relations
A
,
A
,
<
A
, >
A
representing them as subsets of the Cartesian product AA.
3.2.8 Denition
1. Let A be a family of sets. We dene the subset relation on A as
a, b) AA : a b and denote it by
A
.
2. Let A be a family of sets. We dene
the reversed subset relation on A as a, b) A A : a b and
denote it by
A
.
3. Let A be a family of sets. We dene
the proper subset relation on A as a, b) A A : a _ b and
denote it by _
A
.
4. Let A be a family of sets. We dene
the reversed proper subset relation on A as
a, b) AA : a _ b and denote it by _
A
.
3.2.9 Explanatory Note
It is particularly interesting to consider such relations on a powerset, i.e.

P(A)
,
P(A)
, _
P(A)
, _
P(A)
.
3.2.10 Exercise
1. Let A = T(1, 2). Make separate diagrams of binary relations
A
,
A
,
_
A
, _
A
as generalized directed graphs.
2. Let A = T(1, 2). Why is 1
A
1, 3 false?
3.2.11 Denition
1. By the divisibility relation on Z we understand the binary relation
consisting of all the ordered pairs m, n) ZZ such that
kZ
n = k m
and denote it by the mid symbol [ . The formula m[n is read m divides
n or n is a multiple of m.
2. Let k Z and k > 1. By the congruence mod k we understand the
binary relation consigning of all the ordered pairs m, n) Z Z such
that k[(n m) and denote it by
k
. The formula m
k
n is read m
is congruent to n modulo k. Instead of m
k
n one can write
m n(modk) or m=n(modk) .
3.2.12 Explanatory Note
1. According to the denition above 0[0. This does not mean that we allow
the division 0/0.
2. In the denition above the condition k[(n m) can be replaced by
k[(mn) the two conditions are equivalent.
3.2.13 Historical Remark (Optional)
The congruence modulo k was introduced in 1801 by a German mathemati-
cian Carl Friedrich Gauss.
3.2.14 Explanatory Note
A binary relation can be understood as a property of ordered pairs. For
instance the binary relation <
R
consists of these ordered pairs a, b) which
have the property that a <
R
b.
Set operations on relations 3.3
3.3.1 Explanatory Note
As binary relations are sets (of ordered pairs), we can apply to them familiar
set operations , , .
3.3.2 Denition
1. Let R
1
, R
2
be binary relations. We say that R
2
extends R
1
if R
1
R
2
.
2. Let R
1
be a binary relation. By an extension of R
1
we understand any
binary relation R
2
such that R
1
R
2
.
3.3.3 Informal Example
The binary relation isAParentOf is the union of binary relations isAMotherOf
and isAFatherOf. The binary relation isAParentOf extends the binary relation
isAMotherOf.
3.3.4 Explanatory Note
R
2
extends R
1
i for all a, b, if aR
1
b then aR
2
b.
3.3.5 Exercise
1. What is the union of isADaughterOf and isASonOf ?
2. What is the union of <
R
and =
R
?
3. What is the intersection of
R
and
R
?
4. What is the intersection of <
R
and Tot
Z
?
5. What is the dierence
R
minus =
R
?
6. What is the dierence Tot
R
minus =
R
?
7. What is the dierence Tot
R
minus <
R
?
8. Does
R
extend <
R
?
9. Does <
R
extend <
Z
?
3.3.6 Exercise
Let R
1
, R
2
be binary relations.
1. Prove: domain(R
1
R
2
) = domain(R
1
) domain(R
2
).
2. Prove: range(R
1
R
2
) = range(R
1
) range(R
2
).
3. Prove: domain(R
1
R
2
) domain(R
1
) domain(R
2
).
4. Prove: range(R
1
R
2
) range(R
1
) range(R
2
).
5. Disprove: domain(R
1
R
2
) domain(R
1
) domain(R
2
).
6. Disprove: range(R
1
R
2
) range(R
1
) range(R
2
).
7. Prove: domain(R
1
R
2
) domain(R
1
) domain(R
2
).
8. Prove: range(R
1
R
2
) range(R
1
) range(R
2
).
9. Disprove: domain(R
1
R
2
) domain(R
1
) domain(R
2
).
10. Disprove: range(R
1
R
2
) range(R
1
) range(R
2
).
3.3.7 Exercise
Let R
1
, R
2
be binary relations.
1. Prove: if R
1
R
2
then domain(R
1
) domain(R
2
).
2. Prove: if R
1
R
2
then range(R
1
) range(R
2
).
3.3.8 Denition
Let R be a binary relation and R X Y .
By the complement of R with respect to X Y we understand the bi-
nary relation (X Y ) R.
3.3.9 Convention
If the sets X and Y are known from the context we denote the complement
of binary relation R with respect to X Y by R

.
3.3.10 Exercise
1. What is the complement of ,=
R
with respect to 1 1?
2. What is the complement of
R
with respect to 1 1?
3.3.11 Exercise
Let R X X.
1. Prove: domain(R

) (domain(R))

.
2. Prove: range(R

) (range(R))

.
3. Disprove: domain(R

) (domain(R))

.
4. Disprove: range(R

) (range(R))

.
Inverse relation 3.4
3.4.1 Denition
Let R be a binary relation. By the inverse (relation) to R or
converse (relation) to R we understand the binary relation
b, a) : aRb and denote it by R
1
. As indicated by parentheses, the word
relation can be omitted in these phrases.
3.4.2 Fact
aR
1
b i bRa.
3.4.3 Informal Example
isAChildOf is the inverse relation to isAParentOf because
a isAChildOf b i b isAParentOf a, for all a, b.
3.4.4 Fact
1. domain(R
1
) = range(R).
2. range(R
1
) = domain(R).
3.4.5 Exercise
1. What is the inverse relation to isAGrandparentOf?
2. Is isAGrandsonOf the inverse relation to isAGrandfatherOf?
3. What is the inverse relation to =
R
?
4. What is the inverse relation to <
R
?
5. What is the inverse relation to the total relation on 1?
6. What is the inverse relation to the empty relation?
3.4.6 Proposition
1. (R
1
)
1
= R.
2. Let R X X. Then (R
1
)

= (R

)
1
.
3. If R
1
R
2
then R
1
1
R
1
2
.
3.4.7 Exercise
Prove the proposition above.
Relative product and composition 3.5
3.5.1 Denition
Let R
1
and R
2
be binary relations.
1. By the relative product of R
1
and R
2
we understand binary relation
a, c) :
b
aR
1
b bR
2
c and denote it by R
1
; R
2
.
2. By the relation composition of R
1
and R
2
we understand binary re-
lation a, c) :
b
aR
1
b bR
2
c and denote it by R
2
R
1
.
3.5.2 Explanatory Note
The relative product of R
1
and R
2
and the relation composition of R
1
and
R
2
are exactly the same but they are denoted dierently: R
1
; R
2
= R
2
R
1
.
Notice the dierence in the order in which R
1
and R
2
are listed.
3.5.3 Fact
The following conditions are equivalent
1. a(R
1
; R
2
)c,
2. a(R
2
R
1
)c,
3. there exists b s.t. aR
1
b and bR
2
c.
3.5.4 Informal Example
a is an grandson of c i
there exists b s.t. a is a son of b and b is a child of c.
So, isAGrandsonOf = isASonOf ; isAChildOf = isAChildOf isASonOf .
3.5.5 Exercise
1. Express the relation isAGrandmotherOf as a relative product and then as
a relation composition.
2. An uncle is either a parents brother or a husband of a parents sister.
Use relative product and union to formalize this statement.
3.5.6 Historical Remark (Optional)
Relative product of relations has been introduced by a London mathemati-
cian Augustus de Morgan (1806-1878).
3.5.7 Fact
If R
1
AB and R
2
B C then R
1
; R
2
AC and R
2
R
1
AC.
3.5.8 Exercise
Consider a xed plane P, the set L of all straight lines on P, the set T of
all triangles on P, and the set R of all rectangles on P. Let R
1
T L be
a binary relation such that tR
1
l i one of the sides of triangle t is parallel
to the line l. Let R
2
LR be a binary relation such that lR
2
r i the line
l is parallel to one of the sides of rectangle r.
1. What is R
1
; R
2
? What is R
2
R
1
?
2. What is R
2
; R
1
? What is R
1
R
2
?
3.5.9 Exercise
Let R
2
and R
3
be the binary relations on Z such that mR
2
n i n = m + 2
and mR
3
n i n = m+3. Characterize R
2
; R
3
, R
2
R
3
, R
3
; R
2
, R
3
R
2
.
3.5.10 Proposition
If R
1
and R
2
are binary relations
then (R
1
; R
2
)
1
= R
1
2
; R
1
1
and (R
2
R
1
)
1
= R
1
1
R
1
2
.
3.5.11 Explanatory Note
Let us analyze the expressions (R
1
; R
2
)
1
and R
1
2
; R
1
1
.
Assume that R
1
AB and that R
2
B C.
As R
1
; R
2
AC,
so, (R
1
; R
2
)
1
C A.
As R
1
2
C B and R
1
1
B A,
so, R
1
2
; R
1
1
C A.
It is reassuring to know that the relations on both sides of equality are
subsets of C A.
If the second expression were R
1
1
; R
1
2
it would represent a subset of
AC, while the rst expression represents a subset of CA; so the dierent
orders of relations in the two expressions is not a typographical error.
Proof
Take any c, a such that c(R
1
; R
2
)
1
a.
By the denition of the inverse relation, this is equivalent to a(R
1
; R
2
)c.
By the denition of the relative product, this is equivalent to:
there exists b such that aR
1
b and bR
2
c.
By the denition of the inverse relations, this is equivalent to:
there exists b such that bR
1
1
a and cR
1
2
b.
By the denition of the relative product, this is equivalent to: c(R
1
2
; R
1
1
)a.
3.5.12 Proposition
For any binary relations,
(R
1
; R
2
); R
3
= R
1
; (R
2
; R
3
),
(R
3
R
2
) R
1
= R
3
(R
2
R
1
).
3.5.13 Exercise
1. What is
Z
;
Z
?
What is
Z
; <
Z
?
What is <
Z
; <
Z
?
What is <
Z
; >
Z
?
2. Prove: If R AB then R;
B
= R =
A
; R.
3. Assume that R is a binary relation.
Prove:
domain(R)
R; R
1
.
Disprove: R; R
1

domain(R)
.
Formulate analogous statements about the range and tell if they are true.
Powers 3.6
3.6.1 Denition
Let R be a binary relation. We dene recursively:
R
1
= R,
R
n+1
= R
n
R, for any positive integer n.
By the n-th power of R we understand R
n
.
3.6.2 Exercise
Let Family = adam, betty, celia, dan, eva, fred, greg, henry, ian
We dene a binary relation is-a-parent-of over Family as
adam, betty), adam, celia), betty, dan), celia, eva), celia, fred), eva, greg),
eva, henry), henry, ian).
This means adam is-a-parent-of betty and adam is-a-parent-of celia, etc.
Find the powers is-a-parent-of
n
for n = 1, 2, 3, 4, 5 and explain what family
relationships these powers represent.
3.6.3 Exercise
Describe the n-th power of <
Z
for arbitrary n 1.
3.6.4 Proposition
Let R be a binary relation and m, n any positive integers. Then:
1. R
m+n
= R
m
R
n
= R
n
R
m
.
2. R
mn
= (R
m
)
n
= (R
n
)
m
.
3.6.5 Exercise
Notice that in the proposition above, we do not allow m or n to be 1.
Demonstrate that the proposition above would not be true for such values.
More specically, disprove R
2
R
1
= R
1
.
Chapter 4
Functions
Contents
4.1 Basic denitions . . . . . . . . . . . . . . . . . . . . 84
4.2 One-to-one and onto functions . . . . . . . . . . . 87
4.3 Restrictions and extensions . . . . . . . . . . . . . 89
4.4 Important functions . . . . . . . . . . . . . . . . . 90
4.5 Composition . . . . . . . . . . . . . . . . . . . . . . 91
Denition . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Function composition versus relation composition . . . 92
4.6 Inverse function . . . . . . . . . . . . . . . . . . . . 93
4.7 Permutations . . . . . . . . . . . . . . . . . . . . . 94
4.8 Mappings (Optional) . . . . . . . . . . . . . . . . . 96
Basic denitions 4.1
4.1.1 Denition
1. By a function we understand any binary relation f such that

x,y
1
,y
2
xfy
1
xfy
2
y
1
=y
2
.
2. Let f be a function. By an argument of f we understand
any x domain(f).
3. Let f be a function. Let x domain(f). By the value of f at x we
understand the unique y such that xfy and denote it by f(x) . (Con-
sequently, we will write y=f(x) or f(x)=y instead of xfy.)
84
4. Let f be a function. We say that f maps x to y and write f : x y
or x
f
y if f(x)=y.
5. By a function on X or a function dened on X we understand any
function f such that domain(f) = X.
6. By a function with values in Y or a function into Y
or a function to Y we understand any function f such that
range(f) Y .
7. Let f be a function. We say that f is from X to Y and write
f : X Y or X
f
Y if domain(f)=X and range(f) Y .
4.1.2 Example
1. Consider f=0, 1), 1, 0), 2, 3).
f is a function on 0, 1, 2 with values in Z,
or a function from 0, 1, 2 to Z,
symbolically f : 0, 1, 2 Z.
It is also a function with values in 1, 0, 3
or a function from 0, 1, 2 to 1, 0, 3,
symbolically f : 0, 1, 2 1, 0, 3.
2. Instead of using the ordered pair notation, the function f above can be
dened as follows. We dene f : 0, 1, 2 Z such that f(0) =1,
f(1)=0, f(2)=3. Alternatively, the maps to notation can be used:
f : 0 1, f : 1 0, f : 2 3.
3. The function f above could be also dened by means of a formula, as
follows. Dene f : 0, 1, 2 Z such that f(x)=x
2
1.
4. Consider g : 0, 1, 2, 3 Z such that g(x)=x
2
1. Although g and
f above are dened by the same formula they are dierent functions
(because they have dierent domains).
4.1.3 Informal Example
A binary relation child-mother (consisting of some ordered pairs c, m) where
m is a mother and c is her child) is a function because every child has
exactly one mother; we can rename this relation to motherOf and write
m = motherOf(c).
On the other hand, a binary relation mother-child (consisting of some
ordered pairs m, c) where m is a mother and c is her child) is usually not a
function because a mother may have more than one child.
It is however possible to dene a binary relation mother-children (con-
sisting of some ordered pairs m, C) where m is a mother and C is the set
of all her children); this relation is a function.
4.1.4 Explanatory Note
Consider the following conditions concerning a set Persons and a function
motherOf:
1. Persons is a nite set,
2. motherOf is a function on Persons,
3. motherOf is into Persons,
4. For every p Persons,
p,=motherOf(p), and
p,=motherOf(motherOf(p)), and
p,=motherOf(motherOf(motherOf(p))),
etc.
It is not possible to dene a set Persons and a function motherOf which
satisfy these four conditions. For every three of these conditions it is however
possible to dene a set Persons and a function motherOf which satisfy them.
The same problem occurs with the notion of the supervisor of in a
company where there is (of course) a nite number of employees, and al-
most every employee has supervisor and the supervisor is unique. To model
such a situation one often makes supervisorOf a function from Employees to
Employees, such that e = supervisorOf(e) for any employee e who does not
have a supervisor.
4.1.5 Explanatory Note
Given a binary relation represented as a nite set of ordered pairs you can
check if it is a function as follows. If you nd at least one object which
occurs as the rst component in two dierent ordered pairs, the relation is
not a function. Otherwise, the relation is a function.
4.1.6 Programming Exercise (Extra credit)
Write a program which allows the user to dene a nite binary relation over
Z (by entering integers which belong to every ordered pair belonging to the
relation) and displays a message announcing if this relation is a function or
not. The program should also display two sets: domain(R) and range(R).
4.1.7 Explanatory Note
The attempt to dene a function from into Z by means of the formula
f(m/n) = m + n where m and n are integers is not correct. According to
this formula, f(1/2) = 1 +2 = 3 and f(2/4) = 2 +4 = 6. As 1/2 = 2/4 but
3,=6 the requirement that
x,y
1
,y
2
xfy
1
xfy
2
y
1
=y
2
is not satised.
On the other hand the following correctly denes a function. Dene a
function g : Z such that g(0)=1 and g(m/n) = m + n where m and
n are integers, m,=0, n > 0, m and n do not have a common divisor greater
than 1.
4.1.8 Exercise
1. Show that the attempt to dene a function from to by means of the
formula f(m/n) = n/m where m and n are integers is not correct.
2. Show that the attempt to dene a function from
+
to
+
by means of
the formula f(m/n) = n/m where m and n are integers is correct. (
+
stands for the set of all positive rational numbers.)
4.1.9 Fact (Vertical line tests)
Let R be a binary relation over 1.
1. R is a function i every straight line parallel to the Y axis intersects the
graph of R in no more than one point.
2. R is a function on 1 i every straight line parallel to the Y axis intersects
the graph of R in exactly one point.
4.1.10 Exercise
Assume that A is a set with m elements and B is a set with n elements.
How many functions from A to B are there?
One-to-one and onto functions 4.2
4.2.1 Denition
1. Let f be a function and let B be a set. We say that f is onto B or
f is a surjection onto B if range(f)=B.
2. Let f be a function and let A, B be sets. We say that f is from A onto B
and write f : A
onto
B if f : A B and f is onto B.
3. Let f be a function. We say that f is one-to-one or f is 1-1 or
f is an injection if f(a)=f(b) implies a=b, for any a, b domain(f).
4. We write f : A
1-1
B if f : A B and f is one-to-one function.
5. Let f : A B. We say that
f is a one-to-one correspondence between A and B or
f is a 1-1 correspondence between A and B or
f is a bijection between A and B and write f : A
1-1, onto
B if f is
both one-to-one and onto B. In the three expressions dened above
we can also say from A to B or from A onto B instead of between
A and B.
4.2.2 Informal Example
Consider a function motherOf which for every person in its domain assigns
that persons mother. motherOf is usually not 1-1 because two dierent
persons may have the same mother.
4.2.3 Exercise
Show a one-to-one correspondence between 1, 2, 3 and 0, 2, 6.
4.2.4 Explanatory Note
Let f : X Y .
1. f is onto Y i
yY

x
f(x) = y.
2. f is 1-1 i
x
1
,x
2
X
f(x
1
) = f(x
2
) x
1
= x
2
.
3. f is a 1-1 correspondence between X and Y i f is a set of ordered pairs
x, y) where x X and y Y , such that every element of X occurs as
the rst component of these pairs exactly once, and every element of Y
occurs as the second component of these pairs exactly once.
4.2.5 Explanatory Note (Horizontal line tests)
Let f : 1 1. Then,
1. f is 1-1 i every horizontal line intersects the graph of f in at most one
point.
2. f is onto R i every horizontal line intersects the graph of f in at least
one point.
3. f is a 1-1 correspondence between R and R i every horizontal line in-
tersects the graph of f in exactly one point.
4.2.6 Example
1. The function f(n) = 3n + 1 from Z to Z is one-to-one but not onto Z
(because there is no n Z such that f(n)=2).
2. There is no function from 1, 2, 3 onto 1, 2, 3, 4.
3. There is no one-to-one function from 1, 2, 3, 4 to 1, 2, 3.
4.2.7 Example
ASCII code is a 1-1 correspondence between the set of, so called, ASCII
characters and the integers in the range 0 .. 2
7
1, i.e 0..127. (ASCII char-
acters include a-z,A-Z,0-9, some punctuation marks and symbols, as well as
some special characters which do not have graphic representation but which
can be communicated by the user to the computer.)
Unicode is a 1-1 function from a set of most commonly used text charac-
ters of major languages of the world and various technical and mathematical
symbols into the set of integers in the range 0 .. 256 2561, i.e. 0 .. 16
4
1,
i.e. 0 .. 2
16
1, i.e. 0..65,535. The Unicode is an extension of the ASCII
code. The Unicode is not onto 0..65,535.
UTF-16 is a 1-1 function from the set of all historic and contemporary
characters and symbols know to humanity into the set of integers in the
range 0 .. 16 256 256 1, i.e. 0 .. 16
5
1, i.e. 0 .. 2
20
1, i.e. 0..1,048,575.
UTF-16 is an extension of the Unicode.
4.2.8 Proposition
Let A be a nite set and f : A A. Then,
f : A
onto
A i f : A
1-1
A
4.2.9 Exercise
1. Prove: Every one-to-one correspondence between 1, 2, 3 and 0, 2, 6 is
one-to-one.
2. Prove: Every one-to-one function from 1, 2, 3 to 0, 2, 6 is a one-to-one
correspondence between 1, 2, 3 and 0, 2, 6.
3. Prove: Every one-to-one function f is a one-to-one correspondence be-
tween domain(f) and range(f).
4. Disprove: There exists a one-to-one function from 1, 2, 3 to 0, 2, 6, 10
which is a one-to-one correspondence between 1, 2, 3 and 0, 2, 6, 10.
5. Characterize all pairs of nite sets A, B such that any function
f : A B is one-to-one i f is a one-to-one correspondence between A
and B.
4.2.10 Exercise
Show that in the proposition above the assumption that A is nite is essen-
tial.
Restrictions and extensions 4.3
4.3.1 Denition
Let f : A B be a function and let A
0
A. By the restriction of f to A
0
we understand f (A
0
B) and denote it by f A
0
.
4.3.2 Fact
1. If f : A B and A
0
A then f A
0
is a function and
f A
0
: A
0
B.
2. Let f be a function. If f is a one-to-one then f A
0
is one-to-one.
4.3.3 Exercise
1. Disprove: If f : A
onto
B and let A
0
A then f A
0
is onto B.
2. Disprove: If f : A
onto
B and let A
0
_ A then f A
0
is not onto B.
4.3.4 Denition
Let A
0
A and g : A
0
B and f : A B. We say that
f is an extension of g or f extends g if f(a)=g(a) for every a A
0
.
4.3.5 Explanatory Note
A
0


id
A
0
//
fA
0

@
@
@
@
@
@
@
@
A
f

a

id
A
0
//

fA
0

A
A
A
A
A
A
A
A
a
_
f

B f(a)
id
A
0
is a function on A
0
such that id
A
0
(a) = a, for any a A
0
;
A
0
A.
4.3.6 Fact
1. f is an extension of g i g f.
2. f is an extension of g i g = f domain(g).
3. f is an extension of f A, for any A.
Important functions 4.4
4.4.1 Denition
Let A be a set. By the identity function on A we understand the func-
tion on A denoted by id
A
such that id
A
(x)=x for every x A.
4.4.2 Explanatory Note
Whenever A B, we can write id
A
: A
1-1
B.
4.4.3 Denition
Let Abe set and let c be any object. By the constant function on A equal to c
we understand the function f on A such that f(a) = c for any a A.
4.4.4 Denition
Let B A. By the characteristic function of B with respect to A we
understand the function from A to 0, 1 dened as follows:
x 1 if x B,
x 0 if x , B.
4.4.5 Convention
If the set A is known from the context, the characteristic function of B with
respect to A is denoted by
B
.
4.4.6 Explanatory Note
is a lower-case Greek letter, pronounced chi.
4.4.7 Exercise
1. Disprove:
AB
=
A
+
B
,
Disprove:
AB
=
A

B
,
Disprove:
A
=
A
.
2. Show:

AB
=
A

B
,

AB
=
A

AB
,

A
= 1
A
.
3. Dene an operation such that
AB
=
A

B
.
4. Complete: the characteristic function of B with respect to A is onto 0, 1
i ...
4.4.8 Exercise
Find all sets A such that the characteristic function of any subset of A with
respect to A is a constant function.
4.4.9 Explanatory Note
The empty relation, , is a function on , and we can write :
1-1
A, for
any set A.
4.4.10 Denition
Let A
0
, ...A
n
be sets and let i n.
By the i-th projection from A
0
A
1
... A
n
we understand the func-
tion
i
: A
0
A
1
... A
n
onto
A
i
dened as
i
: a
0
, ..., a
i
, ..., a
n
) a
i
.
4.4.11 Explanatory Note
Let A and B be sets.
The 0-th projection from AB is the function

0
: AB A dened as
0
: a, b) a.
The 1-st projection from AB is the function

1
: AB B dened as
1
: a, b) b.
Composition 4.5
Denition
4.5.1 Denition
Let f and g be functions such that range(f) domain(g).
By the function composition of f and g we understand the unique func-
tion, denoted g f , which has the same domain as f and such that
(g f)(a)=g(f(a) for every a domain(f).
4.5.2 Explanatory Note
The reversed order of components has been chosen in the notation of function
composition because it corresponds to the application order:
(g f)(a)=g(f(a).
4.5.3 Example
Consider f : 1 1 dened as f(x)=2x.
Consider g : 1 1 dened as g(x)=x +1.
We have (f g)(x)=f(g(x))=2(x +1) = 2x +2.
We have (g f)(x)=g(f(x))=2x +1.
Notice that f g,=g f.
4.5.4 Informal Example
Consider a function motherOf which to every person in its domain assigns
that persons mother. Consider also a function fatherOf which to every
person in its domain assigns that persons father and whose domain contains
the range of motherOf. The function composition of motherOf and fatherOf
is written as fatherOf motherOf and we have (fatherOf motherOf)(x) =
fatherOf(motherOf(x)), so this composition assigns to every person in its
domain that persons maternal grandfather.
4.5.5 Fact
Let f, g be functions such that function composition g f is dened. Then:
1. domain(g f) = domain(f)
2. range(g f) range(g)
4.5.6 Exercise
Let f, g be functions such that function composition g f is dened.
1. Disprove: domain(g f) = domain(g)
2. Disprove: range(g f) range(g)
Function composition versus relation composition
4.5.7 Convention
Depending on the context we use the phrase composition of f and g and
the symbol to mean either the relation composition or function compo-
sition. The phrase composition of relations, g f, means the relation
composition. The phrase composition of functions, g f, means the func-
tion composition. Also, if function notation (prex notation: f(x)=y and
g(y)=z) is used in the context then the phrase composition of f and g
and notation g f mean the function composition. If relation notation
(inx notation: xfy and ygz) is used in the context then the phrase com-
position of f and g and notation g f mean the relation composition.
In cases where relation composition is needed side by side with the function
composition, the notation f; g can be used for relation composition of f and
g.
4.5.8 Proposition
Let f and g be functions such that range(f) domain(g).
then the function composition of f and g is equal to the relation composition
of f and g:
g f = g f
where the left hand side is the function composition of f and g,
and the right hand side is the relation composition of f and g.
4.5.9 Explanatory Note
Relation composition is dened, no matter what the two component rela-
tions are (but the resulting relation can be empty). In contrast, function
composition of functions f and g is dened only if range(f) domain(g).
This means, function composition of f and g is not dened exactly in the
following cases:
1. f is not a function, or
2. g is not a function, or
3. f and g are functions but range(f) _ domain(g).
Assuming that f and g are binary relations, in all these cases the relation
composition of f and g is dened, and in case 3 its result is a function!
4.5.10 Exercise
Find binary relations R
1
, R
2
such that neither of them is a function but
their composition is a function.
4.5.11 Exercise
1. Prove: if function composition g f= then f=.
2. Disprove: if relation composition S R= then R= or S=.
Inverse function 4.6
4.6.1 Denition
Let f be a one-to-one function. By the inverse function to f we under-
stand f
1
(i.e. the inverse relation to f).
4.6.2 Example
Consider a function motherOf which to every person in its domain assigns
that persons mother. This function is usually not 1-1 (as two dierent
persons may have the sam mother), so the inverse function to motherOf is
not dened. The inverse relation to motherOf exists and could be called
mother-child relation because it consists of ordered pairs m, c) where m is
the mother of c. mother-child is not a function.
4.6.3 Explanatory Note
If f is not a 1-1 function, then the inverse function is not dened.
If f : A
1-1
B is not onto B then f
1
is dened, however B is not the
domain of f
1
; we have f
1
: range(f)
1-1, onto
A.
4.6.4 Fact
1. If f is a one-to-one function then f
1
is a function. Moreover f
1
is
one-to-one.
2. If function f is not one-to-one then the inverse relation f
1
is not a
function.
4.6.5 Exercise
1. Disprove: If f : A
1-1
B then f
1
: B A.
2. Prove: If f : A
1-1, onto
B then f
1
: B A.
4.6.6 Exercise
Assume that f is a function and g is the inverse relation to f.
1. Prove: If g is a function then g is the inverse function to f.
2. Prove: If the inverse function to f is dened then g is the inverse function
to f.
Permutations 4.7
4.7.1 Denition
Let A be a set. By a permutation of A we understand any bijection from
A to A.
4.7.2 Explanatory Note
Let A be a nite set. Choose an order to list the elements of A. Now,
any permutation of A can be viewed as a sequence which contains all the
elements of A without repetitions.
For instance, consider the set A = 1, 2, 3, 4. We choose the order 1, 2,
3, 4 to list the elements of A. Consider the permutation consisting of the
following pairs:
1 3,
2 1,
3 2,
4 4
Notice that we listed the pairs of the permutation so that their rst com-
ponents are in our chosen order. Now, the permutation can be represented
as the sequence of the second components from our list of pairs: 3, 1, 2, 4.
For the same set and chosen order of its elements, the sequence 4, 1, 2, 3
represents the permutation:
1 4,
2 1,
3 2,
4 3
4.7.3 Exercise
0. List all the permutations of .
1. List all the permutations of 1.
2. List all the permutations of 1, 2.
3. List all the permutations of 1, 2, 3.
4. List all the permutations of 1, 2, 3, 4.
4.7.4 Programming Exercise (Extra credit)
Write a program which asks the user to input a natural number n and then
prints all the permutations of the set k Z
+
: k < n.
4.7.5 Fact
1. id
A
is a permutation of A.
2. If f, g are permutations of A then g f is a permutation of A.
3. If f is a permutation of A then f
1
is dened and it is a permutation of
A.
4.7.6 Proposition
There number of permutations of a set with n elements is n! .
4.7.7 Proposition
Let f, g, h : A
1-1, onto
A. Then
1. h (g f) = (h g) f.
2. id
A
f = f.
3. f
1
f = id
A
.
4.7.8 Proposition
Let f, g, h, i : A
1-1, onto
A. Then
1. h (g f) = (h g) f.
2. f id
A
= f.
id
A
f = f.
3. f
1
f = id
A
.
f f
1
= id
A
.
4. id
1
A
= id
A
.
5. If g f = h f then g = h.
If f g = f h then g = h.
6. If f i = f then i = id
A
.
If i f = f then i = id
A
.
7. If g f = id
A
then g = f
1
.
If f g = id
A
then g = f
1
.
8. (g f)
1
= f
1
g
1
.
9. (f
1
)
1
= f.
10. If g = f
1
then f = g
1
.
4.7.9 Exercise
Let f : A
1-1, onto
A.
Disprove: If f
1
= f, then f = id
A
.
Mappings (Optional) 4.8
4.8.1 Denition
1. By a mapping we understand any triple f, X, Y ) where f is a function
from X to Y .
2. Let f = f, X, Y ) be a mapping. By the domain of f we understand
the set X.
3. Let f = f, X, Y ) be a mapping. By the codomain of f we understand
the set Y .
4.8.2 Convention
If a set Y containing the range of a function f is known from the context
we will refer to f as a mapping, meaning the mapping f, domain(f), Y ).
Often, we will refer to f : X Y as a mapping, meaning the mapping
f, X, Y ).
4.8.3 Explanatory Note
The notion of codomain applies to mappings but not functions. The notion
of range has been dened for binary relations and functions. One could
dene the range of a mapping as the range of that mappings function.
4.8.4 Example
Consider f : Z Z dened as f(n)=n
2
.
Consider g : Z 1 dened as f(n)=n
2
.
The functions f and g are equal, f=g.
The mappings f and g are not equal: f, Z, Z) is not the same as g, Z, 1)
because they have dierent codomains.
4.8.5 Denition
1. Let f : A B be a mapping. We say that mapping f is onto or
mapping f is a surjection if range(f)=B.
2. Let f : A B be a mapping. We say that mapping f is an injection
or mapping f is one-to-one if function f is one-to-one.
3. Let f : A B be a mapping. We say that mapping f is a bijection
or mapping f is a one-to-one correspondence if f it is both one-to-
one and onto.
4.8.6 Explanatory Note
The reader should compare the denition above with the analogous deni-
tion concerning functions. Notice that in the case of mappings you just say
f is onto or f is a surjection while in the case of functions you need to
specify the range: f is onto Y or f is a surjection onto Y . The same
concerns bijections or one-to-one correspondences.
4.8.7 Denition
Let A be a set. By the identity mapping on A we understand the map-
ping id
A
: A A.
4.8.8 Denition
Let f : A B and g : B C be mappings. By the
composition of mappings f and g we understand the mapping
g f : A C.
4.8.9 Explanatory Note
Notice the diernce between composition of mappings and composition of
functions. The composition of mappings f : A B and g : B

C is
not dened unless B=B

. The composition of functions f : A B and


g : B

C is dened if B B

.
Chapter 5
Partitions and equivalence
relations
Contents
5.1 Partitions . . . . . . . . . . . . . . . . . . . . . . . . 98
5.2 Reexivity, symmetry, transitivity . . . . . . . . . 99
5.3 Equivalence relations versus partitions . . . . . . 103
Partitions 5.1
5.1.1 Denition
By a disjoint family of sets we understand any family of sets in which
every two dierent sets are disjoint.
5.1.2 Exercise
1. Give an example of a disjoint family of sets.
2. Give an example of a family of sets which is not a disjoint family of sets.
3. Let F be a family of sets. Call F an incorrectly-dened-disjoint-family-
of-sets if every two sets in F are disjoint. There are just two incorrectly-
dened-disjoint-families-of-sets. What are they?
5.1.3 Denition
Let A be a set. By a partition of A we understand a family P of sets such
that:
1.

P = A,
2. P is a disjoint family of sets, and
98
3. , P.
5.1.4 Example
For i = 0, 1, 2, let X
i
= n :
kZ
n = 3k +i. The family X
0
, X
1
, X
2
is a
partition of Z.
5.1.5 Exercise
1. List all the partitions of the set 1, 2, 3.
2. List all the partitions of the set 1, 2.
3. List all the partitions of the set 1.
4. List all the partitions of the set .
Reexivity, symmetry, transitivity 5.2
5.2.1 Denition
Let A be a set and let R be a binary relation.
1. R is reexive on A if
aA
aRa.
2. R is symmetric on A if
a,bA
aRb bRa.
3. R is transitive on A if
a,b,cA
aRb bRc aRc.
5.2.2 Example
1. 1, 1), 2, 2) is reexive on 2 and on 1, 2 but not on 1, 2, 3.
2. =
Z
is reexive on N and on Z but not on 1.
3. 1, 2) is symmetric on 1 but not on 1, 2.
4. 1, 2), 2, 1) is symmetric on every set.
5. =
Z
is symmetric on every set.
6. 1, 2), 2, 3) is transitive on 1, 2 but not on 1, 2, 3.
7. 1, 2), 2, 3), 1, 3) is transitive on every set.
8. <
Z
is transitive on every set.
5.2.3 Proposition
Let R be a binary relation. Then the following conditions are equiva-
lent:
1.
a,b
aRb bRa,
2.
a,beld(R)
aRb bRa,
3.
a,bA
aRb bRa, for every set A.
5.2.4 Proposition
Let R be a binary relation. Then the following conditions are equiva-
lent:
1.
a,b,c
aRb bRc aRc,
2.
a,b,celd(R)
aRb bRc aRc,
3.
a,b,cA
aRb bRc aRc, for every set A.
5.2.5 Exercise
1. Show that if a binary relation R is reexive on A and if A
1
A then R
is also reexive on A
1
.
2. Show that if R is binary relation and eld(R) _ A then R is not reexive
on A.
5.2.6 Denition
Let R be a binary relation.
1. R is symmetric if
a,b
aRb bRa.
2. R is transitive if
a,b,c
aRb bRc aRc.
5.2.7 Explanatory Note
The reader should analyze this denition in the context of all the preced-
ing material of this section. Notice that Denition 5.2.1 denes notions of
reexivity, symmetry and transitivity particular to a set A, or as math-
ematicians say, local. Denition 5.2.6 denes analogous absolute or
global notions. Propositions 5.2.3 and 5.2.4 explain the meaning of ab-
solute/global symmetry and transitivity, and justify the use of words ab-
solute and global. As explained in the remark and exercise above there
is no notion of absolute/global reexivity. The only non-local reexivity
condition which is not contradictory is
aeld(R)
aRa but it does not quite
match the strength of notions of absolute/global symmetry or transitivity;
for this reason we should rather think about it as semi-absolute/semi-global
reexivity.
There are many cases in mathematics which are concerned with the in-
terplay of particular/local notions and absolute/global notions. The reader
should learn to identify such situations even if the words particular, lo-
cal, absolute, global are not used explicitly in the denitions. This is
useful for developing a mathematical way of thinking, and it will let you
understand mathematics better.
5.2.8 Denition
Let R be a binary relation. R is reexive if
aeld(R)
aRa.
5.2.9 Informal Example
1. Consider relation isASiblingOf consisting of ordered pairs s, p) where p
is a person and s is that persons sibling. This relation is not reexive,
it is symmetric and it is not transitive.
2. Consider relation isAnAncestorOf consisting of ordered pairs a, p) where
p is a person and a is that persons ancestor. This relation is not reexive,
not symmetric but it is transitive.
5.2.10 Exercise
Let A be a set and let R be a binary relation.
1. Prove: If R is reexive on A then R (AA) is reexive.
2. Prove: If R is symmetric on A then R (AA) is symmetric.
3. Prove: If R is transitive on A then R (AA) is transitive.
5.2.11 Proposition
Let A is a set with n elements. Then there are 2
n(n1)
relations over A
which are reexive on A.
Proof
The number of relations over A which are reexive on A is the same as
the number of subsets of (A A) a, a) : a A. As this set contains
n
2
n = n(n 1) elements, the number of its subsets and the number of
relations in question is 2
n(n1)
.
5.2.12 Exercise
Assume that A is a set with n elements.
1. How many binary relations over A are there?
2. How many binary relations over A are reexive on A?
3. How many binary relations over A are not reexive on A?
4. How many binary relations over A are symmetric?
5. How many binary relations over A are not symmetric?
6. How many binary relations over A are reexive on A and symmetric?
7. How many binary relations over A are reexive on A and not symmetric?
8. How many binary relations over A are not reexive on A and symmetric?
9. How many binary relations over A are not reexive on A and not sym-
metric?
5.2.13 Exercise
Consider binary relations =
Z
, ,=
Z
, <
Z
, >
Z
,
Z
,
Z
, Tot
Z
, the empty relation
and the relation [ of divisibility. For any of these relations, check if it
is reexive on , reexive on N, reexive on Z, reexive on 1, symmetric,
transitive.
5.2.14 Programming Exercise (Extra credit)
Write a program which if given a (small) natural number n outputs the
number of all relations over an n-element set which are transitive.
5.2.15 Proposition
For any integer k > 1, congruence modk,
k
, is reexive on Z, symmetric
and transitive.
Proof
Let k be a xed integer greater than 1.
We will show only transitivity, leaving the remaining parts of the proof for
the reader.
Take any x, y, z such that x
k
y and y
k
z.
Goal: x
k
z.
By the denition of congruence modk, we have:
y x = m k for some m Z and
z y = n k for some n Z.
By adding these equations we obtain:
z x = (m+n) k for some m, n Z.
So, z x = l k for some l Z.
So, x
k
z, by the denition of congruence modk.
5.2.16 Exercise
Prove: The following conditions are equivalent.
1. R is reexive on A.
2. R
1
is reexive on A.
3.
A
R.
4.
A
R
1
.
5.
A
R R
1
.
5.2.17 Exercise
1. Prove: R is reexive on A i R
1
is reexive on A.
2. Prove: R is symmetric i R
1
is symmetric.
3. Prove: R is transitive i R
1
is transitive.
4. Prove: If R is a binary relation over A then
R is symmetric i (AA) R is symmetric.
5.2.18 Exercise
Let R be a binary relation over A.
1. Prove: R is symmetric i (AA) R is symmetric.
2. Prove: R is symmetric i R = R
1
.
3. Prove: R is transitive i R R R.
5.2.19 Exercise
1. Prove: If R
1
and R
2
are transitive relations then R
1
R
2
is transitive.
2. Disprove: If R
1
and R
2
are transitive relations then R
1
R
2
is transitive.
3. Prove: If R is a transitive relation and n > 0 then R
n
is transitive.
5.2.20 Exercise
Prove: If a binary relation R over A is reexive on A then
domain(R)=range(R)=eld(R)=A.
5.2.21 Exercise
1. Prove: If a binary relation R is symmetric on A and B A then R is
symmetric on B.
2. Disprove: If a binary relation R is symmetric on A and A B then R is
symmetric on B.
5.2.22 Exercise
R is weakly transitive if
a,b,c
aRb bRc aRc a=c.
For instance, the relation isASiblingOf is not transitive but it is weakly tran-
sitive.
1. Prove: If R is transitive then R is weakly transitive.
2. Disprove: If R is weekly transitive then R is transitive.
3. Prove: R is weakly transitive i R is transitive.
4. Prove: If R is weakly transitive and reexive then it is transitive.
Equivalence relations versus partitions 5.3
5.3.1 Denition ()
Let A be a set.
By an equivalence (relation) on A we understand any binary relation
R that is reexive on A, symmetric on A, and transitive on A. As indicated
by parentheses, the word relation can be omitted.
5.3.2 Historical Remark (Optional)
Notion of equivalence relation was introduced by G. Frege in 1884.
5.3.3 Example
1. Let A be any set and f be any function on A. Consider the following
relation over A: xRy i f(x) = f(y). R is an equivalence on A. This re-
lation is reexive on A, symmetric and transitive. So, it is an equivalence
on A.
2. Consider the following relation on a set of people. Person
1
is related to
Person
2
if they have birthday on the same day of a year but not necessarily
in the same year.
This relation could be dened using the method from point 1: consider
the function f which with every person associates that persons birthdate
involving only month and day of the month.
3. Consider the following relation on a set of people. Person
1
is related to
Person
2
if they can speak the same language.
This relation is not an equivalence because it is not transitive consider
this situation: Adam can speak only English, Betty can speak English and
Spanish, Charles can speak only Spanish. Also notice that an attempt to
dene this relation using the method from point 1 fails because a person
can speak a language is not a function on the set of people there is a
person who can speak more than one language.
4. =
A
is an equivalence on A.
This example also could be viewed as a particular case of the method of
dening an equivalence from point 1: take the function f which is id
A
.
5. Tot
A
is an equivalence on A.
This example also could be viewed as a particular case of the method
of dening an equivalence from point 1: take the function f which is a
constant function on A.
6. If sets A, B are disjoint then Tot
A
Tot
B
is an equivalence on A B.
7. If A
i
: i I is a disjoint family of sets then

iI
Tot
A
i
is an equivalence
on

iI
A
i
.
8. 0, 0),
1, 1), 2, 2), 1, 2), 2, 1),
3, 3), 4, 4), 5, 5), 3, 4), 4, 3), 3, 5), 5, 3), 4, 5), 5, 4)
is an equivalence relation on 0, 1, 2, 3, 4, 5.
5.3.4 Exercise
1. Consider arbitrary disjoint sets A, B and relation R = Tot
A
Tot
B
. Dene
by an explicit formula a function f on A B such that f(x) = f(y) i
xRy.
2. Disprove: If sets A, B are not disjoint then Tot
A
Tot
B
is not an equiv-
alence on A B.
3. Complete: Tot
A
Tot
B
is an equivalence on AB i sets A, B are disjoint
or ...
5.3.5 Explanatory Note
The notion of equivalence relation should not be confused with the logical
connective of equivalence or metalogical equivalence . However, there
is a connection between them: the binary relation P, Q) FormForm :
P Q is the same as P, Q) Form Form : P Q and it is an
equivalence relation on the set of all rst-order formulas.
5.3.6 Explanatory Note
Notice that while saying that a relation is an equivalence it can be important
to specify the set this relation is an equivalence on; for instance =
Z
is an
equivalence on N and on Z but not on 1.
5.3.7 Exercise
Prove: If a binary relation R over A is an equivalence on A then domain(R)=
range(R)=eld(R)=A.
5.3.8 Denition
By an equivalence (relation) we understand any binary relation R that
is an equivalence on eld(R).
5.3.9 Exercise
Consider binary relations =
Z
, ,=
Z
, <
Z
, >
Z
,
Z
,
Z
, Tot
Z
, , [,
k
for k > 1.
For any of these relations, check if it is an equivalence on Z.
5.3.10 Denition
Let R be an equivalence relation on A and let a A. We dene
the equivalence class of R on A determined by a as a

A : aRa

.
5.3.11 Convention
If A is known from the context, we will write [a]
R
to denote the equivalence
class of R on A determined by a. If both A and R are known from the
context, we will write just [a] .
5.3.12 Denition
Let R be an equivalence relation on A.
1. Let E be an equivalence class of R on A (determined by some element)
and let a A.
a is called a representative of the equivalence class E of R on A
if E = [a]
R
.
2. We dene the quotient set of A by R as A/R = [a]
R
: a A.
5.3.13 Informal Example
Consider the relation is-of-the-same-color-as which is an equivalence relation
on the set of all crayons in Toms box. Consider one particular crayon c.
The equivalence class [c] consists of all the crayons in Toms box which are
of the same color as c.
5.3.14 Explanatory Note
1. The equivalence class of R on A determined by a, is the set of all elements
in A which are related to a by R. The quotient of A by R is a family of
all equivalence classes of R.
2. Of course a is a representative of the equivalence class [a]
R
. We will see
that if b [a]
R
then [a]
R
= [b]
R
. Because of this fact, any b [a]
R
is a
representative of [a]
R
.
5.3.15 Exercise
Prove: a [a].
5.3.16 Exercise
1. Describe equivalence classes of congruence mod 2 determined by 0, 1,
2, 3, ... How many dierent equivalence classes are there? Are they
pairwise disjoint? Is the family of these equivalence classes a partition of
Z? Answer similar questions in the case of congruence mod 3. Answer
similar questions in the case of congruence mod k for arbitrary integer
k > 1.
2. Describe equivalence classes of =
Z
. Is the family of these equivalence
classes a partition of Z?
3. Describe equivalence classes of Tot
Z
. Is the family of these equivalence
classes a partition of Z?
4. Is the empty relation an equivalence on ? How many equivalence classes
does this relation have? Is the family of these equivalence classes a par-
tition of ?
5.3.17 Proposition
Let R be an equivalence relation on A. Then the following conditions are
equivalent:
1. aRb
2. bRa
3. a [b]
4. b [a]
5. [a] [b],=
6. [a] = [b]
Proof
6 5
Assume [a] = [b].
As a [a] we also have a [b] and consequently [a] [b],=.
5 1
Assume [a] [b],=.
So, there exists c [a] [b].
So, c [a] and c [b].
So, aRc and bRc.
By symmetry of R we obtain cRb.
By transitivity of R we obtain aRb.
1 4
Assume aRb.
So, b [a].
4 2
Assume b [a].
So, aRb.
By symmetry of R we obtain bRa.
2 3
Assume bRa.
So, a [b].
3 6
Assume a [b].
So, bRa and by symmetry also aRb.
In order to show that [a]
=
[b] it is enough to show that aRc i bRc, for
any c.
First we will show the implication to the right:
assume aRc; by transitivity we obtain bRc.
Now we will show the implication to the left:
assume bRc; by transitivity we obtain aRc.
5.3.18 Theorem
Let A be a set.
Given any equivalence relation R on A, dene P
R
= A/R.
Given any partition P of a set A, dene binary relation R
P
as
aR
P
b i
BP
a, b B.
Then the following conditions hold.
1. If R is an equivalence on A then P
R
is a partition of A.
2. If P is a partition of A then R
P
is an equivalence on A.
3. If R is an equivalence on A then R
P
R
= R.
4. If P is a partition of A then P
R
P
= P.
5.3.19 Explanatory Note
aR
P
b i
BP
a, b B intuitively means: two elements are related by the
relation determined by a partition if they belong to the same component of
this partition.
The theorem above states that there is a one-to-one correspondence be-
tween equivalence relations on A and partitions of A. This means that
equivalence relations and partitions are two views of the same situation. It
also means that such situations can be described equally well in the language
of equivalence relations and in the language of partitions the two languages
have the same expressive power. It can be useful to have two equivalent ap-
proaches: we will have a choice of either using the terminology of equivalence
relations or the terminology of partitions. This one-to-one correspondence
also allows us to represent equivalence relations as partitions while writing
computer programs.
5.3.20 Exercise
While dening the notion of partition we required that is not a member
of any partition. How would the theorem above change if this requirement
were not in place?
5.3.21 Exercise
Let R
1
and R
2
be equivalence realtions on A.
1. Prove: R
1
R
2
is an equivalence on A.
2. Consider partitions corresponding to R
1
, R
2
and R
1
R
2
. Explain how
the last partition can be obtained from the rst two. Make a diagram
which shows the three partitions.
5.3.22 Exercise
Disprove: If R
1
and R
2
are equivalence relations on A then R
1
R
2
is an
equivalence relation on A.
5.3.23 Corollary
Let R be a binary relation over A. Then,
1. R is an equivalence on A i there exists a function f on A such that xRy
i f(x) = f(y).
2. R is an equivalence on A i there exists a partition A
i
: i I of A such
that R =

iI
Tot
A
i
.
5.3.24 Exercise
1. Prove the corollary above.
2. Prove: Let R be a binary relation over A. If R is an equivalence on A,
then the partition A
i
: i I of A such that R =

iI
Tot
A
i
is unique.
Chapter 6
Closures of binary relations
Contents
6.1 Reexive closure (Optional) . . . . . . . . . . . . 109
6.2 Transitive closure (Optional) . . . . . . . . . . . . 110
Reexive closure (Optional) 6.1
6.1.1 Lemma
If T is a family of binary relations over A which are reexive on A
then

T is binary relation over A which is reexive on A.
Proof
The resulting binary relation is obviously over A.
We will prove that it is reexive on A. Take any a A.
For every R T we have a, a) R.
So, a, a)

T.
So,

T is reexive on A.
6.1.2 Theorem
Let R be a binary relation over A. Let F be the family of all binary relations
over A which are reexive on A and extend R. Then

T is the smallest
binary relation which is reexive on A and extends R.
Proof
By lemma 6.1.1,

T is a binary relation over A which is reexive on A
and extends R. It remains to prove that

T is the smallest such relation.
Take any binary relation R

over A which is reexive on A and extends R.


109
Goal:

T R

.
As R

T and as intersection is always a subset of any of its components,


we have

T R

.
6.1.3 Denition
Let R be a binary relation over A. By the reexive closure of R on A we
understand the smallest binary relation which is reexive on A and extends
R; this relation is denoted R

A
.
6.1.4 Explanatory Note
1. Notice that by 6.1.2 this denition is correct the smallest binary relation
reexive on A which extends R does exist.
2. The next theorem summarizes the denition of reexive closure, the con-
struction from Proposition 6.1.2 and oers another way of constructing
reexive closure.
6.1.5 Theorem
Let R be a binary relation over A. Then:
1. R

A
is the smallest binary relation which is reexive on A and extends
R.
2. R

A
is the intersection of all binary relations over A which are reexive
on A and extend R.
3. R

A
= R
A
.
Proof
It only remains to prove 3.
First notice that R
A
is a reexive relation on A.
Now, we need to show that
R
A
is the smallest reexive relation on A which extends R.
Take any reexive relation R

on A which extends R.
Goal: R
A
R

.
Take any a, b) R
A
.
Now, the goal is: a, b) R

.
We have a, b) R or a, b)
A
.
Case: a, b) R)
As R

extends R, we have a, b) R

.
Case: a, b)
A
)
This means a = b. As R

is reexive, a, b) = a, a) R

.
Transitive closure (Optional) 6.2
6.2.1 Lemma
If T is a family of binary relations over A which are transitive
then

T is a binary relation over A which is transitive.
Proof
The resulting binary relation is obviously over A.
We will prove that it transitive.
Take any a, b, c s.t. a, b), b, c)

T.
So, for every R T we have a, b), b, c) R.
As, every R T is transitive, we have a, c) R.
So, a, c)

T. So,

T is transitive.
6.2.2 Proposition
Let R be a binary relation over A.
Let F be the family of all binary relations over A
which are transitive and which extend R.
Then

T is the smallest binary relation
which is transitive and which extends R.
Proof
By Lemma 6.2.1,

T is a binary relation over A which is transitive and
extends R. It remains to prove that

T is smallest such relation.
Take any binary relation R

over A which is transitive and extends R.


Goal:

T R

.
As R

T and as intersection is always a subset of any of its components,


we have

T R

.
6.2.3 Denition
Let R be a binary relation on A. By the transitive closure of R we
understand the smallest binary relation on A which is transitive and contains
R; this relation is denoted by R
+
.
6.2.4 Explanatory Note
Notice that by 6.2.2 this denition is correct the smallest binary relation
over A which is transitive and contains R does exist.
The next theorem summarizes the denition of transitive closure, the
construction of transitive closure from Proposition 6.2.2 and oers two more
ways of constructing transitive closure.
6.2.5 Theorem
Let R be a binary relation over A. Then
1. R
+
is the smallest binary relation which is transitive and extends R.
2. R
+
is the intersection of all binary relations over A which are transitive
and extend R.
3. R
+
=

i=1
R
i
.
4. aR
+
b i
there exist a
0
, a
1
, ..., a
n
, for some positive integer n, such that a
0
= a,
a
n
= b, and a
0
Ra
1
a
1
Ra
2
... a
n1
Ra
n
.
6.2.6 Informal Example
The binary relation isAnAncestorOf is the transitive closure of the binary
relation isAParentOf.
Chapter 7
Orders
Contents
7.1 Anti-reexivity and anti-symmetry . . . . . . . . 113
7.2 Partial ordering . . . . . . . . . . . . . . . . . . . . 115
7.3 Hasse diagrams . . . . . . . . . . . . . . . . . . . . 118
7.4 Connected relations . . . . . . . . . . . . . . . . . 120
7.5 Linear ordering . . . . . . . . . . . . . . . . . . . . 121
7.6 Lexicographic and anti-lexicographic orders . . . 122
Ordering of X
1
X
2
. . . . . . . . . . . . . . . . . . . . 122
Ordering of X
n
. . . . . . . . . . . . . . . . . . . . . . . 125
Ordering of X

. . . . . . . . . . . . . . . . . . . . . . . 126
7.7 Maximal and greatest elements, upper bounds . 127
Anti-reexivity and anti-symmetry 7.1
7.1.1 Denition
Let R be a binary relation.
1. R is anti-reexive if
a
aRa.
2. R is strongly anti-symmetric or strictly anti-symmetric if

a,b
(aRb bRa).
3. R is (weakly) anti-symmetric if

a,b
(aRb a ,= b bRa).
As indicated by parentheses the adjective weakly can be omitted.
113
7.1.2 Explanatory Note
Notice that conditions above are logically equivalent to the following,
anti-reexivity:
a
(aRa ),
strong anti-symmetry:
a,b
(aRb bRa ),
weak anti-symmetry:
a,b
(aRb bRa a=b).
7.1.3 Exercise
Consider binary relations =
Z
, ,=
Z
, <
Z
, >
Z
,
Z
,
Z
, Tot
Z
, , [,
k
for k > 1.
For any of these relations, check if it is reexive, anti-reexive, symmet-
ric, weakly anti-symmetric, strongly anti-symmetric, transitive. Answer the
same questions for
P(Z)
,
P(Z)
, _
P(Z)
, _
P(Z)
.
7.1.4 Exercise
Assume that A is a set with n elements.
1. How many binary relations over A are anti-reexive?
2. How many binary relations over A are weakly anti-symmetric?
3. How many binary relations over A are strongly anti-symmetric?
7.1.5 Proposition
Let R be a binary relation. Then, R is strongly anti-symmetric i R is
weakly anti-symmetric and anti-reexive.
Proof
)
Assume R is strongly anti-symmetric.
1)
We will show that R is weakly anti-symmetric.
Take any a, b s.t. aRb bRa. Goal: a=b.
By strong anti-symmetry we obtain contradiction.
As contradiction implies a=b, we obtain a=b.
2)
We will show that R is anti-reexive.
Take any a s.t. aRa. Goal: obtain contradiction.
By strong anti-symmetry we obtain contradiction.
)
Assume R is weakly anti-symmetric and anti-reexive.
We will show that R is strongly anti-symmetric.
Take any a, b s.t. aRb bRa. Goal: obtain contradiction.
By weak anti-symmetry we obtain a=b.
So, aRb means aRa.
By anti-reexivity we obtain contradiction.
7.1.6 Exercise
1. Prove: is the only binary relation which is both reexive on some set
and anti-reexive.
2. Show a set A and a binary relation over A which is neither reexive on
A nor anti-reexive.
7.1.7 Exercise
1. Prove: Every relation which is strongly anti-symmetric is also weakly
anti-symmetric.
2. Prove: is the only binary relation which is both symmetric and strongly-
antisymmetric.
3. Prove: Equalities (i.e. diagonal binary relations) are the only binary
relations which are both symmetric and weakly-antisymmetric.
4. Show a binary relation which is neither symmetric nor weakly anti-
symmetric.
Partial ordering 7.2
7.2.1 Historical Remark (Optional)
Theory of ordered sets was originated at the end of 19th century by a German
mathematician Richard Dedekind.
7.2.2 Denition
1. A binary relation over A is called a weak (partial) ordering of A if
it is weakly anti-symmetric, transitive and reexive on A.
2. A binary relation over A is called a strict (partial) ordering of A or
strong (partial) ordering of A if it is weakly anti-symmetric, transi-
tive and anti-reexive.
As indicated by parentheses, the adjective partial may be omitted. The
noun order may be used instead of ordering.
7.2.3 Example
1. For any A 1,

A
and
A
are weak partial orderings of A, and
<
A
and >
A
are strict partial orderings of A.
2. For any set A,

P(A)
and
P(A)
are weak partial orderings of T(A), and
_
P(A)
and _
P(A)
are strict partial orderings of T(A).
3. The divisibility relation restricted to Z
+
is a weak partial ordering of Z
+
.
On the other hand, the divisibility relation on Z is not a weak partial
ordering of Z.
4. Consider X = scisors, rock, paper and binary relation isStrongerThan
such that:
rock isStrongerThan scisors,
paper isStrongerThan rock,
scisors isStrongerThan paper,
like in a childrens game. Relation isStrongerThan is weakly anti-symmetric
and anti-reexive. However it is not transitive, so it is not a strict partial
order.
7.2.4 Theorem
Let R be a binary relation over A.
Then the following conditions are equivalent.
1. R is a strict partial ordering of A,
(i.e. R is anti-reexive, weakly anti-symmetric and transitive.)
2. R is strongly anti-symmetric and transitive.
3. R is anti-reexive and transitive.
Proof
1 2)
Strict partial ordering has been dened by conjunction:
weak anti-symmetry anti-reexivity transitivity.
Weak anti-symmetry anti-reexivity strong anti-symmetry.
So, weak anti-symmetry anti-reexivity transitivity
strong anti-symmetry transitivity.
2 3)
Assume R is strongly anti-symmetric and transitive.
Strong anti-symmetry weak anti-symmetry anti-reexivity.
So, R is also anti-reexive.
3 2)
Assume R is anti-reexive and transitive.
We will show that R is strongly anti-symmetrical.
Take any a, b such that aRb bRa. Goal: obtain contradiction.
By transitivity, a=b.
So, aRa.
By anti-reexivity we obtain a contradiction.
7.2.5 Exercise
Consider binary relations =
Z
, ,=
Z
, Tot
Z
, , [,
k
for k > 1. For any of these
relations, check if it is a strict partial ordering of Z, a weak partial ordering
of Z, or neither.
7.2.6 Theorem
R is a weak partial ordering of A i R
1
is a weak partial ordering of A.
R is a strict partial ordering of A i R
1
is a strict partial ordering of A.
7.2.7 Exercise
Prove the theorem above.
7.2.8 Proposition
For any binary relation R over A dene operation weak
A
(R) as R =
A
and
operation strict
A
(R) as R =
A
.
1. If R is weakly anti-symmetric and transitive binary relation over A then
weak
A
(R) is a weak partial ordering of A and strict
A
(R) is a strict partial
ordering of A.
2. If R is a strict partial ordering of A then weak
A
(R) is a weak partial
ordering of A and strict
A
(weak
A
(R)) = R.
3. If R is a weak partial ordering of A then strict
A
(R) is a strict partial
ordering of A and weak
A
(strict
A
(R)) = R.
7.2.9 Example
weak
Z
(<
Z
) is <
Z
=
Z
, which is
Z
.
strict
Z
(
Z
) is
Z
=
Z
, which is <
Z
.
weak
Z
() is =
Z
, which is =
Z
.
strict
Z
(=
Z
) is =
Z
=
Z
, which is .
Explanatory Note
By this proposition, it does not matter if we specify a weak partial ordering
of A or the corresponding strict partial ordering of A. This justies the
following denition.
7.2.10 Denition
By a (partial) ordering of A we understand either a strict partial order-
ing of A or a weak partial ordering of A.()
7.2.11 Exercise
Show a binary relation over a set A which is weakly-antisymmetric and
transitive but which is not a partial ordering of A.
7.2.12 Denition
Let R be a partial ordering of A By the reverse order to R
or the inverse order to R we understand the inverse relation to R.
7.2.13 Example
For any X 1,
X
is the reverse order to
X
.
For any family A of sets,
A
is the reverse order to
A
.
7.2.14 Convention
If a weak partial ordering of A is denoted by _ then we denote the corre-
sponding strict partial ordering of A by , and vice versa, and we denote
the corresponding reverse orders by _ and ~.
7.2.15 Denition
1. By a poset or partially ordered set we understand an ordered pair
A, R) where A is a set and R is a partial ordering of A.
2. Let X, R) be a poset and let a, b X. We say that a and b are comparable
if aRb bRa a=b.
3. Let X, R) be a poset and let a, b X. We say that a and b are incomparable
if a and b are not comparable.
4. Given a poset X, R), a set C X is called a chain if every two elements
of C are comparable.
5. Given a poset X, R), a set A X is called an antichain if every two
elements of C are incomparable.
7.2.16 Proposition
Take any posets X
1
, R
1
) and X
2
, R
2
). Consider relation R over X
1
X
2
dened as a
1
, a
2
)Rb
1
, b
2
) i a
1
R
1
b
1
a
2
R
2
b
2
.
Then, X
1
X
2
, R) is a poset. Moreover, if at least one of the partial orders
R
1
, R
2
is strict then the partial order R is strict, otherwise partial order R
is weak.
Hasse diagrams 7.3
7.3.1 Denition
Let X = X, ) be a poset and let x, y X.
If x y
zX
(x z z y) then
y is called an immediate successor of x in X and
x is called an immediate predecessor of y in X .
7.3.2 Explanatory Note
Let X = X, ) be a nite poset.
By a Hasse diagram of X we understand a diagram in which
1. every x X is represented by a node (i.e. vertex), possibly labelled with
x,
2. if y is an immediate successor of x then the node representing y is above
the node representing x, and there is an edge between the nodes repre-
senting x and y.
7.3.3 Example
1, 2, 3

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
1, 2 1, 3 2, 3

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
1 2 3
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z

Hasse diagram for T(1, 2, 3) ordered by .


This example also shows that an element may have 0 successors, 1 suc-
cessor or more successors.
7.3.4 Proposition
Let X = X, ) be a nite poset with a strict ordering. Let S be the biggest
binary relation over X such that xSy i y is an immediate successor of x in
X. Then is the transitive closure of S.
7.3.5 Proposition
Let X
1
= X,
1
) and X
2
= X,
2
) be nite posets with strict orderings.
Let S
1
be the biggest binary relation over X such that xS
1
y i y is an
immediate successor of x in X
1
. Let S
2
be the biggest binary relation over
X such that xS
2
y i y is an immediate successor of x in X
2
. If S
1
= S
2
then
1
=
2
.
7.3.6 Explanatory Note
This proposition implies that in the case of a nite poset, the immediate
successor relation determines the order, i.e. the Hasse diagram conveys all
the information about the poset up to an isomorphism (i.e. up to renaming
of the elements of the poset).
7.3.7 Exercise
Show that in the proposition above the assumption that X is nite cannot
be dropped.
Hint: To do so, give an example of dierent posets X
1
= X,
1
) and
X
2
= X,
2
) on the same set innite set X, with strict orderings, such
that S
1
= S
2
where S
1
is the biggest binary relation over X s.t. xS
1
y i y
is an immediate successor of x in X
1
, and S
2
is the biggest binary relation
over X s.t. xS
2
y i y is an immediate successor of x in X
2
.
Connected relations 7.4
7.4.1 Denition
1. A binary relation R over A is called strongly connected on A if

a,bA
aRb bRa.
2. A binary relation R over A is called weakly connected on A if

a,bA
a=b aRb bRa.()
7.4.2 Explanatory Note
Notice that condition of weak connectedness on A can be equivalently writ-
ten as
a,bA
a,=b (aRb bRa).
7.4.3 Proposition
Let R be a binary relation and let A be a set. Then, R is strongly connected
on A i R is weakly connected on A and reexive on A.
Proof
)
Assume R is strongly connected on A.
1)
We will show that R is weakly connected on A.
Take any a, b A s.t. a,=b. Goal: aRb bRa.
The goal follows immediately from strong connectedness on A.
2)
We will show that R is reexive on A.
Take any a A. Goal: aRa.
By strong connectedness on A we obtain aRa aRa.
So, aRa.
)
Assume R is weakly connected on A and reexive on A.
We will show that R is strongly connected on A.
Take any a, b A. Goal: aRb bRa.
Case: a=b)
The goal in this case is aRa aRa, i.e. aRa.
This follows immediately from reexivity on A.
Case: a,=b)
By weak connectedness on A we obtain aRb bRa.
Linear ordering 7.5
7.5.1 Denition
1. A binary relation R over A is called a weak linear order on A if R is
a weak partial order on A and is weakly connected.
2. A binary relation R is called a strict linear order or
strong linear order if R is a strict partial order and is weakly con-
nected.
The adjective total may be used instead of linear.
The noun ordering may be used instead of order.
7.5.2 Historical Remark (Optional)
Linearly ordered sets were introduced in 1895 by a German mathematician
Georg Cantor.
7.5.3 Fact
Every weak linear ordering of A is also a weak partial ordering of A.
Every strict linear ordering of A is also a strict partial ordering of A.
7.5.4 Example
1. For any set A 1,

A
and
A
are weak total orderings of A (and also weak partial orderings
of A).
<
A
and >
A
are strict total orderings of A (and also strict partial orderings
of A).
2. For any set A,

P(A)
and
P(A)
are weak partial orderings of T(A) but not weak linear
orderings of T(A).
_
P(A)
and _
P(A)
are strict partial orderings of T(A) but not strict linear
orderings of T(A).
3. A chain in a poset is a linearly ordered subset of the poset.
7.5.5 Fact
Let _ be a weak linear ordering of A, and be the corresponding strict
linear ordering of A, and _ and ~ be the corresponding reverse orders (i.e.
inverse relations). Then, (a _ b) a ~ b and (a b) a _ b. Such
equivalences do not need to be true in the case of partial orderings.
7.5.6 Proposition
For any binary relation R over A dene operation weak
A
(R) as R =
A
and
operation strict
A
(R) as R =
A
.
1. If R is weakly anti-symmetric, transitive and weakly connected binary re-
lation over A then weak
A
(R) is a weak linear ordering of A and strict
A
(R)
is a strict linear ordering of A.
2. If R is a strict linear ordering of A then weak
A
(R) is a weak linear ordering
of A and strict
A
(weak
A
(R)) = R.
3. If R is a weak linear ordering of A then strict
A
(R) is a strict linear ordering
of A and weak
A
(strict
A
(R)) = R.
7.5.7 Explanatory Note
By this proposition, it does not matter if we specify a weak linear ordering
of A or the corresponding strict linear ordering of A. This justies the
following denition.
7.5.8 Denition
By a linear ordering of A we understand either a strict linear ordering
of A or a weak linear ordering of A.()
7.5.9 Exercise
Show that in the denition of weak linear order the condition of weak con-
nectivity could be replaced by the condition of strong connectivity. Show,
however, that such a replacement in the denition of strict linear order would
change the meaning of that denition.
7.5.10 Exercise
Consider binary relations =
Z
, ,=
Z
, Tot
Z
, , [,
k
for k > 1. For any of these
relations, check if it is strongly connected on Z, weakly connected on Z, a
strict linear order, a weak linear order on Z.
Lexicographic and anti-lexicographic orders 7.6
Ordering of X
1
X
2

7.6.1 Proposition
Let X
1
,
1
) and X
2
,
2
) be posets.
Let R be a binary relation over X
1
X
2
such that
a
1
, a
2
)Rb
1
, b
2
) i a
1

1
b
1
or (a
1
= b
1
and a
2

2
b
2
).
Then X
1
X
2
, R) is a poset.
7.6.2 Denition
For any poset X = X, ) by X
1
we will denote the poset X, ~)
(with the order reverse to ).
7.6.3 Denition
Let
1
be a strict ordering of X
1
, and
let
2
be a strict ordering of X
2
.
1. We dene lexicographic ordering of X
1
X
2
induced by
1
and
2
as follows: a
1
, a
2
) b
1
, b
2
) i a
1

1
b
1
(a
1
= b
1
a
2

2
b
2
).
2. We dene anti-lexicographic ordering of X
1
X
2
induced by
1
and
2
as follows: a
1
, a
2
) b
1
, b
2
) i a
2

2
b
2
(a
2
= b
2
a
1

1
b
1
).
3. For any posets X
1
, X
2
by X
1

L
X
2
we will denote the poset with the
lexicographic order on X
1
X
2
.
4. For any posets X
1
, X
2
by X
1

A
X
2
we will denote the poset with the
anti-lexicographic order on X
1
X
2
.
7.6.4 Example
Assume that a b in an ordered set X. Then,
1. In the lexicographic ordering of X X we have:
a, a) a, b) b, a) b, b).
2. In the anti-lexicographic ordering of X X we have:
a, a) b, a) a, b) b, b).
3. Consider the set of binary digits X = 0, 1.
Assume, as usual, that 0 < 1.
In the lexicographic ordering of X X we have:
0, 0) 0, 1) 1, 0) 1, 1)
which corresponds to the increasing order of numbers written in the bi-
nary system: 00 < 01 < 10 < 11 (where 00 = 0 and 01 = 1).
7.6.5 Explanatory Note
1. If X is the set of lower-case letters of the Latin alphabet, lexicographic
ordering of XX, induced by the usual linear order of the letters in the
alphabet, is the order in which two-letter string appear in dictionaries
(or in which they would appear if dictionaries contained strings which
are not meaningful English words).
2. Although constructions of lexicographic and anti-lexicographic orders on
X
1
X
2
apply to arbitrary partial orders on X
1
and X
2
, the case when X
1
and X
2
are linearly ordered seems to be most common in mathematical
considerations.
7.6.6 Denition
If X
1
and X
2
are linearly ordered sets then lexicographic ordering of X
1
X
2
is called the dictionary ordering of X
1
X
2
.
7.6.7 Exercise
Let X = a, b, c and a b c.
1. List all the elements of X X in the lexicographic order.
2. List all the elements of X X in the anti-lexicographic order.
7.6.8 Exercise
Let X
1
= a, b, c and a
1
b, a
1
c and b, c are incomparable.
Let X
2
= a, b and a
2
b.
1. Make a Hasse diagram for X
1
X
2
with the lexicographic order.
2. Make a Hasse diagram for X
1
X
2
with the anti-lexicographic order.
3. Make a Hasse diagram for X
1
X
1
with the lexicographic order.
4. Make a Hasse diagram for X
1
X
1
with the anti-lexicographic order.
7.6.9 Fact
Let
1
be a strict ordering of X
1
, and
let
2
be a strict ordering of X
2
.
1. The weak lexicographic ordering of X
1
X
2
induced by
1
and
2
satises
the following condition:
a
1
, a
2
) _ b
1
, b
2
) i a
1

1
b
1
(a
1
= b
1
a
2
_
2
b
2
).
2. The weak anti-lexicographic ordering of X
1
X
2
induced by
1
and
2
satises the following condition:
a
1
, a
2
) _ b
1
, b
2
) i a
2

2
b
2
(a
2
= b
2
a
1
_
1
b
1
).
7.6.10 Fact
Let X
1
= X
1
, ) and X
2
= X
2
, ) be posets.
Let a
1
, b
1
X
1
and a
2
, b
2
X
2
.
Let
L
be the lexicographic order on X
1
X
2
.
Let
A
be the anti-lexicographic order on X
2
X
1
.
Then, X
1

L
X
2
= X
2

A
X
1
i.e. a
1
, a
2
)
L
b
1
, b
2
) i a
2
, a
1
)
A
b
2
, b
1
).
7.6.11 Proposition
If X
1
and X
2
are linearly ordered sets then lexicographic and anti-lexicographic
orderings of X
1
X
2
are linear orderings.
7.6.12 Exercise
1. Prove the proposition above.
2. Prove: If X
1

L
X
2
is linearly ordered then both X
1
and X
2
are linearly
ordered.
3. Prove: If X
1

A
X
2
is linearly ordered then both X
1
and X
2
are linearly
ordered.
4. Disprove: The anti-lexicographic ordering of X X is the reverse order
to the lexicographic ordering of X X.
7.6.13 Proposition
1. (X
1

L
X
2
)
1
= (X
1
1
)
L
(X
1
2
)
2. (X
1

A
X
2
)
1
= (X
1
1
)
A
(X
1
2
)
Ordering of X
n

7.6.14 Denition
Let X be a set. For any integer n 1 we dene
the n-th Cartesian power of X , recursively, as follows.
X
1
= X
X
n+1
= X
n
X
7.6.15 Denition
Let be a strict ordering of X. Let n be an integer greater than 0.
We dene the lexicographic ordering of X
n
induced by as follows.
x
1
, ..., x
n
) y
1
, ..., y
n
) i there exists i
0
in the range 1..n, such that
x
i
0
y
i
0
and for every i < i
0
, x
i
=y
i
.
If the ordering is linear, instead of lexicographic ordering one may say
dictionary ordering .
7.6.16 Example
Assume that a b in an ordered set X. Then,
1. In the lexicographic ordering i.e. dictionary ordering of X
3
we have:
a, a, a) a, a, b) a, b, a) a, b, b) b, a, a) b, a, b) b, b, a)
b, b, b).
2. In the anti-lexicographic ordering of X
3
we have:
a, a, a) b, a, a) a, b, a) b, b, a) a, a, b) b, a, b) a, b, b)
b, b, b).
3. Consider the set of binary digits X = 0, 1.
Assume, as usual, that 0 < 1.
In the lexicographic ordering of X
3
we have:
0, 0, 0) 0, 0, 1) 0, 1, 0) 0, 1, 1) 1, 0, 0) 1, 0, 1) 1, 1, 0)
1, 1, 1)
which corresponds to the increasing order of numbers written in the bi-
nary system:
000 < 001 < 010 < 011 < 100 < 101 < 110 < 111
(where 000 = 0, 001 = 1, 010 = 10 and 011 = 11).
7.6.17 Explanatory Note
If X is the set of lower-case letters of the Latin alphabet, lexicographic
ordering of X
n
induced by the usual order of letters in the alphabet is the
order in which n-letter strings appear in dictionaries (or in which they would
appear if dictionaries contained strings which are not meaningful English
words).
7.6.18 Exercise
1. Assume that a b c. List all the elements of a, b, c
3
in the lexico-
graphic order.
2. Assume that a b. List all the elements of a, b
4
in the lexicographic
order.
7.6.19 Fact
Let be a strict ordering of X. Then:
1. X
1
= X and the lexicographic ordering of X
1
is the same as the original
ordering of X.
2. X
2
= X X and the lexicographic ordering of X
2
, as dened in this
subsection, is the same as the lexicographic ordering of XX, as dened
in the previous subsection.
3. In a lexicographic ordering of X
3
,
a
1
, a
2
, a
3
) b
1
, b
2
, b
3
) i
a
1
b
1
or (a
1
= b
1
and a
2
b
2
) or (a
1
= b
1
and a
2
= b
2
and a
3
b
3
).
7.6.20 Exercise
Let X be a linearly ordered set. Disprove: the weak lexicographic ordering
of X
n
satises the following condition:
x
1
, ..., x
n
) _ y
1
, ..., y
n
) i there exists i
0
in the range 1..n, such that
x
i
0
_ y
i
0
and for every i < i
0
, x
i
=y
i
.
7.6.21 Proposition
If X is a linearly ordered set then lexicographic ordering of X
n
is a linear
ordering.
7.6.22 Exercise
1. Prove the proposition above.
2. Prove: If X
n
, with a lexicographic order, is linearly ordered then X is
linearly ordered.
Ordering of X

7.6.23 Explanatory Note


Let X be a set. Recall that X

stands for the set of all nite sequences


with elements from X. If X
n
stands for the set of all sequences of length
n with elements from X then X

i=0
X
n
. This notation applies to
both nite and innite sets X. Recall that if X is nite, it may be called
an alphabet and the nite sequences with elements from X may be called
words or strings.
7.6.24 Denition
1. Let x = x
1
, ..., x
m
). By a prex of x we understand any sequence
x
1
, ..., x
k
) where 0 k m.
2. Let x = x
1
, ..., x
m
). By a proper prex of x we understand any se-
quence x
1
, ..., x
k
) where 0 k < m.
3. Let x = x
1
, ..., x
m
) and y = y
1
, ..., y
n
). By a common prex of x and y
we understand any sequence which is a prex of x and a prex of y.
4. Let be a strict ordering of X.
The the lexicographic ordering of X

induced by is as follows.
Consider any two nite sequences x = x
1
, ..., x
m
) and y = y
1
, ..., y
n
).
Let z = z
1
, ..., z
k
) be the longest common prex of x and y.
We dene: x y i
either x is a proper prex of y
or z is proper prex of both x and y and x
k+1
y
k+1
.
5. If the ordering is linear, instead of lexicographic ordering one may
say dictionary ordering .
7.6.25 Exercise
Let X = a, b, c and a b c. Write the 10 smallest sequences from X

in the lexicographic order. Does any of them contain b?


7.6.26 Explanatory Note
If X is the set of letters of the Latin alphabet, lexicographic ordering of X

,
induced by the usual order of letters in the alphabet, is the order in which
words appear in dictionaries.
7.6.27 Proposition
If the order on X is linear then lexicographic ordering of X

is a linear
ordering.
Maximal and greatest elements, upper bounds 7.7
7.7.1 Denition
Let _ be a weak partial ordering of A and let be the corresponding strict
partial ordering of A.
1. b is maximal in A with respect to _ if b A and
aA
(b a).
2. b is minimal in A with respect to _ if b A and
aA
(a b).
3. b is greatest in A with respect to _ or
biggest in A with respect to _ or
largest in A with respect to _ if b A and
aA
a _ b.
4. b is least in A with respect to _ or
smallest in A with respect to _ if b A and
aA
b _ a.
7.7.2 Explanatory Note
b is maximal in A if no element in A is bigger than b.
b is greatest in A if every element in A, other than b, is smaller than b.
b is minimal in A if no element in A is smaller than b.
b is least in A if every element in A, other than b, is greater than b.
7.7.3 Explanatory Note
Let R be a partial ordering of A.
What is minimal and what is maximal is relative: b is minimal in A with
respect to R i b is maximal in A with respect to R
1
.
What is least and what is greatest is relative: b is least in A with respect to
R i b is greatest in A with respect to R
1
.
7.7.4 Example
Sets are partially ordered by inclusion .
If A B we think of A as smaller than or equal to B.
If A _ B we think of A as smaller than B.
Consider all non-empty sets of integers.
Notice that there is no smallest set among them.
There are however minimal sets: 0, 1, ...
0 is minimal because there is no smaller set among those being considered.
1 is minimal because there is no smaller set among those being considered.
7.7.5 Proposition
1. Depending on the poset there can be zero, one or many (any cardinal
number) of minimal elements, [and zero, one or many (any cardinal num-
ber) of maximal elements].
2. Two dierent minimal elements are incomparable. [Two dierent maxi-
mal elements are incomparable.]
3. Depending on the poset there can be zero or one least elements but not
more than one, [and there can be zero or one greatest elements but not
more than one].
4. If there exists a least element, it is also a minimal element, and then it
is the only minimal element. [If there exists a greatest element, it is also
a maximal element, and then it is the only maximal element.]
5. In a linear poset if there exists a minimal element then it is least, [and if
there exists a maximal element then it is greatest].
6. In a nite poset, if there is exactly one minimal element then it is the
least element, [and if there is exactly one maximal element then it is the
greatest element].
7. In a nite linear poset, there is always the least element, [and the greatest
element].
7.7.6 Denition
Let _ be a weak partial ordering of X. Let A X and let b X.
1. b is an upper bound of A in X, _) if
aA
a _ b.
2. b is a lower bound of A in X, _) if
aA
b _ a.
3. b is the supremum of A in X, _) if b is the least upper bound of A
in X, _). The supremum (i.e. least upper bound) of A in X, if it exists,
is denoted by supA or lubA or
_
A .
4. b is the inmum of A in X, _) if b is the greatest lower bound of A
in X, _). The inmum (i.e. greatest lower bound) of A in X, if it exists,
is denoted by infA or glbA or
_
A .
7.7.7 Proposition
1. Depending on the poset and its subset there can be zero, one or many
(any cardinal number) of lower bounds, [and zero, one or many (any
cardinal number) of upper bounds].
2. Depending on the poset and its subset there can be zero or one greatest
lower bounds but not more than one, [and there can be zero or one least
upper bounds but not more than one].
3. If there exists the greatest lower bound, it is also a lower bound. [If there
exists the least upper bound, it is also an upper bound.]
4. If there exists the least element, it is also the greatest lower bound. [If
there exists the greatest element, it is also the least upper bound.]
7.7.8 Proposition
In T(A), ), for any family A
i

iI
there exists the greatest lower bound
and it is equal to

A
i

iI
.
In T(A), ), for any family A
i

iI
there exists the least upper bound and
it is equal to

A
i

iI
.
7.7.9 Proposition
In the poset of Boolean values, the conjunction operation is the greatest
lower bound, and the disjunction operation is the least upper bound.
7.7.10 Exercise
Let X, ) be a poset. Prove: y is an immediate successor of x i y is
minimal in x

X : x x

.
7.7.11 Exercise
Show that the least common multiple is the least upper bound with respect
to the divisibility relation on Z
+
. (Divisibility relation on Z
+
is a partial
order.)
7.7.12 Exercise
1. The empty relation is a strict partial order on any set X. Characterize
the least upper bounds and greatest lower bounds in such posets.
2. The equality relation is a weak partial order on any set X. Characterize
the least upper bounds and greatest lower bounds in such posets.
Chapter 8
Introduction to
combinatorics
Contents
8.1 Multiplication, addition and division principles . 131
8.2 Permutations . . . . . . . . . . . . . . . . . . . . . 133
8.3 Combinations . . . . . . . . . . . . . . . . . . . . . 135
8.4 k-permutations . . . . . . . . . . . . . . . . . . . . 135
8.5 k-combinations . . . . . . . . . . . . . . . . . . . . 136
Multiplication, addition and division principles 8.1
8.1.1 Explanatory Note
1. Let X be a nite set. By the cardinality of X we understand the
number of elements in X and we denote it by card(X) .
2. Let X
1
, ..., X
n
be sets. X
1
, ..., X
n
are pairwise disjoint if for any 1
i < j n the sets X
i
and X
j
are disjoint.
8.1.2 Exercise
Complete: If X
1
, ..., X
n
are pairwise disjoint and X
i
= X
j
and i,=j then
X
i
= X
j
= ...
8.1.3 Fact (Multiplication principle of counting)
Let X
1
, ..., X
n
be nite sets. Then
card(X
1
... X
n
) = card(X
1
) ... card(X
n
)
131
8.1.4 Fact (Addition principle of counting)
Let X
1
, ..., X
n
be nite pairwise disjoint sets. Then
card(X
1
... X
n
) = card(X
1
) +... +card(X
n
)
8.1.5 Explanatory Note
1. The Multiplication Principle says that the cardinality of the Cartesian
product of X
1
, ..., X
n
is the product of cardinalities of X
1
, ..., X
n
.
2. The Addition Principle says that for pairwise disjoint sets X
1
, ..., X
n
the cardinality of the union of X
1
, ..., X
n
is the sum of cardinalities of
X
1
, ..., X
n
.
3. In the Addition Principle the assumption that the sets are pairwise dis-
joint is essential.
8.1.6 Example
1. Assume that every license plate has three letters followed by four digits.
The letters are chosen from among the 26 capital letters of the English
alphabet and the digits are chosen from among the decimal digits 0..9. A
letter can repeat within the same license plate number; also a digit can
repeat. How many dierent license plates can be formed?
By the Multiplication Principle, there are 26262610101010 = 26
3
10
4
dierent license plates.
2. On a lottery ticket one chooses ve dierent numbers in the range 1...56
and one number in the range 1..45. How many dierent lottery tickets
can be formed?
By the Multiplication Principle, there are 56 55 54 53 52 45 dierent
lottery tickets.
8.1.7 Example
1. How many strings of length up to three can be formed using letters a, b,
c, d, e with possible repetitions. The empty string should be counted.
By the Multiplication Principle there are:
5
0
such strings of length 0,
5
1
such strings of length 1,
5
2
such strings of length 2,
5
3
such strings of length 3.
By the Addition Principle there are 5
0
+ 5
1
+ 5
2
+ 5
3
=
5
4
1
51
strings in
question.
2. There are three kinds of deserts: cakes, ice creams and fruits. Among
cakes there are three to choose from. Among ice creams there are four
to choose from. Among fruits there are ve to choose from. How many
dierent plates can be prepared, each with two dierent deserts. This
means, on a plate there must be:
a. one kind of cake and one kind of ice cream, or
b. one kind of cake and one kind of fruit, or
c. one kind of ice cream and one kind of fruit.
How many dierent kinds of desert plates can be made?
By the Multiplication Principle, there are, respectively
a. 3 4 possibilities,
b. 3 5 possibilities,
c. 4 5 possibilities.
By the Addition Principle, 3 4+3 5+4 5 dierent plates can be made.
8.1.8 Fact (Division principle of counting)
Let R be an equivalence relation on a nite set X such that every equivalence
class of R has cardinality k. Then card(X/R) = card(X)/k.
8.1.9 Exercise
1. Disprove: If R is an equivalence relation on a nite set X then every
equivalence class of X has the same cardinality.
2. Disprove: If R is an equivalence relation on a nite set X and one equiv-
alence class of R has cardinality k then card(X/R) = card(X)/k.
8.1.10 Example
In how many ways can one sit 5 persons (Adam, Betty, Charlie, Don and
Eve) at a round table? Two sittings are considered dierent only if there
exists a person who has a dierent right neighbor or (what follows) a dierent
left neighbor.
Assume that the chairs which are already at the table are numbered
0,1,2,3,4. You can sit 5 persons in these chairs in 5 4 3 2 1 = 5! ways. We
are considering two such sittings equivalent i the second can be obtained
though a rotation of the rst, i.e. if there exists k such that the second
sitting can be obtained from the rst by moving every person from chair i to
i +k(mod5). For instance the sitting C,A,D,E,B is equivalent to E,B,C,A,D
because the second can be obtained from the rst by moving every person
from chair i to chair i +3(mod5).
This is an equivalence relation on the set of all sittings of the ve persons
in chairs numbered 0,1,2,3,4. Every equivalence class of this relation has 5
elements. For instance, the equivalence class of C,A,D,E,B contains also
A,D,E,B,C and D,E,B,C,A and E,B,C,A,D and B,C,A,D,A.
By the Division Principle, the number of sittings in question is 5!/5.
Permutations 8.2
8.2.1 Denition
Let a
1
, ..., a
n
, where n 0, be arbitrary objects.
By a permutation of a
1
, ..., a
n
we understand any sequence in which ev-
ery a
1
, ..., a
n
occurs exactly once.
8.2.2 Explanatory Note
A permutation of a
1
, ..., a
n
is an arrangement of all a
1
, ..., a
n
, in which the
order matters.
8.2.3 Example
The following is a complete list of permutations of 1, 2, 3:
123, 132, 213, 231, 312, 321.
8.2.4 Explanatory Note
1. Let A be a set with n elements. Choose a linear order on the set A, and
name its elements a
1
, ..., a
n
so that a
1
... a
n
. Then any permutation
of a
1
, ..., a
n
can be viewed as a bijection from A to A. Namely, the
permutation a
i
1
, ..., a
in
corresponds to the bijection which maps a
1
to a
i
1
and ... and a
n
to a
in
.
2. For instance, assuming the order 1 2 3 4 5, the permutation
(sequence) 24315 corresponds to the bijection which maps 1 to 2, 2 to 4,
3 to 3, 4 to 1, 5 to 5. Conversely, the bijection which maps 1 to 3, 2 to 5,
3 to 4, 4 to 1, 5 to 2 corresponds to the permutation (sequence) 35412.
8.2.5 Denition
Let n be a non-negative integer. We dene recursively:
0! = 1,
(n +1)! = (n +1) n!, for any positive integer n.
By the factorial of n we understand n!.
8.2.6 Explanatory Note
n! = n(n 1) ... 2 1.
For instance,
0! involves the empty product, so its value is 1.
1! = 1
2! = 2 1 = 2
3! = 3 2 1 = 6
4! = 4 3 2 1 = 24
5! = 5 4 3 2 1 = 120
6! = 6 5 4 3 2 1 = 720
8.2.7 Fact
There are n(n 1)(n 2) ... 2 1 = n! dierent permutations of n objects.
Proof
By the Multiplication Principle, using mathematical induction.
Combinations 8.3
8.3.1 Denition
Let a
1
, ..., a
n
, where n 0, be arbitrary objects.
By a combination of a
1
, ..., a
n
we understand any subset of a
1
, ..., a
n
.
8.3.2 Explanatory Note
A combination of a
1
, ..., a
n
is an arrangement of some (possibly none, pos-
sibly all) of a
1
, ..., a
n
, in which the order does not matter.
8.3.3 Example
The following is a complete list of combinations of 1, 2, 3:
, 1, 2, 3, 1, 2, 1, 3, 2, 3, 1, 2, 3.
8.3.4 Explanatory Note
1. Let A be a set with n elements. Choose a linear order on the set A, and
name its elements a
1
, ..., a
n
so that a
1
... a
n
. Then any combination
of a
1
, ..., a
n
can be viewed as a sequence which lists that combinations
elements in the increasing order, i.e. a sequence a
i
1
, ..., a
i
k
such that
a
i
1
... a
i
k
.
2. For instance, assuming the order 1 2 3 4 5, the combination
(set) 2, 4, 5 corresponds to the increasing sequence 2, 4, 5. Conversely,
the increasing sequence 1, 3 corresponds to the combination (set) 1, 3.
8.3.5 Fact
There are 2
n
dierent combinations of n objects.
Proof
There is a 1-1 correspondence between combinations of a
0
, ..., a
1
and their
characteristic functions i.e. sequences of 0s and 1s of length n. By the
Multiplication Principle, using mathematical induction, the number of such
sequences is 2
n
.
k-permutations 8.4
8.4.1 Denition
Let a
1
, ..., a
n
, where n 0, be arbitrary objects; let k be an integer such
that 0 k n.
By an k-permutation of a
1
, ..., a
n
we understand any sequence of length
k in which every a
1
, ..., a
n
occurs at most once.
8.4.2 Explanatory Note
An k-permutation of a
1
, ..., a
n
is an arrangement of k dierent items from
among a
1
, ..., a
n
, in which the order matters.
8.4.3 Example
The following is a complete list of 2-permutations of 1, 2, 3, 4:
12, 13, 14, 21, 23, 24, 31, 32, 34, 41, 42, 43.
8.4.4 Explanatory Note
Permutations of a
1
, ..., a
n
are exactly n-permutations of a
1
, ..., a
n
.
8.4.5 Denition
Let 0 k n. The symbol (n)
k
stands for n(n1)(n2) ... (nk +1)
and it is read n lower factorial k .
8.4.6 Explanatory Note
(n)
k
=
n!
(n k)!
8.4.7 Fact
There are (n)
k
dierent k-permutations of n objects.
8.4.8 Example
Continuing the previous example, there are 4 3 dierent 2-permutations of
four objects. This is
4!
(42)!
= (4)
2
.
Proof
By the Multiplication Principle, using mathematical induction.
k-combinations 8.5
8.5.1 Denition
Let a
1
, ..., a
n
, where n 0, be arbitrary objects.
By an k-combination of a
1
, ..., a
n
we understand any k-element subset of
a
1
, ..., a
n
.
8.5.2 Explanatory Note
An k-combination of a
1
, ..., a
n
is an arrangement of k dierent items from
among a
1
, ..., a
n
, in which the order does not matter.
8.5.3 Example
The following is a complete list of 3-combinations of 1, 2, 3, 4, 5:
1, 2, 3, 1, 2, 4, 1, 2, 5, 1, 3, 4, 1, 3, 5, 1, 4, 5, 2, 3, 4, 2, 3, 5,
2, 4, 5, 3, 4, 5.
8.5.4 Explanatory Note
For 0 k n let C
k
be the set of all k-combinations of a
1
, ..., a
n
. Then the
family C
k

n
k=0
is a partition of the set of all combinations of a
1
, ..., a
n
.
8.5.5 Explanatory Note
1. Let A be a set with n elements. Choose a linear order on the set
A, and name its elements a
1
, ..., a
n
so that a
1
... a
n
. Then any k-
combination of a
1
, ..., a
n
can be viewed as a sequence which lists that com-
binations k elements in the increasing order, i.e. a sequence a
i
1
, ..., a
i
k

such that a
i
1
... a
i
k
.
2. For instance, assuming the order 1 2 3 4 5, the 3-combination
(set) 2, 4, 5 corresponds to the increasing sequence 2, 4, 5. Conversely,
the increasing sequence 1, 3, 5 corresponds to the 3-combination (set)
1, 3, 5.
8.5.6 Denition
Let 0 k n. The symbol
_
n
k
_
is read n choose k and it stands for
n!
k!(n k)!
8.5.7 Explanatory Note
_
n
k
_
=
n(n 1)(n 2) ... (n k +1)
k!
For instance,
_
7
3
_
=
7 6 5
3 2 1
8.5.8 Proposition
There are
_
n
k
_
dierent k-combinations of n elements.
8.5.9 Example
Continuing the previous example, we will count the 3-combinations of 5
objects. First let us consider all the 3-permutations of 5 objects; there are
5 4 3 of them. Consider two 3-permutations equivalent if they involve
the same objects. (For instance, 3,1,4 is equivalent to 4,3,1.) This is an
equivalence relation. Every equivalence class of this relation has 3! elements
(because there are 3! permutations of 3 objects). By the Division Principle,
there are 5 4 3/3! dierent 3-combinations of 5 objects. This is
_
5
3
_
.
Proof
We will count the k-combinations of n objects. First let us consider all
the k-permutations of n objects; there are n(n 1)(n 2) ... (n k + 1)
of them. Consider two k-permutations equivalent if they involve the same
objects. This is an equivalence relation. Every equivalence class of this re-
lation has k! elements (because there are k! permutations of k objects). By
the Division Principle, there are n(n1)(n2) ... (nk +1)/k! dierent
k-combinations of n objects. This is
_
n
k
_
.
8.5.10 Corollary
_
n
k
_
is always an integer.
Chapter 9
Philosophy of mathematics
and science
Contents
9.1 Structure of mathematics . . . . . . . . . . . . . . 139
9.2 Developing mathematics . . . . . . . . . . . . . . . 144
Structure of mathematics 9.1
9.1.1 Explanatory Note (About objects and properties)
1. Mathematical objects include: numbers (0, 1,
2
3
,

2), points on a line,


plane or in a space, arithmetical operations (+, , , /), quadratic func-
tions (y = ax
2
+ bx + c), smaller-than relation (<), linear equations
(ax +b = 0), etc.
2. By a property of mathematical objects we understand any formula
concerning these objects, which is true or false, depending on the ob-
jects involved.
For instance, the property of being divisible by 2 can be expressed as
there exists an integer k, such that n = 2k, or more formally,
kZ
n =
2k; the number 30 has this property because for n = 30 the formula is
true (with k = 15); the number 31 does not have this property because
for n = 31 the formula is false there is no integer k such that 31 = 2k.
3. By a formal notion or a formal concept we understand either a
mathematical object or a property.
For instance there is a formal notion (or concept) of an integer. There is
a formal notion (or concept) of being even.
139
9.1.2 Explanatory Note (About denitions)
1. Denitions introduce new formal notions basing them on more prim-
itive formal notions, which were introduced earlier.
Denitions also often introduce notation for these notions.
2. The following are common ways of formulating a denition.
x is an odd integer if there exists an integer y such that x = 2y +1.
Let x be an integer. x is called odd if there exists an integer y such
that x = 2y +1.
We dene an odd integer as any integer equal to 2y + 1 where y is
an integer.
By an odd integer we understand any integer equal to 2y + 1 for
some integer y.
These denitions introduce the notion of an odd integer basing it on
more primitive notions of the number 2, the number 1, multiplication
and addition.
3. Notice that denitions can be phrased in a variety of ways, including
these:
x is (called) . . . if . . .
Let x be an object of a specic type. x is (called) . . . if . . .
We dene . . . as . . .
By a . . . we understand . . .
4. In denitions it is customary to use an if between the part being
dened and the part which denes it, however this if represents an
equivalence and should be understood as if and only if.
5. Although denitions explain the meaning of new terms, not every expla-
nation is rigorous enough to be a mathematical denition. For instance,
the explanation denitions introduce new formal notions basing them
on more primitive formal notions, which were introduced earlier is not
a mathematical denition of the term denition because it explains
it by means of terms introduce, new, basing, etc., which may be
intuitive but which have not been dened in a rigorous way.
9.1.3 Explanatory Note (About conventions)
Conventions augment denitions.
1. General conventions introduce commonly used abbreviated versions
of mathematical notation.
For instance, the convention which gives multiplication priority over ad-
dition allows us to write x+y z instead of x+(y z). Unlike denitions,
some conventions sacrice precision for convenience, and introduce nota-
tion which depends on assumptions made in the context. For instance,
conventionally, we write A

instead of U A to represent the complement


of a set A with respect to a universal set U; what A

means depends
on what U is, and either this should be explained in the context or the
considerations should not depend on the choice of U provided that such
a U is xed.
2. Mathematical texts sometimes contain authors conventions which al-
low for a more clear or easier presentation of the material. For instance,
an author may use a convention that integers are represented by k, l, m, n
while real numbers by x, y, z; authors conventions may dier from book
to book.
9.1.4 Explanatory Note (About primitive notions and axioms)
A denition explains one notion in terms of more primitive notions; typically,
these dening notions are explained in their denitions by more primitive
notions, which, typically, are dened by means of yet more primitive notions,
etc. However, the process of dening must have a foundation; this means,
there must be some notions not introduced by denitions.
Primitive notions are not introduced by means of denitions;
instead, their properties are stated in axioms;
Axioms or postulates are the assumptions which underlie theories
in mathematics.
For instance, in formal arithmetic, called Peano Arithmetic, the notion of an
odd integer is dened in terms of multiplication and addition; multiplication
is dened in terms of addition; addition is dened in terms of zero and
successor (i.e. the operation of adding one). Zero and successor are primitive
notions. We are not told what zero and successor are; instead the axioms
tell us about properties of these notions. For instance, among several axioms
one says that zero is a natural number but not a successor of any natural
number. Another axiom is the principle of mathematical induction.
In axiomatic set theory, the notions of a set and membership are primi-
tive; they are not dened but their properties are stated in axioms.
9.1.5 Explanatory Note (About theorems)
1. Theorems are statements of proved properties of mathematical notions.
2. Axioms are considered to be the most basic theorems; all other theorems
are logically derived from denitions and axioms or earlier theorems.
3. Less important or simpler theorems are called propositions; those which
are quite obvious are called facts. Theorems which are just auxiliary to-
wards the proof of other theorems are called lemmas. Theorems which
are immediate consequences of other theorems are called corollaries.
The term theorem is often reserved for important theorems. Very im-
portant theorems have names, as is the case with the Pythagorean the-
orem or the fundamental theorem of arithmetic. So, propositions,
facts, lemmas and corollaries are all theorems these terms are used by
authors of mathematical texts depending on their subjective perception
of diculty, importance or role a theorem plays.
4. In mathematical texts you can also nd examples. Many examples are
theorems as well, but usually they are very simple theorems concerning
a single case; they illustrate denitions or other more general theorems.
(Examples of applications of mathematics to modelling of real world sit-
uations do not fall in the category of theorems.)
5. For instance, the following is a simple theorem, i.e. a proposition: the
product of any two odd integers is odd. The statement that for every
odd integer n, the number 3n is odd is now a corollary. The statement
that 3 789 = 2367 is a related example.
9.1.6 Explanatory Note (About proofs)
1. Logical derivations of theorems from axioms, earlier theorems and def-
initions are called proofs.
Proofs provide rigorous justications of theorems.
2. Proofs may use lemmas i.e. theorems which are not interesting in them-
selves but which were developed especially to be used in another proof.
3. It is crucial that a proof of a theorem uses only those theorems which
were proved earlier. Any attempt to construct a proof of a statement
using the same statement is erroneous; this kind of error is called, in
Latin, circulus vitiosus.
4. For instance, here is a proof of the theorem that the product of any two
odd integers is odd.
Let us take two arbitrary odd integers. By the denition of odd integers,
they can be written as 2m+ 1 and 2n + 1 for some integers m, n. Their
product is: (2m+1)(2n+1) = 4mn+2m+2n+1 = 2(2mn+m+n) +1.
As 2mn + m + n is an integer, by the denition of odd integers, this
product is an odd integer.
Notice that is this proof we have used the denition of an odd integer;
we also used theorems (or lemmas) which tell us that (a + b)(c + d) =
ac +ad +bc +bd and ab +ac +ad = a(b +c +d).
9.1.7 Explanatory Note (About axiomatic theories)
1. Mathematics consists of axiomatic theories.
Axiomatic theories consist of axioms, denitions and theorems with
proofs.
2. Among axiomatic theories, there are various versions of set theory, for-
mal arithmetic (i.e. number theory) and various versions of geometry,
including Euclidean geometry.
3. One of the axiomatic theories, the ZFC set theory has been extended
to encompass numbers, spaces, geometric objects, etc. Most of so far
formulated mathematics, including calculus, algebra, number theory and
geometry, can be formulated within ZFC.
Branches of mathematics, such as abstract algebra, algebraic topology,
theory of dierential equations etc., can be viewed as fragments of ZFC;
however textbook presentations of these subjects do not start from ax-
ioms.
4. One axiomatic theory can be based on axioms which contradict axioms
of another theory.
Euclids Fifth Postulate says that for and straight line l and a point p not
on that l, there exists a straight line parallel to l and going through p.
considered a version of geometry Euclidean geometry can be formulated
as an axiomatic theory in which Euclids Fifth Postulate is an axiom.
J. Boljai and N. Lobachevskij proposed alternative versions of geometry
which include axioms which contradict Euclids Fifth Postulate.
5. In some cases, the word theory is used just for reasons of tradition; for
instance, graph theory is a branch of mathematics but its development
does not start from axioms.
9.1.8 Historical Remark (Optional)
Euclid formulated his system of geometry in the 4th century B.C. it was the
rst axiomatic theory formulated in the history of the mankind. Giuseppe
Peano formulated in 1891 formal arithmetic an axiomatic theory of natural
numbers. In 1908, Ernst Zermello formulated a system of axiomatic set
theory, which evolved into Zermello-Frankel Set Theory with the Axiom of
Choice, abbreviated to ZFC.
9.1.9 Explanatory Note (About hierarchical structure)
Theories have a twofold hierarchical structure.
1. Denitions introduce new notions basing them on earlier notions. This
can be restated as:
denitions create the hierarchy of notions which starts with prim-
itive notions.
Except for minor variations, the notions and their denitions are standard
in mathematics and they are presented in the same way in all mathemat-
ical texts.
2. Every next theorem is proved from earlier ones or from axioms. This can
be restated as:
proofs create a hierarchy of theorems which starts with axioms.
There are often multiple ways to prove the same theorem, so this hierar-
chy varies form text to text.
9.1.10 Exercise
Research the following in library.
1. Find examples of two primitive notions and two axioms used in an ax-
iomatic mathematical theory. (You will get more points for considering
a theory, whose primitive notions are not mentioned in this text.) Read
enough about that theory to understand what you are copying; include
basic explanations in your answer to this exercise.
2. Using the discussion in this section, list the names of various types of
theorems and explain how they should be used. Find theorems of these
various types in another mathematics textbook. In your solution to this
problem give the title and author of the textbook. Comment if in that
textbook the names of theorems of various types are used the way we
discussed.
3. Find and write down a proof of one familiar theorem. Prepare to present
this proof in class. Make sure to clearly identify the denitions, axioms
and earlier theorems on which the proof is based.
Developing mathematics 9.2
9.2.1 Explanatory Note (About conjectures)
1. Conjectures are statements of suspected properties of mathematical
notions which have not been yet proved or disproved.
Formulating conjectures is useful in the process of developing mathemat-
ics. A conjecture is a challenge to mathematicians. When the conjecture
is proved it becomes a theorem. If the conjectured property is disproved
the statement that the property does not hold becomes a theorem. Some-
times a conjectured statement is eventually proved to be independent of
the existing axioms and then it becomes a new axiom.
2. In the 17th century, Pierre Fermat conjectured that all numbers of the
form 2
2
n
+1 where n is a non-negative integer are prime. In 1772, Leonard
Euler proved that 2
2
5
+1 is divisible by 641, hence not prime.
3. The most famous conjecture of Pierre Fermat was that the equation x
n
+
y
n
= z
n
has no solutions in positive integers x, y, z, n with n > 2. This
statement remained a conjecture for more than 300 years. Mathematical
societies funded prizes for anybody who would prove or disprove it. In the
second half of the twentieth century computers were employed to search
for a counter-example but did not nd it. Finally, in 1994 Andrew Wiles
proved the conjecture.
4. In 1742, Charles Goldbach conjectured that every even integer greater
than 2 is a sum of two primes. As of 2006, it has not been proved or
disproved.
Some mathematicians believe that Goldbachs conjecture can be neither
proved nor disproved neither the conjecture nor its negation follow from
the axioms in technical terms, it is independent of the axioms. However
independence of Goldbachs conjecture has not been proved either.
5. A statement A is said to be independent of axioms if neither A follows
from nor negation of A follows from .
A conjecture which turns out independent of the axioms can become a
new axiom.
Why does one care that a conjecture is independent of axioms before
making it a new axiom? If a conjecture A is not independent of axioms ,
then either A follows from or negation of A follows from . In the former
case, A does not contribute anything new to the theory: whatever follows
from and A follows just from . In the later case, the theory based on
axioms together with A is inconsistent, i.e. it leads to contradiction;
such a theory is useless.
Consider the following statement: for every family of non-empty sets
there exists a function which maps every set in that family to an element
of that set. It has been proved that this statement is independent of the
axioms of ZF set theory (assuming that ZF is consistent). The statement
is known under the name of axiom of choice and it is an axiom in ZFC
the ZF set theory with the axiom of choice.
6. Sometimes the word hypothesis is used in the sense of conjecture,
for instance, there is Continuum Hypothesis (which used to be a conjec-
ture, but which has been proved independent of the axioms of ZFC) and
Rieman Hypothesis whose status has not been determined as of 2006.
(Conjecture is the second meaning of the word hypothesis; the rst
meaning is assumption in reasoning.
9.2.2 Explanatory Note (About theses)
1. A scientic thesis is a statement, supported by repeatable observa-
tion but potentially refutable, which states that certain mathematical
notions model certain aspects of the real world.
As a thesis concerns a reality outside math, it involves notions other than
formal mathematical notions, and because of that it cannot be proved or
disproved based on mathematical axioms. For the same reason, a thesis
cannot be made an axiom in a formal theory.
Observations of the real world which are consistent with the model dis-
cussed in the thesis are said to support the thesis. A statement without
(a sucient) support will not be considered as a scientic thesis.
To be called a thesis a statement must be also potentially refutable. To
refute a thesis, one needs to nd a discrepancy between a repeatable
observation of the real world (possibly in a repeatable experiment) and
the mathematical model discussed in the thesis.
2. Church-Turing thesis states that recursive functions model the intu-
itive notion of computable functions. This thesis is supported by a proven
fact that all programs in contemporary programming languages (as of
2006) are equivalent to recursive functions. This statement is potentially
refutable, although it seems unlikely that it will be refuted that a
new computational mechanism can be introduced which will compute a
non-recursive function.
3. Although the term Newtons thesis is not commonly used, we could
understand by it the following statement: Newtons laws (also known as
Newtons axioms) model the mechanics of the universe.
Newtons thesis in this version has been refuted by observations of the
elementary particles (quantum world) and also by observations of planets
(movement of the perihelion of Mercury).
Although the term Einsteins thesis is not commonly used, we could
understand by it the following statement: Theory of relativity models the
mechanics of the non-quantum part of the universe. This is supported
by numerous observations.
Einsteins thesis implies a weaker version of the Newtons thesis: with
high probability Newtons laws model the mechanics of the bodies much
more massive than atoms and travelling at speeds much slower than the
speed of light (which could be made precise by specifying the degree of
probability, the error of approximation, the required mass and the limit
of the speed, but we will skip these details.) Because of this, Newtons
mechanics remains the foundation of mechanical engineering.
A version of Einsteins thesis without the restriction to the non-quantum
part of the universe has been refuted.
9.2.3 Exercise
Explain and expand: None of axioms, theses and conjectures have proofs,
but for dierent reasons.
Chapter 10
Methodology of scientic
research
Contents
10.1 Modelling (Optional) . . . . . . . . . . . . . . . . 147
10.2 Average seek time of a computer disc (Optional) 152
csc318
Modelling (Optional) 10.1
10.1.1 Informal Example
The binary relation is-of-the-same-color-as is an equivalence relation on the
set of crayons in Toms box (in some models).
10.1.2 Explanatory Note
We call the example above informal for two reasons:
1. it concerns notions not dened in mathematics (crayons, colors), and
2. it is not completely specied it relies on our imagination (of how many
crayons are there and of what colors they are), and on our intuition (of
what is meant by the same color).
10.1.3 Explanatory Note (On modelling)
Mathematics is commonly used to model real-world notions and situations as
well as notions and situations from sciences. Once a problem is modelled in
mathematics, it can be treated as a purely mathematical problem involving
exclusively notions dened in mathematics without references to the real
world or any science.
147
Modelling is always done with a specic goal in mind and involves
abstraction, formalization/interpretation and representation.
These three processes often cannot be completely separated.
Abstraction, with a particular goal, means focussing on the essen-
tial aspects of the situation, disregarding those details which are not
relevant to the goal.
For instance, thinking of informal example above, if the goal is to consider
only colors, we can disregard the weights. On the other hand, modelling
with the goal of describing the trajectory of the box, if thrown by Tom,
would require accounting for the wights but would allow to disregard colors.
Formalization/interpretation in mathematics means replacing no-
tions not dened in mathematics by notions dened in mathematics.
Representation means replacing notions dened in mathematics by
other notions dened in mathematics (which are perhaps easier to
work with).
Two mathematical models are equivalent if they represent the same
information.
Given several dierent but equivalent models we can try to choose the model
which allows for the easiest realization of our goal.
10.1.4 Example
We will present several mathematical models of the situation from the infor-
mal example above, translating it to the language of mathematics (in this
case, the language od sets, functions and relations), and specifying exactly
what crayons are there, what is meant by a color, and what is the assignment
of colors to crayons. We will also comment on the models.
1. Box = 1, 0, 1, 2, 3, 4, 5
Crayons = 1, 2, 3, 4, 5.
Colors = yellow, green, blue
color(1) = yellow
color(2) = blue
color(3) = green
color(4) = yellow
color(5) = green
a is-of-the-same-color-as b i color(a) = color(b)
is-of-the-same-color-as is an equivalence relation on Crayons
2. As the goal is to consider just crayons and their colors, more abstraction
could be applied. We will improve and simplify the model above by
removing the description of the Box.
Crayons = 1, 2, 3, 4, 5.
Colors = yellow, green, blue
color(1) = yellow
color(2) = blue
color(3) = green
color(4) = yellow
color(5) = green
a is-of-the-same-color-as b i color(a) = color(b)
is-of-the-same-color-as is an equivalence relation on Crayons.
3. Crayons =
1, yellow), 2, blue), 3, green), 4, yellow), 5, green).
x
1
, y
1
)is-of-the-same-color-as x
2
, y
2
) i y
1
= y
2
is-of-the-same-color-as is an equivalence relation on Crayons.
This model oers a dierent representation but it is equivalent to the
previous model.
4. Crayons = 1, 2, 3, 4, 5.
Colors = yellow, green, blue
yellow = 1, 4,
blue = 2,
green = 3, 5,
a is-of-the-same-color-as b i
CColors
a C b C.
is-of-the-same-color-as is an equivalence relation.
This model oers a yet dierent representation but it is equivalent to the
either of the previous two models.
5. Crayons = 1, 2, 3, 4, 5.
Colors = 400, 450, 550
(This are the wavelengths of blue, green and yellow light, in nanometers.)
color(1) = 550
color(2) = 400
color(3) = 450
color(4) = 550
color(5) = 450
a is-of-the-same-color-as b i [color(a) color(b)[ 10
is-of-the-same-color-as is an equivalence relation.
This model oers a yet dierent representation but it is equivalent to the
either of the previous three models.
6. Crayons = 1, 2, 3, 4, 5.
Colors = [400, 700]
(This is the interval of wavelengths of visible light, in nanometers.)
color(1) = 550
color(2) = 400
color(3) = 450
color(4) = 550
color(5) = 450
a is-of-the-same-color-as b i [color(a) color(b)[ 10
is-of-the-same-color-as is an equivalence relation on Crayons.
This model oers a yet dierent representation, and despite its similarity
to the previous model, it is not equivalent: the numbers of colors in the
two models are dierent.
7. Crayons = 1, 2, 3, 4, 5, 6, 7, 8, 9.
Colors = [400, 700]
color(1) = 550
color(2) = 400
color(3) = 450
color(4) = 550
color(5) = 450
color(6) = 410
color(7) = 420
color(8) = 430
color(9) = 440
a is-of-the-same-color-as b i [color(a) color(b)[ 10
is-of-the-same-color-as is not an equivalence relation.
Notice that is-of-the-same-color-as is dened by the same formula as in
the previous model, however with more crayons in this model, is-of-the-
same-color-as is no longer an equivalence relation.
This model is not equivalent to the previous model.
8. Crayons = c
1
, c
2
, c
3
, c
4
, c
5
.
Colors =
yellow, yellow-green, yellow-green, green, blue-green, blue, blue-green
(Colors are ranges of hues; there are three colors in this model: yellowish
hue color, greenish hue color and bluish hue color.)
color(c
1
) = yellow, yellow-green
color(c
2
) = blue, blue-green
color(c
3
) = yellow-green, green, blue-green
color(c
4
) = yellow, yellow-green
color(c
5
) = yellow-green, green, blue-green
a is-of-the-same-color-as b i color(a) color(b),=
(Two colors are considered the same if they have a common hue.)
is-of-the-same-color-as is not an equivalence relation.
If you recognize the value of the previous model you cannot dismiss this
model as inappropriate although the two models use dierent repre-
sentations and involve dierent numbers of crayons, they are based on
similar ideas.
10.1.5 Explanatory Note
Why have we called the example at the beginning of this section informal?
Whenever a description of situation relies on imagination or intuition, there
is a possibility of non-equivalent interpretations. Indeed, in some models
above, is-of-the-same-color-as is an equivalence relation, while in some, it is
not.
In mathematics, science and engineering one cannot use statements or
descriptions which allow inconsistent interpretations. Informal examples,
which are simply stated at the cost of admitting non-equivalent models, are
useful in learning but they should be recognized as informal and lacking
precision.
10.1.6 Explanatory Note (On quality of models)
For one situation and a modelling goal we can construct many dierent
mathematical models.
The appropriateness/quality of a mathematical model of a given
situation is evaluated by checking to what extent the inferences/results
obtained in the model coincide with the observations conducted in the
situation.
Evaluation of quality of models is not in the scope of mathematics; it is in
the scope of experimental science.
1. Movement of a ball of a given mass, on a at, level surface, the ball being
initially subjected to a given force, can be modelled with or without tak-
ing the friction into account. The model which takes friction into account
is more accurate. However, the model without friction oers a suciently
good approximation if we are interested in tracing the movement of the
ball over a short interval of time.
2. Before the 20th century, the orbit of Mercury was modelled by an equa-
tion constructed according to Newtons mechanics. In the 20th century,
another equation was constructed based on Einsteins theory of relativ-
ity. In Newtons model the perihelion of the orbit did not circle the Sun;
in Einsteins model it did. (The orbit is an ellipse; the perihelion is the
point on the orbit which is closest to the Sun.) Astronomical observa-
tions have shown that this so called precession of Mercury amounts to
an angle of about 43 seconds per century, so the perihelion circles the
Sun in a period of time equal (within the error of measurement) to that
obtained in Einsteins model. So, Einsteins model of Mercurys orbit
is more accurate than Newtons. On the other hand Newtons model is
simpler. Which model to use, depends on how you weigh accuracy versus
simplicity.
10.1.7 Exercise
Modelling a color of an object as a single wavelength of visible light is sim-
plistic. The color of an object which reects light depends on what wave-
lengths of light are absorbed by the object. So, it can be appropriate to
model the color of an object as a subset of the interval [400, 700] which con-
tains exactly the absorbed wavelengths. In this context, model the relation
is-of-the-same-color-as.
10.1.8 Explanatory Note (On modelling for computer programming)
Notice that modelling is used not only in mathematics but also while design-
ing computer programs. The only dierence is that while modelling in math-
ematics, we represent real world objects as mathematical notions (sets, or-
dered pairs, etc.), and while modelling for computer programming, we repre-
sent real world objects as data structures (records, linked lists, etc.) For this
reason, modelling for computer programs is called data representation.
In complex problems, it can be helpful to perform two stage modelling:
rst to model a real world situation in mathematics, and then to model
relevant mathematical notions as data structures.
In some problems it may be useful to compare dierent equivalent rep-
resentations and to choose one which allows for easiest and most ecient
realization of the goal; i.e. one which admits an algorithm with a better
computational complexity.
10.1.9 Programming Exercise (Extra credit)
Model the mathematical notion a nite set of integers, and the union oper-
ation, using two dierent approaches. In the rst approach represent such
sets as lists of integers, in arbitrary order. In the second approach represent
such sets as sorted lists of integers. For each approach, design an ecient al-
gorithms for computing the union. Although the two models are equivalent,
one oers a better time complexity; which one?
Average seek time of a computer disc (Optional) 10.2
10.2.1 Explanatory Note
A computer disk contains one or more plates. Either one or both surfaces
of a plate are used to record information. A surface contains a number of
concentric circles, called tracks, on which the information is recorded. The
tracks are equally spaced.
Every tracks is divided into the same number of segments, called blocks.
Angular measures of all blocks are the same. Although blocks on tracks near
the edge of the plate are longer than those on tracks near the center of the
plate, every block stores the same amount of data.() A block is the smallest
unit of data that can be transferred between the disk and RAM; even if only
a single byte is needed, the entire block which contains the byte needs to be
transferred.
The disk drive is equipped with an armcontaining one read-write head
per every surface. The arm moves all the read-write heads simultaneously
in a straight line between the edge of the plates and their centers. When a
head reaches the desired track, the arm stops; the plates continuously rotate
underneath and the head can read or write a block of information on the
track over which it is positioned.
Operations of the arm and the heads are controlled by the disk con-
troller which is a part of the computer disk unit.
In the computer, requests from the CPU are processed by the I/O pro-
cessor which operates in parallel with the CPU while information is being
transferred CPU can do other work. The I/O processor communicates with
the disk controller and arranges transfer of information between the disk
and an I/O buer in RAM.
10.2.2 Denition
The time needed to fulll a request for transfer of data between the disk and
RAM is called an access time. Access time can be split into the following
components.
1. Moving the read-write head from its current position to a position over
the track where the requested block is located. The time spent on this
operation is called a seek time.
2. Waiting until the beginning of the requested block comes under the head.
The time spent on this is called a latency or rotational delay.
3. Scanning the desired block. The time spent on this operation is called a
transfer time.
10.2.3 Explanatory Note
Disk manufacturers often specify the average-case or worst-case access time
for their models. We will consider the best-case as well.
Best-case Worst-case Average-case
Seek
Time
0 Time needed to
move form the
rst to the last
track
? (This will
be investigated in
this section)
Latency 0 Time needed for
one full revolution
of the disk
Time needed for
half of the revolu-
tion of the disk
Transfer
Time
Time needed for
the block to pass
under the head
Time needed for
the block to pass
under the head
Time needed for
the block to pass
under the head
Access
Time
Sum of the above Sum of the above Sum of the above
10.2.4 Explanatory Note
Seek time depends on the algorithm for scheduling disk arm movements.
One simple algorithm is First-Come-First-Served Algorithm (FCFS):
the requests for block transfers are served in the order they were received.
10.2.5 Explanatory Note
It is obvious that the average-case latency is the average of the best-case
latency and worst-case latency. But what does average seek time mean
(under FCFS)? We need to develop understanding of this issue and we will
be proceeding in stages before we can formulate and solve a real life version
of this problem. Our initial formulations of the problem will contain sim-
plifying, unrealistic assumptions, but these will be removed one by one in
consecutive versions.
To get to the essence of this issue, instead of considering the time we
will consider the distance the read-write head needs to move. The distance
between the tracks will be measured in multiples of the distance between
two consecutive tracks; so, the distance between tracks i and j is [i j[
units. We will assume that there are n tracks on a surface of our disk.
The case of worst (largest) distance occurs when the head needs to move
from track 1 to track n, i.e. the distance of n 1 units. The best case is
when no movement is necessary, i.e. the distance of 0 units. What is the
average case?
10.2.6 Exercise
Under the FCFS algorithm, is the average distance travelled by the disk
read-write head equal to the average of the best- and worst-case distances?
10.2.7 Solution
To visualize the distances involved consider a (toy) disk with just ve tracks.
The following chart shows the distances the read-write-head must travel to
move form a position above track i to a position above track j, for all pairs
i, j). The distance between two consecutive tracks is used as a unit of
distance.
Distances to track:
1 2 3 4 5
1 0 1 2 3 4
2 1 0 1 2 3
From track: 3 2 1 0 1 2
4 3 2 1 0 1
5 4 3 2 1 0
The worst-case distance is 4; the best-case distance is 0; their average is 2.
The total distance in the 25 cases listed in the table above is 40. Assuming
that each of the 25 cases is equally likely, the average distance is 40/25 = 1.6.
This shows that the answer to the question in the exercise is no.
10.2.8 Sample Problem (Average seek distance under FCFS assuming
uniform distribution of requests)
Consider a disk with n tracks per surface. Assume that the movements of the
read-write head from track i to track j are equally likely for all pairs i, j)
where i, j n. What is the average distance AD(n) the read-write head
travels in a single move? Give your answer as a multiple of the distance
between two consecutive tracks.
10.2.9 Chart
Distances to track:
1 2 3 ... n 1 n
1 0 1 2 ... n 1 n
2 1 0 1 ... n 2 n 1
From track: 3 2 1 0 ... n 3 n 2
... ... ... ... ... ... ...
n 1 n 1 n 2 n 3 ... 0 1
n n n 1 n 2 ... 1 0
10.2.10 Solution
We already answered this question for n = 5. To consider the question in
full generality we need to deal with the chart above.
We will denote the total distance travelled by the read-write head in
the n
2
cases listed in this chart by TD(n). So, TD(n) is the sum of the n
2
numbers in this chart and
AD(n) =
TD(n)
n
2
But how to represent TD(n) by a concise mathematical expression? Well,
lets rst see how the function TD changes when we pass from n to n + 1,
for instance, from 5 to 6. (The entries in the newly added row and column
are in italic.)
Distances to track:
1 2 3 4 5 6
1 0 1 2 3 4 5
2 1 0 1 2 3 4
From track: 3 2 1 0 1 2 3
4 3 2 1 0 1 2
5 4 3 2 1 0 1
6 5 4 3 2 1 0
Notice that TD(6) = TD(5) +2(1 +2 +3 + 4 +5). In general,
TD(n +1) = TD(n) +2(1 +2 +... +n) = TD(n) +n(n +1).
(We have used the fact that 1 +2 +.. +n = n(n+1)/2.) So, now we have a
formula which allows to reduce the problem of calculating TD(n +1) to the
problem of calculating TD(n). Such a formula is called a recursive formula
or a recurrence. However, notice that this formula does not dene function
TD uniquely until we add the base case: TD(1) = 0. Now, the complete
denition of TD is
(1) TD(1) = 0
(2) TD(n +1) = TD(n) +n(n +1)
We would be interested in knowing a formula which denes TD explicitly,
in terms of n, without referring to TD. Finding such formulas is the subject
of the theory of recurrence equations, but here we will try to manage by our
own means.
The nicest functions to work with are polynomials perhaps TD is a
polynomial lets explore. What could be the degree of such a polynomial?
Equation (2) involves terms of degree two, so perhaps TD can be represented
by a polynomial of a degree not bigger than three. We are going to assume
that
(3) TD(n) = an
3
+bn
2
+cn +d
and we will try to nd values of coecients a, b, c, and d. (If this fails,
we will be back where we were.) Using the recurrences (1) and (2) above
we will set a system of linear equations in which a, b, c, d will be treated as
variables. Let us express the left-hand side of (2) using (3):
TD(n +1) =
a(n +1)
3
+b(n +1)
2
+c(n +1) +d =
a(n
3
+3n
2
+3n +1) +b(n
2
+2n +1) +c(n +1) +d =
an
3
+3an
2
+3an +a +bn
2
+2bn +b +cn +c +d =
an
3
+(3a +b)n
2
+(3a +2b +c)n +(a +b +c +d)
Now let us express the right-hand side of (2) using (3):
TD(n) +n(n +1) =
an
3
+bn
2
+cn +d +n(n +1) =
an
3
+(b +1)n
2
+(c +1)n +d
From calculus we know that if two polynomials in variable n have the same
values for all n Z
+
then the polynomials must have the same coecients.
(Would you be able to prove such a proposition?) So, we obtain the following
equations.
(4i) 3a +b = b +1
(4ii) 3a +2b +c = c +1
(4iii) a +b +c +d = d
This is a system of 3 equations with 4 variables we need one more equation.
The fourth equation will be obtained from (1) and (3):
0 = TD(1) = a 1
3
+b 1
2
+c 1 +d = a +b +c +d,
i.e.
(4iv) a +b +c +d = 0
Solve equations (4i) - (4iv)!
You should obtain a = 1/3, b = 0, c = 1/3, d = 0.
The way we obtained these values guarantees that the function an
3
+bn
2
+
cn +d, satises conditions (1) and (2). So,
(5) TD(n) =
n
3
n
3
=
(n 1)n(n +1)
3
So, the average distance travelled by the read-write head on a disk with n
tracks under assumptions of this problem is
(6) AD(n) =
TD(n)
n
2
=
(n 1)(n +1)
3n
=
n
2
1
3n
As (n
2
1)/3n = (n
1
n
)/3, for big values of n the following approximate
formula will be valid.
(7) AD(n)
n
3
10.2.11 Programming Exercise (Extra credit)
Write a program which calculates AD(n) for n = 2
k
where k = 0, 1, 2, ..., 20
in three ways, by means of three dierent functions/methods:
1. The rst function should add the n
2
numbers from Chart 10.2.9 and
divide the sum by n
2
.
2. The second function should be based on the recursive denition of TD(n)
in the solution above.
3. The third function should use the exact formula for AD(n) which de-
scribes AD explicitly in terms of n, developed in the solution above.
Analyze the time complexities of the three functions and express them using
big O notation. Time the three functions on the computer. Graph the results
of timing using logarithmic paper. Compare the timing results with your
theoretical analysis of time complexity.
10.2.12 Exercise
In the solution above, in order to nd function TD such that TD(1) = 0 and
TD(n + 1) = TD(n) +n(n + 1) we assumed that TD(n) can be represented
by a polynomial of degree not bigger than 3, set a system of linear equations
and solved them to nd the coecients of the polynomial. To understand
this process better, try the following and describe the results.
1. Assume that TD(n) can be represented by a polynomial of degree not
bigger than 2, set a system of linear equations and try to solve them to
nd the coecients of the polynomial.
2. Assume that TD(n) can be represented by a polynomial of degree not
bigger than 4, set a system of linear equations and try to solve them to
nd the coecients of the polynomial.
10.2.13 Exercise
The Reader could approach the sample problem above in a dierent way.
The lower triangle in Chart 10.2.9 contains n 1 ones, n 2 twos, n 3
threes, etc. So,
TD(n) =
2 [(n 1) 1 +(n 2) 2 +... +1 (n 1)] =
2 [(n 1 +n 2 +... +n (n 1)) +
(1 1 +2 2 +... +(n 1) (n 1))] =
2 [n (1 +2 +... +(n 1)) (1
2
+2
2
+... +(n 1)
2
)]
The formula for 1 + 2 + ... + k is well known. On the other hand, hardly
anybody knows or remembers the formula for 1
2
+ 2
2
+ ... + k
2
. If we
knew this formula we could nish the calculation of TD(n) and then obtain
AD(n). Find this formula using steps analogous to those in the solution
above: assume that 1
2
+2
2
+... +k
2
can be represented by a polynomial of
degree not bigger than 3, set a system of linear equations and solve them to
nd the coecients of the polynomial. As an additional exercise prove by
mathematical induction that the polynomial you found represents 1
2
+2
2
+
... +k
2
.
10.2.14 Explanatory Note
In some situations one cannot assume (as we did in the previous sample
problem) that all possible moves of the read-write head are equally likely.
If the computer is used by a single user who has just one le open, the
read-write head is more likely to stay on the same track or to move to the
next track than to move anywhere else. We will formulate a more general
version of our problem which will cover also this case.
10.2.15 Sample Problem (Average seek distance under FCFS assuming
non-uniform distribution of requests)
Consider a disk with n tracks per surface. Assume that the probability that
the head stays on the same track is p
0
. Assume that for every k < n the
probability of the head movement from track k to track k + 1 is p
1
. As-
sume that the head movements between all the remaining pairs of tracks
are equally likely. What is the average distance AD(n, p
0
, p
1
) the read-write
head travels in a single move? Give your answer as a multiple of the distance
between two consecutive tracks.
10.2.16 Solution
Distances to track:
1 2 3 ... n 1 n
1 0 1 2 ... n 1 n
2 1 0 1 ... n 2 n 1
From track: 3 2 1 0 ... n 3 n 2
... ... ... ... ... ... ...
n 1 n 1 n 2 n 3 ... 0 1
n n n 1 n 2 ... 1 0
Requests represented by items on the main diagonal (zeros) occur with prob-
ability p
0
; requests represented by items just above the main diagonal (italic
ones) occur with probability p
1
; the remaining requests occur with proba-
bility 1 p
0
p
1
. How to handle these assumptions of probability? Let us
think about frequency of events. Let R be a number of requests for data
transfers; think that R is big. According to the assumptions of the problem,
among our R requests there will be roughly:
Rp
0
requests for data from the current track,
Rp
1
requests for data from the next track,
R (1 p
0
p
1
) requests for data from a yet another track.
The average length of a move is:
0 among requests involving the same track,
1 among requests involving the next track,
(TD(n) (n 1))/(n
2
n (n 1)) among other requests
where TD(n) has been calculated in the previous solution. (Look at the
chart above and think why!)
So, the total length of these R moves is
Rp
0
0 +Rp
1
1 +
R(1 p
0
p
1
)(TD(n) (n 1))
n
2
n (n 1)
and the average distance can be obtained by dividing this expression by R:
p
0
0 +p
1
1 +
(1 p
0
p
1
)(TD(n) (n 1))
n
2
n (n 1)
After substituting here the expression (5) for TD(n) and after some simpli-
cations, the Reader should obtain:
(8) AD(n, p
0
, p
1
) = p
1
+
(1 p
0
p
1
)(n
2
+n 3)
3(n 1)
Let us also derive from (8) a simplied, approximate formula which can be
used for big values of n.
(9) AD(n, p
0
, p
1
)
(1 p
0
p
1
)n
3
10.2.17 Exercise
Check consistency of formula (8) with the formula (6) the rst sample
problem is a particular case of the second sample problem with p
0
= n/n
2
=
1/n and p
1
= (n 1)/n
2
, so substituting these values in formula (8) should
produce a formula equivalent to (6).
10.2.18 Programming Exercise (Extra credit)
Using a random number generator write a program which simulates R =
1, 000, 000 random head movements between tracks of a disk with n = 1000
tracks and calculates the average distance travelled by the head under as-
sumptions of Sample Problem 10.2.15. Compare the result produced by the
program with the result obtained from the formula in the solution above.
10.2.19 Explanatory Note
In the real world, customers of disk manufacturers do not ask about the
average distance travelled by the read-write head, they ask about the average
seek time. Transition from the calculation of distance to the calculation of
time is not immediate the seek time is not proportional to the distance
travelled by the head. In every move a certain startup time needs to elapse
before the mechanism can overcome inertia, and only after that the head
moves at a constant speed. (Notice that the inertia is signicant not because
the head is heavy but because it is trying to move very fast.) With the
addition of this detail we will formulate the full version of our problem.
10.2.20 Sample Problem (Average seek time under FCFS full version)
Consider a disk with n tracks per surface. Assume that the probability
that the head stays on the same track is p
0
. Assume that for every k < n
the probability of the head movement from track k to track k + 1 is p
1
.
Assume that the head movements between all the remaining pairs of tracks
are equally likely. Assume that the time needed to move the read-write head
from track i to j (where i,=j) is t
0
+[i j[ t
1
where t
0
and t
1
are constants,
(t
0
is much bigger than t
1
).
What is the average seek time AST(n, p
0
, p
1
, t
0
, t
1
) ?
10.2.21 Solution
We will continue the reasoning from the previous version of the problem.
Recall that R stands for the number of requests for data transfers. The
total distance the head moves in these R requests is R AD(n, p
0
, p
1
). In
R (1 p
0
) of these requests the head does not stay on the current track
and the startup time must be accounted for. The total time spend on head
movements in these R requests can be split into R (1 p
0
) startups, which
take R (1p
0
)t
0
time, and the time spent on moving at the constant speed
over the total distance: R AD(n, p
0
, p
1
)t
1
. So, the total time used for head
movements in these R requests is R (1 p
0
)t
0
+ R AD(n, p
0
, p
1
)t
1
. To
obtain the average seek time we need to divide this by R:
AST(n, p
0
, p
1
, t
0
, t
1
) = (1 p
0
)t
0
+AD(n, p
0
, p
1
)t
1
Now, it remains to substitute expression (8) for AD(n, p
0
, p
1
)
(10) AST(n, p
0
, p
1
, t
0
, t
1
) =
(1 p
0
)t
0
+p
1
t
1
+
(1 p
0
p
1
)t
1
(n
2
+n 3)
3(n 1)
Let us also derive from (10) a simplied, approximate formula which can be
used for big values of n.
(11) AST(n, p
0
, p
1
, t
0
, t
1
) (1 p
0
)t
0
+
(1 p
0
p
1
)t
1
n
3
In this approximate formula we left the constant term (1 p
0
)t
0
because t
0
is much bigger than t
1
causing that this term can substantially aect the
resulting value if n is just big but not huge. (In real computer disks n is of
the order of 100 or 1000 and t
0
can be 50 times bigger than t
1
.)
10.2.22 Exercise
Check consistency of formula (10) with the formula (8) the second sample
problem is a particular case of the third sample problem with t
0
= 0 and
t
1
= 1, so substituting these values in formula (10) should produce a formula
equivalent to (8).
10.2.23 Programming Exercise (Extra credit)
Write a program which simulates head movements between tracks of a disk
and calculates the average seek distance under assumptions of Sample Prob-
lem 10.2.20. Compare the result produced by the program with the result
obtained from the formula in the solution above.
10.2.24 Explanatory Note
In this section we have shown how a problem and its solution can evolve to-
gether. Given a real world problem, a researcher often simplies the problem
using additional, even unrealistic, assumptions. Then one of the simplifying
assumptions is removed and researcher generalizes the previous solution to
the new version of the problem. This is repeated until the full version of the
problem is solved.
10.2.25 Explanatory Note
Solutions to sample problems presented above assume the First-Come-First-
Served (FCFS) algorithm for scheduling disk arm movements: the requests
for block transfers are served in the order they were received. There is a
more ecient disk arm scheduling algorithm known as LOOK (a variant of
SCAN or ELEVATOR algorithm): the head keeps moving in one direction
until it visits all tracks for which there are requests in the current pool, then
it changes direction and continues in the same manner, and so on.
We can assume that placements of requests form a Poisson process, i.e.
that the time between two requests has an exponential distribution. Theo-
retical analysis of the average seek time under the LOOK algorithm belongs
to the queuing theory and it is sometimes presented in a graduate courses
on probability.
10.2.26 Advanced Programming Problem (Optional)
Write a program to perform a simulation of the LOOK algorithm. The
program should report not only the average seek time but also the average
waiting time for completion of a request.
Appendix A
Summaries
Contents
A.1 Sets of numbers . . . . . . . . . . . . . . . . . . . 162
A.2 Equivalences and equalities useful in proofs . . . 163
Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . 163
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Binary relations . . . . . . . . . . . . . . . . . . . . . . 164
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Equivalence relations and partitions . . . . . . . . . . . 166
Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
A.3 English versus logic . . . . . . . . . . . . . . . . . 167
A.4 Logical equivalences useful in proofs . . . . . . . 170
Eliminating a connective or quantier . . . . . . . . . . 170
Simplifying a negation . . . . . . . . . . . . . . . . . . . 170
Other logical equivalences useful in proofs . . . . . . . . 171
A.5 Constructing proofs and counter-examples . . . 172
A.6 Reading mathematical symbols . . . . . . . . . . 174
A.7 Greek alphabet . . . . . . . . . . . . . . . . . . . . 174
A.8 Arity . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Sets of numbers A.1
N the set of natural numbers, i.e. these numbers: 0, 1, 2, 3, ...
Z the set of integers, i.e. these numbers: ..., 3, 2, 1, 0, 1, 2, 3, ...
Z
+
the set of positive integers, i.e. these numbers: 1, 2, 3, ...
162
the set of rational numbers,
i.e. all numbers which can be represented by fractions
1 the set of real numbers
Z
+
_ N _ Z _ _ 1
Equivalences and equalities useful in proofs A.2
Arithmetic
Divisibility relation, m divides n:
m[n i m, n Z m ,= 0
kZ
n = k m
Congruence mod k (where k Z, k 2), m is congruent to n mod k:
m
k
n i m, n Z k[(n m),
Sets
a is a member of A:
a A
Empty set:
x i false
X = i
x
x , X
Set with elements a
1
, a
2
, a
3
:
x a
1
, a
2
, a
3
i x=a
1
x=a
2
x=a
3
Set of all the elements a from A such that Q(a):
x a A : Q(a) i x A Q(x)
Inclusion, A is a subset of B:
A B i
x
(x A x B)
A B i (A _ B) A=B
Reversed inclusion, B is a superset of A:
B A i A B
Equality of sets:
A = B i
x
(x A x B)
A = B i (A B) (B A)
Proper inclusion, A is a proper subset of B:
A _ B i A B A,=B
Reversed proper inclusion, B is a proper superset of A:
B _ A i A _ B
Union:
x A B i x A x B
Union of an indexed family:
x

iI
A
i
i
iI
x A
i
Union of a family:
x

A i
BA
x B
Intersection:
x A B i x A x B
Intersection of an indexed family:
x

iI
A
i
i
iI
x A
i
Intersection of a family:
x

A i
BA
x B
Set dierence:
x AB i x A x , B
Complement with respect to a chosen universal set U:
x A i x U x , A
Symmetric dierence:
x A

B i x (AB) (B A)
x A

B i x (A B) (A B)
Powerset:
x T(A) i x A
Cartesian product:
x AB i
aA,bB
x=a, b)
Cartesian power:
x A
3
i
x
1
,x
2
,x
3
A
x=x
1
, x
2
, x
3
)
Binary relations
R is a binary relation i
X,Y
R X Y
aRb i a, b) R
Domain:
a domain(R) i
b
aRb
Range:
b range(R) i
a
aRb
Field:
x eld(R) i x domain(R) x range(R)
Inverse relation:
aR
1
b i bRa
Relative product and relation composition:
a(R
1
; R
2
)b i a(R
2
R
1
)b i
x
aR
1
x xR
2
b
Power:
a
0
R
3
a
3
i
a
1
,a
2
a
0
Ra
1
a
1
Ra
2
a
2
Ra
3
R is reexive on A i
aA
aRa
R is symmetric on A i
a,bA
aRb bRa
R is transitive on A i
a,b,cA
aRb bRc aRc
R is anti-reexive on A i
aA
aRa
R is weakly anti-symmetric on A i
a,bA
aRb bRa a=b
R is strongly anti-symmetric on A i
a,bA
aRb bRa
R is strongly connected on A i
a,bA
aRb bRa
R is weakly connected on A i
a,bA
aRb bRa a=b
Functions
R is a function i
x,y
1
,y
2
xRy
1
xRy
2
y
1
=y
2
.
Function from X to Y :
f : X Y i domain(f) = X range(f) Y .
Injection or one-to-one function:
f is 1-1 i
x
1
,x
2
domain(f)
x
1
,=x
2
f(x
1
),=f(x
2
),
f : X
1-1
Y i f : X Y and f is 1-1.
Surjection onto Y :
f is onto Y i range(f) = Y ,
f : X
onto
Y i f : X Y and f is onto Y .
Bijection between X and Y :
f : X
1-1, onto
Y i f : X
1-1
Y and f : X
onto
Y .
Composition (assuming that range(f) domain(g)):
(g f)(x) = g(f(x)).
Identity function on A:
id
A
(x)=x (for every x A).
Inverse function (assuming that f is 1-1):
f
1
(x)=y i f(y)=x.
f : X
1-1
Y i there exists g : Y X such that g f = id
X
.
f : X
onto
Y i there exists g : Y X such that f g = id
Y
.
f : X
1-1, onto
Y i
there exists g : Y X such that g f = id
X
and f g = id
Y
.
Image of a set under a function:
b

f (A
1
) i
aA
1
f(a) = b.
Inverse image or pre-image of a set under a function:
a

f (B
1
) i
bB
1
f(a) = b.
Equivalence relations and partitions
R is an equivalence on A i
R is reexive on A, symmetric on A and transitive on A.
P is a partition of A i
P is a disjoint family of sets,

P = A, and , P.
Equivalence class of R determined by a
(assuming that R AA and R is an equivalence on A):
[a]
R
= b A : aRb.
Quotient set, quotient of A by R, partition corresponding to R
(assuming that R AA and R is an equivalence on A):
A/R = [a]
R
: a A.
Given a partition P, the corresponding equivalence relation on

P:
aRb i
pP
a p b p.
Orders
R is a weak (partial) order on A i
R is reexive on A, weakly anti-symmetric on A and transitive on A.
R is a strict (partial) order on A i
R is anti-reexive on A, weakly anti-symmetric on A, transitive on A.
R is a strict (partial) order on A i
R is strongly anti-symmetric on A and transitive on A.
R is a strict (partial) order i
R is anti-reexive on A and transitive on A.
R is a weak linear order on A i
R is a weak partial order on A and is weakly connected on A.
R is a weak linear order on A i
R is a weak partial order on A and is strongly connected on A.
R is a strict linear order on A i
R is a strict partial order on A and is weakly connected on A.
1-1 correspondence between weak and strict orders on A:
x _ y i x y x=y
x y i x _ y x,=y.
b is maximal in A i b A and
aA
(b a),
i.e. b A and nothing in A is bigger than b.
b is minimal in A i b A and
aA
(a b),
i.e. b A and nothing in A is smaller than b.
b is greatest in A i b A and
aA
a _ b,
i.e. b A and everything in A is smaller or equal to b.
b is least in A i b A and
aA
b _ a,
i.e. b A and everything in A is bigger or equal to b.
b is an upper bound of A i
aA
a _ b
i.e. everything in A is smaller or equal to b.
b is a lower bound of A i
aA
b _ a
i.e. everything in A is bigger or equal to b.
b = supA = lubA =
_
A i b is the least upper bound of A.
b = infA = glbA =
_
A i b is the greatest lower bound of A.
English versus logic A.3
English Logic
p even if q p
p regardless of q
p whether q or not
not p p
it is not the case that p
p and q p q
both p and q hold
p but q
p although q
p even though q
p however q
p, moreover q
p while q
p ; q
p. q.
p. Also, q.
p without q p q
(p q)
neither p nor q p q
none of p and q hold (p q)
both p and q do not hold
not both p and q hold (p q)
p q
p or q p q
p or q or both
p and/or q
either p or q p q
p or q but not both (p q)
p is equivalent to q p q
p if and only if q (p q)
p exactly when q
p just when q
English Logic
if p then q p q
p implies q q is implied by p
if p, q q if p
when p, q q when p
whenever p, q q whenever p
not p without q without q, no p
p provided q p q
p is implied by q q implies p
p if q if q, p
p when q when q, p
p whenever q whenever q, p
without p, no q not q without p
The following phrases are used when p is known or assumed to be true:
p, so q p q
p, thus q
p, hence q
p, therefore q
because of p, q q because p
as p, q q as p
The following phrases are used when q is known or assumed to be true:
p because q because of q, p p q
p as q as q, p
p unless q unless q, p p q ?
p except if q except if q, p
p except when q except when q, p
English Logic
p(x) is enough for q(x)
x
(p(x)q(x))
p(x) is sucient for q(x)
p(x) is not enough for q(x)
x
(p(x)q(x))
p(x) is not sucient for q(x)
x
(p(x)q(x))

x
(p(x) q(x))
p(x) is necessary for q(x)
x
(p(x)q(x))
p(x) is not necessary for q(x)
x
(p(x)q(x))

x
(p(x)q(x))

x
(p(x) q(x))
p(x) is sucient and necessary for q(x)
x
(p(x) q(x))
conditions p(x) and q(x) are equivalent
it is not the case that p(x) is sucient and necessary for q(x)
x
(p(x) q(x))
conditions p(x) and q(x) are not equivalent
x
(p(x) q(x))
English Logic
all of p
1
, p
2
, p
3
hold p
1
p
2
p
3
p
1
and p
2
and p
3
none of p
1
, p
2
, p
3
hold p
1
p
2
p
3
neither p
1
nor p
2
nor p
3
(p
1
p
2
p
3
)
all p
1
, p
2
, p
3
do not hold
some of p
1
, p
2
, p
3
hold p
1
p
2
p
3
p
1
or p
2
or p
3
exactly one of p
1
, p
2
, p
3
holds (p
1
p
2
p
3
) (p
1
p
2
p
3
) (p
1
p
2
p
3
)
either p
1
or p
2
or p
3
(p
1
p
2
p
3
) (p
1
p
2
) (p
1
p
3
) (p
2
p
3
)
only one of p
1
, p
2
, p
3
holds
all of p
1
, p
2
, p
3
hold or none (p
1
p
2
p
3
) (p
1
p
2
p
3
)
p
1
, p
2
, p
3
are equivalent (p
1
p
2
) (p
2
p
3
) (p
3
p
1
)
only some of p
1
, p
2
, p
3
hold (p
1
p
2
p
3
) (p
1
p
2
p
3
)
some of p
1
, p
2
, p
3
hold but not all
some of p
1
, p
2
, p
3
hold and some do not
English Logic
all objects are p
x
p(x)
no objects are not p
x
p(x)
no objects are p
x
p(x)
all objects are not p
x
p(x)
some objects are p
x
p(x)
some objects are not p
x
p(x)
not all objects are p
only some objects are p
x
p(x)
x
p(x)
some objects are p but not all
x
p(x)
x
p(x)
some objects are p and some are not
English Logic
all p are q
x
(p(x) q(x))
no p are not q
no p are q
x
(p(x) q(x))
all p are not q
some p are q
x
(p(x) q(x))
only p are q
x
(p(x) q(x))
all and only p are q
x
(p(x) q(x))
some p are not q
x
(p(x) q(x))
not all p are q
only some p are q
x
(p(x) q(x))
x
(p(x) q(x))
some p are q but not all
x
(p(x) q(x))
x
(p(x) q(x))
some p are q and some are not
English Logic
everybody admires everybody
x

y
a(x, y)
everybody is admired by everybody
y

x
a(x, y)
somebody admires somebody
x

y
a(x, y)
somebody is admired by somebody
y

x
a(x, y)
somebody admires everybody
everybody is admired by the same person
everybody admires somebody but not necessarily the same person
everybody admires the same person
nobody admires anybody
nobody admires everybody
everybody admires everybody else
x

y
(x,=y a(x, y))
everybody is admired by everybody
y

x
(x,=y a(x, y))
somebody admires somebody else
x

y
(x,=y a(x, y))
somebody is admired by somebody else
y

x
(x,=y a(x, y))
everybody but one person admires that person
somebody admires everybody else
Logical equivalences useful in proofs A.4
Eliminating a connective or quantier
A B A B
A B B A
A B A B
A B (A B) (B A)
A B (A B) (A B)
AB (A B) (A B) ( stands for exclusive-or.)
AB (A B) (B A)
A A ( stands for false.)

xU
A(x)
xU
A(x)

xU
A(x)
xU
A(x)
!
xU
A(x)
xU
A(x)
x
1
,x
2
U
(A(x
1
) A(x
2
) x
1
=x
2
)
Simplifying a negation
(A B) (A B)
(A B) (A B)
(A B) (B A)
(A B) (A B)
(A B) A B
(A B) (AB)
(A B) (A B) (B A)
(A B) (A B) (A B)
(AB) (A B)
(AB) (A B) (A B)
(A) A

xU
A(x)
xU
A(x)

xU
A(x)
xU
A(x)
Other logical equivalences useful in proofs
A B B A
A A ( stands for false.)
A
1
(A
2
B) (A
1
A
2
) B
A
1
(A
2
(... (A
n
B)...)) (A
1
A
2
... A
n
) B

xA
P(x)
x
(x A P(x))

xA
P(x)
x
(x A P(x))

xU
(A(x) B(x)) (
xU
A(x)) (
xU
B(x))

xU
(A(x) B(x)) (
xU
A(x)) (
xU
B(x))
Constructing proofs and counter-examples A.5
The following are basic proof methods.
To prove: do this:

xU
A(x) consider an arbitrary x U and prove A(x).
A
1
... A
n
prove A
1
and ... and prove A
n
.
A
1
... A
n
B assume A
1
, ..., A
n
and prove B.
A specify a formula B such that B A and prove B.
The following proof methods are derived from the basic ones.
To prove: do this:

xU
A(x) consider an arbitrary x U and prove A(x), or
(*) assume
xU
A(x) and obtain contradiction, or
(
1
) specify sets B
1
, ..., B
n
s.t. B
1
... B
n
= U and
prove
xB
1
A(x) and ... and prove
xBn
A(x).

xU
A(x) (
2
) specify one particular x
0
U and prove A(x
0
), or
(*) assume
xU
A(x) and obtain contradiction.
!
xU
A(x) prove
xU
A(x) and prove
x
1
,x
2
U
(A(x
1
) A(x
2
) x
1
=x
2
).
A B prove A and prove B.
A
1
... A
n
prove A
1
and ... and prove A
n
.
A B assume A and prove B, or
assume B and prove A, or
(*) assume A B and obtain contradiction.
AB prove A B and prove (A B), or
prove A B and prove A B, or
(*) assume A B and obtain contradiction.
A
1
... A
n
B assume A
1
, ..., A
n
and prove B, or
(*) assume A
1
, ..., A
n
, B and obtain contradiction.
A
1
... A
n
B (
1
) prove A
1
B and ... and prove A
n
B.
A (A
1
... A
n
) B (
1
) prove A A
1
B and ... and prove A A
n
B.
A B assume A and prove B, or
(
3
) assume B and prove A, or
(*) assume A B and obtain contradiction.
A B prove A B and prove B A, or
(*) assume AB and obtain contradiction.
A prove A.
A (*) assume A and obtain contradiction.
A specify a formula B such that B A and prove B, or
specify a formula B such that B A and prove B, or
(
4
) assume A and obtain contradiction.
1
This kind of proof is called a proof by cases.
2
This kind of proof is called a proof by example or a constructive proof
of existence.
3
This kind of proof is called a proof by contrapositive.
4
This kind of proof is called a proof by contradiction.
* This is a particular case of the proof by contradiction.
A.5.1 Explanatory Note
The method of proof by example is applicable only to existential statements.
It is not correct to attempt to prove
xU
A(x) by demonstrating an example
x
0
U such that A(x
0
), unless x
0
is the only element in U.
A.5.2 Explanatory Note
Recall that a sentence is a formula without free variables.
A.5.3 Denition
1. Let A be a sentence. To disprove A means to prove A.
2. Let
xU
A(x) be a sentence. By a counter-example to
xU
A(x) we
understand any x
0
U such that A(x
0
).
A.5.4 Explanatory Note
Disproving
xU
A(x) amounts to proving
xU
A(x), and for that it is
sucient to specify one x
0
U and prove A(x
0
); such an x
0
is a counter-
example to
xU
A(x).
Reading mathematical symbols A.6
A.6.1 Explanatory Note
1. The symbols x
0
, x
1
, . . . are read x sub zero, x sub one, etc.; i is
called the subscript of x
i
or the lower index of x
i
.
2. The symbols such as x
5,3
is read x sub ve three; i is called
the rst subscript of x
i,j
or the rst lower index of x
i,j
; j is called
the second subscript of x
i,j
or the second lower index of x
i,j
;
3. The symbols x
0
, x
1
, . . . are read x super zero, x super one, etc.; i is
called the superscript of x
i
or the upper index of x
i
.
4. The symbols such as x
5,3
is read x super ve three; i is called
the rst superscript of x
i,j
or the rst upper index of x
i,j
; j is called
the second superscript of x
i,j
or the second upper index of x
i,j
.
5. The symbol such as x
1
0
is read x sub zero super one; i and j are called re-
spectively the subscript of x
j
i
and the superscript of x
j
i
or they are
called respectively the lower index of x
j
i
and the upper index of x
j
i
6. Symbol such as x
5,3,4
or x
4
5,3
, etc. also can be used.
Greek alphabet A.7
The following letters from the Greek alphabet are commonly used in math-
ematics and physics.
Lowercase Capital Pronauciation
alpha
beta
gamma
delta
epsilon
zeta
eta
theta
iota
kappa
lambda
mu
nu
xi
pi
rho
sigma
tau
upsilon
phi
chi
psi
omega
In this table we omitted those letters which have the same shape as letters
of Latin alphabet. For instance the capital letter alpha has the same shape
as the Latin capital A.
Arity A.8
A.8.1 Explanatory Note
f(x
1
, ..., x
n
) is read f of x sub one through x sub n. Here, x
1
, ..., x
n
are
called arguments of f .
A.8.2 Explanatory Note
Instead of with 1 argument we say unary .
Instead of with 2 arguments we say binary .
Instead of with 3 arguments we say ternary .
Instead of with 4 arguments we say quaternary .
Instead of with n arguments we say n-ary or of arity n .
This terminology applies to relations, functions, relation symbols (pred-
icate symbols), function symbols, etc.
The terms unary, ternary and quaternary come from the names of
Latin numerals. The terms n-ary and arity come from the suxes of
the words unary, binary, ternary, and quaternary.

You might also like