MATH 213 Chapter 9: Relations
Total Page:16
File Type:pdf, Size:1020Kb
MATH 213 Chapter 9: Relations Dr. Eric Bancroft Fall 2013 9.1 - Relations Definition 1 (Relation). Let A and B be sets. A binary relation from A to B is a subset R ⊆ A×B, i.e., R is a set of ordered pairs where the first element from each pair is from A and the second element is from B. If (a; b) 2 R then we write a R b or a ∼ b (read \a relates/is related to b [by R]"). If (a; b) 2= R, then we write a R6 b or a b. We can represent relations graphically or with a chart in addition to a set description. Example 1. A = f0; 1; 2g;B = f1; 2; 3g;R = f(1; 1); (2; 1); (2; 2)g Example 2. (a) \Parent" (b) 8x; y 2 Z; x R y () x2 + y2 = 8 (c) A = f0; 1; 2g;B = f1; 2; 3g; a R b () a + b ≥ 3 1 Note: All functions are relations, but not all relations are functions. Definition 2. If A is a set, then a relation on A is a relation from A to A. Example 3. How many relations are there on a set with. (a) two elements? (b) n elements? (c) 14 elements? Properties of Relations Definition 3 (Reflexive). A relation R on a set A is said to be reflexive if and only if a R a for all a 2 A. Definition 4 (Symmetric). A relation R on a set A is said to be symmetric if and only if a R b =) b R a for all a; b 2 A. Definition 5 (Anitsymmetric). A relation R on a set A is said to be antisymmetric if and only if a R b and b R a =) a = b for all a; b 2 A. 2 Definition 6 (Transitive). A relation R on a set A is said to be transitive if and only if a R b and b R c =) a R c for all a; b; c 2 A. Example 4. Determine whether the relation R on the set of all integers is reflexive, symmetric, antisymmetric, or transitive, where (a; b) 2 R if and only if (a) a 6= b (b) a ≥ b2 Example 5. Determine whether the relation R on the set of all web pages is reflexive, symmetric, antisymmetric, or transitive, where (a; b) 2 R if and only if (a) Everyone who has visited page a has also visited page b. (b) There are no common links found on both page a and page b Combining Relations We can combine two relations R1 and R2 from A to B using the following operations (these all come from set operations that we've discussed previously(: Intersection: R1 \ R2 = f(a; b) j (a; b) 2 R1 and (a; b) 2 R1g Union: R1 [ R2 = f(a; b) j (a; b) 2 R1 or (a; b) 2 R1g Difference: R1 − R2 = f(a; b) j (a; b) 2 R1 but (a; b) 2= R1g 1 Symmetric Difference: R1 ⊕ R2 = f(a; b) j (a; b) 2 R1 or (a; b) 2 R2 but (a; b) 2= R1 \ R2g 1In the portfolio problem I used ∆ to denote symmetric difference before I realized that this book uses ⊕ instead. 3 Definition 7 (Composition). If R1 is a relation from A to B and R2 is a relation from B to C, then we define R2 ◦ R1 = f(a; c) j a 2 A; c 2 C; and there exists b 2 B such that (a; b) 2 R1 and (b; c) 2 R2g Example 6. Let R1 and R2 be relations on Z where R1 = f(a; b) j ajbg and R2 = fg. Find the following: (a) R1 \ R2 (b) R1 [ R2 (c) R1 − R2 (d) R2 − R1 (e) R1 ◦ R2 (f) R1 ⊕ R2 4 Definition 8. Let R be a recursion on a set A. Then we define the powers of R as R1 = R Rn = Rn−1 ◦ R = R ◦ R ◦ · · · ◦ R; for n > 1 | {z } n copies of R Example 7. A = f1; 2; 3; 4; 5g;R = f(1; 1); (1; 2); (1; 3); (2; 3); (2; 4); (3; 1); (3; 4); (3; 5)g n Theorem 1. A relation R on a set A is transitive if and only if R ⊆ R for all n 2 Z+. 9.2 - n-ary Relations Definition 9 (n-ary Relation). Let A1;A2;:::;An be sets. An n-ary relation on these sets is a subset R ⊆ A1 × A2 × · · · × An. The sets A1;A2;:::;An are called the domains of the relation and n is the degree. Definition 10 (Selection Operator). Let R be an n-art relation and C a condition that elements in R may satisfy. The selection operator sC maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy the condition C. 5 Definition 11 (Projection). The projection Pi1;i2;:::;im , where i1 < i2 < ··· < im, maps the n-tuple (a1; a2; : : : ; an) to the m-tuple (ai1 ; ai2 ; : : : ; aim ) where m < n. Example 8. Let S = fStatesg, A = N, Z = fn 2 N j 0 < n < 10000g, and let R be the relation on S × F × Z where A represents average annual snowfall and Z represents ZIP codes. 9.3 - Representing Relations In addition to charts, sets, and graphs we can represent relations using: 1. A zero-one matrix MR = [mij], where ( 1 if (ai; bj) 2 R mij = 0 if (ai; bj) 2= R (This can be used for any relation from A to B.) 2.A digraph (or directed graph). Definition 12 (Digraph). A digraph consists of a set V of vertices or nodes together with a set E of ordered pairs of elements of V called edges or arcs. Given an edge (a; b), a is called the initial vertex of the edge and b is called the terminal vertex of the edge. An edge from a vertex to itself, (a; a), is call a loop. a b Example 9. d c Example 10. Draw the \divides" relation on the set f2, 3, 4, 5, 6, 7, 8, 9g both as a digraph and as a 0-1 matrix. 6 We can use digraphs and 0-1 matrices to identify whether or not a relation is reflexive, symmetric, antisymmetric, or transitive. Reflexive: Symmetric: Antisymmetric: Transitive: Theorem 2. Given relations R1, R2, and R on a set A with matrix representations MR1 , MR2 , and MR, respectively, then • MR1[R2 = MR1 _ MR2 • MR1\R2 = MR1 ^ MR2 • MR1◦R2 = MR2 MR1 [n] • MRn = MR 7 Example 11. Let R1 = f(1; 2); (2; 1); (2; 2); (3; 3)g and R2 = f(1; 1); (1; 2); (1; 3); (3; 2)g be binary relations on the set A = f1; 2; 3g. Find MR1 and MR2 and then use them to find MR1[R2 , MR1\R2 , and MR1◦R2 . Verify by computing R1 [ R2, R1 \ R2, and R1 ◦ R2 without matrices. 21 0 13 21 1 03 20 1 13 Example 12. Let MR = 40 0 15, MS = 40 0 05, MP = 40 0 15. Compute MRn , MSn , 1 1 0 1 1 1 0 0 0 MP n , to determine if the relations R, S, and P are transitive. 8 9.4 - Closures of Relations Definition 13 (Reflexive Closure). Let R be a relation on a set A. The reflexive closure of R is the smallest relation containing R that is reflexive. We denote the reflexive closure by R [ ∆ where ∆ = f(a; a) j a 2 Ag. Definition 14 (Symmetric Closure). Let R be a relation on a set A. The symmetric closure of R is the smallest relation containing R that is symmetric. We denote the reflexive closure by R [ R−1 where R−1 = f(b; a) j (a; b) 2 Rg. Example 13. Let R = f(1; 1); (1; 2); (2; 4); (3; 1); (4; 2)g be a relation on the set A = f1; 2; 3; 4g. Find the reflexive closure and symmetric closure of R. Definition 15. A path from a to b in a digraph G is a sequence of edges (x0; x1), (x1; x2), (x2; x3),. , (xn−1; xn) where n 2 N, a = x0, and b = xn. This path is denoted by x0; x1; : : : ; xn and has length n. An empty set of edges is viewed as a path of length 0 from a to a. A path of length n ≥ 1 that begins and ends at the same vertex is called a circuit or cycle. Example 14. Let A = fa; b; c; dg and R = f(a; b); (b; a); (a; d); (d; b); (c; c); (c; b)g. Definition 16 (The Connectivity Relation). Let R be a relation on the set A. The connectivity relation R∗ consists of all pairs (a; b) such that there is path of length at least 1 from a to b in R. Alternatively, 1 [ R∗ = Ri i=1 9 Example 15. Let R be the relation on the set of all people in the world that contains (a; b) iff a n ∗ has met b. What is R , where n 2 Z+? What is R ? Definition 17 (Transitive Closure). Let R be a relation on a set A. The transitive closure of R is the smallest relation containing R that is transitive. Theorem 3. The transitive closure of R is R∗. Example 16. R = f(1; 1); (1; 2); (2; 4); (3; 1); (4; 2)g It turns out that if A is a set with n elements and R is a relation on A, then any time there is a path of length 1 or more from a to b in R there there is a path of length n or less from a to b in R.