Download presentation
Presentation is loading. Please wait.
1
Agenda Lecture Content: Relations (Relasi)
Matrices of Relations (Matriks Relasi) Review Quiz Exercise
2
Relations
3
Relations Relations generalize the notion of function.
Function is a special type of Relation Relationships between elements of sets occur in many contexts. To express a relationship between elements of two sets: ordered pairs made up of two related elements binary relations. (Bogor, Jawa Barat), (Surabaya, Jawa Timur)
4
Relation: Definition Let A and B be sets. A binary relation from A to B is a subset of A B. Cartesian Product IF R : binary relation THEN a R b: (a, b) R a R b: (a, b) R Notation: domain: {a A | (a,b) R for some b B} range: {b B | (a,b) R for some a A}
5
Example A = {0, 1, 2} B = {a, b} Relation from a to b: {(0, a), (0, b), (1, a), (2, b)} 0 R a ? 0 R 2 ? 2 R a ?
6
Note: Function is a special type of Relation
Properties: The domain of the function f is equal to A For each a A, there is exactly one b B such that (a,b) f.
7
How to represent relation
R = {(0, a), (0, b), (1, a), (2, b)} Table A B 0 a 0 b 1 a 2 b
8
How to represent relation
Digraphs = Directed Graphs (chapter 8) A = {a, b, c, d}, R = {(a, b), (a, d), (b, b), (b, d), (c, a), (c, b), (d, b)}. a b d c
9
How to represent relation
1 A 2 3 4 B C D R A B C D 1 2 3 4 1 1 1 1 1 1
10
Relations on a Set A Relation on the set A is a relation from A to A a subset of A A A = {1, 2, 3, 4} Which pairs are belong to R = {(a, b) | a ≤ b} ? {(1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4), (2,2), (3,3),(4,4)}
11
Example Ordered pairs: (1, 1), (1, 2), (2, 1), (1, -1) and (2, 2)
R1 = {(a, b) | a ≤ b} R2 = {(a, b) | a > b} R3 = {(a, b) | a = b} R4 = {(a, b) | a = b or a = -b} R5 = {(a, b) | a = b + 1} R6 = {(a, b) | a + b ≤ 3}
12
Properties of Relations
Reflexive Symmetric Antisymmetric Transitive Composite
13
Reflexive A relation R on a set A is called reflexive if (a, a) R for every element a A. 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)}
14
Which one is reflexive? R1 = {(a, b) | a ≤ b} R2 = {(a, b) | a > b} R3 = {(a, b) | a = b} R4 = {(a, b) | a = b or a = -b} R5 = {(a, b) | a = b + 1} R6 = {(a, b) | a + b ≤ 3}
15
Symmetric and Antisymmetric
A relation R on a set A is called symmetric: if (a, b) R then (b, a) R. A relation R on a set A is called antisymmetric: if for all a, b R, IF (a, b) R AND a ≠ b THEN (b, a) R . (IF (a, b) R AND (b, a) R THEN a = b ) 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)}
16
Which one is symmetric, antisymmetric?
R1 = {(a, b) | a ≤ b} R2 = {(a, b) | a > b} R3 = {(a, b) | a = b} R4 = {(a, b) | a = b or a = -b} R5 = {(a, b) | a = b + 1} R6 = {(a, b) | a + b ≤ 3}
17
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 . 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)}
18
Which one is transitive?
R1 = {(a, b) | a ≤ b} R2 = {(a, b) | a > b} R3 = {(a, b) | a = b} R4 = {(a, b) | a = b or a = -b} R5 = {(a, b) | a = b + 1} R6 = {(a, b) | a + b ≤ 3}
19
S R = {(a,c) | (a,b) R and (b,c) S for some b B}
Composition Let R be a relation from a set A to a set B and S a relation from B to a set C. We denote the composition of R and S by S R. S R = {(a,c) | (a,b) R and (b,c) S for some b B} R is the relation from {1, 2, 3} to {1, 2, 3, 4} R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} S is the relation from {1, 2, 3, 4} to {0, 1, 2} S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)} S R ? S R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}
20
Digraph and Properties of Relations
Reflexive: there is a loop at every vertex. Symmetric: whenever there is a directed edge from x to y, there is also a directed edge from y to x. Antisymmetric: whenever there is a directed edge from x to y, and x ≠ y, then there is no directed edge from y to x. Transitive: whenever there are directed edges from x to y and from y to z, then there is also a directed graph from x to z.
21
Partial Orders Partial Orders is a relation R that is
reflexive, antisymmetric and transitive. Ex. R1 = {(a, b) | a ≤ b}
22
Equivalence Relations
A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive Ex. R = {(1,1), (1,3), (1,5), (2,2),(2,4),(3,1),(3,3), (3,5),(4,2),(4,4),(5,1),(5,3),(5,5)} R is an equivalence relation on {1,2,3,4,5}
23
Matrices of Relations
24
Matrices of Relations Alternative methods for representing relations: Zero – One matrices
25
Zero-One Matrices A = {a1, a2, …, an} B = {b1, b2, …, bn} R is a relation from A to B. R can be represented by the matrix MR = [mij] where mij = 1, if (ai,bj)R, and mij = 0, if (ai,bj)R.
26
Example A = {1, 2, 3} B = {1, 2} R = {(a, b) | a > b} R = {(2, 1), (3, 1), (3, 2)}
27
Example A = {a1, a2, a3 , a4} B = {b1, b2, b3 , b4} R ?
28
Zero-One Matrices Find Zero-One Matrices for: Reflexive Relation ?
Symmetric Relation ? Antisymmetric Relation ?
29
Antisymmetric Relation ?
Zero-One Matrices Reflexive Relation ? Symmetric Relation ? Antisymmetric Relation ?
30
Combining Relations A = {1, 2, 3} B = {1, 2, 3, 4}
R1 R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)} R1 R2 = {(1, 1)}
31
Combining Relations
32
Combining Relations
33
Review Quiz Exercise
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.