You are on page 1of 9

# Relations

## Dr. Khair Eddin

Sabri
Relations
Dr. Khair Eddin Sabri
Department of Computer Science, University of Jordan
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Introduction)
Let A and B be sets. A binary relation from A to B is
a subset of A B.
Relations are a generalization of functions.
A relation on the set A is a relation from A to A.
Example, Let A be the set {1, 2, 3, 4}. Which ordered
pairs are in the relation R = {(a, b)|a divides b}?
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Properties of relations)
Reexive: A relation R on a set A is called reexive if
(a, a) R for every element a A.
Symmetric: A relation R on a set A is called symmetric
if (b, a) R whenever (a, b) R, for all a, b A.
Antisymmetric: A relation R on a set A such that for
all a, b A, if (a, b) R and (b, a) R, then a = b is
called antisymmetric.
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.
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Operations on relations)
Identity relation
Complement of a relation
R
1
R
1
R
2
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Operations on relations)
R
1
R
2
R
1
R
2
R
1
R
2
R
n
, note a relation is transitive if R
n
R for
n = 1, 2, 3
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(n-ary relations)
Let A
1
, A
2
, , An be sets. An n-ary relation on these
sets is a subset of A
1
A
2
A
n
.
The sets A
1
, A
2
, , A
n
are called the domains of the
relation
n is called its degree
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Representation of relations)
Zero-one matrix
Directed graph
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Closure of a relation)
Reexive closure
Symmetric closure
Transitive closure
Dr. Khair Eddin Sabri Relations
Relations
Dr. Khair Eddin
Sabri
(Equivalence Relations)
A relation on a set A is called equivalence relation if it
is reexive, symmetric, and transitive.
Example: Let R be the relation on the set of integers
such that a R b if and only if a = b or a = b.
Dr. Khair Eddin Sabri Relations