Chapter 9: Relations Relations

Similar documents
Math.3336: Discrete Mathematics. Chapter 9 Relations

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Relations Graphical View

Section 7.1 Relations and Their Properties. Definition: A binary relation R from a set A to a set B is a subset R A B.

and e 2 ~ e 2 iff e 1

Reading 11 : Relations and Functions

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

1.4 Equivalence Relations and Partitions

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University

Week 4-5: Binary Relations

5. Partitions and Relations Ch.22 of PJE.

Week 4-5: Binary Relations

Automata and Languages

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

Properties of the Integers

Relations --- Binary Relations. Debdeep Mukhopadhyay IIT Madras

CSC Discrete Math I, Spring Relations

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Equivalence relations

Section 8.4 Closures of Relations

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Relationships between elements of sets occur in many contexts. Every day we deal with

What are relations? f: A B

Discrete Mathematics. 2. Relations

Math 42, Discrete Mathematics

Nonnegative Matrices I

Equivalence, Order, and Inductive Proof

Discrete Mathematics. Chapter 4. Relations and Digraphs Sanguk Noh

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

1. To be a grandfather. Objects of our consideration are people; a person a is associated with a person b if a is a grandfather of b.

Math 42, Discrete Mathematics

Lecture 8: Equivalence Relations

Rela%ons and Their Proper%es. Slides by A. Bloomfield

CMPSCI 250: Introduction to Computation. Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013

1.3 Vertex Degrees. Vertex Degree for Undirected Graphs: Let G be an undirected. Vertex Degree for Digraphs: Let D be a digraph and y V (D).

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

Worksheet on Relations

14 Equivalence Relations

2. Transience and Recurrence

Relations, Functions, and Sequences

Notes for Science and Engineering Foundation Discrete Mathematics

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Practice Exam 1 CIS/CSE 607, Spring 2009

CHAPTER 1 SETS AND EVENTS

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

CSE 20 DISCRETE MATH. Winter

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

Lecture 7: Relations

Preliminaries and Complexity Theory

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Chapter 2 - Relations

Week 4-5: Generating Permutations and Combinations

CSE 20 DISCRETE MATH. Fall

Today. Binary relations establish a relationship between elements of two sets

Relations and Equivalence Relations

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

Problems for Putnam Training

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

GROUPS AS GRAPHS. W. B. Vasantha Kandasamy Florentin Smarandache

Relations. Relations. Definition. Let A and B be sets.

Packing of Rigid Spanning Subgraphs and Spanning Trees

0 Sets and Induction. Sets

1 Predicates and Quantifiers

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

Sets and Motivation for Boolean algebra

Combinatorial optimization problems

Selected Solutions to Even Problems, Part 3

Reading: Chapter 9.3. Carnegie Mellon

Generating Permutations and Combinations

Ring Sums, Bridges and Fundamental Sets

The Pigeonhole Principle

0 Logical Background. 0.1 Sets

Introduction to Kleene Algebras

MATH 101: ALGEBRA I WORKSHEET, DAY #1. We review the prerequisites for the course in set theory and beginning a first pass on group. 1.

Relations. Definition 1 Let A and B be sets. A binary relation R from A to B is any subset of A B.

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Homework 1 2/7/2018 SOLUTIONS Exercise 1. (a) Graph the following sets (i) C = {x R x in Z} Answer:

Discrete Mathematics. Benny George K. September 22, 2011

DRAFT CONCEPTUAL SOLUTION REPORT DRAFT

Discrete Structures (2IT50)

MATH 13 SAMPLE FINAL EXAM SOLUTIONS

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Independencies. Undirected Graphical Models 2: Independencies. Independencies (Markov networks) Independencies (Bayesian Networks)

Relations. Carl Pollard. October 11, Department of Linguistics Ohio State University

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Coloring Vertices and Edges of a Path by Nonempty Subsets of a Set

1 Chapter 1: SETS. 1.1 Describing a set

TOPOLOGICAL ASPECTS OF YAO S ROUGH SET

2.31 Definition By an open cover of a set E in a metric space X we mean a collection {G α } of open subsets of X such that E α G α.

SF2729 GROUPS AND RINGS LECTURE NOTES

HOMEWORK #2 - MATH 3260

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

The integers. Chapter 3

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Equational Logic. Chapter Syntax Terms and Term Algebras

Transcription:

Chapter 9: Relations 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) R then we write a R b or a b (read a relates/is related to b [by R] ). If (a, b) / R, then we write a R b or a b. We can represent relations graphically or with a chart in addition to a set description. Example 1. A = {0, 1, 2}, B = {1, 2, 3}, R = {(1, 1), (2, 1), (2, 2)} Example 2. (a) Parent (b) x, y Z, x R y x 2 + y 2 = 8 (c) A = {0, 1, 2}, B = {1, 2, 3}, a R b a + b 3 (d) 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 A. Definition 4 (Symmetric). A relation R on a set A is said to be symmetric if and only if for all a, b A. a R b = b R a Definition 5 (Anitsymmetric). A relation R on a set A is said to be antisymmetric if and only if for all a, b A. a R b and b R a = a = b 2

Definition 6 (Transitive). A relation R on a set A is said to be transitive if and only if for all a, b, c A. a R b and b R c = a R c Example 4. Determine whether the relation R on the set of all integers is reflexive, symmetric, antisymmetric, or transitive, where (a, b) R if and only if (a) a b (b) a b 2 Example 5. Determine whether the relation R on the set of all web pages is reflexive, symmetric, antisymmetric, or transitive, where (a, b) 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 3

Combining Relations We can combine two relations R 1 and R 2 from A to B using the following operations (these all come from set operations that we ve discussed previously(: Intersection: R 1 R 2 = {(a, b) (a, b) R 1 and (a, b) R 2 } Union: R 1 R 2 = {(a, b) (a, b) R 1 or (a, b) R 2 } Difference: R 1 R 2 = {(a, b) (a, b) R 1 but (a, b) / R 2 } Symmetric Difference: R 1 R 2 = {(a, b) (a, b) R 1 or (a, b) R 2 but (a, b) / R 1 R 2 } Definition 7 (Composition). If R 1 is a relation from A to B and R 2 is a relation from B to C, then we define R 2 R 1 = {(a, c) a A, c C, and there exists b B such that (a, b) R 1 and (b, c) R 2 } Example 6. Let R 1 and R 2 be relations on Z where R 1 = {(a, b) a b} and R 2 = {(a, b) a is a multiple of b}. Find the following: (a) R 1 R 2 (b) R 1 R 2 (c) R 1 R 2 (d) R 2 R 1 (e) R 1 R 2 (f) R 1 R 2 (g) R 2 R 1 4

Definition 8. Let R be a relation on a set A. Then we define the powers of R as R 1 = R R n = R n 1 R = R } R {{ R }, for n > 1 n copies of R Example 7. A = {1, 2, 3, 4, 5}, R = {(1, 1), (1, 2), (1, 3), (2, 3), (2, 4), (3, 1), (3, 4), (3, 5)} Theorem 1. A relation R on a set A is transitive if and only if R n R for all n Z +. 9.2 - n-ary Relations Definition 9 (n-ary Relation). Let A 1, A 2,..., A n be sets. An n-ary relation on these sets is a subset R A 1 A 2 A n. The sets A 1, A 2,..., A n are called the domains of the relation and n is the degree. 9.3 - Representing Relations In addition to charts, sets, and graphs we can represent relations using: 1. A zero-one matrix M R = [m ij ], where m ij = { 1 if (a i, b j ) R 0 if (a i, b j ) / R (This can be used for any relation from A to B.) 2. A digraph (or directed graph). Definition 10 (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. Example 8. a b c d 5

Example 9. Draw the divides relation on the set {2, 3, 4, 5, 6, 7, 8, 9} both as a digraph and as a 0-1 matrix. 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 R 1, R 2, and R on a set A with matrix representations M R1, M R2, and M R, respectively, then M R1 R 2 = M R1 M R2 M R1 R 2 = M R1 M R2 M R1 R 2 = M R2 M R1 M R n = M [n] R 6

Example 10. Let R 1 = {(1, 2), (2, 1), (2, 2), (3, 3)} and R 2 = {(1, 1), (1, 2), (1, 3), (3, 2)} be binary relations on the set A = {1, 2, 3}. Find M R1 and M R2 and then use them to find M R1 R 2, M R1 R 2, and M R1 R 2. Verify by computing R 1 R 2, R 1 R 2, and R 1 R 2 without matrices. Example 11. Let M R = 1 0 1 0 0 1, M S = 1 1 0 0 1 1 0 0 0, M P = 0 0 1. Compute M R n, M S n, M P n, to determine 1 1 0 1 1 1 0 0 0 if the relations R, S, and P are transitive. 7

9.4 - Closures of Relations Definition 11 (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 = {(a, a) a A}. Definition 12 (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 = {(b, a) (a, b) R}. Example 12. Let R = {(1, 1), (1, 2), (2, 4), (3, 1), (4, 2)} be a relation on the set A = {1, 2, 3, 4}. Find the reflexive closure and symmetric closure of R. Definition 13. A path from a to b in a digraph G is a sequence of edges (x 0, x 1 ), (x 1, x 2 ), (x 2, x 3 ),..., (x n 1, x n ) where n N, a = x 0, and b = x n. This path is denoted by x 0, x 1,..., x n 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 13. Let A = {a, b, c, d} and R = {(a, b), (b, a), (a, d), (d, b), (c, c), (c, b)}. Definition 14 (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, R = i=1 R i 8

Example 14. Let R be the relation on the set of all people in the world that contains (a, b) iff a has met b. What is R n, where n Z +? What is R? Definition 15 (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 15. R = {(1, 1), (1, 2), (2, 4), (3, 1), (4, 2)} 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. This means that and R = M R = n i=1 n i=1 R i M [i] R (It turns out that this is still not the most efficient way of computing R.) Example 16. R = {(1, 1), (1, 2), (2, 4), (3, 1), (4, 2)} 9

Warshall s Algorithm Definition 16 (Interior Vertex). An interior vertex is any vertex in a path that is not the initial vertex or terminal vertex. (The initial or terminal vertex could be an interior vertex as long as the path visits it again without starting or ending there.) [ Theorem 4 (Warshall s Algorithm). W k = w (k) ij ], where w (k) ij = 1 if and only if there is a path from v i to v j such that all interior vertices are in the set {v 1,..., v k }. (Note: the first and last vertices in the path can be outside, length 1 paths always count since there are no interior vertices (vacuously true), and the path doesn t have to visit all of the vertices v 1,..., v k.) Example 17. R = {(1, 1), (1, 2), (2, 4), (3, 1), (4, 2)} 1 2 4 3 10

9.5 - Equivalence Relations Definition 17 (Equivalence Relation). A relation R on a set A is called an equivalence relation if and only if R is reflexive, symmetric, and transitive. If two elements a and b are related by an equivalence relation, then we write a b. 1 All elements that are related to an element a A form the equivalence class of a, denoted by [a] R (or simply [a] if there is only one relation under consideration): [a] R = {b (b, a) R} a is called a representative of the equivalence class [a] R. Theorem 5. Given an equivalence relation R on a set A and given two elements a, b A, the following are equivalent: 1. a b 2. [a] R = [b] R 3. [a] R [b] R = Example 18. (a) a b if and only if a and b have the same gender. (b) a b if and only if a and b have the same first name. 1 As was mentioned earlier in the notes, some books use the notation to denote any relation, but in this book it is only used if element are related under an equivalence relation. 11

(c) a b if and only if a b (mod 5). (d) [4] 5 (e) a b if and only if a and b say the same thing. (f) Definition 18 (Partition). A partition of a set S is a collection Π = {A 1, A 2,..., A m } of nonempty, pairwise disjoint subsets of S such that every element of S is in one of the subsets A i. We say that Π partitions S (or Π is a partition of S ). Theorem 6. Let R be an equivalence relation on a set S. Then the equivalence classes of R form a partition of S. Conversely, any partition Π of S defines an equivalence relation on S whose equivalence classes are the sets in Π. Equivalence relations give us a way to identify some notion of sameness (same name, same remainder, same set of a partition, etc.). 12