CSC 125 - Discrete Math I, Spring 2017 Relations
Binary Relations Definition: A binary relation R from a set A to a set B is a subset of A B Note that a relation is more general than a function Example: Let A = {0, 1, 2} and B = {a, b} {(0, a), (0, b), (1, a), (2, b)} is a relation from A to B We can represent relations from a set A to a set B graphically or using a table
Binary Relation on a Set Definition: A binary relation R on a set A is a subset of A A or a relation from A to A Example: Let A = {a, b, c}, then R = {(a, a), (a, b), (a, c)} is a relation on A
Example Binary Relations Example: Consider these relations on the set of integers R 1 = {(a, b) a b} R 2 = {(a, b) a > b} R 3 = {(a, b) a = b a = b} R 4 = {(a, b) a = b} R 5 = {(a, b) a = b + 1} R 6 = {(a, b) a + b 3}
Reflexive Relations Definition: R is reflexive if and only if (a, a) R for every element a A Written symbolically, R is reflexive if and only if x((x, x) R) Examples: The following relations on the integers are reflexive: R 1 = {(a, b) a b} R 3 = {(a, b) a = b a = b} R 4 = {(a, b) a = b} The following relations are not reflexive: R 2 = {(a, b) a > b} (3 3) R 5 = {(a, b) a = b + 1} (3 3 + 1) R 6 = {(a, b) a + b 3} (4 + 4 3)
Symmetric Relations Definition: R is symmetric if and only if (b, a) R for all a, b A Written symbolically, R is symmetric if and only if x y((x, y) R (y, x) R) Examples: The following relations on the integers are symmetric: R 3 = {(a, b) a = b a = b} R 4 = {(a, b) a = b} R 6 = {(a, b) a + b 3} The following relations are not symmetric: R 1 = {(a, b) a b} (3 4 but 4 3) R 2 = {(a, b) a > b} (4 > 3 but 4 3) R 5 = {(a, b) a = b + 1} (4 = 3 + 1 but 3 4 + 1)
Antisymmetric Relations Definition: A relation R on set A is called antisymmetric if (a, b) R and (b, a) R, then a = b, for all a, b A Written symbolically, R is antisymmetric if and only if x y((x, y) R (y, x) R x = y) Examples: The following relations on the integers are antisymmetric: R 1 = {(a, b) a b} R 2 = {(a, b) a > b} R 4 = {(a, b) a = b} R 5 = {(a, b) a = b + 1} The following relations are not antisymmetric: R 3 = {(a, b) a = b a = b} (both (1, 1) and ( 1, 1) belong to R 3 ) R 6 = {(a, b) a + b 3} (both (1, 2) and (2, 1) belong to R 6
Transitive Relations Definition: 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 Written symbolically, R is transitive if and only if x y z((x, y) R (y, z) R (x, z) R) Examples: The following relations on the integers are transitive: R 1 = {(a, b) a b} R 2 = {(a, b) a > b} R 3 = {(a, b) a = b a = b} R 4 = {(a, b) a = b} The following relations are not transitive: R 5 = {(a, b) a = b + 1} (both (3,2) and (4,3) belong to R 5, but not (3,3)) R 6 = {(a, b) a + b 3} (both (2,1) and (1,2) belong to R 6, but not (2,2))
Combining Relations Given two relations R 1 and R 2, we can combine them using basic set operations to form new relations, such as R 1 R 2, R 1 R 2, R 1 R 2, and R 2 R 1 Example: Let A = {1, 2, 3} and B = {1, 2, 3, 4} and let R 1 = {(1, 1), (2, 2), (3, 3)} and R 2 = {(1, 1), (1, 2), (1, 3), (1, 4)} R 1 R 2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)} R 1 R 2 = {(1, 1)} R 1 R 2 = {(2, 2), (3, 3)} R 2 R 1 = {(1, 2), (1, 3), (1, 4)}
Composition Definition: Let R 1 be a relation from a set A to a set B and R 2 be a relation from B to a set C, then the composition (or composite) or R 1 with R 2, denoted by R 2 R 1, is a relation from A to C consisting of the ordered pairs (a, c) where a A and c C and there exists an element b B where such that (a, b) R 1 and (b, c) R 2.
Powers of a Relation Definition: Let R be a binary relation on A, then the powers R n, n = 1, 2,..., are defined recursively by: R 1 = R R n+1 = R n R
Representing Relations as Zero-One Matrices A relation R from finite sets A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n } can be represented by an m n zero-one matrix M R = [m ij ] where { 1 if (a i, b j ) R m i,j = 0 if (a i, b j ) R Note that we have induced an ordering on the elements in each set; the ordering is arbitrary but we need to be consistent
Representing Relations as Zero-One Matrices Example Let A = {a 1, a 2, a 3, a 4, a 5 } and B = {b 1, b 2, b 3 } and let R be a relation from A to B as follows: R = {(a 1, b 1 ), (a 1, b 2 ), (a 1, b 3 ), (a 2, b 1 ), (a 3, b 1 ), (a 3, b 2 ), (a 3, b 3 ), (a 5, b 1 )} The zero-one matrix representation is 1 1 1 1 0 0 M R = 1 1 1 0 0 0 1 0 0
Zero-One Matrix of a Relation on a Set Let R be a relation on a finite set A and let M R be the zero-one matrix representation of R R is reflexive if and only if the diagonal of M R is all ones R is symmetric if and only if M R is symmetric (M R = M T R ) R is antisymmetric if an only if the off-diagonal entries of M R + MR T are zero or one (but not two) R is transitive if and only if the support of MR 2 is a subset of the support of M R, where the support is the set of non-zero entries
Combining Relations with Zero-One Matrix Representations Let R 1 and R 2 be relations on a finite set A and let M R1 and M R2 be the respective zero-one matrix representations M R1 R 2 = M R1 M R2 = M R1 M R2 M R1 R 2 Let R be a relation from A to B and S be a relation from B to C and let M R and M S be the respective zero-one matrix representations M S R = M R M S
Equivalence Relations Definition: A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive Definition: Two elements a and b that are related by an equivalence relation are called equivalent, denoted as a b
Equivalence Relation Example Example: Suppose that R is a relation on the set of strings of English letters such that arb if and only if l(a) = l(b), where l is the length of the string To determine if R is an equivalence relation we need to show that all of the properties of an equivalence relation hold Reflexivity: Because l(a) = l(b), it follows that ara for all strings a Symmetry: Suppose that arb. Since l(a) = l(b), l(b) = l(a) also holds and bra Transitivity: Suppose that arb and brc. Since l(a) = l(b), and l(b) = l(c), l(a) = l(c) also holds and arc
Equivalence Classes Definition: Let R be an equivalence relation on a set A, then the set of all elements that are related to an element a of A is called the equivalence class of a, denoted by [a] R [a] R = {s (a, s) R} If b [a] R, then b is call a representative of this equivalence class
Equivalence Classes and Paritions Theorem 1: Let R be an equivalence relation on set A. The following statements for elements a and b of A are equivalent: arb [a] R = [b] R [a] R [b] R =
Partition of a Set Definition: A partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union In other words, the collection of subsets A i where i I forms a partition of S if and only if A i for i I, A i A j = when i j, and A i = S i I
An Equivalence Relation Partitions a Set Let R be an equivalence relation on a set A. The union of all the equivalence classes of R is all of A since an element of a of A is in its own equivalence class [a] R, in other words [a] R = A a A From Theorem 1, it follows that these equivalence classes are either equal or disjoint, so [a] R [b] R = when [a] R [b] R Therefore, the equivalence classes form a partition of A, because they split A into disjoint subsets
Partial Orderings Definition: A relation R on a set S is called a paritial ordering, or partial order, if it is reflexive, antisymmetric, and transitive A set together with a partial ordering R is called a partially ordered set, or poset, and is denoted by (S, R)
Partial Ordering Example Example: Show that the greater than or equal relation ( ) is a partial ordering on the set of integers Reflexivity: a a for every integer a Antisymmetry: If a b and b a, then a = b Transitivity: If a b and b c, the a c
Comparability Definition: The elements a and b of a poset (S, ) are comparable if either a b or b a. When a and b are elements of S such that neither a b nor b a, then a and b are called incomparable Definition: If (S, ) is a poset and every two elements of S are comparable, S is called a totally ordered or linearly ordered set, and is called a total order or a linear order
Lexicographic Order Definition: Given two posets (A 1, 1 ) and (A 2, 2 ), the lexicographic ordering on A 1 A 2 is defined by specifying that (a 1, a 2 ) is less than (b 1, b 2 ), that is (a 1, a 2 ) (b 1, b 2 ), either if a 1 1 b 1 or if a 1 = b 1 and a 2 2 b 2 This definition can be extended to a lexicographic ordering of strings