Relations Sections 8.1 & 8.5 Based on Rosen and slides by K. Busch 1 Relations and Their Properties A binary relation R from set to set A B is a subset of Cartesian product A B Example: UW students UW courses A B R {( , ) | is enrolled in } a b a b B Example: { 0 , 1 , 2 } { b , } A a R {( 0 , ), ( 0 , ), ( 1 , ), ( 2 , )} a b a b 2 1
A A relation on set is a subset of A A Example: A relation on set : { 1 , 2 , 3 , 4 } A {( 1 , 1 ), ( 1 , 2 ), ( 2 , 1 ), ( 2 , 2 ), ( 3 , 4 ), ( 4 , 1 ), ( 4 , 4 )} R 3 More Examples Relations over integers: {( , ) | } R a b a b {( , ) | or } R a b a b a b {( , ) | (mod )} for positive integer 1 R a b a b m m {( , ) | 1 } R a b b a (Actually a function) 2
Functions as Relations Relation over integers Z {( , ) | 1 } R a b b a Function from Z to Z ( ) 1 f a b a : f Z Z Function from A to B assigns exactly one element from B to each input from A i.e., a functions is a restricted type of relation where every a in A is in exactly one ordered pair (a,b). Reflexive relation on set : R A , ( , ) a A a a R Example: { 1 , 2 , 3 , 4 } A {( 1 , 1 ), ( 1 , 2 ), ( 2 , 1 ), ( 2 , 2 ), ( 3 , 4 ), ( 3 , 3 ), ( 4 , 3 ), ( 4 , 4 )} R 6 3
Symmetric relation : R ( , ) ( , ) a b R b a R Example: { 1 , 2 , 3 , 4 } A {( 1 , 1 ), ( 1 , 2 ), ( 2 , 1 ), ( 2 , 2 ), ( 3 , 4 ), ( 4 , 3 ), ( 4 , 4 )} R 7 Antisymmetric relation : R ( , ) ( , ) a b R b a R a b Example: { 1 , 2 , 3 , 4 } A {( 1 , 1 ), ( 1 , 2 ), ( 2 , 2 ), ( 3 , 4 ), ( 4 , 4 )} R 8 4
Transitive relation : R ( , ) ( , ) ( , ) a b R b c R a c R Example: { 1 , 2 , 3 , 4 } A {( 1 , 1 ), ( 1 , 2 ), ( 2 , 3 ), ( 3 , 4 )( 1 , 3 ), ( 1 , 4 ), ( 2 , 4 )} R 9 Combining Relations 1 {( 1 , 1 ), ( 2 , 2 ), ( 3 , 3 )} R 2 {( 1 , 1 ), ( 1 , 2 ), ( 1 , 3 ), ( 1 , 4 )} R {( 1 , 1 ), ( 1 , 2 ), ( 1 , 3 ), ( 1 , 4 ), ( 2 , 2 ), ( 3 , 3 )} R R 1 2 {( 1 , 1 )} R R 1 2 {( 2 , 2 ), ( 3 , 3 )) R R 1 2 10 5
Composite relation: S R ( , ) : ( , ) ( , ) a b S R x a x R x b S Note: ( , ) ( , ) ( , ) a b R b c S a c S R Example: {( 1 , 1 ), ( 1 , 4 ), ( 2 , 3 ), ( 3 , 1 ), ( 3 , 4 )} R {( 1 , 0 ), ( 2 , 0 ), ( 3 , 1 ), ( 3 , 2 ), ( 4 , 1 )} S S {( 1 , 0 ), ( 1 , 1 ), ( 2 , 1 ), ( 2 , 2 ), ( 3 , 0 ), ( 3 , 1 )} R 11 Power of relation: n R 1 R 1 n n R R R R Example: {( 1 , 1 ), ( 2 , 1 ), ( 3 , 2 ), ( 4 , 3 )} R 2 {( 1 , 1 ), ( 2 , 1 ), ( 3 , 1 )( 4 , 2 )} R R R 3 2 {( 1 , 1 ), ( 2 , 1 ), ( 3 , 1 )( 4 , 1 )} R R R 4 3 3 R R R R 12 6
Theorem: A relation is transitive R R n if and only if R for all 1 , 2 , 3 , n R Proof: 2 1. If part: R 2. Only if part: use induction 13 R 1. If part: We will show that if 2 R then is transitive R R Assumption: 2 R Definition of power: 2 R R R ( , ) a c R Definition of composition: ( , ) ( , ) ( , ) a b R b c R a c R R Therefore, is transitive R 14 7
2. Only if part: We will show that if is transitive R R n then for all 1 R n Proof by induction on n Inductive basis: 1 n 1 It trivially holds R R R 15 Inductive hypothesis: R k Assume that R k for all 1 n 16 8
1 Inductive step: We will prove R n R Take arbitrary n 1 ( , ) a b R We will show ( , ) a b R 17 n 1 ( , ) a b R definition of power n ( , ) a b R R definition of composition n : ( , ) ( , ) x a x R x b R R n inductive hypothesis R : ( , ) ( , ) x a x R x b R is transitive R ( , ) a b R End of Proof 18 9
Recommend
More recommend