0% found this document useful (0 votes)
62 views54 pages

Chapter 2

This document provides an introduction to discrete mathematics concepts related to sets. It defines basic set notation and describes ways to represent sets, including listing elements, set builder notation, and Venn diagrams. It discusses properties of sets such as subsets, size of sets, power sets, and Cartesian products. Finally, it covers basic set operations like union, intersection, difference, and complement and provides examples to illustrate these concepts.

Uploaded by

busati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views54 pages

Chapter 2

This document provides an introduction to discrete mathematics concepts related to sets. It defines basic set notation and describes ways to represent sets, including listing elements, set builder notation, and Venn diagrams. It discusses properties of sets such as subsets, size of sets, power sets, and Cartesian products. Finally, it covers basic set operations like union, intersection, difference, and complement and provides examples to illustrate these concepts.

Uploaded by

busati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 54

Discrete Mathematics

Abdelrahman Busati
College of Information Technology
University of Fujairah
2. Basic Structures: Sets,
Functions, Sequences,
Sums, and Matrices
2.1.1 Introduction to Set

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
2.1.1 Introduction to Set
EXAMPLE 1: The set V of all vowels in the English alphabet can be written as
V = {a, e, i, o, u}. ◂
EXAMPLE 2: The set O 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}. ◂
2.1.1 Introduction to Set
• Another way to describe a set is to use set builder notation. For
instance, the set O 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 =, for some positive integers p and q}.
2.1.1 Introduction to Set
• These sets, each denoted using a boldface letter, play an important
role in discrete mathematics:
N = {0, 1, 2, 3, …}, the set of all natural numbers
Z = {… , −2, −1, 0, 1, 2, …}, the set of all integers
Z+ = {1, 2, 3, …}, the set of all positive integers
Q = { ∣ p ∈ Z, q ∈ Z, and q ≠ 0}, the set of all rational numbers
R, the set of all real numbers
R+, the set of all positive real numbers
C, the set of all complex numbers.
2.1.1 Introduction to Set
• 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.
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

We see that A ⊆ B if and only if the quantification


∀x(x ∈ A → x ∈ B)
2.1.3 Subsets
EXAMPLE 8: The set of all odd positive integers less than 10 is a subset of the
set of all positive integers less than 10, the set of rational numbers is a subset
of the set of real numbers, the set of all computer science majors at your
school is a subset of the set of all students at your school, and the set of all
people in China is a subset of the set of all people in China (that is, it is a
subset of itself). Each of these facts follows immediately by noting that an
element that belongs to the first set in each pair of sets also belongs to the
second set in that pair
2.1.3 Subsets
EXAMPLE 9: The set of integers with squares less than 100 is not a
subset of the set of nonnegative integers because −1 is in the former
set [as (−1)2 < 100], but not the latter set. The set of people who have
taken discrete mathematics at your school is not a subset of the set of
all computer science majors at your school if there is at least one
student who has taken discrete mathematics who is not a computer
science major.
2.1.3 Subsets

Theorem 1: shows that every nonempty set S is


guaranteed to have at least two subsets, the empty
set and the set S itself, that is, ∅ ⊆ S and S ⊆ S.
When we wish to emphasize that a set A is
a subset of a set B but that A ≠ B, we write A
⊂ B and say that A is a proper subset of B.
∀x(x ∈ A → x ∈ B) ∧ ∃x(x ∈ B ∧ x ∉ A)
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 13: The set of positive integers is infinite.


2.1.5 Power Sets

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

EXAMPLE 18: What is the Cartesian product A × B × C, where A = {0, 1},


B = {1, 2}, and C = {0, 1, 2}?
Solution: The Cartesian product A × B × C consists of all ordered triples
(a, b, c), where a ∈ A, b ∈ B, and c ∈ C. Hence,
A × B × C = {(0, 1, 0), (0, 1, 1), (0, 1, 2), (0, 2, 0), (0, 2, 1), (0, 2, 2),
(1, 1, 0), (1, 1, 1), (1, 1, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2)}.
2.2 Set Operations

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

An element x belongs to the intersection of the


sets A and B if and only if x belongs to A and x
belongs to B. This tells us that:
A ∩ B = {x ∣ x ∈ A ∧ x ∈ B}.
The Venn diagram shown in Figure 2 represents
the intersection of two sets A and B. The shaded
area that is within both the circles representing
the sets A and B is the area that represents the
intersection of A and B.
2.2 Set Operations

EXAMPLE 3: Let A = {1, 3, 5, 7, 9} and B = {2, 4, 6, 8, 10}.


Because A ∩ B = ∅, A and B are disjoint.
2.2 Set Operations

EXAMPLE 4: The difference of {1, 3, 5} and {1, 2, 3} is the


set {5}; that is, {1, 3, 5}−{1, 2, 3}={5}. This is different from
the difference of {1, 2, 3} and {1, 3, 5}, which is the set {2}.
EXAMPLE 5: The difference of the set of computer science
majors at your school and the set of mathematics majors
at your school is the set of all computer science majors at
your school who are not also mathematics majors.
2.2 Set Operations

In Figure 4 the shaded area outside


the circle representing A is the area
representing A. We give some
examples of the complement of a
set.
2.2.2 Set Identities
2.2.2 Set Identities
EXAMPLE 6: Prove that = ∪ .
Solution: We will prove that the two sets A ∩ B and A ∪ B are equal by showing that
each set is This identity says that the complement of the intersection of two sets is
the union of their complements. a subset of the other. First, we will show that
⊆ . We do this by showing that if x is in , then it must also be in . Now suppose that
x ∈. By the definition of complement, x ∉ . Using the definition of intersection, we
see that the proposition ¬((x ∈ A) ∧ (x ∈ B)) is true.
By applying De Morgan’s law for propositions, we see that ¬(x ∈ A) or ¬(x ∈ B).
Using the definition of negation of propositions, we have x ∉ A or x ∉ B. Using the
definition of the complement of a set, we see that this implies that x ∈ A or x ∈ B.
Consequently, by the definition of union, we see that x ∈ . We have now shown
that ⊆ .
2.2.2 Set Identities
EXAMPLE 7: Use set builder notation and logical equivalences to establish the first De
Morgan law = ∪ .
Solution: We can prove this identity with the following steps.
= {x ∣ x ∉ A ∩ B} by definition of complement
= {x ∣ ¬(x ∈ (A ∩ B))} by definition of does not belong symbol
= {x ∣ ¬(x ∈ A ∧ x ∈ B)} by definition of intersection
= {x ∣ ¬(x ∈ A) ∨ ¬(x ∈ B)} by the first De Morgan law for logical equivalences
= {x ∣ x ∉ A ∨ x ∉ B} by definition of does not belong symbol
= {x ∣ x ∈ ∨ x ∈ } by definition of complement
= {x ∣ x ∈ ∪ } by definition of union
= ∪ by meaning of set builder notation
2.2.2 Set Identities
EXAMPLE 8: Use a membership table to show that
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
Solution: The membership table for these combinations of
sets is shown in Table 2. This table has eight rows. Because the
columns for A ∩ (B ∪ C) and (A ∩ B) ∪ (A ∩ C) are the same,
the identity is valid.
2.2.2 Set Identities
2.2.2 Set Identities
EXAMPLE 9: Let A, B, and C be sets. Show that
A ∪ (B ∩ C) = (C ∪ B) ∩ A.
Solution: We have
A ∪ (B ∩ C) = A ∩ (B ∩ C) by the first De Morgan law
= A ∩ (B ∪ C) by the second De Morgan law
= (B ∪ C) ∩ A by the commutative law for intersections
= (C ∪ B) ∩ A by the commutative law for unions.
2.2.3 Generalized Unions and
Intersections
• Because unions and intersections of sets satisfy associative
laws, the sets A ∪ B ∪ C and A ∩ B ∩ C are well defined; that
is, the meaning of this notation is unambiguous when A, B,
and C are sets. That is, we do not have to use parentheses to
indicate which operation comes first because A ∪ (B ∪ C) =
(A ∪ B) ∪ C and A ∩ (B ∩ C) = (A ∩ B) ∩ C. Note that A ∪ B ∪
C contains those elements that are in at least one of the sets
A, B, and C, and that A ∩ B ∩ C contains those elements that
are in all of A, B, and C. These combinations of the three sets,
A, B, and C, are shown in Figure 5.
2.2.3 Generalized Unions and
Intersections
• EXAMPLE 10: Let A = {0, 2, 4, 6, 8}, B = {0, 1, 2, 3, 4}, and
C = {0, 3, 6, 9}. What are A ∪ B ∪ C and A ∩ B ∩ C?
• Solution: The set A ∪ B ∪ C contains those elements in at least
one of A, B, and C. Hence, A ∪ B ∪ C = {0, 1, 2, 3, 4, 6, 8, 9}. The
set A ∩ B ∩ C contains those elements in all three of A, B, and C.
Thus, A ∩ B ∩ C = {0}.
2.2.3 Generalized Unions and
Intersections
2.3.1 Introduction to Function

Functions are specified in many different ways. Sometimes we


explicitly state the assignments, as in Figure 1. Often we give a
formula, such as (x) = x + 1, to define a function. Other Assessment
times we use a computer program to specify a function. A
function : A → B can also be defined in terms of a relation from A to
B.
Remark: Functions are sometimes also called mappings or transformations.
2.3.1 Introduction to Function
2.3.1 Introduction to Function

Figure 2 represents a function from A to B.


2.3.1 Introduction to Function
Remark: Note that the codomain of a function from A to B is the
set of all possible values of such a function (that is, all elements of
B), and the range is the set of all values of f(a) for a ∈ A, and is
always a subset of the codomain. That is, the codomain is the set
of possible values of the function and the range is the set of all
elements of the codomain that are achieved as the value of f for at
least one element of the domain.
2.3.1 Introduction to Function
EXAMPLE 1: What are the domain,
codomain, and range of the function that
assigns grades to students described in the
first paragraph of the introduction of this
section?
Solution: Let G be the function that assigns a
grade to a student in our discrete
mathematics class. Note that G(Adams) = A,
for instance. The domain of G is the set
{Adams, Chou, Goodfriend, Rodriguez,
tevens}, and the codomain is the set {A, B, C,
D, F}. The range of G is the set {A, B, C, F},
because each grade except D is assigned to
some student.
2.3.1 Introduction to Function
When specifying a function, we specify its domain, its codomain,
and how it maps elements of the domain to the codomain. Two
functions are equal when:
their domains are equal,
their codomains are equal,
and they map each element in their common domain to the
same element in their common codomain.
2.3.1 Introduction to Function

EXAMPLE2: Answer the following for : x → y

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}. ◂

EXAMPLE 4: Let f : Z → Z assign the square of an integer to this integer.


Then, (x) = x2, where the domain of f is the set of all integers, the
codomain of f is the set of all integers, and the range of f is the set of all
integers that are perfect squares, namely, {0, 1, 4, 9, … }. ◂
2.3.2 One-to-One and Onto
Functions
Some functions never assign the same value to two different domain
elements. These functions are said to be one-to-one.

Note that a function is one-to-one if and only if (a) ≠ (b) whenever a ≠ b.


This way of expressing that is one-to-one is obtained by taking the
contrapositive of the implication in the definition.
2.3.2 One-to-One and Onto
Functions
EXAMPLE 5: Determine whether the function f from {a, b, c, d} to {1, 2,
3, 4, 5} with f(a) = 4, f(b) = 5, f(c) = 1, and f(d) = 3 is one-to-one.
Solution: The function f is one-to-one because f takes on different
values at the four elements of its domain. This is illustrated in Figure.
2.3.2 One-to-One and Onto
Functions
EXAMPLE 6: Determine whether the function (x) = x2 from the set of
integers to the set of integers is one-to-one.
Solution: The function (x) = x2 is not one-to-one because, for instance, (1)
= (−1) = 1, but 1 ≠ −1.
2.3.2 One-to-One and Onto
Functions
EXAMPLE 7: Determine whether the function (x) = x + 1 from the set of real
numbers to itself is one-to-one.
Solution: Suppose that x and y are real numbers with (x) = (y), so that
x + 1 = y + 1. This means that x = y. Hence, (x) = x + 1 is a one-to-one function
from R to R.

EXAMPLE 8: Suppose that each worker in a group of employees is assigned a


job from a set of possible jobs, each to be done by a single worker. In this
situation, the function that assigns a job to each worker is one-to-one. To see
this, note that if x and y are two different workers, then (x) ≠ (y) because the
two workers x and y must be assigned different jobs.
2.3.2 One-to-One and Onto
Functions
For some functions the range and the codomain are equal. That is,
every member of the codomain is the image of some element of the
domain. Functions with this property are called onto functions.
2.3.2 One-to-One and Onto
Functions
EXAMPLE 9: Let be the function from {a, b, c, d} to {1, 2, 3} defined by (a) = 3, (b) = 2,
(c) = 1, and (d) = 3. Is f an onto function?
Solution: Because all three elements of the codomain are images of elements in the
domain, we see that f is onto. This is illustrated in Figure 4. Note that if the codomain
were {1, 2, 3, 4}, then f would not be onto.
EXAMPLE 10: Is the function (x) = x2 from the set of integers to the set of integers
onto?
Solution: The function is not onto because there is no integer x with x 2 = −1, for
instance. ◂
EXAMPLE 11: Is the function (x) = x + 1 from the set of integers to the set of integers
onto?
Solution: This function is onto, because for every integer y there is an integer x such
that (x) = y.To see this, note that (x) = y if and only if x + 1 = y, which holds if and only if
x = y − 1. (Note that y − 1 is also an integer, and so, is in the domain of .) ◂
2.3.2 One-to-One and Onto
Functions

EXAMPLE 12: Let f be the function from {a, b, c, d} to {1, 2, 3, 4}


with f(a) = 4, f(b) = 2, f(c) = 1, and f(d) =3. Is f a bijection?
Solution: The function f is one-to-one and onto. It is one-to-one
because no two values in the domain are assigned the same
function value. It is onto because all four elements of the
codomain are images of elements in the domain. Hence, f is a
bijection. ◂
2.3.2 One-to-One and Onto
Functions

You might also like