1 / 15

Relation

Relation. Relations. Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set A x B = {< x,y > : xA and yB }. A relation is just any subset of the CP!! R  AxB Ex: A = students; B = courses.

andren
Download Presentation

Relation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Relation

  2. Relations • Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set A x B = {<x,y> : xA and yB}. • A relation is just any subset of the CP!! R  AxB • Ex: A = students; B = courses. R = {(a,b) | student a is enrolled in class b}

  3. Example • 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 . • This means, for instance, that 0Ra , but that 1Rb. Relations can be represented graphically, using arrows to represent ordered pairs. Another way to represent this relation is to use a table.

  4. Yes, a function is a special kind of relation. Relations • Recall the definition of a function: f = {<a,b> : b = f(a) , aA and bB} • Is every function a relation? • A relation can be used to express a one-to-many relationship between the elements of the sets A and B where an element of A may be related to more than one element of B. A function represents a relation where exactly one element of B is related to each element of A.

  5. Example • Let A be the set { l , 2, 3 , 4}. Which ordered pairs are in the relation R = {(a , b) | a divides b}? • Solution: Because (a , b) is in R if and only if a and b are positive integers not exceeding 4 such that a divides b, we see that R = {( 1 , 1 ) , ( 1 , 2), ( 1 , 3), ( 1 , 4), (2, 2), (2, 4), (3 , 3), (4, 4) } .

  6. Example • Solution: The pair ( 1 , 1 ) is in R1, R3 , R4 , and R6; ( 1 , 2) is in R1 and R6; (2, 1 ) is in R2 , R5 , and R6; ( 1 , - 1 ) is in R2 , R3 , and R6; and finally, (2, 2) is in R1, R3 , and R4

  7. Example • How many relations are there on a set with n elements? Solution: A relation on a set A is a subset of A x A . Because A x A has n2 elements when A has n elements, and a set with m elements has 2m subsets, there are 2n2 subsets of A x A . Thus, there are 2n2 relations on a set with n elements. • For example, there are 232 = 29 = 512 relations on the set {a , b, c } .

  8. Properties of a Relation

  9. Example • Which of the relations are reflexive? Solution: • The reflexive relations are R1,R3 , and R4 . For each of the other relations in this example it is easy to find a pair of the form (a , a) that is not in the relation.

  10. Properties of a Relation

  11. Example • Which of the relations are symmetric and which are anti symmetric? • Solution: The relations R2 and R3 are symmetric, because in each case (b , a) belongs to the relation whenever (a , b) does. For R2 , the only thing to check is that both (2, 1 ) and ( 1 , 2) are in the relation. For R3 , it is necessary to check that both ( 1 , 2) and (2, I ) belong to the relation, and ( 1 , 4) and (4, 1 ) belong to the relation. • R4, Rs , and R6 are all antisymmetric. For each of these relations there is no pair of elements a and b with a =1= b such that both (a , b) and (b , a) belong to the relation.

  12. Example • Which of the relations are symmetric and which are anti symmetric?

  13. Properties of a Relation

  14. Example

  15. Example

More Related