<<

2.3. RELATIONS 32

2.3. Relations

2.3.1. Relations. Assume that we have a of men M and a set of women W , some of whom are married. We want to express which men in M are married to which women in W . One way to do that is by listing the set of pairs (m, w) such that m is a man, w is a woman, and m is married to w. So, the “married to” can be represented by a of the M W . In general, a relation R from a set A to a set B will be understoo×d as a subset of the Cartesian product A B, i.e., R A B. If an element a A is related to an element b ×B, we often⊆write× a R b instead of (a, b∈) R. ∈ ∈ The set a A a R b for some b B { ∈ | ∈ } is called the domain of R. The set b B a R b for some a A { ∈ | ∈ } is called the range of R. For instance, in the relation “married to” above, the domain is the set of married men, and the range is the set of married women. If A and B are the same set, then any subset of A A will be a in A. For instance, assume A = 1, 2, 3,×4 . Then the binary relation “less than” in A will be: { }

< = (x, y) A A x < y A { ∈ × | } = (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4) . { }

Notation: A set A with a binary relation R is sometimes represented by the pair (A, R). So, for instance, (Z, ) means the set of together with the relation of non-strict inequalit≤ y.

2.3.2. Representations of Relations. Arrow diagrams. Venn diagrams and arrows can be used for rep- resenting relations between given sets. As an example, figure 2.8 rep- resents the relation from A = a, b, c, d to B = 1, 2, 3, 4 given by R = (a, 1), (b, 1), (c, 2), (c, 3) .{In the diagram} an{arrow from} x to y means{ that x is related to y. This} kind of graph is called or digraph. 2.3. RELATIONS 33

1 a b c 2 d 3 4

A B

Figure 2.8. Relation.

Another example is given in diagram 2.9, which represents the di- visibility relation on the set 1, 2, 3, 4, 5, 6, 7, 8, 9 . { }

1 2 8

4 6 3 9 7 5

Figure 2.9. Binary relation of divisibility.

Matrix of a Relation. Another way of representing a relation R from A to B is with a matrix. Its rows are labeled with the elements of A, and its columns are labeled with the elements of B. If a A and b B then we write 1 in row a column b if a R b, otherwise∈we write 0.∈ For instance the relation R = (a, 1), (b, 1), (c, 2), (c, 3) from A = a, b, c, d to B = 1, 2, 3, 4 has the{ following matrix: } { } { } 1 2 3 4 a 1 0 0 0 b 1 0 0 0 c 0 1 1 0 d 0 0 0 0     2.3.3. Inverse Relation. Given a relation R from A to B, the 1 inverse of R, denoted R− , is the relation from B to A defined as 1 b R− a a R b . ⇔ 2.3. RELATIONS 34

For instance, if R is the relation “being a son or daughter of”, then 1 R− is the relation “being a parent of”.

2.3.4. . Let A, B and C be three sets. Given a relation R from A to B and a relation S from B to C, then the composition S R of relations R and S is a relation from A to C defined by: ◦ a (S R) c there exists some b B such that a R b and b S c . ◦ ⇔ ∈ For instance, if R is the relation “to be the father of”, and S is the relation “to be married to”, then S R is the relation “to be the father in law of”. ◦

2.3.5. Properties of Binary Relations. A binary relation R on A is called:

1. Reflexive if for all x A, x R x. For instance on Z the relation “equal to” (=) is reflexiv∈ e. 2. Transitive if for all x, y, z A, x R y and y R z implies x R z. ∈ For instance (=) and (<) on Z are transitive relations.

3. Symmetric if for all x, y A, x R y y R x. For instance on Z, equality (=) is symmetric,∈ but strict⇒inequality (<) is not. 4. Antisymmetric if for all x, y A, x R y and y R x implies x = y. ∈ For instance, non-strict inequality ( ) on Z is antisymmetric. ≤

2.3.6. Partial Orders. A partial order, or simply, an order on a set A is a binary relation “4” on A with the following properties:

1. Reflexive: for all x A, x x. ∈ 4 2. Antisymmetric: (x 4 y) (y 4 x) x = y. 3. Transitive: (x y) (y ∧ z) x ⇒ z. 4 ∧ 4 ⇒ 4 Examples:

1. The non-strict inequality ( ) in Z. ≤ + 2. Relation of divisibility on Z : a b t, b = at. | ⇔ ∃ 2.3. RELATIONS 35

3. Set inclusion ( ) on P(A) (the collection of of a given set A). ⊆

Exercise: prove that the aforementioned relations are in fact partial orders. As an example we prove that divisibility is a partial order:

1. Reflexive: a = a 1 a a. ⇒ | 2. Antisymmetric: a b b = at for some t and b a a = bt0 for | ⇒ | ⇒ 1 some t0. Hence a = att0, which implies tt0 = 1 t0 = t− . The ⇒ only invertible positive integer is 1, so t = t0 = 1 a = b. ⇒ 3. Transitive: a b and b c implies b = at for some t and c = bt0 for | | some t0, hence c = att0, i.e., a c. | Question: is the strict inequality (<) a partial order on Z? Two elements a, b A are said to be comparable if either x y ∈ 4 or y 4 x, otherwise they are said to be non comparable. The order is called total or linear when every pair of elements x, y A are com- + ∈ parable. For instance (Z, ) is totally ordered, but (Z , ), where “ ” represents integer divisibilit≤y, is not. A totally ordered subset| of a par-| tially ordered set is called a chain; for instance the set 1, 2, 4, 8, 16, . . . + { } is a chain in (Z , ). |

2.3.7. Hasse diagrams. A is a graphical represen- tation of a in which each element is represented by a dot (node or vertex of the diagram). Its immediate successors are placed above the node and connected to it by straight line segments. As an example, figure 2.10 represents the Hasse diagram for the relation of divisibility on 1, 2, 3, 4, 5, 6, 7, 8, 9 . { } Question: How does the Hasse diagram look for a totally ordered set?

2.3.8. Equivalence Relations. An on a set A is a binary relation “ ” on A with the following properties: ∼ 1. Reflexive: for all x A, x x. 2. Symmetric: x y ∈ y ∼x. 3. Transitive: (x ∼ y)⇒ (y∼ z) x z. ∼ ∧ ∼ ⇒ ∼ 2.3. RELATIONS 36

8 9

4 6 5 7

2 3

1

Figure 2.10. Hasse diagram for divisibility.

For instance, on Z, the equality (=) is an equivalence relation. Another example, also on Z, is the following: x y (mod 2) (“x is congruent to y 2”) iff x y is even. For instance,≡ 6 2 (mod 2) because 6 2 = 4 is even, but 7− 4 (mod 2), because 7 ≡4 = 3 is not even. Congruence− modulo 2 is in6≡fact an equivalence relation:−

1. Reflexive: for every integer x, x x = 0 is indeed even, so x x (mod 2). − ≡

2. Symmetric: if x y (mod 2) then x y = t is even, but y x = t is also≡even, hence y x (mo−d 2). − − ≡ 3. Transitive: assume x y (mod 2) and y z (mod 2). Then x y = t and y z = ≡u are even. From here,≡ x z = (x y) + (y− z) = t + u −is also even, hence x z (mod −2). − − ≡

2.3.9. Equivalence Classes, Set, Partitions. Given an equivalence relation on a set A, and an element x A, the set of elements of A related∼ to x are called the equivalence∈ of x, represented [x] = y A y x . Element x is said to be a representative of class{ ∈ | ∼ } [x]. The collection of equivalence classes, represented A/ = [x] x A , is called quotient set of A by . ∼ { | ∈ } ∼ Exercise: Find the equivalence classes on Z with the relation of congruence modulo 2. One of the main properties of an equivalence relation on a set A is that the quotient set, i.e. the collection of equivalence classes, is a partition of A. Recall that a A is a collection of 2.3. RELATIONS 37 non-empty subsets A1, A2, A3, . . . of A which are pairwise disjoint and whose equals A:

1. A A = for i = j, i ∩ j ∅ 6

2. n An = A.

ExampleS : in Z with the relation of congruence modulo 2 (call it “ 2”), there are two equivalence classes: the set E of even integers and ∼ the set O of odd integers. The quotient set of Z by the relation “ 2” ∼ of congruence modulo 2 is Z/ 2 = E, O . We see that it is in fact a ∼ { } partition of Z, because E O = , and Z = E O. ∩ ∅ ∪ Exercise: Let m be an integer greater than or equal to 2. On Z we define the relation x y (mod m) m (y x) (i.e., m divides exactly y x). Prove that≡it is an equivalence⇔ | relation.− What are the equivalence− classes? How many are there?

Exercise: On the Cartesian product Z Z∗ we define the relation (a, b) R (c, d) ad = bc. Prove that R ×is an equivalence relation. ⇔ Would it still be an equivalence relation if we extend it to Z Z? ×