# Representing Relations Rosen 7.3. Using Matrices For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular.

## Presentation on theme: "Representing Relations Rosen 7.3. Using Matrices For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular."— Presentation transcript:

Representing Relations Rosen 7.3

Using 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 A=B we use the same ordering for A and B. m ij = 1 if (a i,b j )  R = 0 if (a i,b j )  R

Example Zero-One Matrix b1b2b3 a1 a2 a3 R = {(a1,b1), (a1,b2), (a2,b2), (a3,b2), (a3,b3)}

Matrix 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. ReflexiveNot Reflexive

A relation R on a set A is called Symmetric if (b,a)  R whenever (a,b)  R for a,b  A. M R = (M R ) t is Antisymmetric if (a,b)  R and (b,a)  R only if a=b for a,b  A is antisymmetric. –If m ij = 1, i  j, m ji = 0 SymmetricAntisymmetricNeither

Examples Reflexive Symmetric Reflexive Antisymmetric

Let 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)}

R1  R2, R1  R2 M R1  R2 = M R1  M R2, M R1  R2 = M R1  M R2

What is R2  R1? The composite of R 1 and R 2 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)  R 1 and (b,c)  R 2. R2  R1 = {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1)} R1 = {(1,1), (1,3), (2,1), (3,3)} R2 = {(1,1), (1,2), (1,3), (2,2), (2,3), (3,1)}

Boolean Product Let A = [a ij ] be an m by k zero-one matrix and B = [b ij ] 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 c ij where c ij = (a i1  b 1j )  (a i2  b 2j ) ...  (a ik  b kj ).

What is R2  R1? R2  R1 = {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1)} M R2  R1 =M R1 M R2

Directed 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 a b c Reflexive (Loops at all vertices) Symmetric (All edges both ways)

Relation R on a set A a b c R = {(a,b), (b,b), (b,c), (c,a), (c,c)} Transitive? No a b c R = {(a,b), (b,b), (b,c), (a,c), (c,c)} Transitive? Yes Rosen, pp. 493-494

Relation R on a set A a b c R = {(a,a), (a,c), (b,b), (b,a), (b,c), (c,c)} Reflexive Antisymmetric Transitive

Download ppt "Representing Relations Rosen 7.3. Using Matrices For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular."

Similar presentations