MTK3013 Chapter8 Relation Latest
MTK3013 Chapter8 Relation Latest
my
RELATIONS
MTK3013
DISCRETE MATHMATICS
http://fskik.upsi.edu.my
Relations
If we want to describe a relationship between elements of
two sets A and B, we can use ordered pairs with their first
element taken from A and their second element taken
from B.
Since this is a relation between two sets, it is called a
binary relation.
Definition: Let A and B be sets. A binary relation from A to
B is a subset of AB.
In other words, for a binary relation R we have
R AB. We use the notation aRb to denote that (a, b)R
and aRb to denote that (a, b)R.
http://fskik.upsi.edu.my
Relations
When (a, b) belongs to R, a is said to be related to b by R.
Example: Let P be a set of people, C be a set of cars, and D
be the relation describing which person drives which car(s).
P = {Carl, Suzanne, Peter, Carla},
C = {Mercedes, BMW, tricycle}
D = {(Carl, Mercedes), (Suzanne, Mercedes),
(Suzanne, BMW), (Peter, tricycle)}
This means that Carl drives a Mercedes, Suzanne drives a
Mercedes and a BMW, Peter drives a tricycle, and Carla
does not drive any of these vehicles.
http://fskik.upsi.edu.my
Functions as Relations
You might remember that a function f from a set A to a set
B assigns a unique element of B to each element of A.
The graph of f is the set of ordered pairs (a, b) such that b =
f(a).
Since the graph of f is a subset of AB, it is a relation from
A to B.
Moreover, for each element a of A, there is exactly one
ordered pair in the graph that has a as its first element.
http://fskik.upsi.edu.my
Functions as Relations
Relations on a Set
Relations on a Set
(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)}
Solution: R = {
1 1
R 1 2 3 4
X X X
2 2
1
X X
2
3 3
X
3
4 4 4
http://fskik.upsi.edu.my
Relations on a Set
How many different relations can we define on a set A
with n elements?
A relation on a set A is a subset of AA.
How many elements are in AA ?
There are n2 elements in AA, so how many subsets (=
relations on A) does AA have?
The number of subsets that we can form out of a set with
2
m elements is 2m. Therefore, 2n subsets can be formed
out of AA.
n 2
Answer: We can define 2 different relations
on A.
http://fskik.upsi.edu.my
Relations on a Set
Relations on a Set
(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)}
Solution: R = {
1 1
R 1 2 3 4
X X X
2 2
1
X X
2
3 3
X
3
4 4 4
http://fskik.upsi.edu.my
Relations on a Set
How many different relations can we define on a set A
with n elements?
A relation on a set A is a subset of AA.
How many elements are in AA ?
There are n2 elements in AA, so how many subsets (=
relations on A) does AA have?
The number of subsets that we can form out of a set with
2
m elements is 2m. Therefore, 2n subsets can be formed
out of AA.
n 2
Answer: We can define 2 different relations
on A.
http://fskik.upsi.edu.my
Relations on a Set
How many different relations can we define on a set A
with n elements?
A relation on a set A is a subset of AA.
How many elements are in AA ?
There are n2 elements in AA, so how many subsets (=
relations on A) does AA have?
The number of subsets that we can form out of a set with
m n 2
m elements is 2 . Therefore, 2 subsets can be formed
out of AA.
2
Answer: We can define 2n different relations
on A.
http://fskik.upsi.edu.my
Properties of Relations
We will now look at some useful ways to classify relations.
Definition: A relation R on a set A is called reflexive if (a,
a)R for every element aA.
Are the following relations on {1, 2, 3, 4} reflexive?
R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)} No.
R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)} Yes.
Properties of Relations
Definitions:
A relation R on a set A is called symmetric if (b, a)R
whenever (a, b)R for all a, bA.
A relation R on a set A is called antisymmetric if
a = b whenever (a, b)R and (b, a)R.
A relation R on a set A is called asymmetric if
(a, b)R implies that (b, a)R for all a, bA.
http://fskik.upsi.edu.my
Properties of Relations
Definition: A relation R on a set A is called transitive if
whenever (a, b)R and (b, c)R, then (a, c)R for a, b,
cA.
Are the following relations on {1, 2, 3, 4}
transitive?
R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)} Yes.
Counting Relations
Example: How many different reflexive relations can be
defined on a set A containing n elements?
Solution: Relations on R are subsets of AA, which contains
n2 elements.
Therefore, different relations on A can be generated by
choosing different subsets out of these n2 elements, so
2
there are 2n relations.
A reflexive relation, however, must contain the n elements
(a, a) for every aA.
Consequently, we can only choose among n2 – n =
n(n – 1) elements to generate reflexive relations, so there
are 2n(n – 1) of them.
http://fskik.upsi.edu.my
Combining Relations
Relations are sets, and therefore, we can apply the usual
set operations to them.
If we have two relations R1 and R2, and both of them are
from a set A to a set B, then we can combine them to R1
R2, R1 R2, or R1 – R2.
In each case, the result will be another relation from A to
B.
http://fskik.upsi.edu.my
Representing Relations
What do we know about the matrices representing a
relation on a set (a relation from A to A) ?
They are square matrices.
What do we know about matrices representing reflexive
relations?
All the elements on the diagonal of such matrices Mref
must be 1s.
1
1
.
M ref
.
.
1
http://fskik.upsi.edu.my
Representing Relations
What do we know about the matrices representing
symmetric relations?
These matrices are symmetric, that is, MR = (MR)t.
1 0 1 1 1 1 0 0
0 1 0 0 1 1 0 0
MR MR
1 0 0 1 1 1 0 0
1 0 1 1 1 1 0 0
symmetric matrix, non-symmetric matrix,
symmetric relation. non-symmetric relation.
http://fskik.upsi.edu.my
Representing Relations
The Boolean operations join and meet (you remember?)
can be used to determine the matrices representing the
union and the intersection of two relations, respectively.
Representing Relations
Example: Let the relations R and S be represented by the
matrices
1 0 1 1 0 1
M R 1 0 0 M S 0 1 1
0 1 0 1 0 0
What are the matrices representing R˅S and R˄S?
Solution: These matrices are given by
1 0 1 1 0 1
M RS M R M S 1 1 1 M RS M R M S 0 0 0
1 1 0 0 0 0
http://fskik.upsi.edu.my
MB A = MAoMB
0 1 1
M R2 M R 1 1 1
[ 2]
0 1 0