Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 1 Section 7.1 Relations and their properties

2 2 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)

3 3 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 Denotation of binary relation R

4 4 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

5 5 Example 1 A = {0,1,2} B = {a,b} R = {(0,a), (0,b), (1,a), (2,b)} 0a1b20a1b2 Rab0xx1x2xRab0xx1x2x

6 6 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

7 7 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

8 8 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

9 9 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)}

10 10 Relations on the set of integers Relations on the set of integers are infinite relations Some examples include: R 1 = {(a,b) | a = b} R 2 = {(a,b) | a = 5b} R 3 = {(a,b) | a = b+2}

11 11 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 n 2 elements A set with m elements has 2 m subsets Therefore, there are 2 n 2 relations on a set with n elements For set {a,b,c,d} there are 2 16, or 65,536 relations on the set

12 12 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

13 13 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

14 14 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

15 15 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

16 16 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

17 17 Example 2 Let A = set of integers and –R 1 = {(a,b) | a  b} –R 2 = {(a,b) | a<b} –R 3 = {(a,b) | a=b or a=-b} –R 4 = {(a,b) | a=b} –R 5 = {(a,b) | a=b+1} –R 6 = {(a,b) | a+b  2} Which of these are reflexive, symmetric, antisymmetric, transitive?

18 18 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 R 1 ={(1,1), (2,2), (3,3)}, R 2 ={(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)}

19 19 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


Download ppt "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."

Similar presentations


Ads by Google