Relations Their Properties Introduction Let A B be
Relations & Their Properties
Introduction • Let A & B be sets. • A binary relation from A to B is a subset of A x B. • Let R be a relation. If ( a, b ) R, we write a R b. • Example: – Let S be a set of students. – Let C be a set of courses. – Let R = { (s, c) | student s is taking course c}. • Many students may take the same course. • A single student may take many courses. Copyright © Peter Cappello 2
Functions as Relations Functions are a kind of relation. – Let function f : A B. – If f( a ) = b, we could write ( a, b ) f A x B. – P( A x B ) = the set of all relations from A to B. – Let F = the set of all functions from A to B. – F is a proper subset of P( A x B ) F Copyright © Peter Cappello 3
Relations on a Set • A relation on a set A is a relation from A to A. • Examples of relations on R: – R 1 = { (a, b) | a b }. – R 2 = { (a, b) | b = +sqrt( a ) }. – Are R 1 & R 2 functions? Copyright © Peter Cappello 4
Properties of Relations A relation R on A is: • Reflexive: a ( a. Ra ). Are either R 1 or R 2 reflexive? • Symmetric: a b ( a. Rb b. Ra ). – Let S be a set of people. – Let R & T be relations on S, R = { (a, b) | a is a sibling of b }. T = { (a, b) | a is a brother of b }. Is R symmetric? Is T symmetric? Copyright © Peter Cappello 5
• Antisymmetric: 1. a b ( ( a. Rb b. Ra ) ( a = b ) ). 2. a b ( ( a b ) ( ( a, b ) R ( b, a ) R ) ). Example: L = { ( a, b ) | a b }. Can a relation be symmetric & antisymmetric? • Transitive: a b c ( ( a. Rb b. Rc ) a. Rc ). Are any of the previous examples transitive? Copyright © Peter Cappello 6
Composition • Let R be a relation from A to B. • Let S be a relation from B to C. • The composition is S R = { ( a, c ) | b ( a. Rb b. Sc ) }. • Let R be a relation on A. R 1 = R Rn = Rn-1 R. • Let R = { (1, 1), (2, 1), (3, 2), (4, 3) }. What is R 2, R 3? Copyright © Peter Cappello 7
End 8. 1 Copyright © Peter Cappello 8
Graph a Relation from A to B • • • The word graph above is used as a verb. Let A = { 1, 2, 3 } and B = { 2, 3, 4 }. Let R be a relation from A to B where { (a, b) | a divides b }. 4 B 3 2 1 2 3 Copyright © Peter Cappello 2011 A 9
- Slides: 9