Packet #5: Binary Relations Applied Discrete Mathematics

Total Page:16

File Type:pdf, Size:1020Kb

Packet #5: Binary Relations Applied Discrete Mathematics CSC224/226 – Packet 5 – Binary Relations Packet #5: Binary Relations Applied Discrete Mathematics Table of Contents Binary Relations Summary Page 1 Binary Relations Examples Page 2 Properties of Relations Page 3 Examples Pages 4-5 Representations Page 6 Composites Page 8 Closures Pages 10-11 Equivalence Relations Pages 12-13 Posets & Hasse Diagrams Pages 14-17 CSC224 – Packet 5 – Binary Relations CSC224/226 – Packet 5 – Binary Relations Binary Relations Summary I. Definition: A binary relation is a set of points, or ordered pairs. The ordered pairs are of the form (a,b) where a is a member of a set A (a ∈ A) and b is a member of a set B (b ∈ B). Any subset R ⊆ A x B is a binary relation. (Remember that A x B is the set of ordered pairs {(a,b) | a∈A ∧ b ∈ B}) II. Properties: Consider the binary relation R ⊆ A x A. A. Reflexive:R is reflexive if ∀ a ∈ A, (a,a) ∈ R B. Irreflexive: R is irreflexive if ∀ a ∈ A, (a,a) ∉ R. Is ¬ (R is reflexive) ⇔ (R is irreflexive)? C. Non-reflexive: ¬ (R is reflexive) D. Symmetric: R is symmetric if ∀ a, b ∈ A, [ ((a,b) ∈ R) ⇔ ((b,a) ∈ R) ] E. Antisymmetric: R is antisymmetric if ∀ a, b ∈ A, [(a,b) ∈ R ∧ (b,a) ∈ R] ⇒ (b = a) F. Asymmetric: R is asymmetric if ∀ a, b ∈ A, [(a,b) ∈ R] ⇒ [(b,a) ∉ R] Asymmetric = irreflexive AND antisymmetric G. Transitive: R is transitive if ∀ a, b ∈ A, [(a,b) ∈ R ∧ (b,c) ∈ R] ⇒ (a,c) ∈ R Also: R2 ⊆ R if and only if R is transitive. III. Representations A. Matrix: Form a matrix with the rows labeled with elements of A and the columns labeled with elements of B. Then place a 1 in position (a,b) if (a,b) ∈ R and a 0 in position (a,b) if (a,b) ∉ R. B. Digraph: Make a column of dots, label one for each element of A. Make another column of dots for the elements of B. Now, for every element (a,b) in R, draw an arrow from point a to point b. IV. Inverse Relation V. Composite Relations VI. Closure Properties (Reflexive, Symmetric, & Transitive closures) VII. Special Types A. Equivalence Relations are reflexive, symmetric and transitive (RST) B. Partially Ordered Sets are reflexive, antisymmetric and transitive (RAT) 1 CSC224/226 – Packet 5 – Binary Relations Binary Relations Definition 1. A binary relation is a set of ordered pairs. 2. Each ordered pair consists of elements taken from two sets. 3. The relation xRy is an ordered pair, <x,y> ∈ R, with x taken from the set S , and y taken from the set S . 1 2 4. S and S can be finite or infinite. They do not have to be equal. 1 2 Examples of Binary Relations A binary relation R on the set SxT. Example: S = {a, b, c} T = {1, 2, 3} R = {(a, 1), (a, 3), (b, 2), (c, 3)} A special binary relation R is a subset of SxS. Example: S = {a,b,c,d} R = {<a,a>, <a,b>, <a,c>, <b,a>, <b,d>, <c,a>, <c,b>, <d,b>} R is a factor relation on Ρ, where for x,y ∈ Ρ, xRy ⇔ x is a factor of y True or False? 3R6, 5R6, 6R3, 8R24, 5R5, 12R16 Define R on Ζ by xRy ⇔ x < y True or False? 2R3, 2R2, 5R10, 3R2, -1R1, 0R-1 Let R be the "congruent mod 5" relation on Ζ x Ζ for x,y ∈ Ζ, xRy ⇔ (x-y) is divisible by 5 ⇔ x ≡ y (mod 5) True or False? 2R7, -2R2, 2R2, 23R3, 3R23, -1R4, 0R10, -1R5 Let R be the subset relation, P({1,2,3}), where for A,B ∈ P({1,2,3}), ARB ⇔ A ⊆ B True or False? ∅R{1,2}, {1}R{2}, {1}R{1,2,3}, {2,3}R{2,3}, {1,2}R∅ CSC224 – Packet 5 – Binary Relations 2 CSC224/226 – Packet 5 – Binary Relations Properties of Binary Relations Relation R on set S (Universe of Discourse = S) Reflexive: if, for all x in S, xRx exists, then R is said to be reflexive. ∀x[xRx] Example: S = {1,2,3,4} if <1,1>;<2,2>;<3,3>;<4,4> ∈ R, then R is reflexive. if S = ∅, then R is also empty. Is R reflexive? Irreflexive: if, for all x in S, there is no xRx, then R is said to be irreflexive. ∀x[¬(xRx)] Note: To be irreflexive is different from being non-reflexive. ∀x[¬ (xRx)] irreflexive ¬∀x(xRx) = ∃x[¬(xRx)] non-reflexive Symmetric: If ∀x∀y[xRy → yRx] then R is said to be symmetric. Antisymmetric: If ∀x∀y[(xRy ∧ yRx) → (x = y)] then R is said to be antisymmetric. Note: To be antisymmetric is different from being asymmetric. ∀x∀y[xRy → ¬(yRx)] asymmetric Transitive: If ∀x∀y[(xRy ∧ yRz) → xRz] then R is said to be transitive. Also: R2 ⊆ R if and only if R is transitive. CSC224 – Packet 5 – Binary Relations 3 CSC224/226 – Packet 5 – Binary Relations Examples of Binary Relations Example 1: The real plane (R x R) is a binary relation, where points are of the form (x,y) where x ∈ R is on the real x-axis and y ∈ R is on the real y-axis. Example 2: The set of points on the graph y = x2 forms a subset of R x R, so it is a binary relation. It can be written as a set as well as by a graph. The set notation is: {(x,f(x)) | x ∈ R and f(x) = x2 }. Some points in this binary relation are: (0,0), (- 1,1), (1,1), (2,4), (3,9). What are some points that are not in this binary relation? Example 3: Define a relation R ⊆ A x B where A is the set of all dogs on the planet, and B is the set of all humans, and (a,b) ∈ R if dog a belongs to person b. If Tony is a boy and Sparky is a dog, can (Tony, Sparky) be in R? Notice that not all dogs have owners and not all people have dogs, so R ≠ A x B. Example 4: Let A = {1,3,4,6,7}. Here are some binary relations on A x A. For each of them, determine which properties the relations have. R1 = {(1,3),(7,4)} is a binary relation. R2 is defined by: ∀(a ∈ A) ∀ (b ∈ A) a ≤ b ⇒ (a,b) ∈ R R2 = {(1,1),(1,3),(1,4),(1,6),(1,7), (3,3),(3,4),(3,6),(3,7),(4,4),(4,6),(4,7),(6,6),(6,7),(7,7)} R3 is defined by: ∀(a ∈ A) ∀ (b ∈ A) a > b ⇒ (a,b) ∈ R R3 = ? R4 is defined by: ∀(a ∈ A) ∀ (b ∈ A) a ≡ b (mod 3) ⇒ (a,b) ∈ R (Remember that a ≡ b (mod 3) means that a and b have the same remainder if you divide both of them by 3.) R4 = { (1,1),(1,4),(1,7),(3,3),(3,6),(4,1),(4,4),(4,7),(6,3),(6,6), (7,1),(7,4),(7,7)} CSC224 – Packet 5 – Binary Relations 4 CSC224/226 – Packet 5 – Binary Relations Examples (Illustrated Under Examples of Binary Relations) CSC224 – Packet 5 – Binary Relations 5 CSC224/226 – Packet 5 – Binary Relations Representations of Binary Relations A matrix can be used to represent the binary relation by using a 1 to indicate the pairs in the relationship and 0 elsewhere. If S = S , a digraph (also called a 1 2 directed graph) can be also used to represent the relation, xRy. A digraph consists of vertices (elements of the set S) and directional branches indicating the connection in the ordered pair. example: S = S = S = {1,2,3,4} 1 2 xRy = {<1,2>,<1,4>,<2,3>,<4,4>} Matrix Representation: 1234 1 0101 2 0010 3 0000 4 0001 Digraph Representation 1 2 3 4 It is easy to see if a relation is reflexive from the matrix representing the relation. If the relation is reflexive, M will have all 1's in its major diagonal. If the relation is irreflexive, M will have all 0's in its major diagonal. If the relation is non-reflexive, M will have a mixture of 0's and 1's in its major diagonal. 1000 0100 This matrix is reflexive. 0010 0001 CSC224 – Packet 5 – Binary Relations 6 CSC224/226 – Packet 5 – Binary Relations If the relation is symmetric, M is symmetric about the major diagonal. If the relation is antisymmetric, M will not have any symmetry about the major diagonal. If the relation is non-symmetric, M will have at least one set of elements that are symmetric about the major diagonal. (The matrix given below is symmetric.) 0100 1010 0110 0000 Transitivity is a little more difficult to check. One can check element by element xRy, yRz, and xRz for all x, y, and z. You must check EVERY pair xRy and yRz and make sure that xRz is in the relation. Alternatively, you can compute R2 and check: if R2 ⊆ R then R is transitive. -1 Definition of R -1 R is obtained by interchanging the x,y pair for each element in R. So if -1 R ⊆ A x B, then R ⊆ B x A. Example 1: R = {<1,2>, <3,4>, <2,3>, <4,1>} -1 R = {<2,1>, <4,3>, <3,2>, <1,4>} Using the Matrix to check for properties: -1 If M is the matrix for R, then R is represented by the transpose of M, where we T interchange the rows and columns of M to get M .
Recommended publications
  • Section 4.1 Relations
    Binary Relations (Donny, Mary) (cousins, brother and sister, or whatever) Section 4.1 Relations - to distinguish certain ordered pairs of objects from other ordered pairs because the components of the distinguished pairs satisfy some relationship that the components of the other pairs do not. 1 2 The Cartesian product of a set S with itself, S x S or S2, is the set e.g. Let S = {1, 2, 4}. of all ordered pairs of elements of S. On the set S x S = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), Let S = {1, 2, 3}; then (2, 4), (4, 1), (4, 2), (4, 4)} S x S = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2) , (3, 3)} For relationship of equality, then (1, 1), (2, 2), (3, 3) would be the A binary relation can be defined by: distinguished elements of S x S, that is, the only ordered pairs whose components are equal. x y x = y 1. Describing the relation x y if and only if x = y/2 x y x < y/2 For relationship of one number being less than another, we Thus (1, 2) and (2, 4) satisfy . would choose (1, 2), (1, 3), and (2, 3) as the distinguished ordered pairs of S x S. x y x < y 2. Specifying a subset of S x S {(1, 2), (2, 4)} is the set of ordered pairs satisfying The notation x y indicates that the ordered pair (x, y) satisfies a relation .
    [Show full text]
  • Binary Relations.Pdf
    Binary Relations Any set of ordered pairs defines a binary relation. We express a particular ordered pair, (x, y) R, where R is a binary relation, as xRy. Properties Properties of a binary relation R on a set X: a. reflexive: if for every x X, xRx holds, i.e. (x, x) R. b. symmetric: if for every x and y in X, whenever xRy holds, then yRx holds. c. transitive: if for every x, y, and z in X, whenever xRy holds and yRz holds, then xRz holds. Graphical Representation Suppose that X = {A, B, C, D} and that R = {(A, B), (B, D), (C, C), (D, B)}. We can represent the binary relation R as a set, as a graph or as a Boolean matrix. Graphically, we have Boolean Matrix Representation As a Boolean matrix we have A B C D A 0 1 0 0 B 0 0 0 1 C 0 0 1 0 D 0 1 0 0 What would a Boolean matrix look like if it represented a reflexive binary relation, a symmetric binary relation, a transitive binary relation, any combination of the above? Reflexive Relation A B C D A - 1 - - B - - - 1 C - - 1 - D - 1 - - Symmetric Relation A B C D A - 1 - - B - - - 1 C - - 1 - D - 1 - - Transitive Relation A B C D A - 1 - - B - - - 1 C - - 1 - D - 1 - - Click here for Answers Composition of Relations: Let R be a relation from X to Y, and S be a relation from Y to Z. Then a relation written as R o S is called a composite relation of R and S where R o S = { (x, z) | x X z Z ( y) (y Y (x, y) R (y, z) S) } We can also write the composition as R o S = { (x, z) | x X z Z ( y) (y Y xRy ySz) } Note: Relational composition can be realized as matrix multiplication.
    [Show full text]
  • Discrete Mathematics
    Discrete Mathematics Chapter 7 Relations 7.1 Relations and their properties. ※The most direct way to express a relationship between elements of two sets is to use ordered pairs. For this reason, sets of ordered pairs are called binary relations. Example 1. A : the set of students in your school. B : the set of courses. R = { (a, b) : a∈A, b∈B, a is enrolled in course b } 7.1.1 Def 1. Let A and B be sets. A binary relation from A to B is a subset R of A×B. ( Note A×B = { (a,b) : a∈A and b∈B } ) Def 1’. We use the notation aRb to denote that (a, b)∈R, and aRb to denote that (a,b)∉R. Moreover, a is said to be related to b by R if aRb. 7.1.2 Example 3. Let A={0, 1, 2} and B={a, b}, then {(0,a),(0,b),(1,a),(2,b)} is a relation R from A to B. This means, for instance, that 0Ra, but that 1Rb A B R ⊆ A×B = { (0,a) , (0,b) , (1,a) (1,b) , (2,a) , (2,b)} 0 a ∈R ∈R 1 b 2 R 7.1.3 Example (上例) : A : 男生, B : 女生, R : 夫妻關系 A : 城市, B : 州, 省 R : 屬於 (Example 2) Note. Relations vs. Functions A relation can be used to express a 1-to-many relationship between the elements of the sets A and B. ( function 不可一對多,只可多對一 ) Def 2. A relation on the set A is a subset of A × A ( i.e., a relation from A to A ).
    [Show full text]
  • Chapter 5 Partial Orders, Lattices, Well Founded Orderings
    Chapter 5 Partial Orders, Lattices, Well Founded Orderings, Equivalence Relations, Distributive Lattices, Boolean Algebras, Heyting Algebras 5.1 Partial Orders There are two main kinds of relations that play a very important role in mathematics and computer science: 1. Partial orders 2. Equivalence relations. In this section and the next few ones, we define partial orders and investigate some of their properties. 459 460 CHAPTER 5. PARTIAL ORDERS, EQUIVALENCE RELATIONS, LATTICES As we will see, the ability to use induction is intimately related to a very special property of partial orders known as well-foundedness. Intuitively, the notion of order among elements of a set, X, captures the fact some elements are bigger than oth- ers, perhaps more important, or perhaps that they carry more information. For example, we are all familiar with the natural ordering, , of the integers ≤ , 3 2 1 0 1 2 3 , ··· − ≤− ≤− ≤ ≤ ≤ ≤ ≤··· the ordering of the rationals (where p1 p2 iff q1 q2 p2q1 p1q2 ≤ − 0, i.e., p2q1 p1q2 0ifq1q2 > 0 else q1q2 ≥ − ≥ p2q1 p1q2 0ifq1q2 < 0), and the ordering of the real numbers.− ≤ In all of the above orderings, note that for any two number a and b, either a b or b a. ≤ ≤ We say that such orderings are total orderings. 5.1. PARTIAL ORDERS 461 A natural example of an ordering which is not total is provided by the subset ordering. Given a set, X, we can order the subsets of X by the subset relation: A B, where A, B are any subsets of X. ⊆ For example, if X = a, b, c , we have a a, b .
    [Show full text]
  • Relations III
    CS 441 Discrete Mathematics for CS Lecture 23 Relations III. Milos Hauskrecht [email protected] 5329 Sennott Square CS 441 Discrete mathematics for CS M. Hauskrecht Composite of relations Definition: Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is the relation consisting of the ordered pairs (a,c) where a A and c C, and for which there is a b B such that (a,b) R and (b,c) S. We denote the composite of R and S by S o R. Example: AB C c a b RS CS 441 Discrete mathematics for CS M. Hauskrecht 1 Composite of relations Definition: Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is the relation consisting of the ordered pairs (a,c) where a A and c C, and for which there is a b B such that (a,b) R and (b,c) S. We denote the composite of R and S by S o R. (a,c) S o R Example: AB C c a b RS CS 441 Discrete mathematics for CS M. Hauskrecht Composite of relations Definition: Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is the relation consisting of the ordered pairs (a,c) where a A and c C, and for which there is a b B such that (a,b) R and (b,c) S.
    [Show full text]
  • CS202 Fall 2011 Lecture (Lost Count) – 12/1 Relations
    11/30/11 Relations CS202 Fall 2011 Lecture (lost count) – 12/1 Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set Relations A x B = {(a,b) : a∈A and b∈B}. Prof. Tanya Berger-Wolf aRb or (a,b) ∈ R means “a is related to b” A relation is just any subset of the Cartesian Product: R ⊆ AxB Ex1: A = {0,1,2}, B = {2,3} => AxB = {(0,2), (0,3), (1,2), (1,3), (2,2), (2,3)} R = {(a,b) | a < b}. So R = {(0,2), (0,3), (1,2), (1,3), (2,3)} = AxB-{(2,2)} Ex2: A = students at UIC; B = courses at UIC. R = {(a,b) | student a is enrolled in class b} Ex3: A = {3 letter strings}, B = {all English words} R = {(a,b) | a is a prefix of b} 1 Relations and Functions Properties of Relations Recall the definition of a function: f = {(a,b) : b = f(a) , a∈A and b∈B} Is every function a relation? Yes, a function is Reflexivity: a special kind of A relation R on AxA is reflexive if for all a∈A, (a,a) ∈R. relation. Symmetry: Draw Venn diagram of cross products, relations, Cross product A relation R on AxA is symmetric if functions (a,b) ∈ R implies (b,a) ∈ R . 1 11/30/11 Properties of Relations Properties of Relations - techniques… How can we check for transitivity? Draw a picture of the relation (called a “graph”) [Epp p. 580]. Transitivity: " ! Vertex for every element of A A relation on AxA is transitive if " ! Edge for every element of R (a,b) ∈ R and (b,c) ∈ R imply (a,c) ∈ R.
    [Show full text]
  • Today's Lecture Chapter 8: Section
    Announcements ICS 6B } Regrades for Quiz #3 and Homeworks #4 & Boolean Algebra & Logic 5 are due Thursday Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 7 – Ch. 8.4, 8.5, 8.6 Lecture Set 7 - Chpts 8.4, 8.5, 8.6 2 Grades Overall Grades & Quiz #3… Quiz #3 90-100 } Max: 100% } Min: 42% 80-89 } Median: 83% 70-79 Overall 60-69 less } Max: 99% than 50 } Min 45% 01234567 } Median: 84% Overall Quiz #3 Lecture Set 7 - Chpts 8.4, 8.5, 8.6 3 Lecture Set 7 - Chpts 8.4, 8.5, 8.6 4 Today’s Lecture } Chapter 8 8.4, 8.5, 8.6 ● Closures of Relations 8.4 Chapter 8: Section 8.4 ● Equivalence Relations 8.5 ● Partial Orderings 8.6 Closures of Relations Lecture Set 7 - Chpts 8.4, 8.5, 8.6 5 1 Closure of Relations Reflexive Closure Let R be a relation on set A. Example Let P be a property (reflexive, symmetric, etc.) A1,2,3 The closure of R with respect to the property P R1,1,1,2,1,3 is the smallest relation containing R which has this property. P“being reflexive” } In other words, add the minimum number of pairs to obtain R is not reflexive, b/c its missing 2,2, 3,3 property P. The smallest reflexive relation containing R is } Note: This may not be possible. S1,1,1,2,1,3,2,2,3,3 Example: This is the reflexive closure of R & it’s the intersection A1,2,3,4, R1,1,1,3,14 of all of the reflexive relations that contain R P is being “irreflexive” Any relation on A which is reflexive and contains R } If the closure S of R w.r.t.
    [Show full text]
  • Relations and Functions
    2 Relations and Functions 2.1 INTRODUCTION The word relation implies an association of two objects, two persons, etc., according to some property possessed by them, e.g. (i) A is the son of B. The relation R here is “is the son of ”. (ii) Delhi is the capital of INDIA. The relation R here is “is the capital of ”. In Mathematics we can study relationship between a real number and a number which is smaller than it, between a program and a variable it uses. Relationship between elements of sets is represented using a structure called relation. 2.2 RELATION OR BINARY RELATION Let A and B be two non-empty sets. A binary relation or simply a relation from A to B is a sub- set of A × B. Given x ∈A and y ∈ B, we write x R y if (x, y) ∈ R and x R y if (x, y) ∉ R. If R is relation from A to A, then R is said to be relation on A. A binary relation on a set A is a subset of A × A. This definition needs some explanation, since the connection between it and the informal idea of a relation might not be obvious. Note: The word ‘binary’ refers to the fact that the relation is between two elements of A. As this is the only kind of relation we will be studying, we will omit the word ‘binary’ in what follows. The easiest way to do this is by means of an example. Let A = {1, 3, 5} be a set.
    [Show full text]