DEFINITION OF A RELATION
RELATIONS
Let A and B be non-empty sets.
A relation R from A and B is a
subset of A x B.
A relation is a relationship
between two sets.
A x B = {(a,b) | a A b B}
R AxB
1
EXAMPLE I
RELATION
If (a,b) R, we say that a is
related to b.
aRb
Otherwise
a NR b
3
X = {0,1,2} and Y = {a,b}
X x Y = {(0,a), (0,b), (1,a), (1,b),
(2,a), (2,b)}
R = {(1,a), (1,b), (2,a), (2,b)}
1 R a, 2 R a
0 NR a, 0 NR b
Is a R 1 true?
EXAMPLE II
EXAMPLE III
X = {2,3,4}
Y = {3,4,5,6,7}
Define a relation R from X to Y
such that
(x,y) R if x divides y
R = {(2,4),(2,6),(3,3),(3,6),(4,4)}
A = {1,2,3,4,}
B = {1,3,4,5}
Define a relation (a R b) R on A
such that a < b.
R = {(1,3), (1,4), (1,5), (2,3), (2,4),
(2,5), (3,4), (3,5), (4,5)}
Domain = {1,2,3,4} Range = {3,4,5}
Domain = {2,3,4}
Range = {3,4,6}
Relations on a Set I
Domain and Range
Domain of R
{x X | (x,y) R for some y Y}
A relation on the set A is a
relation from A to A.
Range of R
{y Y | (x,y) R for some x X}
7
Relations on a Set II
Relations on a Set III
How many possible relations are
there on a set with 1 element?
A = {1}
A x A = {(1,1)}
R = {{ }}
R = {(1,1)}
How many possible relations are
there on a set with 2 elements?
A = {1,2}
A x A = {(1,1),(1,2),(2,1),(2,2)}
10
Relations on a Set IV
Relations on a Set III
{ }, {(1,1)}, {(1,2)}, {(2,1)}, {(2,2)},
{(1,1),(1,2)}, {(1,1),(2,1)}, {(1,1),(2,2)},
{(1,2),(2,1)}, {(1,2),(2,2)}, {(2,1),(2,2)},
{(1,1),(1,2),(2,1)}, {(1,1),(1,2),(2,2)},
{(1,1),(2,1),(2,2)}, {(1,2),(2,1),(2,2)},
{(1,1),(1,2),(2,1),(2,2)}
11
How many relations are there on
a set with 3 elements?
512
How many relations are there on
a set with n elements?
12
Properties of relations I
Examples of reflexive relations
A relation R on a set A is called
reflexive if (a,a) R for every
element a A.
a (a,a) R
13
Examples of reflexive relations
Consider these relations
R1 = {(a,b) | a b}
R2 = {(a,b) | a > b}
R3 = {(a,b) | a = b or a = -b}
R4 = {(a,b) | a = b}
R5 = {(a,b) | a = b + 1}
R6 = {(a,b) | a + b 3}
Which of these are reflexive?
Consider the following relations on {1,2,3,4}
R1 = {(1,1),(1,2),(2,1),(2,2),(4,4)}
R2 = {(1,1),(2,2),(3,3),(1,2),(2,1)}
R3 = {(1,1),(2,2),(3,3),(4,4)}
R4 = {(1,1),(2,2),(3,3),(4,4),(4,3)}
R5 = {(1,1),(2,1),(3,1),(4,1)}
R6 = {(3,4)}
Which of these are reflexive?
14
Examples of reflexive relations
Is the divides relation on the
set of integers reflexive?
Is the divides relation on the
set of positive integers
reflexive?
15
16
Properties of relations II
Properties of relations III
A relation R on a set A is called
symmetric if (b,a) R whenever
(a,b) R,
for all a A and b A.
A relation R on a set A is called
antisymmetric
if (a,b) R and (b,a) R,
then a = b,
for all a A and b A.
b (a,b) R
(b,a) R
a b (a,b) R
(b,a) R a = b
17
18
Symmetric relations
Symmetric and Antisymmetric
The terms symmetric and
antisymmetric are not opposites.
A relation can have both of these
properties or may lack both of
them.
19
Consider the following relations on {1,2,3,4}
R1 = {(1,1),(1,2),(2,1),(2,2),(2,4)}
R2 = {(1,1),(2,2),(3,3),(1,2),(2,1)}
R3 = {(1,1),(2,2),(3,3),(4,4)}
R4 = {(1,1),(2,2),(3,3),(4,4),(4,3)}
R5 = {(1,1),(2,1),(3,1),(4,1)}
R6 = {(3,4)}
Which of these are symmetric?
20
Symmetric relations
Antisymmetric relations
The relations R2 and R3 are symmetric,
because in each case (b,a) belongs to the
relation whenever (a,b) does.
For R2, check that both (2,1) and (1,2) are in
the relation.
For R3, check that (2,1) and (1,2) and (1,4)
and (4,1) are in the relation.
Verify that none of the other relations is
symmetric by finding a pair (a,b) such that it
is in the relation but (b,a) is not.
21
Antisymmetric relations
Consider the following relations on {1,2,3,4}
R1 = {(1,1),(1,2),(2,1),(2,2),(4,4)}
R2 = {(1,1),(2,2),(3,3),(1,2),(2,1)}
R3 = {(1,1),(2,2),(3,3),(4,4)}
R4 = {(1,1),(2,2),(3,3),(4,4),(4,3)}
R5 = {(1,1),(2,1),(3,1),(4,1)}
R6 = {(3,4)}
Which of these are antisymmetric?
22
Antisymmetric relations
R3, R4, R5 and R6 are antisymmetric.
For each of these relations, there is no pair
of elements a and b with a b such that
(a,b) and (b,a) are both in the relation.
Verify that none of the other relations is
antisymmetric. This is done by finding a
pair (a,b) with a b such that (a,b) and (b,a)
are both in the relation.
A relation R on a set X is
called antisymmetric
if for all x,y X, if(x,y) R and
x y, then (y,x) R
23
24
Symmetric and Antisymmetric
Consider these relations
R1 = {(a,b) | a b}
R2 = {(a,b) | a > b}
R3 = {(a,b) | a = b or a = -b}
R4 = {(a,b) | a = b}
R5 = {(a,b) | a = b + 1}
R6 = {(a,b) | a + b 3}
Which of these are (anti)symmetric?
Symmetric and Antisymmetric
Is the divides relation on the
set of integers symmetric?
Is the divides relation on the
set of integers
antisymmetric?
25
Properties of relations IV
26
Transitive Relations
Consider the following relations on {1,2,3,4}
A relation R on a set X is
called transitive if whenever
(a,b) R and (b,c) R, then
(a,c) R, for all a,b,c A.
a b c((a,b) R
(b,c) R (a,c) R
27
R1 = {(1,1),(1,2),(2,1),(2,2),(3,4),(4,1)}
R2 = {(1,1),(1,2),(2,1)}
R3 = {(1,1),(1,2),(1,4),(2,4),(4,1)}
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)}
Which of these are transitive?
28
Transitive Relations
Transitive Relations
R4, R5 and R6 are transitive.
Verify that if (a,b) and (b,c) belong to this relation,
then (a,c) also does.
R4 is transitive because (3,2) and (2,1), (4,2) and
(2,1), (4,3) and (3,1), and (4,3) and (3,2) are only such
sets of pairs, and (3,1), (4,1), and (4,2) belong to R4.
Verify that R5 and R6 are transitive.
R1 is not transitive because (3,4) and (4,1) belong to
R1 but (3,1) does not. (2,1) and (1,2) belong to R2 but
(2,2) does not. (4,1) and (1,2) belong to R3 but (4,2)
does not.
Consider these relations
R1 = {(a,b) | a b}
R2 = {(a,b) | a > b}
R3 = {(a,b) | a = b or a = -b}
R4 = {(a,b) | a = b}
R5 = {(a,b) | a = b + 1}
R6 = {(a,b) | a + b 3}
Which of these are transitive?
29
Combining Relations
30
Combining Relations
Let A = {1,2,3} and B = {1,2,3,4}
R1={(1,1),(2,2),(3,3)}
R2={(1,1),(1,2),(1,3),(1,4)}
R1 U R2 = {
}
R1 R2 = {
}
R1 R2 = {
}
R2 R1 = {
}
R1 U R2 = {(1,1), (1,2), (1,3),
(1,4), (2,2), (3,3)}
R1 R2 = {(1,1)}
R1 R2 = {(2,2),(3,3)}
R2 R1 = {(1,2),(1,3),(1,4)}
31
32
Composite Relations
Composite Relations
X is the relation from {1,2,3} to
{1,2,3,4} Assume:
X = {(1,1), (1,4), (2,3), (3,1), (3,4)}
X = {(1,1), (1,4), (2,3), (3,1), (3,4)}
Y = {(1,0), (2,0), (3,1), (3,2), (4,1)}
Y is the relation from {1,2,3,4} to
{0,1,2} Assume:
Y = {(1,0), (2,0), (3,1), (3,2), (4,1)}?
XoY = {(1,0), (1,1), (2,1),
(2,2), (3,0), (3,1)}
33
34
Composite Relations
Let P be a relation from set A to set B.
And Q be a relation from B to set C.
The composite of P and Q is the relation
consisting of ordered pairs (a,c), where a
A, c C, and for which there exists an
element b (b B) such that (a,b) P and
(b,c) Q.
We denote the composite of P and Q by
PoQ.
35
Inverse of a relation
Representing relations using
matrices
Representing relations using
directed graphs
Closures of relations
36