You are on page 1of 64

Sets

A set is an unordered collection of objects, called elements or members of the set. A set is said to
contain its elements. We write a ∈ A to denote that a is an element of the set A. The notation a ∉ A
denotes that a is not an element of the set A.

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.

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 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 O = {x ∈ Z+ | x is odd and x < 10}.
These sets, each denoted using a boldface letter, play an important role
in discrete mathematics:
N = {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.
Two sets are equal if and only if they have the same elements. Therefore, if A
and B are sets, then A and B are equal if and only if ∀x(x ∈ A ↔ x ∈ B).We
write A = B if A and B are equal sets.

Eg: 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.

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 { }.
A set with one element is called a singleton set. A common error is to
confuse the empty {∅} has one more element than ∅.
Venn Diagrams
Sets can be represented graphically using Venn diagrams, named after the English
mathematician JohnVenn.
In Venn diagrams the universal set U, which contains all the objects under
consideration, is represented by a rectangle. Inside this rectangle, circles or other
geometrical figures are used to represent sets. Sometimes points are used to
represent the particular elements of the set.

Eg: Draw a Venn diagram that represents V, the set of vowels in the English
alphabet.
Subsets: The set A is a subset of B if and only if every element of A is also an element
of B. We use the notation A ⊆ B to indicate that A is a subset of the set B.
We see that A ⊆ B if and only if the quantification ∀x(x ∈ A → x ∈ B) is true. Note that
to show that A is not a subset of B we need only find one element x ∈ A with x ∉ B.

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. A is a proper subset of B denoted by A ⊂
B to be true, it must be the case that A ⊆ B and there must exist an element x of B that
is not an element of A. That is, A is a proper subset of B if and only if
∀x(x ∈ A → x ∈ B) ∧ ∃x(x ∈ B ∧ x ∉ A) is true.
Showing Two Sets are Equal : To show that two sets A and B are equal, show that
A ⊆ B and B ⊆ A.
That is, A = B if and only if ∀x(x ∈ A → x ∈ B) and ∀x(x ∈ B → x ∈ A) or
equivalently if and only if ∀x(x ∈ A ↔ x ∈ B), which is what it means for the A
and B to be equal.

The Size of a Set: Let S be a set. If there are exactly n distinct elements in S
where n is a nonnegative integer, we say that S is a finite set and that n is the
cardinality of S. The cardinality of S is denoted by |S|.
Eg:
Let A be the set of odd positive integers less than 10. Then |A| = 5.
Because the null set has no elements, it follows that |∅| = 0.
Power Sets: Given a set S, the power set of S is the set of all subsets of the set S.
The power set of S is denoted by P(S).

Q. What is the power set of the set {0, 1, 2}?


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}}.
Q. What is the power set of the empty set? What is the power set of the set
{∅}?
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.
Cartesian Products
Let A and B be sets. The Cartesian product of A and B, denoted by A × B, is the
set of all ordered pairs (a, b), where a ∈ A and b ∈ B. Hence,
A × B = {(a, b) | a ∈ A ∧ b ∈ B}.
What is the Cartesian product of A = {1, 2} and B = {a, b, c}?
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.

Note that the Cartesian products A × B and B × A are not equal, unless A = ∅ or
B = ∅.
A subset R of the Cartesian product A × B is called a relation from the set A to the set
B. The elements of R are ordered pairs, where the first element belongs to A and the
second to B.
For example,
R = {(a, 0), (a, 1), (a, 3), (b, 1), (b, 2), (c, 0), (c, 3)} is a relation from
the set {a, b, c} to
the set {0, 1, 2, 3}.

A relation from a set A to itself is called a relation on A.


Q. What are the ordered pairs in the less than or equal to relation, which contains (a,
b) if a ≤ b, on the set {0, 1, 2, 3}?
• The ordered pair (a, b) belongs to R if and only if both a and b belong to {0, 1, 2, 3}
and a ≤ b. Consequently, the ordered pairs in R are (0,0), (0,1), (0,2), (0,3), (1,1), (1,2),
(1,3),(2,2), (2, 3), and (3, 3).
Set Operations
Let A and B be sets. The union of the sets A and B, denoted by A ∪ B, is the set
that contains those elements that are either in A or in B, or in both.

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.
A ∪ B = {x | x ∈ A ∨ x ∈ B}.

Let A and B be sets. The intersection of the sets A and B, denoted by A ∩ B, is the
set containing those elements in both A and B.
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.
A ∩ B = {x | x ∈ A ∧ x ∈ B}.
Two sets are called disjoint if their intersection is the empty set.

Let A and B be sets. The difference of A and B, denoted by A − B, is the set


containing those elements that are in A but not in B. The difference of A and B is
also called the complement of B with respect to A.

An element x belongs to the difference of A and B if and only if x ∈ A and x ∉ B.


This tells us that
A − B = {x | x ∈ A ∧ x ∉ B}.

Q. The difference of {1, 3, 5} and {1, 2, 3} is the set ______


Let U be the universal set. The complement of the set A, denoted by 𝐴,ҧ is the
complement of A with respect to U. Therefore, the complement of the set A is
U − A.

An element belongs to 𝐴ҧ if and only if x ∉ A. This tells us that


𝐴ҧ = {x ∈ U | x ∉ A}.
Set Identities Identity Name
A∩U=A Identity laws
A∪∅=A
A∪U=U Domination laws
A∩∅ = ∅
A∪A=A Idempotent laws
A∩A=A
𝐴Ӗ = A Complementation law
A∪B=B∪A Commutative laws
A∩B=B∩A
A ∪ (B ∪ C) = (A ∪ B) ∪ C Associative laws
A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Distributive laws
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
A ∩ B= 𝐴ҧ ∪ 𝐵ത De Morgan’s laws
A ∪ B = 𝐴ҧ ∩ 𝐵ത
A ∪ (A ∩ B) = A Absorption laws
A ∩ (A ∪ B) = A
A ∪ 𝐴ҧ = U Complement laws
A ∩ 𝐴ҧ = ∅
Q. Use set builder notation and logical equivalences to establish A ∩ B= 𝐴ҧ ∪ 𝐵ത

We can prove this identity with the following steps.


A ∩ B = {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
ഥ ∪ Bത ) ∩ A
Q. Let A, B, and C be sets. Show that A ∪ (B ∩ C) = (C ഥ.

ഥ ∩ (B ∩ C)
A ∪ (B ∩ C) = A 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.
Relations and Their Properties
The most direct way to express a relationship between elements of two sets is
to use ordered pairs made up of two related elements. For this reason, sets of
ordered pairs are called binary relations.
Let A and B be sets. A binary relation from A to B is a subset of A × B.

A binary relation from A to B is a set R of ordered pairs where the first element
of each ordered pair comes from A and the second element comes from B. We
use the notation a R b to denote that (a, b) ∈ R and to denote that (a, b) ∉
R. Moreover, when (a, b) belongs to R, a is said to be related to b by R.
Relations on a Set
Relations from a set A to itself. A relation on a set A is a relation from A
to A.

Q. Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R
= {(a, b) | a divides b}?
Properties of Relations
A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are reflexive?
Q. Is the “divides” relation on the set of whole number reflexive?
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called
antisymmetric.
The set A is symmetric if ∀a∀b((a, b) ∈ R → (b, a) ∈ R). Similarly, the relation R on the set A is
antisymmetric if ∀a∀b(((a, b) ∈ R ∧ (b, a) ∈ R) → (a = b)).
The terms symmetric and antisymmetric are not opposites, because a relation can have both of these
properties or may lack both of them. A relation cannot be both symmetric and antisymmetric if it
contains some pair of the form (a, b), where a ≠ b. A relation is not antisymmetric if we can find a
pair (a, b) with a ≠ b such that (a, b) and (b, a) are both in the relation.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are symmetric and which are antisymmetric?
Q. Is the “divides” relation on the set of positive integers symmetric? Is it antisymmetric?
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric.
The set A is symmetric if ∀a∀b((a, b) ∈ R → (b, a) ∈ R). Similarly, the relation R on the set A is antisymmetric if
∀a∀b(((a, b) ∈ R ∧ (b, a) ∈ R) → (a = b)).
The terms symmetric and antisymmetric are not opposites, because a relation can have both of these
properties or may lack both of them. A relation cannot be both symmetric and antisymmetric if it contains
some pair of the form (a, b), where a ≠ b. A relation is not antisymmetric if we can find a pair (a, b) with a ≠ b
such that (a, b) and (b, a) are both in the relation.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are symmetric and which are antisymmetric?
R2 and R3 is symmetric and R4, R5 and R6 are antisymmetric
Q. Is the “divides” relation on the set of positive integers symmetric? Is it antisymmetric?
Antisymmetric
Properties of Relations
A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are reflexive?
Q. Is the “divides” relation on the set of whole number reflexive?
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called
antisymmetric.
The set A is symmetric if ∀a∀b((a, b) ∈ R → (b, a) ∈ R). Similarly, the relation R on the set A is
antisymmetric if ∀a∀b(((a, b) ∈ R ∧ (b, a) ∈ R) → (a = b)).
The terms symmetric and antisymmetric are not opposites, because a relation can have both of these
properties or may lack both of them. A relation cannot be both symmetric and antisymmetric if it
contains some pair of the form (a, b), where a ≠ b. A relation is not antisymmetric if we can find a
pair (a, b) with a ≠ b such that (a, b) and (b, a) are both in the relation.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are symmetric and which are antisymmetric?
Q. Is the “divides” relation on the set of positive integers symmetric? Is it antisymmetric?
A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric.
The set A is symmetric if ∀a∀b((a, b) ∈ R → (b, a) ∈ R). Similarly, the relation R on the set A is antisymmetric if
∀a∀b(((a, b) ∈ R ∧ (b, a) ∈ R) → (a = b)).
The terms symmetric and antisymmetric are not opposites, because a relation can have both of these
properties or may lack both of them. A relation cannot be both symmetric and antisymmetric if it contains
some pair of the form (a, b), where a ≠ b. A relation is not antisymmetric if we can find a pair (a, b) with a ≠ b
such that (a, b) and (b, a) are both in the relation.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are symmetric and which are antisymmetric?
R2 and R3 is symmetric and R4, R5 and R6 are antisymmetric
Q. Is the “divides” relation on the set of positive integers symmetric? Is it antisymmetric?
Antisymmetric
A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R,
then (a, c) ∈ R, for all a, b, c ∈ A.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are transitive?
Q. Is the “divides” relation on the set of positive integers transitive?
A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R,
for all a, b, c ∈ A.

Q. Consider the following relations on {1, 2, 3, 4}:


R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are transitive?
R4, R5, and R6 are transitive.
Q. Is the “divides” relation on the set of positive integers transitive?
Yes.
• Suppose that a divides b and b divides c. Then there are positive integers k and l such that b =
ak and c = bl. Hence, c = a(kl), so a divides c. It follows that this relation is transitive.
Combining Relations
Because relations from A to B are subsets of A × B, two relations from A
to B can be combined in any way two sets can be combined.
Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relations R1 = {(1, 1), (2, 2), (3,
3)} and R2 = {(1, 1), (1, 2), (1, 3), (1, 4)} can be combined to obtain
• R1 ∪ R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)},
• R1 ∩ R2 = {(1, 1)},
• R1 − R2 = {(2, 2), (3, 3)},
• R2 − R1 = {(1, 2), (1, 3), (1, 4)}.
Let R be a relation from a set A to a set B and S a relation from B to a set C.
The composite of R and S is the relation consisting of ordered pairs (a, c),
where a ∈ A, c ∈ C, and for which there exists an element b ∈ B such that (a,
b) ∈ R and (b, c) ∈ S. We denote the composite of R and S by S ◦R.

Q. What is the composite of the relations R and S, where R is the relation


from {1, 2, 3} to {1, 2, 3, 4} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is
the relation from {1, 2, 3, 4} to {0, 1, 2} with S = {(1, 0), (2, 0), (3, 1), (3, 2), (4,
1)}?

S ◦R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
Representing Relations Using Matrices
A relation between finite sets can be represented using a zero–one matrix. Suppose that R is a
relation from A = {a1, a2, . . . , am} to B = {b1, b2, . . . , bn}. The relation R can be represented by
the matrix MR = [mij ], where
1 if (ai, bj ) ∈ R,
mij =ቊ
0 if (ai, bj) ∉ R.
Eg: Suppose that A = {1, 2, 3} and B = {1, 2}. Let R be the relation from A to B containing (a, b)
if a ∈ A, b ∈ B, and a > b. What is the matrix representing R if a1 = 1, a2 = 2, and a3 = 3, and b1 =
1 and b2 = 2?
Because R = {(2, 1), (3, 1), (3, 2)}, the matrix for R is

0 0
MR = 1 0
1 1
The matrix of a relation on a set, which is a square matrix, can be used to
determine whether the relation has certain properties.

1 1 1 0
1 1 0 0 0
1 0 1 0
(i) reflexive (ii) Symmetric (iii) Antisymmetric

Q. Suppose that the relation R on a set is represented by the matrix

1 1 0
MR= 1 1 1
0 1 1
Is R reflexive, symmetric, and/or antisymmetric?
Q. Consider the following relations on {1, 2, 3, 4}:
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are symmetric and which are antisymmetric?

1 1 0 1 1 1 1 1 0 0 0 0
R3 = 1 1 0 0 R5 = 0 1 1 1 R6 = 0 0 0 0
0 0 1 0 0 0 1 1 0 0 0 1
1 0 0 1 0 0 0 1 0 0 0 0
The matrices representing the union and intersection of relations are
MR1∪R2= MR1∨ MR2 and MR1∩R2= MR1∧ MR2 .
Example: Suppose that the relations R1 and R2 on a set A are represented by the matrices
1 0 1 1 0 1
MR1 = 1 0 0 MR2= 0 1 1
0 1 0 1 0 0
What are the matrices representing R1 ∪ R2 and R1 ∩ R2?
• The matrix representing the union of these relations has a 1 in the positions where either
MR1 or MR2 has a 1.
• The matrix representing the intersection of these relations has a 1 in the positions where
both MR1 and MR2 have a 1.
1 0 1
MR1∪R2= MR1∨ MR2= 1 1 1
1 1 0
1 0 1
MR1∩R2= MR1∧ MR2= 0 0 0
0 0 0
Determining the matrix for the composite of relations
Composite of relations can be found using the Boolean product of the
matrices
Boolean product:
Let A = [aij ] be an m × k zero–one matrix and B = [bij ] be a k × n zero–
one matrix. Then the Boolean product of A and B, denoted by A⨀B, is
the m × n matrix with (i, j )th entry cij where
cij = (ai1 ∧ b1j ) ∨ (ai2 ∧ b2j ) ∨ ・ ・ ・ ∨ (aik ∧ bkj ).

From the definition of the Boolean product, this means that


• MS ◦R = MR ⨀ MS.
Q. Find the matrix representing the relations S ◦R, where the matrices
representing R and S are
1 0 1 0 1 0
M R = 1 1 0 MS = 0 0 1
0 0 0 1 0 1

1 ∧ 0 ∨ (0 ∧ 0) ∨ (1 ∧ 1) 1 1
MS ◦R = MR ⨀ MS = 0 1 1
0 0 0

1 1 1
= 0 1 1
0 0 0
Representing Relations Using Digraphs
A directed graph, or digraph, consists of a set V of vertices (or nodes) together
with a set E of ordered pairs of elements of V called edges (or arcs). The
vertex a is called the initial vertex of the edge (a, b), and the vertex b is called
the terminal vertex of this edge.

An edge of the form (a, a) is represented using an arc from the vertex a back
to itself. Such an edge is called a loop.
The directed graph with vertices a, b, c, and d,
and edges (a, b), (a, d), (b, b), (b, d), (c, a), (c, b), and (d, b) is
Equivalence Relations: A relation on a set A is called an equivalence
relation if it is reflexive, symmetric, and transitive.

A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b,


c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A.

Partial Orderings: A relation R on a set S is called a partial ordering or


partial order if it is reflexive, antisymmetric, and transitive. A set S
together with a partial ordering R is called a partially ordered set, or
poset, and is denoted by (S,R). Members of S are called elements of the
poset.
Example: Show that the “greater than or equal” relation (≥) is a partial
ordering on the set of integers.

Because a ≥ a for every integer a, ≥ is reflexive. If a ≥ b and b ≥ a, then a = b.


Hence, ≥ is antisymmetric. Finally, ≥ is transitive because a ≥ b and b ≥ c
imply that a ≥ c. It follows that ≥ is a partial ordering on the set of integers
and (Z, ≥) is a poset.

Similarly, the divisibility relation | is a partial ordering on the set of positive


integers.

Q. Let R be the relation on the set of people such that xRy if x and y are
people and x is older than y. R is partial ordering?
Customarily, the notation ⪯ is used to denote the relation in any poset
(S,R), not just the “less than or equals” relation.

The elements a and b of a poset (S, ⪯) are called comparable if either a ⪯


b or b ⪯ a. When a and b are elements of S such that neither a ⪯ b nor b ⪯
a, a and b are called incomparable.

Example: In the poset (Z+, |), are the integers 3 and 9 comparable? Are 5
and 7 comparable?
The integers 3 and 9 are comparable, because 3 | 9. The integers 5 and 7
are incomparable, because 5 ∤ 7 and 7 ∤ 5.
If (S, ⪯) is a poset and every two elements of S are comparable, S is
called a totally ordered or linearly ordered set, and ⪯ is called a total
order or a linear order. A totally ordered set is also called a chain.

Example: The poset (Z,≤) is totally ordered, because a ≤ b or b ≤ a


whenever a and b are integers.

(S, ⪯) is a well-ordered set if it is a poset such that it is a total ordering


and every nonempty subset of S has a least element.
Hasse Diagrams Many edges in the directed graph for a finite poset do
not have to be shown because they must be present.

Because this relation is a partial ordering, it is


reflexive, and its directed graph has loops at all
vertices. Consequently, we do not have to show these
loops because they must be present;

Because a partial ordering is transitive, we do not have


to show those edges that must be present because of
transitivity.

If we assume that all edges are pointed “upward”, we


do not have to show the directions of the edges

Fig: Constructing the Hasse Diagram for ({1, 2, 3, 4},≤).


Q. Draw the Hasse diagram representing the partial ordering {(a, b) |a
divides b} on {1, 2, 3, 4, 6, 8, 12}.
Hasse Diagrams Many edges in the directed graph for a finite poset do
not have to be shown because they must be present.

Because this relation is a partial ordering, it is


reflexive, and its directed graph has loops at all
vertices. Consequently, we do not have to show these
loops because they must be present;

Because a partial ordering is transitive, we do not have


to show those edges that must be present because of
transitivity.

If we assume that all edges are pointed “upward”, we


do not have to show the directions of the edges

Fig: Constructing the Hasse Diagram for ({1, 2, 3, 4},≤).


Q. Draw the Hasse diagram representing the partial ordering {(a, b) |a
divides b} on {1, 2, 3, 4, 6, 8, 12}.
Maximal and Minimal Elements
Elements of posets that have certain extremal properties are important for
many applications. An element of a poset is called maximal if it is not less
than any element of the poset.
That is, a is maximal in the poset (S, ⪯) if there is no b ∈ S such that a ≺ b.
Similarly, an element of a poset is called minimal if it is not greater than any
element of the poset.

That is, a is minimal if there is no element b ∈ S such that b ≺ a. Maximal


and minimal elements are easy to spot using a Hasse diagram.

They are the “top” and “bottom” elements in the diagram.


Note: A poset can have more than one maximal element and more than one
minimal element.
Q. Which elements of the poset ({2, 4, 5, 10, 12, 20, 25}, |) are maximal, and
which are minimal?

The maximal elements are 12, 20, and 25, and


the minimal elements are 2 and 5.

Sometimes there is an element in a poset that is greater than every other


element. Such an element is called the greatest element. That is, a is the
greatest element of the poset (S, ⪯) if b ⪯ a for all b ∈ S. The greatest
element is unique when it exists.

Likewise, an element is called the least element if it is less than all the other
elements in the poset. That is, a is the least element of (S, ⪯) if a ⪯ b for all
b ∈ S. The least element is unique when it exists.
Q. Determine whether the posets represented by each of the Hasse diagrams in the
figure have a greatest element and a least element.

The least element of the poset with Hasse diagram (a) is a. This poset has no
greatest element.
The poset with Hasse diagram (b) has neither a least nor a greatest element.
The poset with Hasse diagram (c) has no least element. Its greatest element is d.
The poset with Hasse diagram (d) has least element a and greatest element d.
Upper bound and Lower bound
• Sometimes it is possible to find an element that is greater than or equal to all the
elements in a subset A of a poset (S, ⪯). If u is an element of S such that a ⪯ u for all
elements a ∈ A, then u is called an upper bound of A.
• Likewise, there may be an element less than or equal to all the elements in A. If l is
an element of S such that l ⪯ a for all elements a ∈ A, then l is called a lower bound
of A.
Q. Find the lower and upper bounds of the subsets
{a, b, c}, {j, h}, and {a, c, d, f } in the poset with the
Hasse diagram shown in Figure

The upper bounds of {a, b, c} are e, f, j, and h, and its only


lower bound is a. There are no upper bounds of {j, h}, and
its lower bounds are a, b, c, d, e, and f . The upper bounds
of {a, c, d, f } are f , h, and j , and its lower bound is a.
Least upper bound and Greatest lower bound
The element x is called the least upper bound of the subset A if x is an upper
bound that is less than every other upper bound of A. The least upper bound of A is
unique if it exists

That is, x is the least upper bound of A if a ⪯ x whenever a ∈ A, and x ⪯ z whenever


z is an upper bound of A.

Similarly, the element y is called the greatest lower bound of A if y is a lower bound
of A and z ⪯ y whenever z is a lower bound of A. The greatest lower bound of A is
unique if it exists

The greatest lower bound and least upper bound of a subset A are denoted by
glb(A) and lub(A), respectively.
Q. Find the greatest lower bound and the least upper bound of {b, d, g}, if they
exist, in the poset shown in Figure

The upper bounds of {b, d, g} are g and h. Because


g ≺ h, g is the least upper bound. The lower bounds
of {b, d, g} are a and b. Because a ≺ b, b is the
greatest lower bound.
Q. Find the greatest lower bound and the least upper bound of the sets {3, 9,
12} and {1, 2, 4, 5, 10}, if they exist, in the poset (Z+, |).

greatest lower bound of {3, 9, 12}


is 3

greatest lower bound of {1, 2, 4, 5, 10}


is 1

least upper bound of {3, 9, 12}


is 36

least upper bound of {1, 2, 4, 5, 10}


is 20
Lattices
• A partially ordered set in which every pair of elements has both a least upper
bound and a greatest lower bound is called a lattice.

Q. Determine whether the posets represented by each of the Hasse diagrams in


Figure are lattices.
The posets represented by the Hasse diagrams in (a) and (c) are both
lattices because in each poset every pair of elements has both a least
upper bound and a greatest lower bound.
On the other hand, the poset with the Hasse diagram shown in (b)
is not a lattice, because the elements b and c have no least upper bound.
Q. Determine whether the posets represented by each of the Hasse diagrams in Figure are lattices.

a. Yes
b. No
c. Yes

Q. Draw the Hasse diagram for the poset ({3, 5, 9, 15, 24, 45}, |).
Find the maximal elements: 24, 45
Find the minimal elements: 3, 5
Is there a greatest element: Does not exist
Is there a least element: Does not exist
Find all upper bounds of {3, 5}: 15, 45
Find the least upper bound of {3, 5}, if it exists. 15
Find all lower bounds of {15, 45}: 3, 5, 15
Find the greatest lower bound of {15, 45}, if it exists. 15
Topological Sorting
Suppose that a project is made up of 20 different tasks. Some tasks can be
completed only after others have been finished. How can an order be found for these
tasks? To model this problem we set up a partial order on the set of tasks so that a ≺
b if and only if a and b are tasks where b cannot be started until a has been
completed.
LEMMA: Every finite nonempty poset (S, ) has at least one minimal element.
Algorithm:
procedure topological sort ((S, ⪯ ): finite poset)
k := 1
while S ≠ ∅
ak : = a minimal element of S {such an element exists by Lemma}
S : = S − {ak}
k:=k+1
return a1, a2, . . . , an {a1, a2, . . . , an is a compatible total ordering of S}
Q. Find a compatible total ordering for the poset ({1, 2, 4, 5, 12, 20}, |).

• The first step is to choose a minimal


element. This must be 1, because it is the
only minimal element.
• Next, select a minimal element of ({2, 4, 5,
12, 20}, |). There are two minimal elements
in this poset, namely, 2 and 5. We select 5.
The remaining elements are {2, 4, 12, 20}.
• The only minimal element at this stage is 2.
Next, 4 is chosen because it is the only
minimal element of ({4, 12, 20}, |).
• Because both 12 and 20 are minimal
elements of ({12, 20}, |), either can be
chosen next. We select 20, which leaves 12
as the last element left. This produces the
• total ordering1 ≺ 5 ≺ 2 ≺ 4 ≺ 20 ≺ 12.
Q. A development project at a computer company requires the completion of seven tasks. Some of these tasks
can be started only after other tasks are finished. A partial ordering on tasks is set up by considering task X ≺
task Y if task Y cannot be started until task X has been completed. The Hasse diagram for the seven tasks, with
respect to this partial ordering, is shown in Figure. Find an order in which these tasks can be carried out to
complete the project.

An ordering of the seven tasks can be obtained by performing a topological


sort. The steps of a sort are illustrated in Figure. The result of this sort,
A ≺ C ≺ B ≺ E ≺ F ≺ D ≺ G, gives one possible order for the tasks.
Q. Schedule the tasks needed to build a house, by specifying their
order, if the Hasse diagram representing these tasks is as shown in the
figure.
Function
Let A and B be nonempty sets. A function f from A to B is an assignment of exactly
one element of B to each element of A. We write f (a) = b if b is the unique
element of B assigned by the function f to the element a of A. If f is a function
from A to B, we write f : A → B.

If f is a function from A to B, we say that A is the domain of f and B is the


codomain of f. If f (a) = b, we say that b is the image of a and a is a preimage of b.
The range, or image, of f is the set of all images of elements of A. Also, if f is a
function from A to B, we say that f maps A to B.
A function f is said to be one-to-one, or an injunction, if and only if f (a) = f (b)
implies that a = b for all a and b in the domain of f. A function is said to be injective
if it is one-to-one.
Note that a function f is one-to-one if and only if f (a) ≠ f (b) whenever a ≠ b.

Q. Determine whether the function f (x) = x2 from the set of integers to the set of
integers is one-to-one.
The function f (x) = x2 is not one-to-one because, for instance, f (1) = f (−1) = 1,
but 1 = −1.
A function f from A to B is called onto, or a surjection, if and only if for
every element b ∈ B there is an element a ∈ A with f (a) = b. A function
f is called surjective if it is onto.

The function f is a one-to-one correspondence, or a bijection, if it is


both one-to-one and onto. We also say that such a function is bijective.
Let f be a one-to-one correspondence from the set A to the set B. The inverse
function of f is the function that assigns to an element b belonging to B the unique
element a in A such that f (a) = b. The inverse function of f is denoted by f−1. Hence,
f−1(b) = a when f (a) = b.

Q. Let f : Z → Z be such that f (x) = x + 1. Is f invertible, and if it is, what is its inverse?
The function f has an inverse because it is a one-to-one correspondence. To reverse
the correspondence, suppose that y is the image of x, so that y = x + 1. Then x = y − 1.
This means that y − 1 is the unique element of Z that is sent to y by f . Consequently,
f−1(y) = y − 1.

Q. Let f be the function from R to R with f (x) = x2. Is f invertible?


Because f (−2) = f (2) = 4, f is not one-to-one. Hence, f is not invertible.
Let g be a function from the set A to the set B and let f be a function from the
set B to the set C. The composition of the functions f and g, denoted for all a ∈ A
by f ◦ g, is defined by
(f ◦ g)(a) = f (g(a)).

Example: Let f and g be the functions from the set of integers to the set of
integers defined by f (x) = 2x + 3 and g(x) = 3x + 2. What is the composition of f
and g? What is the composition of g and f ?
(f ◦ g)(x) = f (g(x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7
and
(g ◦ f )(x) = g(f (x)) = g(2x + 3) = 3(2x + 3) + 2 = 6x + 11.

The commutative law does not hold for the composition of functions.
Floor and Ceiling function
The floor function assigns to the real number x the largest integer that is less than or
equal to x. The value of the floor function at x is denoted by 𝑥 .
The ceiling function assigns to the real number x the smallest integer that is greater
than or equal to x. The value of the ceiling function at x is denoted by 𝑥 .
−𝑥 =- 𝑥 −𝑥 = − 𝑥
−1 −1
=? =?
2 2
= -1 =0
Q. In asynchronous transfer mode, data are organized into cells of 53 bytes. How
many ATM cells can be transmitted in 1 minute over a connection that transmits data
at the rate of 500 kilobits per second? (1 byte=8 bits)
500∗1000
• = 70,754 ATM cells can be transmitted in 1 minute over a 500 kilobit per
53∗8
second connection.
1
Q. Prove that if x is a real number, then 2𝑥 = 𝑥 + 𝑥 +
2
Let x = n + f ---------(1)
where n is an integer and 0 ≤ f < 1. There are two cases to consider, depending on
1
whether f is less than, or greater than or equal to
2
1
First consider the case when 0 ≤ f < .
2
From (1), 2x = 2n + 2f
2𝑥 = 2𝑛
1 1
𝑥+ =𝑛+𝑓+
2 2
1
𝑥+ =n
2
LHS RHS
1
2𝑥 =2n 𝑥 + 𝑥+ =𝑛 + 𝑛
2
1
Second consider the case when ≤ f <1.
2
From (1), 2x = 2n + 2f
= 2n+1+2f-1
2𝑥 = 2𝑛 + 1
1 1
𝑥+ =𝑛+𝑓+
2 2
1
=n+1+f−
2
1
𝑥+ =n+1
2
LHS RHS
1
2𝑥 =2n + 1 𝑥 + 𝑥+ =𝑛 + 𝑛 + 1 = 2𝑛 + 1
2
Q. Prove or disprove that 𝑥 + 𝑦 = 𝑥 + 𝑦 for all real numbers x and y.
1 1
It is false. A counterexample when x = and y =
2 2
LHS
𝑥 + 𝑦 =1
RHS
𝑥 + 𝑦 =2

• An algorithm is called recursive if it solves a problem by reducing it to an


instance of the same problem with smaller input.
Eg: factorial(n: nonnegative integer), Computing gcd(a, b) where a, b
are nonnegative integers, fibonacci(n: nonnegative integer)

You might also like