190 likes | 355 Views
Section 7.1. Relations and their properties. Binary relation. A binary relation is a set of ordered pairs that expresses a relationship between elements of 2 sets Formal definition: Let A and B be sets A binary relation from A to B is a subset of AxB (Cartesian product).
E N D
Section 7.1 Relations and their properties
Binary relation • A binary relation is a set of ordered pairs that expresses a relationship between elements of 2 sets • Formal definition: • Let A and B be sets • A binary relation from A to B is a subset of AxB (Cartesian product)
Denotation of binary relation R • Suppose a A and b B • If (a,b) R, then aRb • If (a,b) R, then aRb • If aRb, we can state that a is related to b by R
Example 1 • Let A = {0,1,2} and B = {a,b} • Then {(0,a), (0,b), (1,a), (2,b)} is a relation from A to B • We can state that, for instance, 0Ra and 1Rb • We can represent relations graphically, as shown on the next slide
Example 1 A = {0,1,2} B = {a,b} R = {(0,a), (0,b), (1,a), (2,b)} R a b 0 x x 1 x 2 x 0 a 1 b 2
Functions as relations • A function f from set A to set B assigns a unique element of B to each element of A • The graph of f is the set of ordered pairs (a,b) such that b = f(a) • The graph of f is a subset of AxB, so it is a relation from A to B
Functions as relations • The graph of f has the property that every element of A is the first element of exactly one ordered pair of the graph • If R is a relation from A to B such that every element is the first element of exactly one ordered pair of R, then a function can be defined with R as its graph
Not all relations are functions • A relation can express a one-to-many relationship between elements of sets A and B, where an element of A may be related to several elements of B • On the other hand, a function represents a relation in which exactly one element of B is related to each element of A
Relations on a set • A relation on a set A is a relation from A to A; in other words, a subset of AxA • Example: Let A = {1,2,3,4,5,6}; which ordered pairs are in the relation R={(a,b)|a divides b}? • Solution: {(1,1) (1,2), (1,3), (1,4), (1,5), (1,6), (2,2), (2,4), (2,6), (3,3), (3,6), (4,4), (5,5), 6,6)}
Relations on the set of integers • Relations on the set of integers are infinite relations • Some examples include: R1 = {(a,b) | a = b} R2 = {(a,b) | a = 5b} R3 = {(a,b) | a = b+2}
Finding the number of relations on a finite set • A relation on a set A is a subset of AxA • If A has n elements, AxA has n2 elements • A set with m elements has 2m subsets • Therefore, there are 2n2 relations on a set with n elements • For set {a,b,c,d} there are 216, or 65,536 relations on the set
Properties of relations • Reflexive: a relation R on set A is reflexive if (a,a) R for every element a A • For example, for set A = {1,2,3} • if R = {(1,1), (1,2), (2,2), (3,1), (3,3)} then R is a reflexive relation • On the other hand, if R = {(1,1), (1,2), (2,3), (3,3)} then R is not a reflexive relation
Properties of relations • Symmetric: a relation R on a set A is symmetric if (b,a) R whenever (a,b) R for all a,b A • For set A = {a,b,c,d}: • if R = {(a,b), (b,a), (c,d), (d,c)} then R is symmetric • if R = {(a,b), (b,a), (c,d), (c,b)} then R is not symmetric
Properties of relations • Antisymmetric: a relation R on a set A is antisymmetric if (a,b) R and (b,a) R only when a=b • Note that symmetric and antisymmetric are not necessarily opposite; a relation can be both at the same time
Examples of symmetry and antisymmetry • For A={1,2,3}: • R = {(1,1), (1,2), (2,1)} is symmetric but not antisymmetric • R = {(1,1), (1,2), (2,3)} is antisymmetric but not symmetric • R = {} is both symmetric and antisymmetric • R = {(1,2), (1,3), (2,3)} is antisymmetric
Properties of relations • Transitive: A relation R on a set A is called transitive if, whenever (a,b) R and (b,c) R, then (a,c) R for a,b,c A • For set A = {1, 2, 3, 4}: • R = {(1,3), (3,4), (1,2), (2,3), (2,4), (1,4)} is transitive • R = {(1,3), (3,4), (1,2), (2,4)} is not transitive
Example 2 • Let A = set of integers and • R1 = {(a,b) | ab} • R2 = {(a,b) | a<b} • R3 = {(a,b) | a=b or a=-b} • R4 = {(a,b) | a=b} • R5 = {(a,b) | a=b+1} • R6 = {(a,b) | a+b2} • Which of these are reflexive, symmetric, antisymmetric, transitive?
Combining relations • Since relations from A to B are subsets of AxB, relations from A to B can be combined any way 2 sets can be combined • Let A={1,2,3} and B={1,2,3,4} and R1={(1,1), (2,2), (3,3)}, R2={(1,1),(1,2),(1,3),(1,4)} • R1 R2 = {(1,1), (1,2), (2,2), (1,3),(3,3), (1,4)} • R1 R2 = {(1,1)} • R1 - R2 = {(2,2), (3,3)} • R2 - R1 = {(1,2), (1,3), (1,4)}
Composition of relations • Let R be a relation from A to B and S be a relation from B to C • S R is the relation consisting of ordered pairs (a,c) where a A and c C and there exists an element b B such that (a,b) R and (b,c) S