L04 - Relation
L04 - Relation
COLLEGE OF ICT
IS 143
Discrete Structure
Lecture 4
Instructor
Dr. Joseph Cosmas
Kijitonyama Campus
Block A,
Room No. A023
[email protected]
Content
Introduction to Course
Proof Techniques
Discrete Probability
Relations
Relations & their properties
Definition 1
0
R a b
a
1 0 X X
1 X
b
2 2 X
Relations (cont.)
Relations on a set
Definition 2
A relation on the set A is a relation from A to A.
Definition 3
Solution:
R2 & R3: symmetric each case (b, a) belongs to the relation
whenever (a, b) does.
For R2: only thing to check that both (1,2) & (2,1) belong to the relation
For R3: it is necessary to check that both (1,2) & (2,1) belong to the
relation.
None of the other relations is symmetric: find a pair (a, b) so that it is in
the relation but (b, a) is not.
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)}
11
Relations (cont.)
Solution (cont.):
R4, R5 and R6: antisymmetric for each of these
relations there is no pair of elements a and b with
a b such that both (a, b) and (b, a) belong to the relation.
None of the other relations is antisymmetric.: find a pair (a,
b) with a b so that (a, b) and (b, a) are both in the
relation.
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), (3,4), (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)}
Relations (cont.)
Definition 5:
TABLE A: Students
Definition 2:
The projection Pi1 ,i2 ,...,im maps the n-tuple (a1,a2, …, an) to
the m-tuple ( ai1 , ai2 ,..., aim ) where m n.
Solution: When the projection P1,4 is used, the second and third columns
of the table are deleted, and pairs representing student names and GPA
are obtained. Table B displays the results of this projection.
Students GPA
Names
Smith 3.9
TABLE B: Stevens 4.0
GPAs Rao 3.5
Adams 3.0
Lee 3.7
N-ary Relations & their Applications (cont.)
Definition 4:
1 1 0
M R 1 1 1 .
0 1 1
Solution:
- Since all the diagonal elements of this matrix are equal
to 1, then R is reflexive.
- Since the two side of diagonal reflect each other then R
is Symmetric
- Since MR is symmetric, R is not antisymmetric.
Representing Relations
Relations can also represented using diagraphs
Definition 1:
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.
Representing Relations
Example:The directed graph with vertices a, b, c and d , and
edges (a,b), (a,d), (b,b), (b,d), (c,a) and (d,b). The edge (b,b) is
called a loop.
a b
d c
Equivalence Relations
Equivalence classes
Definition 1:
Solution:
The equivalence class of 0 contains all the integers a
such that a 0 (mod 4). Hence, the equivalence class of
0 for this relation is
[0] = {…, -8, -4, 0, 4, 8, …}
Theorem 1:
The pairs (1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2) and
(3,3) R A1 = [1,2,3} is an equivalence class. The pairs
(4,4), (4,5), (5,4) and (5,5) R A2 = {4,5} is an
equivalence class. The pair (6,6) R {6} is an equivalence
class.
1 1 0
(c) M R 1 1 1 .
0 1 1
1 1 0
(d) M R 1 1 0 .
0 1 1
Examples
Determine whether the relation whose digraph is
given below is an equivalence relation.
Let A = {1, 2, 3} and R = {(1, 1), (1, 4), (4, 1), (4, 4), (2,
2), (2, 3), (3, 2), (3, 3)}. Write the Matrix of R and
sketch its graph. Determine whether R is equivalence.