Professional Documents
Culture Documents
• Representation of
Relations
• Paths in Relations
CSCI1303 • Properties of
Mathematics for Computing I Relations
CSCI1303 - Mathematics for Computing I Relations
Overview of Relation
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Representing Relations
• Set of Ordered-Pairs
• Matrix
• Digraph
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Set of Ordered-Pairs
• Ordered-pair:
• a listing of objects/items in a
𝐴×𝐵 = 𝑥, 𝑦 𝑥 ∈ 𝐴 and 𝑦 ∈ 𝐵}
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Suppose 𝐴 = 1, 2, 3 and 𝐵 = 𝑟, 𝑠
𝐴×𝐵 =
𝐵×𝐴=
𝐴×𝐴=
𝐵×𝐵 =
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Suppose 𝐴 = 1, 2, 3 and 𝐵 = 𝑟, 𝑠
𝐴×𝐵 = 1, 𝑟 , 1, 𝑠 , 2, 𝑟 , 2, 𝑠 , 3, 𝑟 , 3, 𝑠
𝐵×𝐴= 𝑟, 1 , 𝑟, 2 , 𝑟, 3 , 𝑠, 1 , 𝑠, 2 , 𝑠, 3
𝐴×𝐴= 1, 1 , 1, 2 , 1, 3 , 2, 1 , 2, 2 , 2, 3 , 3, 1 , 3, 2 , 3, 3
𝐵×𝐵 = 𝑟, 𝑟 , 𝑟, 𝑠 , 𝑠, 𝑟 , 𝑠, 𝑠
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Relations
Let 𝐴 and 𝐵 be nonempty sets:
𝑎 is related to 𝑏 by 𝑅 is written as 𝑎 𝑅 𝑏
where 𝑅 ⊆ 𝐴 × 𝐵 and (𝑎, 𝑏) ∈ 𝑅
𝑎 is NOT related to 𝑏 by 𝑅 is written as 𝑎 𝑅 𝑏
where 𝑅 ⊆ 𝐴 × 𝐵 and (𝑎, 𝑏) ∉ 𝑅
𝑅 is a relation on 𝐴 if 𝑅 ⊆ 𝐴 × 𝐴
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Therefore,
𝑅= 1, 2 , 1, 3 , 2, 3
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Therefore,
𝑅 = 1, 1 , 1, 2 , 1, 3 , 1, 4 , 1, 5 , 2, 2 , 2, 4 , 3, 3 , 4, 4 , 5, 5
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
𝐷𝑜𝑚𝑎𝑖𝑛(𝑅) =
𝑅𝑎𝑛𝑔𝑒(𝑅) =
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
𝐷𝑜𝑚𝑎𝑖𝑛(𝑅) = 1, 2
𝑅𝑎𝑛𝑔𝑒(𝑅) = 2, 3
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Matrix of Relations
Let 𝐴 = 𝑎1 , 𝑎2 , … , 𝑎𝑚 ,
𝐵 = 𝑏1 , 𝑏2 , … , 𝑏𝑛 and
𝑅 ⊆ 𝐴 × 𝐵 be a relation.
The matrix 𝐌𝑅 is called the matrix of 𝑅 of 𝑚 × 𝑛 dimension
where 𝐌𝑅 = [𝑚𝑖𝑗 ] is defined by
1, 𝑎𝑖 , 𝑏𝑗 ∈ 𝑅
𝑚𝑖𝑗 = ቐ
0, 𝑎𝑖 , 𝑏𝑗 ∉ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Example: digraph
Let 𝑅 = 1,1 , 1,2 , 2,1 , 2,2 , 2,3 , 2,4 , 3,4 , 4,1
is a relation on set 𝐴 = 1, 2, 3, 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Example: digraph
Let 𝑅 = 1,1 , 1,2 , 2,1 , 2,2 , 2,3 , 2,4 , 3,4 , 4,1
is a relation on set 𝐴 = 1, 2, 3, 4
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Example: digraph
1 3
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Example: digraph
1 3
Therefore 𝑅 = 1, 1 , 1, 3 , 2, 3 , 3, 2 , 3, 3 , 4, 3
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 3
Vertices 1 2 3 4 Total
In-degree
Out-degree
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 3
Vertices 1 2 3 4 Total
In-degree 1 1 4 0
Out-degree
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 3
Vertices 1 2 3 4 Total
In-degree 1 1 4 0
Out-degree 2 1 2 1
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 3
Vertices 1 2 3 4 Total
In-degree 1 1 4 0 6
Out-degree 2 1 2 1 6
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Paths in Relations
Definition
Suppose that 𝑅 is a relation on a set 𝐴.
A path of length 𝑛 in 𝑅 from 𝑎 to 𝑏 is a finite
sequence
𝜋 ∶ 𝑎, 𝑥1 , 𝑥2 , … , 𝑥𝑛−1 , 𝑏
beginning with 𝑎 and ending with 𝑏, such that
𝑎 𝑅 𝑥1 , 𝑥1 𝑅 𝑥2 , …, 𝑥𝑛−1 𝑅 𝑏.
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Paths in Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Paths in Relations
Definition
If 𝑛 is a fixed𝑛 number, we define a relation 𝑅𝑛 as
follows: 𝑥 𝑅 𝑦 means that there is a path of length 𝑛
from 𝑥 to 𝑦
Definition
∞
A relation 𝑅 (connectivity relation for 𝑅) on 𝐴 by
letting 𝑥 𝑅∞ 𝑦 mean that there is some path from 𝑥 to
𝑦
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
𝑛 Path 𝑅𝑛
2 1, 1 : 1,2,1 1,1 , 1,3 , 1,4 , 2,1 , 2,2 , 2,3 , 4,2
1, 3 : 1,2,3
1, 4 : 1,2,4
2, 1 : 2,4,1
2, 2 : 2,1,2
2, 3 : 2,4,3
4, 2 : 4,1,2
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
𝑛 Path 𝑅𝑛
3 1, 1 : 1,2,4,1 1,1 , 1,2 , 1,3 , 2,1 , 2,2 , 2, 3 , 2, 4 ,
1, 2 : 1,2,1,2 4,1 , 4,3 , 4,4
1, 3 : 1,2,4,3
2, 1 : 2,1,2,1
2, 2 : 2,4,1,2
2, 3 : 2,1,2,3
2, 4 : 2,1,2,4
4, 1 : 4,1,2,1
4, 3 : 4,1,2,3
4, 4 : 4,1,2,4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Properties of Relations
Reflexive A relation 𝑅 on a set 𝐴 is reflexive if 𝑎, 𝑎 ∈ 𝑅 for all 𝑎 ∈ 𝐴
Irreflexive A relation 𝑅 on a set 𝐴 is irreflexive if 𝑎, 𝑎 ∉ 𝑅 for all 𝑎 ∈ 𝐴
Symmetric A relation 𝑅 on a set 𝐴 is symmetric if whenever 𝑎, 𝑏 ∈ 𝑅, then
𝑏, 𝑎 ∈ 𝑅
Asymmetric A relation 𝑅 on a set 𝐴 is asymmetric if whenever 𝑎, 𝑏 ∈ 𝑅, then
𝑏, 𝑎 ∉ 𝑅
Anti- A relation 𝑅 on a set 𝐴 is antisymmetric if whenever 𝑎, 𝑏 ∈ 𝑅
symmetric and 𝑏, 𝑎 ∈ 𝑅, then 𝑎 = 𝑏. 𝑎, 𝑏 ∈ 𝑅 ∧ 𝑏, 𝑎 ∈ 𝑅 ⟶ 𝑎 = 𝑏
Transitive A relation 𝑅 on a set 𝐴 is transitive if whenever 𝑎, 𝑏 ∈ 𝑅 and 𝑏, 𝑐 ∈
𝑅, then 𝑎, 𝑐 ∈ 𝑅. 𝑎, 𝑏 ∈ 𝑅 ∧ 𝑏, 𝑐 ∈ 𝑅 ⟶ 𝑎, 𝑐 ∈ 𝑅
Equivalence Reflexive, Symmetric and Transitive
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2 NOT Reflexive
because 4,4 ∉ 𝑅
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Irreflexive:
A relation 𝑅 on a set 𝐴 is irreflexive if 𝑎, 𝑎 ∉ 𝑅 for all 𝑎 ∈ 𝐴
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Irreflexive:
A relation 𝑅 on a set 𝐴 is irreflexive if 𝑎, 𝑎 ∉ 𝑅 for all 𝑎 ∈ 𝐴
1 2 NOT Irreflexive
because 1, 1 ∈ 𝑅, 2, 2 ∈ 𝑅 and 3, 3 ∈ 𝑅
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Symmetric:
A relation 𝑅 on a set 𝐴 is symmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∈ 𝑅
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Symmetric:
A relation 𝑅 on a set 𝐴 is symmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∈ 𝑅
1 2 NOT Symmetric
because 1, 3 ∈ 𝑅 but 3, 1 ∉ 𝑅
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Asymmetric:
A relation 𝑅 on a set 𝐴 is asymmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∉ 𝑅
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Asymmetric:
A relation 𝑅 on a set 𝐴 is asymmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∉ 𝑅
1 2
NOT Asymmetric
because 1, 2 ∈ 𝑅, and 2, 1 ∈ 𝑅
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟏, 𝟏 ∈ 𝑹 ∧ 𝟏, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟏
1 2 𝑎 = 1 and
𝑏 = 1. 𝑇 ∧ 𝑇 ⟶ 𝑇
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟏, 𝟏 ∈ 𝑹 ∧ 𝟏, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟏
1 2 𝑎 = 1 and
𝑏 = 1. 𝑇 ∧ 𝑇 ⟶ 𝑇
Consider
𝟏, 𝟐 ∈ 𝑹 ∧ 𝟐, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟐
3 4 𝑎 = 1 and
𝑏 = 2. 𝑇 ∧ 𝑇 ⟶ 𝐹
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟏, 𝟏 ∈ 𝑹 ∧ 𝟏, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟏
1 2 𝑎 = 1 and
𝑏 = 1. 𝑇 ∧ 𝑇 ⟶ 𝑇
Consider
𝟏, 𝟐 ∈ 𝑹 ∧ 𝟐, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟐
3 4 𝑎 = 1 and
𝑏 = 2. 𝑇 ∧ 𝑇 ⟶ 𝐹
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟐, 𝟏 ∈ 𝑹 ∧ 𝟏, 𝟑 ∈ 𝑹 ⟶ 𝟐, 𝟑 ∈ 𝑹
1 2 𝑎 = 2,
𝑏 = 1 and 𝑇 ∧ 𝑇 ⟶ 𝐹
𝑐 = 3.
3 4 NOT Transitive
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2 NOT Reflexive
NOT Symmetric NOT Equivalence
3 4 NOT Transitive
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
1 2
3 4
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Reflexive
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Irreflexive:
A relation 𝑅 on a set 𝐴 is irreflexive if 𝑎, 𝑎 ∉ 𝑅 for all 𝑎 ∈ 𝐴
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Irreflexive:
A relation 𝑅 on a set 𝐴 is irreflexive if 𝑎, 𝑎 ∉ 𝑅 for all 𝑎 ∈ 𝐴
NOT Irreflexive
Because ALL 1,1 ∈ 𝑅, 2,2 ∈ 𝑅,
3,3 ∈ 𝑅 and 4,4 ∈ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Symmetric:
A relation 𝑅 on a set 𝐴 is symmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∈ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Symmetric:
A relation 𝑅 on a set 𝐴 is symmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∈ 𝑅
Symmetric
because
1, 2 ∈ 𝑅 and 2, 1 ∈ 𝑅
1, 3 ∈ 𝑅 and 3, 1 ∈ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Asymmetric:
A relation 𝑅 on a set 𝐴 is asymmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∉ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Definition of Asymmetric:
A relation 𝑅 on a set 𝐴 is asymmetric if whenever
𝑎, 𝑏 ∈ 𝑅, then 𝑏, 𝑎 ∉ 𝑅
NOT Asymmetric
because 1, 2 ∈ 𝑅, and 2, 1 ∈ 𝑅
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟏, 𝟐 ∈ 𝑹 ∧ 𝟐, 𝟏 ∈ 𝑹 ⟶ 𝟏 = 𝟐
𝑎 = 1 and
𝑏 = 2. 𝑇 ∧ 𝑇 ⟶ 𝐹
NOT Anti-symmetric
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Consider
𝟐, 𝟏 ∈ 𝑹 ∧ 𝟏, 𝟑 ∈ 𝑹 ⟶ 𝟐, 𝟑 ∈ 𝑹
𝑎 = 2,
𝑏 = 1 and 𝑇 ∧ 𝑇 ⟶ 𝐹
𝑐 = 3.
Not Transitive
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
hyaacob@iium.edu.my
CSCI1303 - Mathematics for Computing I Relations
Reflexive
Symmetric Not Equivalence
NotTransitive
hyaacob@iium.edu.my