Module 2: Language of Mathematics
Theme 1: Sets
A set is a collection of objects. We describe a set by listing all of its elements (if this set is nite and not too big) or by specifying a property that uniquely identies it. Example 1: The set of all decimal digits is
But to dene a set of all even positive integers we write:
where is a natural number
The last denition can be also written in another form, namely:
is an even natural number
In the rest of this course, we shall either write This notation is called the set builder. Let be a set such that elements
property describing or
property describing ,
where or should be read as such as. Both are used in discrete math, however, we prefer the former. belong to it. We shall write
if is an element of . If does not belong to we denote it as . Uppercase letters are usually used to denote sets. Some letters are reserved for often used sets such as the set of natural numbers
(i.e., set of all counting numbers), the set of integers
(i.e., positive and negative natural numbers together with zero), and
the set of rational numbers which are ratios of integers, that is, The set We shall write Example 2: The set subset of that is not an element of Two sets and is said to be a subset of to indicate that
.A .
set with no elements is called the empty (or null) set and is denoted as . if and only if every element of is a subset of . . Actually, in this case or ).
are
is also an element of
is a subset of
is a proper
, and we write it as
. By proper we mean that there exits at least one element of
(in our example such elements are , or
are equal if and only if they have the same elements. We will subsequently and
make this statement more precise. For example, the sets
equal since order does not matter for sets. When the sets are nite and small, one can verify this 1
by listing all elements of the sets and comparing them. However, when sets are dened by the set builder it is sometimes harder to decide whether two sets are equal or not. For example, is the set
(i.e., solutions of this weird looking equation
, where
equal to ? Therefore, we introduce another equivalent denition:
and whenever
, then
if whenever
)
, then
. The last statement can be written as follows:
if and only if (To see this, one can think of two real numbers show that sets. If is, is nite, then the number of elements of and
(1)
and that are equal; to prove this fact it sufces to
.) This equivalence is very useful when proving some theorems regarding is called its cardinality and denoted as , that
number of elements in A A set is said to be innite if it has an innite number of elements. For example, the cardinality of is , while
is an innite set.
, then there are
The set of all subsets of a given set Example 3: If
is called the power set and denoted . subsets of , namely:
Thus the cardinality of is Theorem 1. If Proof:1 The set
if
. .
Now, we shall prove our rst theorem about sets. , then
has
elements and we can name them any way we want. For example, , say , contains some elements form
. Any subset of
elements or better we can associate with every element
. We can list these
which is set to be
an indicator of
and zero otherwise. More formally, for every subset
we construct an indicator belongs to ; other-
with understanding that
if and only if the th element of
wise we set
. For example, for
an element of
(i.e.,
) while
, the identier of is since is not
, that is,
and
. Observe that every set of
desired cardinality of . Since can take only two values, and there are possibilities the total number of indicators is
, which is the cardinality of . This completes the proof.
has a unique indicator
. Thus counting the number of indicators will give us the
The Cartesian product of two sets where
and
and
, denoted by
, is the set of ordered pairs
, that is,
and
This proof can be omitted in the rst reading.
U A B A B AB U A B B
AB
AB
B = UB
Figure 1: Venn diagrams for the union, intersection, difference, and complementary set. Example 4: If
and
, then
of
In general, we can consider Cartesian products of three, four, or sets. If
, then an element
is called an -tuple.
We now introduce set operations. Let intersection , and the difference
and
be two sets. We dene the union
, the
, respectively, as follows:
Example 5: Let
and
or
and and
, then
We say that sets. 3 and are disjoint if
, that is, there is no element that belongs to both
Sometimes we deal with sets that are subsets of a (master) set
. We will call such a set the
universal set or the universe. One denes the complement of the set , denoted as , as diagrams as shown in Figure 1, which is self-explanatory. When is, and
We can represent visually the union, intersection, difference, and complementary set using Venn are disjoint, the cardinality of (provided is the sum of cardinalities of and and , that
). This identity is not true when
are not disjoint, yielding
since the intersection part would be counted twice!. To avoid this, we must subtract
The above property is called the principle of inclusion-exclusion. An astute reader may want to generalize this to three and more sets. For example, consider the sets from Example 5. Note that
, while , and , thus
We have already observed some relationships between set operations. For example, if , then , but . There are more to discover. We list these identities in Table 1. Table 1: Set Identities Identity Name Identity Laws
Domination laws Idempotent laws
Complementation laws Commutative laws
Associative laws Distributive laws De Morgans laws
We will prove several of these identities, using different methods. We are not yet ready to use sophisticated proof techniques, but we will be able to use either Venn diagrams or the the principle 4
expressed in (1) (i.e., to prove that two sets are equal it sufces to show that one set is a subset of the other and vice versa). The reader may want to use Venns diagram to verify all the identities of Table 1. Example 6: Let us prove one of the identities, say De Morgans law, showing that and . First suppose or which implies that . Hence, or .
(observe this by drawing the Venn diagram or referring to the logical de Morgan laws discussed in Module 1). Thus, Hence Suppose now that , that is, which implies or . This further implies that . This shows that or .
, and therefore
. This proves
, and completes the proof
of the De Morgan law. Exercise 2A: Using the same arguments as above prove the complementation law.
Theme 2: Relations
In Theme 1 we dened the Cartesian product of two sets ordered pairs
such that
and
and
, denoted as
, as the set of
. We can use this to dene a (binary) relation if it is a subset of the Cartesian product
We say that is a binary relation from
, then we write
to
. If
and say that and
is related to . . Dene the relation as
Example 7: Let
divides
where by divides we mean with zero remainder. Then
We now dene two important sets for a relation, namely, its domain and its range. The domain of is dened as
and for some
while the range of is the set
and for some
In words, the domain of is composed of all all
for which there is such that . The set of . while the range is .
such that there exists is the range of
Example 8: In Example 7 the domain of that domain of is a subset of
is the set
. Observe
while the range is a subset of
There are several important properties that are used to classify relations on sets. Let relation on the set . We say that: ;
be a
is reexive if for every
is symmetric if implies for all
is antisymmetric if and implies that is transitive if and implies for all
Example 9: Consider the relation is:
and let
. Observe that
not reexive since ; not symmetric since for example but 6
not antisymmetric since and but not transitive since
and , but
.
. The
On the other hand, consider this relation
relation is reexive, transitive, but not symmetric, however, its antisymmetric, as easy to check. Exercise 2B: Let
. Is the following relation
reexive, symmetric, antisymmetric, or transitive? Relations are used in mathematics and in computer science to generalize and make more rigorous certain commonly acceptable notion. For example, is a relation that denes equality between elements. Example 10: Let
be the set of rational numbers, that is, ratios of integers. Then means that has the same value as . For example, . The relation partitions the set of all rational numbers into subsets such every subset contains all numbers that are equal. Observe that
is reexive, symmetric and transitive. Indeed,
is the same as
, and nally if
and
, then
. Such relations are called equivalence relations and they play important
role in mathematics and computer science. A relation set
that is reexive, symmetric, and transitive is called an equivalence relation on the divides (actually, partitions) the set of all rational
. As we have seen above, the relation
numbers into disjoint sets that cover the the whole set of rational numbers. Let us generalize this. For an equivalence relation we dene the equivalence set for any
denoted by
as follows
In words, the whole set sets).
is the set of all elements
such that and
are related by . This is a special set, and are disjoint and is the sum of disjoint equivalence
as we formally explain below. Informally, the two different equivalence sets is partitioned into disjoint equivalence sets (i.e.,
More formally, observe that if , hence , then . Thus
, then
. Indeed, let
. We shall prove that
and from
and transitivity we conclude that
, hence .
, as needed. In a similar manner we can prove that (by denition of
which proves that
Clearly if
logically equivalent, manner: If into disjoint subsets other words, the set
). The latter can be expressed in a different, but (this is an example of counterpositive can be partitioned . In belongs to exactly one equivalence class
, then
argument discussed in Module 1: Basic Logic). We should conclude that the set such that every element of
is a partition of discuss.
There is one important example of equivalence classes, called congruence class, that we must Example 11: Fix a number that is a positive integer (i.e., a natural number). Let integers. We dene a relation on be the set of all
such that since
by if is divisible by , that is, there is an integer
. We will write
for , or more often
a relation is also called congruence modulo n. For example,
since
, but
. Such
is not divisible by .
It is not difcult to prove that
. If
is reexive, symmetric and transitive. Indeed,
, then
let
and
. That is,
since
and
implies
. Then
. Finally,
since
hence Since
is an equivalence relation, we can dene equivalence classes which are called congruence
classes. From the denition we know that
for some
Example 12: Congruence classes modulo
are
In words, an integer belongs to one of the above classes because when dividing by the remainder is either or or or or , but nothing more than this. We have seen before that the relation the same with well known
was generalized to the equivalence relations. Let us do
if
and
relation. Notice that it denes an order among of real number. Let now Clearly, this relation is reexive and transitive because
and if unless
and
, then
. It is denitely not symmetric since
doe snot imply and
. Actually, it is easy to see that it is antisymmetric since if
, then
. We
call such relations partial orders. More precisely, a relation reexive, antisymmetric, and transitive. Example 13: Let if divides (evenly) for we saw in Example 11. It is not symmetric (indeed,
on a set
is partial order if
is
. This relation is reexive and transitive as
divides but not the other way around). Is it
antisymmetric? Let divides and divides , that is, there are integers and such that
and
. That is,
, hence
. Since
we must have
Thus is antisymmetric.
total order) since for
that and
A reexive, antisymmetric, and transitive relation
is called partial order (not just an order or
it may happen that neither . If for all
nor
. In Example 13 we see
we have either
or
, then
denes a
total order. For example, the usual ordering of real numbers denes a total ordering, but pairs of real numbers in a plane dene only a partial order.
Theme 3: Functions
Functions are one of the most important concepts in mathematics. They are also special kinds of relations. Recall that a relation
from
also that the domain of is the set of
to
is a subset of the Cartesian product
. Recall
such that there exists related to through , that is, there is
. For relations it is not important that for every
related to
by
. Moreover, it is from
legitimate to have two s, say and such that and for some . These two properties are eliminated in the denition of a function. More formally, we dene a function denoted as to as a relation from is
to ;
having two additional properties:
1. The domain of 2. If
and
, then
The last item means that if there is an such that it is related to and , then must be equal to
. In other words, there is no that has two different values of related to it. We shall use lowercase letters , , , etc. to denote functions. Furthermore, when
we shall
write it as
. Finally, we will also use another standard notation for functions, namely:
Functions are also called mappings or transformations. The second property of the function denition is very important, so we characterize it in another way. Consider a relation on and
. Dene
Observe that is a set. It may be empty, may contain one element or many elements. When is a function, then is not empty for every dened as
and in fact it contains exactly one element that is denoted as for a function
for some
called an image of . More generally, the image of
is
In other words, is a subset of Figure 2 the image of
is
for which there is
such that
. For example in
to
Example 14: (a) Consider the relation . It is a function since every
from
has exactly one image in
. In fact,
and
and
. Figure 2 shows a graphical representation of this function.
is not a function since have the same
(b) The relation image .
10
1 2 3
a b c d
Figure 2: The function
dened in Example 14.
8
4 4
2 2
-3
-2
-1
1 x
-3
-2
-1
1 x
(a) Figure 3: Plots of two functions: (a)
(b)
; (b)
Functions are often represented by mathematical formulas. For example, we can write for every real , or more formally
or
To visualize such functions we often graph them in the coordinates where Example 15: In Figure 3 we draw the functions are dened on the set of reals hence the range of
which is the domain for both functions. Since
and
. Both functions
and
is the set of nonnegative reals while for
and
it is the set of positive reals. That is,
Exercise 2C: What is the image of for function
? What about the image of
over the
? 11
There are some functions occurring so often in computer science that we must briey discuss them here. The rst function, the modulus operator, we already studied in Example 11. We say that
is equal to the remainder when is divided by (we, of course, implicitly assume that
, i.e., and are integers). We recall that
and .
is equivalent to
used
before. For example, We shall write this function as
with the understanding that is the remainder of the division range of to the set
. The domain of such a function is
the set of integers, while the image (or range) is the set of natural numbers. In fact, we can restrict the between and .
because the remainder of any division by must be an integer
, then
The other important and often used functions are the oor and ceiling of a real number. Let
the greatest integer less than or equal to the least integer greater than or equal to
For example,
Finally, we introduce some classes of functions as we did with relations. Consider the function
shown in Figure 3(a). We have
, that is, there are two values of that to is one-to-one or injective if there
are mapped into the same value of (or with the same image). This is an example of a function that is not one-to-one or injective. We say that a function are
for each
from
there is at most one
such that if
, then
. In other words, for one-to-one function
with
. The function in Figure 3(b) is one-to-one,
as easy to see. Example 16: Consider
from
to
. This function is injective.
How to know weather a function is one-to-ne or not? We provide some conditions below. We rst introduce increasing and decreasing functions. A function decreasing) if
( ) whenever
for all
is increasing (non. For example, the
12
function
is increasing in the domain
is decreasing (non-increasing) if will be.
(cf. Figure 3(b)). Similarly, a function
) whenever
for all
. For
an increasing (decreasing) function the bigger the value of The function
is, the bigger (smaller) the value of
. However, it is a decreasing function for all negative reals and increasing in the set of all positive
reals. In Example 16 we have is said to be onto Example 17: Let numbers. Clearly,
plotted in Figure 3(a) is neither increasing or decreasing in the domain
. A function
be such that , thus it is onto
from
to
such that
or surjective function.
, where
. But if we dene
is the set of positive real
with
, then such a function is not surjective. that is both injective and surjective is called a bijection. The function in as
A function inverse function
Example 16 is a bijection while the function in Example 17 is not. For a bijection we can dene an
that is,
and
switch their roles. Observe that we do not need to have bijection in order to dene
the inverse since: (i) the domain of the inverse function is every there must be such that and this is guaranteed by the requirement that Example 18. Let restrict the domain range, that is, is
; (ii) There must be only one such that
is one-to-one function.
and by the denition of a function, for
be such that
. Now
. This is not a one-to-one function. Let us
to the set of nonnegative reals
and we do the same with the
has an inverse function dened on
which
Finally, we dene the composition of two functions. Let and Then for every Example 19: Let
we nd
, but for such we compute and is denoted as
function is called the composition of
and
. The resulting
Then Example 20: Let
and
. The composition
13
Theme 4: Sequences, Sums, and Products
Sequences are special functions whose domain is the set of natural numbers
, that is,
is a sequence. We shall write
or
to denote an
element of a sequence, where the letter
in can be replaced by any other letter, say or . Since a sequence is a set we often write it as or simply .
Example 21: Let
for
. That is, the sequence
starts with
If
, then the sequence begins with
Finally,
looks like
by selecting only some terms. For
We can create another sequence from a given sequence example, we can take very second term of the sequence can denote such a sequence (subsequence) as
, that is,
. This amounts
to restricting the domain to a subset of natural numbers. If we denote this subset as
where
. Another way of denoting a subsequence is
, then we
is a subsequence of natural numbers, that is, , that is,
. It is usually
required that
is an increasing sequence.
There is one important subsequence that we often use. Namely, dene Sometimes, we shall denote such a sequence as
Example 22: Let . The rst terms are . Take every second term to produce a sequence that starts . We can write it as or as . Sequences are important since they are very often used in computer science. They are frequently used in sums and products that we discuss next. Consider a (sub)sequence
and add all the elements to yield
To avoids the dots we have a short hand notation for such sums, namely
14
In the above, we use different indices of summation ,
or since they do not matter. What matters
is the lower bound and the upper bound of the index of summation, and the sequence itself. In a similar manner we can dene the product notation. For the above case instead of writing
we simply write
Example 23: Here are some examples:
Exercise 2D: Find 1.
2.
We have to learn how to manipulate sums and products. Observe that
. We obtained exactly the same
In the above we change the index of summation from sum
for some
. In general, when we change index , we must change the lower summation index from
to
to, say
to
, the upper
summation index from
to
, and
must be replaced by
Example 24: This is the most sophisticated example in this module, however, it is important that the reader understands it. We consider a special sequence called the geometric progression. It is dened as follows: Fix
and dene
for
. This sequence begins with
Let us now consider the sum of the rst terms of such a sequence, that is,
(2)
15
Can we nd a simple formula for such a sum? Consider the following chain of implications
where the second line follows from the change of the index summation factor
in front of the sum, while in the last line we replaced
, in the third line we
by as dened in (2). Thus
we prove that
from which we nd :
as long as
. Therefore, the complicated sum as in (2) has a very simple closed-form solution
given above. An unconvinced reader may want to verify on some numerical examples that these two formulas give the same numerical value.
16