2.1 Sets
2.2 Set Operations 2.3 Functions 2.4 Sequences and
Summations 2.5 Cardinality of
Sets 2.6 Matrices
M
uch of discrete mathematics is devoted to the study of discrete structures, used to repre-sent discrete objects. Many important discrete structures are built using sets, which are collections of objects. Among the discrete structures built from sets are combinations, unordered collections of objects used extensively in counting; relations, sets of ordered pairs that represent relationships between objects; graphs, sets of vertices and edges that connect vertices; and finite state machines, used to model computing machines. These are some of the topics we will study in later chapters.The concept of a function is extremely important in discrete mathematics. A function assigns to each element of a first set exactly one element of a second set, where the two sets are not necessarily distinct. Functions play important roles throughout discrete mathematics. They are used to represent the computational complexity of algorithms, to study the size of sets, to count objects, and in a myriad of other ways. Useful structures such as sequences and strings are special types of functions. In this chapter, we will introduce the notion of a sequence, which represents ordered lists of elements. Furthermore, we will introduce some important types of sequences and we will show how to define the terms of a sequence using earlier terms. We will also address the problem of identifying a sequence from its first few terms.
In our study of discrete mathematics, we will often add consecutive terms of a sequence of numbers. Because adding terms from a sequence, as well as other indexed sets of numbers, is such a common occurrence, a special notation has been developed for adding such terms. In this chapter, we will introduce the notation used to express summations. We will develop formulae for certain types of summations that appear throughout the study of discrete mathematics. For instance, we will encounter such summations in the analysis of the number of steps used by an algorithm to sort a list of numbers so that its terms are in increasing order.
The relative sizes of infinite sets can be studied by introducing the notion of the size, or cardinality, of a set. We say that a set is countable when it is finite or has the same size as the set of positive integers. In this chapter we will establish the surprising result that the set of rational numbers is countable, while the set of real numbers is not. We will also show how the concepts we discuss can be used to show that there are functions that cannot be computed using a computer program in any programming language.
Matrices are used in discrete mathematics to represent a variety of discrete structures. We will review the basic material about matrices and matrix arithmetic needed to represent relations and graphs. The matrix arithmetic we study will be used to solve a variety of problems involving these structures.
2.1 Sets
Introduction
In this section, we study the fundamental discrete structure on which all other discrete structures are built, namely, the set. Sets are used to group objects together. Often, but not always, the objects in a set have similar properties. For instance, all the students who are currently enrolled in your school make up a set. Likewise, all the students currently taking a course in discrete mathematics at any school make up a set. In addition, those students enrolled in your school who are taking a course in discrete mathematics form a set that can be obtained by taking the elements common to the first two collections. The language of sets is a means to study such 115
collections in an organized fashion. We now provide a definition of a set. This definition is an intuitive definition, which is not part of a formal theory of sets.
DEFINITION 1 A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We writea ∈ A to denote that a is an element of the set A. The notationa ∈ A denotes that a is not an element of the set A.
It is common for sets to be denoted using uppercase letters. Lowercase letters are usually used to denote elements of sets.
There are several ways to describe a set. One way is to list all the members of a set, when this is possible. We use a notation where all members of the set are listed between braces. For example, the notation{a, b, c, d} represents the set with the four elements a, b, c, and d. This way of describing a set is known as the roster method.
EXAMPLE 1 The setV of all vowels in the English alphabet can be written as V = {a, e, i, o, u}. ▲ EXAMPLE 2 The setO of odd positive integers less than 10 can be expressed by O = {1, 3, 5, 7, 9}. ▲ EXAMPLE 3 Although sets are usually used to group together elements with common properties, there is nothing that prevents a set from having seemingly unrelated elements. For instance,{a, 2, Fred, New Jersey} is the set containing the four elements a, 2, Fred, and New Jersey. ▲ Sometimes the roster method is used to describe a set without listing all its members. Some members of the set are listed, and then ellipses (. . .) are used when the general pattern of the elements is obvious.
EXAMPLE 4 The set of positive integers less than 100 can be denoted by{1, 2, 3, . . . , 99}. ▲ Another way to describe a set is to use set builder notation. We characterize all those elements in the set by stating the property or properties they must have to be members. For instance, the setO of all odd positive integers less than 10 can be written as
O = {x | x is an odd positive integer less than 10}, or, specifying the universe as the set of positive integers, as
O = {x ∈ Z+| x is odd and x < 10}.
We often use this type of notation to describe sets when it is impossible to list all the elements of the set. For instance, the set Q+of all positive rational numbers can be written as
Q+= {x ∈ R | x = pq, for some positive integers p and q}.
Beware that mathe-maticians disagree whether 0 is a natural number. We consider it quite natural.
These sets, each denoted using a boldface letter, play an important role in discrete mathe-matics:
N= {0, 1, 2, 3, . . .}, the set of natural numbers Z= {. . . , −2, −1, 0, 1, 2, . . .}, the set of integers Z+ = {1, 2, 3, . . .}, the set of positive integers
Q= {p/q | p ∈ Z, q ∈ Z, and q = 0}, the set of rational numbers R, the set of real numbers
R+, the set of positive real numbers C, the set of complex numbers.
(Note that some people do not consider 0 a natural number, so be careful to check how the term natural numbers is used when you read other books.)
Recall the notation for intervals of real numbers. Whena and b are real numbers with a < b, we write
[a, b] = {x | a ≤ x ≤ b}
[a, b) = {x | a ≤ x < b}
(a, b] = {x | a < x ≤ b}
(a, b) = {x | a < x < b}
Note that[a, b] is called the closed interval from a to b and (a, b) is called the open interval froma to b.
Sets can have other sets as members, as Example 5 illustrates.
EXAMPLE 5 The set{N, Z, Q, R} is a set containing four elements, each of which is a set. The four elements of this set are N, the set of natural numbers; Z, the set of integers; Q, the set of rational numbers;
and R, the set of real numbers. ▲
Remark: Note that the concept of a datatype, or type, in computer science is built upon the concept of a set. In particular, a datatype or type is the name of a set, together with a set of operations that can be performed on objects from that set. For example, boolean is the name of the set{0, 1} together with operators on one or more elements of this set, such as AND, OR, and NOT.
Because many mathematical statements assert that two differently specified collections of objects are really the same set, we need to understand what it means for two sets to be equal.
DEFINITION 2 Two sets are equal if and only if they have the same elements. Therefore, ifA and B are sets, thenA and B are equal if and only if ∀x(x ∈ A ↔ x ∈ B). We write A = B if A and B are equal sets.
EXAMPLE 6 The sets{1, 3, 5} and {3, 5, 1} are equal, because they have the same elements. Note that the order in which the elements of a set are listed does not matter. Note also that it does not matter if an element of a set is listed more than once, so{1, 3, 3, 3, 5, 5, 5, 5} is the same as the set
{1, 3, 5} because they have the same elements. ▲
GEORG CANTOR (1845–1918) Georg Cantor was born in St. Petersburg, Russia, where his father was a successful merchant. Cantor developed his interest in mathematics in his teens. He began his university studies in Zurich in 1862, but when his father died he left Zurich. He continued his university studies at the University of Berlin in 1863, where he studied under the eminent mathematicians Weierstrass, Kummer, and Kronecker.
He received his doctor’s degree in 1867, after having written a dissertation on number theory. Cantor assumed a position at the University of Halle in 1869, where he continued working until his death.
Cantor is considered the founder of set theory. His contributions in this area include the discovery that the set of real numbers is uncountable. He is also noted for his many important contributions to analysis. Cantor also was interested in philosophy and wrote papers relating his theory of sets with metaphysics.
Cantor married in 1874 and had five children. His melancholy temperament was balanced by his wife’s happy disposition.
Although he received a large inheritance from his father, he was poorly paid as a professor. To mitigate this, he tried to obtain a better-paying position at the University of Berlin. His appointment there was blocked by Kronecker, who did not agree with Cantor’s views on set theory. Cantor suffered from mental illness throughout the later years of his life. He died in 1918 from a heart attack.
THE EMPTY SET There is a special set that has no elements. This set is called the empty set, or null set, and is denoted by∅. The empty set can also be denoted by { } (that is, we represent the empty set with a pair of braces that encloses all the elements in this set). Often, a set of elements with certain properties turns out to be the null set. For instance, the set of all positive integers that are greater than their squares is the null set.
A set with one element is called a singleton set. A common error is to confuse the empty
{∅} has one more
element than∅. set∅ with the set {∅}, which is a singleton set. The single element of the set {∅} is the empty set itself! A useful analogy for remembering this difference is to think of folders in a computer file system. The empty set can be thought of as an empty folder and the set consisting of just the empty set can be thought of as a folder with exactly one folder inside, namely, the empty folder.
NAIVE SET THEORY Note that the term object has been used in the definition of a set, Definition 1, without specifying what an object is. This description of a set as a collection of objects, based on the intuitive notion of an object, was first stated in 1895 by the German mathematician Georg Cantor. The theory that results from this intuitive definition of a set, and the use of the intuitive notion that for any property whatever, there is a set consisting of exactly the objects with this property, leads to paradoxes, or logical inconsistencies. This was shown by the English philosopher Bertrand Russell in 1902 (see Exercise 46 for a description of one of these paradoxes). These logical inconsistencies can be avoided by building set theory beginning with axioms. However, we will use Cantor’s original version of set theory, known as naive set theory, in this book because all sets considered in this book can be treated consistently using Cantor’s original theory. Students will find familiarity with naive set theory helpful if they go on to learn about axiomatic set theory. They will also find the development of axiomatic set theory much more abstract than the material in this text. We refer the interested reader to [Su72] to learn more about axiomatic set theory.