Beruflich Dokumente
Kultur Dokumente
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
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., 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
are equal if and only if they have the same elements. We will subsequently and
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
, where
and whenever
, then
if whenever
)
, then
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)
.) 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
. .
has
elements and we can name them any way we want. For example, , say , contains some elements form
. Any subset of
an indicator of
wise we set
an element of
(i.e.,
) while
, that is,
and
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.
and
and
, denoted by
, that is,
and
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
, then an element
is called an -tuple.
and
, the
, respectively, as follows:
Example 5: Let
and
or
and and
, then
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
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
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
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
to
. If
Example 7: Let
divides
We now dene two important sets for a relation, namely, its domain and its range. The domain of is dened as
for which there is such that . The set of . while the range is .
is the set
. Observe
There are several important properties that are used to classify relations on sets. Let relation on the set . We say that: ;
be a
and let
. Observe that
and , but
.
. The
relation is reexive, transitive, but not symmetric, however, its antisymmetric, as easy to check. Exercise 2B: Let
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 the same as
, and nally if
and
, then
. Such relations are called equivalence relations and they play important
that is reexive, symmetric, and transitive is called an equivalence relation on the divides (actually, partitions) the set of all rational
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
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.,
, then
. Indeed, let
and from
, hence .
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
. We will write
since
, but
. Such
is not divisible by .
. If
, 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
for some
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
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
, 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
antisymmetric? Let divides and divides , that is, there are integers and such that
and
. That is,
, hence
. Since
we must have
Thus is antisymmetric.
that and
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
to
. Recall
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 ;
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
is
such that
. For example in
to
from
. In fact,
and
and
10
1 2 3
a b c d
4 4
2 2
-3
-2
-1
1 x
-3
-2
-1
1 x
(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
and
. Both functions
and
and
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
is equivalent to
used
with the understanding that is the remainder of the division range of to the set
the set of integers, while the image (or range) is the set of natural numbers. In fact, we can restrict the between and .
, 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
, 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
such that if
, then
with
from
to
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
12
function
for all
. For
. 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,
. A function
be such that , thus it is onto
from
to
such that
or surjective function.
, where
. But if we dene
with
, then such a function is not surjective. that is both injective and surjective is called a bijection. The function in as
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
be such that
. Now
which
Finally, we dene the composition of two functions. Let and Then for every Example 19: Let
we nd
and
. The resulting
and
. The composition
13
, that is,
or
to denote an
in can be replaced by any other letter, say or . Since a sequence is a set we often write it as or simply .
for
starts with
If
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
where
, then we
. 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
To avoids the dots we have a short hand notation for such sums, namely
14
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
2.
for some
. In general, when we change index , we must change the lower summation index from
to
to, say
to
, the upper
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
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
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