RelationsCSCE 235, Spring 2010 1 Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.

Slides:



Advertisements
Similar presentations
Chapter 2 Revision of Mathematical Notations and Techniques
Advertisements

Equivalence Relations
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
Chap6 Relations Def 1: Let A and B be sets. A binary relation from A
Basic Properties of Relations
Relations.
Discrete Mathematics Lecture # 16 Inverse of Relations.
Applied Discrete Mathematics Week 11: Graphs
Ch. 8: Relations 8.1 Relations and their Properties.
Discrete Structures Chapter 5 Relations Nurul Amelina Nasharuddin Multimedia Department.
CSE115/ENGR160 Discrete Mathematics 05/03/11 Ming-Hsuan Yang UC Merced 1.
Relations. Binary Relations a relation between elements of two sets is a subset of their Cartesian product (of ordered pairs). Note the di ff erence between.
Relations binary relations xRy on sets x  X y  Y R  X  Y Example: “less than” relation from A={0,1,2} to B={1,2,3} use traditional notation 0 < 1,
Discussion #26 Chapter 5, Sections /15 Discussion #26 Binary Relations: Operations & Properties.
Equivalence Relations: Selected Exercises
Discrete Mathematics Lecture#11.
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Relations Chapter 9.
Relations (1) Rosen 6 th ed., ch. 8. Binary Relations Let A, B be any two sets. A binary relation R from A to B, written (with signature) R:A↔B, is a.
Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from.
Chapter 4 Relations and Digraphs
CS Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 Ofc hr: Thur, 9:30-11:30a Fall 2002KSU - Discrete Structures1.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Relations and their Properties
CHAPTER 3 FUZZY RELATION and COMPOSITION. 3.1 Crisp relation Product set Definition (Product set) Let A and B be two non-empty sets, the product.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
CS 103 Discrete Structures Lecture 19 Relations. Chapter 9.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
Relations. L222 Agenda –Relations 7.3 Representing Relations As subsets of Cartesian products Column/line diagrams Boolean matrix Digraph Operations on.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
1 Equivalence relations Binary relations: –Let S1 and S2 be two sets, and R be a (binary relation) from S1 to S2 –Not every x in S1 and y in S2 have such.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Chapter8 Relations 8.1: Relations and their properties.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
The Relation Induced by a Partition
Discrete Mathematical
Relations and Their Properties
Citra Noviyasari, S.Si, MT
Chapter 5 Relations and Operations
Relations.
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Equivalence Relations
Relations Chapter 9.
RELATION KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
Dr. Ameria Eldosoky Discrete mathematics
Applied Discrete Mathematics Week 9: Equivalence Relations
Relations and Their Properties
8.1 Relations and Their Properties
Equivalence relations
Basics of Relations.
Lecture # 16 Inverse of Relations
Presentation transcript:

RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs Definition: A binary relation from a set A to a set B is a subset R  A  B ={ (a,b) | a  A, b  B } Relation versus function – In a relation, each a  A can map to multiple elements in B – Relations are more general than functions When (a,b)  R, we say that a is related to b. Notation: aRb, aRb $aRb$, $a\notR b$

RelationsCSCE 235, Spring Relations: Representation To represent a relation, we can enumerate every element of R Example – Let A={a 1,a 2,a 3,a 4,a 5 } and B={b 1,b 2,b 3 } – Let R be a relation from A to B defined as follows R={(a 1,b 1 ),(a 1,b 2 ),(a 1,b 3 ),(a 3,b 1 ),(a 3,b 2 ),(a 3,b 3 ),(a 5,b 1 )} We can represent this relation graphically a1a1 a2a2 a3a3 a4a4 b1b1 b2b2 b3b3 AB a5a5

RelationsCSCE 235, Spring Relations on a Set Definition: A relation on the set A is a relation from A to A and is a subset of A  A Example: The following are binary relations on N R 1 ={ (a,b) | a  b } R 2 ={ (a,b) | a,b  N, a/b  Z } R 3 ={ (a,b) | a,b  N, a-b=2 } Question: Give some examples of ordered pairs (a,b)  N 2 that are not in each of these relations

RelationsCSCE 235, Spring Properties We will study several properties of relations – Reflexive – Symmetric – Transitive – Antisymmetric – Asymmetric

RelationsCSCE 235, Spring Properties: Reflexivity In a relation on a set, if all ordered pairs (a,a) for every a  A appears in the relation, R is called reflexive Definition: A relation R on a set A is called reflexive iff  a  A (a,a)  R

RelationsCSCE 235, Spring Reflexivity: Examples Recall the relations below, which is reflexive? R 1 ={ (a,b) | a  b } R 2 ={ (a,b) | a,b  N, a/b  Z } R 3 ={ (a,b) | a,b  N, a-b=2 } R 1 is reflexive since for every a  N, a  a R 2 is reflexive since a/a=1 is an integer R 3 is not reflexive since a-a=0 for every a  N

RelationsCSCE 235, Spring Properties: Symmetry Definitions: – A relation R on a set A is called symmetric if  a,b  A ( (b,a)  R  (a,b)  R ) – A relation R on a set A is called antisymmetric if  a,b  A [ (a,b)  R  (b,a)  R  a=b]

RelationsCSCE 235, Spring Symmetry versus Antisymmetry In a symmetric relation aRb  bRa In an antisymmetric relation, if we have aRb and bRa hold only when a=b An antisymmetric relation is not necessarily a reflexive relation A relation can be – both symmetric and antisymmetric – or neither – or have one property but not the other A relation that is not symmetric is not necessarily asymmetric

RelationsCSCE 235, Spring Symmetric Relations: Example Consider R={(x,y)  R 2 |x 2 +y 2 =1}, is R – Reflexive? – Symmetric? – Antisymmetric? R is not reflexive since for example (2,2)  R 2 R is symmetric because  x,y  R, xRy  x 2 +y 2 =1  y 2 +x 2 =1  yRx R is not antisymmetric because (1/3,  8/3)  R and (  8/3,1/3)  R but 1/3  8/3

RelationsCSCE 235, Spring Properties: Transitivity 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  a,b,c  A ((aRb)  (bRc))  aRc

RelationsCSCE 235, Spring Transitivity: Examples (1) Is the relation R={(x,y)  R 2 | x  y} transitive? Is the relation R={(a,b),(b,a),(a,a)} transitive? Yes, it is transitive because xRy and yRz  x  y and y  z  x  z  xRz No, it is not transitive because bRa and aRb but bRb

RelationsCSCE 235, Spring Transitivity: Examples (2) Is the relation {(a,b) | a is an ancestor of b} transitive? Is the relation {(x,y)  R 2 | x 2  y} transitive? Yes, it is transitive because aRb and bRc  a is an ancestor of b and b is an ancestor of c  a is an ancestor of c  aRc No, it is not transitive because 2R4 and 4R10 but 2R10

RelationsCSCE 235, Spring More Properties Definitions – A relation on a set A is irreflexive if  a  A (a,a)  R – A relation on a set A is asymmetric if  a,b  A ( (a,b)  R  (b,a)  R ) Lemma: A relation R on a set A is asymmetric if and only if – R is irreflexive and – R is antisymmetric

RelationsCSCE 235, Spring Combining Relations Relations are simply… sets (of ordered pairs); subsets of the Cartesian product of two sets Therefore, in order to combine relations to create new relations, it makes sense to use the usual set operations – Intersection (R 1  R 2 ) – Union (R 1  R 2 ) – Set difference (R 1 \R 2 ) Sometimes, combining relations endows them with the properties previously discussed. For example, two relations may be not transitive, but their union may be

RelationsCSCE 235, Spring Combining Relations: Example Let – A={1,2,3,4} – B={1,2,3,4} – R 1 ={(1,2),(1,3),(1,4),(2,2),(3,4),(4,1),(4,2)} – R 2 ={(1,1),(1,2),(1,3),(2,3)} Let – R 1  R 2 = – R 1  R 2 = – R 1 \ R 2 = – R 2 \ R 1 =

RelationsCSCE 235, Spring Composite of Relations Definition: Let R 1 be a relation from the set A to B and R 2 be a relation from B to C, i.e. R 1  A  B and R 2  B  C the composite of R 1 and R 2 is the relation consisting of ordered pairs (a,c) where a  A, c  C and for which there exists an element b  B such that (a,b)  R 1 and (b,c)  R 2. We denote the composite of R 1 and R 2 by R 2  R 1

RelationsCSCE 235, Spring Powers of Relations Using the composite way of combining relations (similar to function composition) allows us to recursively define power of a relation R on a set A Definition: Let R be a relation on A. The powers R n, n=1,2,3,…, are defined recursively by R 1 = R R n+1 = R n  R

RelationsCSCE 235, Spring Powers of Relations: Example Consider R={(1,1),(2,1),(3,2),(4,3)} R 2 = R 3 = R 4 = Note that R n =R 3 for n=4,5,6,…

RelationsCSCE 235, Spring Powers of Relations & Transitivity The powers of relations give us a nice characterization of transitivity Theorem: A relation R is transitive if and only if R n  R for n=1,2,3,…

RelationsCSCE 235, Spring Representing Relations We have seen one way to graphically represent a function/relation between two (different) sets: Specifically as a directed graph with arrows between nodes that are related We will look at two alternative ways to represent relations – 0-1 matrices (bit matrices) – Directed graphs

RelationsCSCE 235, Spring Equivalence Relation Consider the set of every person in the world Now consider a R relation such that (a,b)  R if a and b are siblings. Clearly this relation is – Reflexive – Symmetric, and – Transitive Such as relation is called an equivalence relation Definition: A relation on a set A is an equivalence relation if it is reflexive, symmetric, and transitive

RelationsCSCE 235, Spring Equivalence Class (1) Although a relation R on a set A may not be an equivalence relation, we can define a subset of A such that R does become an equivalence relation (on the subset) Definition: Let R be an equivalence relation on a set A and let a  A. The set of all elements in A that are related to a is called the equivalence class of a. We denote this set [a] R. We omit R when there is not ambiguity as to the relation. [a] R = { s | (a,s)  R, s  A}

RelationsCSCE 235, Spring Equivalence Class (2) The elements in [a] R are called representatives of the equivalence class Theorem: Let R be an equivalence class on a set A. The following statements are equivalent – aRb – [a]=[b] – [a]  [b]  The proof in the book is a circular proof

RelationsCSCE 235, Spring Partitions Partitions (1) Equivalence classes partition the set A into disjoint, non-empty subsets A 1, A 2, …, A k A partition of a set A satisfies the properties –  k i=1 A i =A – A i  A j =  for i  j – A i   for all i

RelationsCSCE 235, Spring Partitions (2) Example: Let R be a relation such that (a,b)  R if a and b live in the same state, then R is an equivalence relation that partitions the set of people who live in the US into 50 equivalence classes Theorem: – Let R be an equivalence relation on a set S. Then the equivalence classes of R form a partition of S. – Conversely, given a partition A i of the set S, there is a equivalence relation R that has the set A i as its equivalence classes

RelationsCSCE 235, Spring Partitions: Visual Interpretation In a 0-1 matrix, if the elements are ordered into their equivalence classes, equivalence classes/partitions form perfect squares of 1s (with 0s everywhere else) In a diargh, equivalence classes form a collections of disjoint complete graphs Example: Let A={1,2,3,4,5,6,7} and R be an equivalence relation that partitions A into A 1 ={1,2}, A 2 ={3,4,5,6} and A 3 ={7} – Draw the 0-1 matrix – Draw the digraph

RelationsCSCE 235, Spring Equivalence Relations: Example 1 Example: Let R={ (a,b) | a,b  R and a  b} – Is R reflexive? – Is it transitive? – Is it symmetric? No, it is not. 4 is related to 5 (4  5) but 5 is not related to 4 Thus R is not an equivalence relation

RelationsCSCE 235, Spring Equivalence Relations: Example 2 Example: Let R={ (a,b) | a,b  Z and a=b} – Is R reflexive? – Is it transitive? – Is it symmetric? – What are the equivalence classes that partition Z ?

RelationsCSCE 235, Spring Equivalence Relations: Example 3 Example: For (x,y),(u,v)  R 2, we define R={ ((x,y),(u,v)) | x 2 +y 2 =u 2 +v 2 } Show that R is an equivalence relation. What are the equivalence classes that R defines (i.e., what are the partitions of R 2 )?

RelationsCSCE 235, Spring Equivalence Relations: Example 4 Example: Given n,r  N, define the set n Z + r = { na + r | a  Z } – For n=2, r=0, 2 Z represents the equivalence class of all even integers – What n, r give the class of all odd integers? – For n=3, r=0, 3 Z represents the equivalence class of all integers divisible by 3 – For n=3, r=1, 3 Z represents the equivalence class of all integers divisible by 3 with a remainder of 1 – In general, this relation defines equivalence classes that are, in fact, congruence classes (See Section 3.4)