Study Guides for Discrete Mathematics
Section 6.3 - Representing Relations
Representing Relations Using Matrices
Let R Í A X B be a relation.
Further, let A = {a1, a2, …, aN} and B = {b1, b2, …, bN}
A matrix MR representing the relation R can be constructed as follows.
Let the iTH row of MR correspond to ai and let the jTH column of MR correspond to bj .
Then IF (ai, bj) Î R THEN the ijTH entry of MR is1 ELSE the ijTH entry of MR is 0.
Example: Find the matrix for the Relation R = {(1,2), (1,3), (1,4), (2,2), (2,3), (3,4)}
|
0 |
1 |
1 |
1 |
|
0 |
1 |
1 |
0 |
|
0 |
0 |
0 |
1 |
Numerous other examples are given in the text beginning on page 374.
Properties of Relations as characterized by matrix properties
Whenever a relation is defined on the crossproduct of a set and itself the associated matrix is a square matrix. This is always true when we refer to powers of a relation.
Recall the properties of relations that we studied earlier - reflexivity, symmetry, antisymmetry and transitivity. Most of these properties (or their absence) are easily observable in matrices of relations.
Reflexivity - A matrix of a relation is reflexive iff every entry on the main diagonal of the matrix is equal to1.
Symmetry - A matrix of a relation is symmetric iff the ijTH entry of the matrix equals the jiTH entry of the matrix.
Antisymmetry - A matrix of a relation is antisymmetric iff whenever the ijTH entry of the matrix equals 1 the jiTH entry of the matrix = 0.
Transitivity - A matrix of a relation is transitive iff whenever entry (I,J) = 1 and entry (J,L) = 1 then entry (I,L) = 1.
Operations on Matrices of Relations
The entries in the matrix of a relation R Í A X A are actually Boolean values written as 0 for false and 1 for true; indicating the absence or presence of elements of A X A. I.e. if the i,j entry of the matrix is 1 then (ai, ai) Î R else (ai, ai) Ï R.
Consequently, we would expect that operations on these matrices would correspond to Boolean operations. This is, in fact, the case. The Boolean operations meet (and) and join (or) may be defined on the matrices of relations just as the addition operation is defined on ordinary numeric matrices. (See pages 375 and 376 in the text).
Meet and Join
Briefly, if R and S are relations and MR = (aij) and MS = (bij) then
MR /\ MS = (aij /\ bij) and MR \/ MS = (aij \/ bij)
Composition
If R and S are relations then the matrix associated with S o R is denoted MSo R.
MSo R = MR o MS where o is the Boolean product. (Notice again the reversal of R and S)
The Boolean product of two matrices is computed just as one would compute the ordinary product of two matrices except that AND takes the place of multiplication and OR takes the place of addition. The obvious operation tables apply.
|
0 /\ 0 |
0 |
Ñ |
0 \/ 0 |
0 |
|
0 /\ 1 |
0 |
Ñ |
0 \/ 1 |
1 |
|
1 /\ 0 |
0 |
Ñ |
1 \/ 0 |
1 |
|
1 /\ 1 |
1 |
Ñ |
1 \/ 1 |
1 |
In order to explain how one actually computes MR o MS let us first define the iTH row of a matrix to be its iTH row vector and the jTH column of a matrix to be its jTH column vector.
Next, let us define the Boolean product of a row vector by a column vector.
If A = (a1, a2, … aN) is a row vector and B = (b1, b2, …bN) is a column vector (ideally the elements of B are written in a column) then A o B = ((a1/\ b1) \/ (a2/\ b2) \/… \/ (aN/\ bN))
Example: Compute the Boolean product of the following vectors.
Row vector A = (1, 0, 1). Column vector B = (0, 1, 1)
A o B = (1 /\ 0) \/ (0 /\ 1) \/ (1 /\1) = 0 \/ 0 \/ 1 = 1
Finally, we may define the IJTH entry of matrix MR o MS to be the Boolean product of the ITH row vector of MR with the JTH column vector of MS.
Example: Find the Boolean product of matrices A and B given below.
|
1 |
0 |
|
1 |
0 |
|
0 |
1 |
|
1 |
1 |
|
1/\0 \/ 0/\1 |
1/\1 \/ 0/\1 |
|
1/\0 \/ 0/\1 |
1/\1 \/ 0/\1 |
|
0 |
1 |
|
0 |
1 |
Representing Relations Using Digraphs
Relations may also be represented using digraphs. The transformation is quite straightforward.
Let R Í A X A and let G be a digraph representing R.
Then each vertex of G represents an element of A and (a,b) is an edge from node a of G to node B of G iff (a,b) Î R.
Example: Draw the digraph, G, of the matrix, M, given below.
Label the nodes of the graph A, B and C.
|
0 |
1 |
1 |
|
1 |
0 |
0 |
|
0 |
1 |
1 |
G
