Discrete Math Lecture #03 (2020) PDF
Discrete Math Lecture #03 (2020) PDF
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
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
Solution : Yes.
Discrete MATH by Yahya AMER
Solution : R = { (1,1),(2,2) }
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
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
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.
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
END