Chapter 2
Chapter 2
Abdelrahman Busati
College of Information Technology
University of Fujairah
2. Basic Structures: Sets,
Functions, Sequences,
Sums, and Matrices
2.1.1 Introduction to Set
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.
Note:
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 { }.
2.1.2 Venn Diagrams
• Sets can be represented graphically using
Venn diagrams, named after the English
mathematician John Venn, who introduced
their use in 1881. In Venn diagrams the
universal set U, which contains all the
objects under consideration, is represented
by a rectangle. (Note that the universal set
varies depending on which objects are of
interest.)
EXAMPLE 7: Draw a Venn diagram that
represents V, the set of vowels in the English
alphabet (see Figure 1).
2.1.3 Subsets
Sets may have other sets as members. For instance, we have the sets
A = {∅, {a}, {b}, {a, b}} and B = {x ∣ x is a subset of the set {a, b}}.
Note that these two sets are equal, that is, A = B. Also note that {a} ∈ A,
but a ∉ A.
2.1.4 The Size of a Set
EXAMPLE 10: Let A be the set of odd positive integers less than 10. Then |A| = 5.
EXAMPLE 11: Let S be the set of letters in the English alphabet. Then |S| = 26.
EXAMPLE 12: Because the null set has no elements, it follows that |∅| = 0.
EXAMPLE 14: What is the power set of the set {0, 1, 2}?
Solution: The power set P({0, 1, 2}) is the set of all subsets of {0, 1, 2}.
Hence,
P({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}.
Note that the empty set and the set itself are members of this set of
subsets.
2.1.5 Power Sets
EXAMPLE 15: What is the power set of the empty set? What is the power
set of the set {∅}?
Solution: The empty set has exactly one subset, namely, itself. consequently,
P(∅) = {∅}.
The set {∅} has exactly two subsets, namely, ∅ and the set {∅} itself.
Therefore,
P({∅}) = {∅, {∅}}. ◂
If a set has n elements, then its power set has 2n elements. We will
demonstrate this fact in several ways in subsequent sections of the text.
2.1.6 Cartesian Products
EXAMPLE 16: What is the Cartesian product of A = {1, 2} and B = {a, b, c}?
Solution: The Cartesian product A × B is
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.
Note that, A × B ≠ B × A
2.1.6 Cartesian Products
EXAMPLE 17: What is the Cartesian product of A = {1, 2} and B = {a, b, c}?
Solution: The Cartesian product B × A is
B × A = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}.
This is not equal to A × B, which was found in Example 16.
2.1.6 Cartesian Products
An element x belongs to the union of the sets A and B if and only if x belongs
to A or x belongs to B. This tells us that
A ∪ B = {x ∣ x ∈ A ∨ x ∈ B}.
EXAMPLE 1: The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5};
that is, {1, 3, 5}∪{1, 2, 3}={1, 2, 3, 5}.
2.2 Set Operations
EXAMPLE 2: The union of the set of all computer science majors at your
school and the set of all mathematics majors at your school is the set of
students at your school who are majoring either in mathematics or in
computer science (or in both).
2.2 Set Operations
Domain: X Y
Codomain: A 1
Range: B 2
Preimage of 2: C 3
Image(s( of A: D
F(D):
2.3.1 Introduction to Function
Solution:
Answer the following for : x → y
Domain: x X Y
Codomain: y A 1
Range: {1, 2} B 2
Preimage of 2: {D} C 3
Image(s( of A: {1} D
F(D): 2
2.3.1 Introduction to Function
EXAMPLE 3: Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24),
(Carla, 21), (Desire, 22), (Eddie, 24), and (Felicia, 22). Here each pair consists of a
graduate student and this student’s age. Specify a function determined by this
relation.
Solution: If is a function specified by R, then (Abdul ) = 22, (Brenda) = 24, (Carla)
= 21, (Desire) = 22, (Eddie) = 24, and (Felicia) = 22. [Here, (x) is the age of x,
where x is a student.] For the domain, we take the set {Abdul, Brenda, Carla,
Desire, Eddie, Felicia}. We also need to specify a codomain, which needs to
contain all possible ages of students. Because it is highly likely that all students
are less than 100 years old, we can take the set of positive integers less than 100
as the codomain. The range of the function we have specified is the set of
different ages of these students, which is the set {21, 22, 24}.
2.3.1 Introduction to Function
EXAMPLE 3: Let f be the function that assigns the last two bits of a bit
string of length 2 or greater to that string. For example, (11010) = 10.
Then, the domain of f is the set of all bit strings of length 2 or greater,
and both the codomain and range are the set {00, 01, 10, 11}. ◂