Relations & Their Properties.

advertisement
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 ).
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:
– R1 = { (a, b) | a  b }.
– R2 = { (a, b) | b = +sqrt( a ) }.
– Are R1 & R2 functions?
Copyright © Peter Cappello
4
Properties of Relations
A relation R on A is:
• Reflexive: a ( aRa ).
Are either R1 or R2 reflexive?
• Symmetric: a b ( aRb  bRa ).
– 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 ( ( aRb  bRa )  ( 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 ( ( aRb  bRc )  aRc ).
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 ( aRb  bSc ) }.
• Let R be a relation on A.
R1 = R
Rn = Rn-1  R.
• Let R = { (1, 1), (2, 1), (3, 2), (4, 3) }.
What is R2, R3?
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
Download