Title: Representing Relations
1Representing Relations
2Using Matrices
- For finite sets we can use zero-one matrices.
Elements of each set A and B must be listed in
some particular (but arbitrary) order. When AB
we use the same ordering for A and B. - mij 1 if (ai,bj) ??R
- 0 if (ai,bj) ?R
3Example Zero-One Matrix
b1 b2 b3
a1 a2 a3
R (a1,b1), (a1,b2), (a2,b2), (a3,b2), (a3,b3)
4Matrix of a relation on a set, A
- Can be used to determine whether the relations
has certain properties. - Recall that R on A is reflexive if (a,a) ?R for
every element a? A.
Reflexive Not Reflexive
5A relation R on a set A
- is called Symmetric if (b,a) ?R whenever (a,b) ?R
for a,b ?A. MR (MR)t - Is antisymmetric (a,b) ?R and (b,a) ?R only if
ab for a,b ?A is antisymmetric. - If mij 1, i?j, mji 0
Symmetric Antisymmetric Neither
6Examples
Reflexive Symmetric
Reflexive Antisymmetric
7Let R1, R2 be relations on A
- A 1,2,3
- R1 (1,1), (1,3), (2,1), (3,3)
- R2 (1,1), (1,2), (1,3), (2,2), (2,3), (3,1)
8R1?R2, R1?R2
MR1?R2 MR1 ? MR2, MR1?R2 MR1 ? MR2
9What is R1 ? R2?
- The composite of R1 and R2 is the relation
consisting of ordered pairs (a,c) where a ? A, c
? A, and for which there exists an element b ? A
such that (a,b) ? R1 and (b,c) ? R2. - R1 ? R2 (1,1), (1,2), (1,3), (3,1), (2,1),
(2,2), (2,3)
10Boolean Product
- Let A aij be an m by k zero-one matrix and B
bij be a k by n zero-one matrix. Then the
Boolean Product of A and B denoted by A B is
the m by n matrix with i,j entry cij where - cij (ai1?b1j) ? (ai2 ? b2j) ?... ? (aik ? bkj).
11What is R1 ? R2?
- R1 ? R2 (1,1), (1,2), (1,3), (3,1), (2,1),
(2,2), (2,3) - MR1?R2 MR1 MR2
12Directed Graphs (Digraph)
- A directed graph consists of a set V of vertices
together with a set E of ordered pairs of
elements of V called edges. - (a,b), a is initial vertex, b is the terminal
vertex
Reflexive (Loops) Symmetric (Edges both ways)
b
a
c
13Relation R on a set A
R (a,b), (b,b), (b,c), (c,a),
(c,c) Transitive
b
a
c
14Relation R on a set A
R (a,a), (a,c), (b,b), (b,a), (b,c),
(c,c) Reflexive Antisymmetric
b
a
c