Discrete MATH
ITCS 1313
2020 / 2021
SET THEORY
Lecture #03
Discrete MATH by Yahya AMER
Outlines
◼ Relations & Relation properties
Reflexive Relation
Irreflexive Relation
Symmetric Relation
Antisymmetric Relation
Transitive Relation
◼ Composite Relations
◼ Representing Relations
Using Matrix
Discrete MATH by Yahya AMER
Relations
Formal Definition: Let A and B be two sets. A binary relation R from A to B
is a subset of A B = { (a, b) : aA, bB }.
The relation defines the connection between two given sets using ordered pairs.,
sets of ordered pairs are called binary relations.
Example #1: A : the set of students in your school. B : the set of courses.
R = { (a, b) : aA, bB, a is enrolled in course b } . A = {Ali, Sami, Hani, Ahmed}.
B = {CS101, CS201, CS202}.We specify relation R A B as the set that lists all
students a A enrolled in class b B.
R = { (Ali, CS101), (Sami, CS201), (Sami, CS202), (Ahmed, CS201), (Ahmed, CS202) }
Example #2: Given the set X = {1, 3, 4, 6}. Y = { 0, 2, 4, 6, 8}.
R = { (x, y) : xX, yY, x = y/2 }
Set Builder method 0
1
2 A relation can be
3 represented using
R = {(1, 2), (3, 6), (4, 8)} 4
4 Set builder or
Roster method 6 Roster method or
6
8 An arrow diagram
Arrow diagram
Discrete MATH by Yahya AMER
Definition. We use the notation aRb to denote that (a, b)R, and aRb to denote that
(a,b)R. Moreover, a is said to be related to b by R if aRb.
Example #3 : Let A = {0, 1, 2} and B = {a, b}, then {(0,a), (0,b), (1,a), (2,b)} is a relation
R from A to B. This means, for instance, that 0Ra, but that 1Rb.
A B
R = { (0, a ) , ( 0, b ) , (1, a ), ( 2, b )}
0 a
1 R AB = { (0, a ) , ( 0, b ) , (1, a ) , (1, b ) , ( 2, a ) , ( 2, b )}
b R R
2
R
Definition. A relation on the set A is a subset of A A ( i.e., a relation from A to A ).
Example #4 :
Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation
R = { (a, b) | a divides b }?
1 1
Solution : R = { (1,1), (1,2), (1,3), (1,4),
2 2
(2,2), (2,4),
A= {1, 2, 3, 4} A= {1, 2, 3, 4} (3,3), 3 3
(4,4) } 4 4
Discrete MATH by Yahya AMER
Example #5 : Consider the following relations on Z: a, b Z.
R1 = { (a, b) | a b }
R2 = { (a, b) | a > b } Which of these relations
R3 = { (a, b) | a = b or a = -b } contain each of the pairs
R4 = { (a, b) | a = b } (1,1), (1,2), (2,1), (1,-1),
and (2,2)?
R5 = { (a, b) | a = b+1 }
R6 = { (a, b) | a + b 3 }
(1,1) (1,2) (2,1) (1,-1) (2,2)
R1 ● ● ●
R2 ● ●
Solution : R3 ● ● ●
R4 ● ●
R5 ●
R6 ● ● ● ●
Discrete MATH by Yahya AMER
Reflexive vs Irreflexive Relation
Definition: A relation R on a set A is called reflexive
if (a,a)R for every aA.
Definition: A relation R on a set A is called Irreflexive
if (a,a)R for every aA.
Example #6 : Consider the following relations on {1, 2, 3, 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) }
which of them are reflexive or Irreflexive ?
Solution : R2 Neither reflexive nor Irreflexive
R3 Reflexive
R4 Irreflexive
Discrete MATH by Yahya AMER
Example #7 : Consider the following relations on Z Which
of the relations are reflexive or irreflexive?
R1 = { (a, b) | a b }
R2 = { (a, b) | a > b }
R3 = { (a, b) | a = b or a = -b }
R4 = { (a, b) | a = b }
Reflexive : R1, R3 and R4
R5 = { (a, b) | a = b+1 }
Irreflexive : R2 and R5
R6 = { (a, b) | a + b 3 }
Example #8 : Is the “divides” relation on the set of positive
integers reflexive?
Solution : Yes.
Discrete MATH by Yahya AMER
Symmetric vs Antisymmetric Relation
Definition : (1) A relation R on a set A is called
symmetric if for a, b A, (a, b) R (b, a)R
sym. (b , a)R
(a, b)R, a ≠b
antisym. (b , a)R
Definition : A relation R on a set A is called
antisymmetric if for a, b A, (a, b)R (b, a) R .
Example #9 : Which of the relations are symmetric or antisymmetric ?
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) }
Solution : R2, R3 are symmetric
R4 are antisymmetric.
Discrete MATH by Yahya AMER
Example #10 : Is the “divides” relation on the set of positive integers
symmetric? Is it antisymmetric?
Solution : It is not symmetric since 1|2 but 2 | 1.
It is antisymmetric since a |b and b |a implies a =b.
Example #11 : Let A = {1,2,3}, give a relation R on A set that is
both symmetric and antisymmetric, but not reflexive.
Solution : R = { (1,1),(2,2) }
Example #12 : Let A = {1,2,3}, give a relation R on A set. is both not
symmetric and not antisymmetric, but reflexive.
Solution : R = { (1,1), (2,2), (3,3), (2,1), (2,3), (3,2) }
Discrete MATH by Yahya AMER
Transitive Relation
Definition. A relation R on a set A is called transitive if for a, b,
c A, (a, b)R and (b, c)R (a, c)R.
Example #13 : Which of the relations are transitive ?
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) }
Solution :
R2 is not transitive since
(2,1) R2 and (1,2) R2 but (2,2) R2.
R3 is not transitive since
(2,1) R3 and (1,4) R3 but (2,4) R3.
R4 is transitive.
Example #14 : Is the “divides” relation on the set of positive integers transitive?
Solution : Suppose a |b and b |c since a |c then its transitive
Discrete MATH by Yahya AMER
Combining Relations
Example. Let A = {1, 2, 3} and B = {1, 2, 3, 4}.
The relation 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), (2,2), (3,3), (1,2), (1,3), (1,4)}
R1 ∩ R2 = {(1,1)}
R1 - R2 = {(2,2), (3,3)}
R2 - R1 = {(1,2), (1,3), (1,4)}
R1 R2 = {(2,2), (3,3), (1,2), (1,3), (1,4)}
symmetric difference (R1R2) – (R1 R2)
Discrete MATH by Yahya AMER
Definition. 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 aA, cC,
and for which there exists an element bB such that (a,b)R
and (b,c)S. We denote the composite of R and S by R S.
Example: What is the composite of 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)}?
1
1 0
2
2 1
3
3 2
4
R S
Solution: R S is the relation from {1, 2, 3} to {0, 1, 2} with
R S = {(1, 0), (1,1), (2, 1), (2, 2), (3, 0), (3, 1)}.
Discrete MATH by Yahya AMER
Definition. Let R be a relation on the set A. The powers Rn, n = 1, 2, 3, …,
are defined recursively by R1 = R and Rn+1 = Rn R.
Example: Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find the powers Rn, n=2, 3, 4,….
Solution. R 2 = R R = {(1, 1), (2, 1), (3, 1), (4, 2)}.
R 3 = R 2 R = {(1, 1), (2, 1), (3, 1), (4, 1)}.
R 4 = R 3 R = {(1, 1), (2, 1), (3, 1), (4, 1)} = R 3.
Therefore Rn = R 3 for n = 4, 5, ….
Discrete MATH by Yahya AMER
Representing Relations using Matrices
Suppose that R is a relation from A={a1, a2, …, am}
to B = {b1, b2,…, bn }. The relation 1, if (ai , bj)R
R can be represented by the m =
ij
matrix MR = [mij], where
0, if (ai , bj)R
Example: Suppose that A = {1, 2, 3} and B = {1, 2}. Let R = {(a, b) | a > b,
aA, bB}. What is the matrix MR representing R ?
Solution : B
1 2
R = {(2, 1), (3, 1), (3, 2)}
1 0 0 0 0
M R = 1 0
A 2
1 0
1 1
3 1 1
Discrete MATH by Yahya AMER
a1 a2 … … an
a1 1
1
Let A={a1, a2, …,an}. A relation R on A is a2
reflexive iff (ai,ai)R,i. MR = :
:
an 1
1
The relation R is symmetric iff
(ai,aj)R (aj,ai)R. This means mij = mji . M R = 1 0 = ( M R ) t
0
1
The relation R is antisymmetric iff 0
0
(ai , aj)R and i j (aj ,ai) R . This MR =
means that if mij=1 with i≠j, then mji=0. 1 0
0
Discrete MATH by Yahya AMER
Example:
Suppose that the relation R on a set is represented by the matrix
Is R reflexive, symmetric,
1 1 0
antisymmetric ? M R = 1 1 1
0 1 1
Solution : reflexive , symmetric , not antisymmetric
Example. Suppose that S={0, 1, 2, 3}. Let R be a relation
containing (a, b) if a b, where a S and b S.
Is R reflexive, symmetric, antisymmetric ?
0 1 2 3
Solution : 0 1 1 1 1
1
0 1 1 1 ∴ R is reflexive and
MR =
2 0 0 1 1 antisymmetric,
not symmetric.
3 0 0 0 1
Discrete MATH by Yahya AMER
Example. Suppose the relations R1 and R2 on
1 0 1 1 0 1
a set A are represented by the matrices
M R1 = 1 0 0 M R2 = 0 1 1
0 1 0 1 0 0
What are the matrices representing R1 R2 and R1 R2?
Solution : 1 0 1 1 0 1
M R1 R2 = 1 1 1 M R1 R2 = 0 0 0
1 1 0 0 0 0
Example.
Solution :
Discrete MATH by Yahya AMER
Example. Find the matrix representing the relation S R, where the matrices
representing R and S are
1 0 1 0 1 0
M R = 1 1 0 M S = 0 0 1
0 0 0 1 0 1
Solution :
Discrete MATH by Yahya AMER
Another way to solve…..
In here we use the
Arrow diagram
instead of matrices
Discrete MATH by Yahya AMER
END