Relations Sections 8.1 & 8.5 Based on Rosen and slides by K. - - PDF document

relations
SMART_READER_LITE
LIVE PREVIEW

Relations Sections 8.1 & 8.5 Based on Rosen and slides by K. - - PDF document

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


slide-1
SLIDE 1

1

Relations

Sections 8.1 & 8.5

1 Based on Rosen and slides by K. Busch

Relations and Their Properties

2

A binary relation R from set to set is a subset of Cartesian product

A B B A

Example:

} 2 , 1 , {  A } , { b a B  )} , 2 ( ), , 1 ( ), , ( ), , {( b a b a R 

Example:

courses UW students UW   B A } in enrolled is | ) , {( b a b a R 

slide-2
SLIDE 2

2

A relation on set :

3

A relation on set is a subset of

A A A

Example:

} 4 , 3 , 2 , 1 {  A )} 4 , 4 ( ), 1 , 4 ( ), 4 , 3 ( ), 2 , 2 ( ), 1 , 2 ( ), 2 , 1 ( ), 1 , 1 {(  R

More Examples

1 integer positive for )} (mod | ) , {(    m m b a b a R }

  • r

| ) , {( b a b a b a R    

Relations over integers:

} | ) , {( b a b a R   } 1 | ) , {(    a b b a R

(Actually a function)

slide-3
SLIDE 3

3

Functions as Relations

} 1 | ) , {(    a b b a R 1 ) (    a b a f

Relation over integers Z

Z Z f  :

Function from Z to 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

  • ne ordered pair (a,b).

6

Reflexive relation on set :

R

R a a A a    ) , ( ,

Example:

} 4 , 3 , 2 , 1 {  A )} 4 , 4 ( ), 3 , 4 ( ), 3 , 3 ( ), 4 , 3 ( ), 2 , 2 ( ), 1 , 2 ( ), 2 , 1 ( ), 1 , 1 {(  R A

slide-4
SLIDE 4

4

7

Symmetric relation :

R

R a b R b a    ) , ( ) , (

Example:

} 4 , 3 , 2 , 1 {  A )} 4 , 4 ( ), 3 , 4 ( ), 4 , 3 ( ), 2 , 2 ( ), 1 , 2 ( ), 2 , 1 ( ), 1 , 1 {(  R

8

Antisymmetric relation :

R

b a R a b R b a      ) , ( ) , (

Example:

} 4 , 3 , 2 , 1 {  A )} 4 , 4 ( ), 4 , 3 ( ), 2 , 2 ( ), 2 , 1 ( ), 1 , 1 {(  R

slide-5
SLIDE 5

5

9

Transitive relation :

R

R c a R c b R b a      ) , ( ) , ( ) , (

Example:

} 4 , 3 , 2 , 1 {  A )} 4 , 2 ( ), 4 , 1 ( ), 3 , 1 )( 4 , 3 ( ), 3 , 2 ( ), 2 , 1 ( ), 1 , 1 {(  R

10

Combining Relations

)) 3 , 3 ( ), 2 , 2 {( )} 1 , 1 {( )} 3 , 3 ( ), 2 , 2 ( ), 4 , 1 ( ), 3 , 1 ( ), 2 , 1 ( ), 1 , 1 {(

2 1 2 1 2 1

      R R R R R R )} 3 , 3 ( ), 2 , 2 ( ), 1 , 1 {(

1 

R )} 4 , 1 ( ), 3 , 1 ( ), 2 , 1 ( ), 1 , 1 {(

2 

R

slide-6
SLIDE 6

6

11

Composite relation:

)} 4 , 3 ( ), 1 , 3 ( ), 3 , 2 ( ), 4 , 1 ( ), 1 , 1 {(  R )} 1 , 4 ( ), 2 , 3 ( ), 1 , 3 ( ), , 2 ( ), , 1 {(  S )} 1 , 3 ( ), , 3 ( ), 2 , 2 ( ), 1 , 2 ( ), 1 , 1 ( ), , 1 {(  R S 

S b x R x a x R S b a       ) , ( ) , ( : ) , ( 

R S 

Example:

R S c a S c b R b a       ) , ( ) , ( ) , (

Note:

12

Power of relation:

n

R R R 

1

R R R

n n

 

1

Example:

)} 3 , 4 ( ), 2 , 3 ( ), 1 , 2 ( ), 1 , 1 {(  R )} 2 , 4 )( 1 , 3 ( ), 1 , 2 ( ), 1 , 1 {(

2

  R R R  )} 1 , 4 )( 1 , 3 ( ), 1 , 2 ( ), 1 , 1 {(

2 3

  R R R 

3 3 4

R R R R   

slide-7
SLIDE 7

7

A relation is transitive if and only if for all

13

Theorem:

R R Rn 

 , 3 , 2 , 1  n

Proof:

  • 1. If part:

R R 

2

  • 2. Only if part: use induction

We will show that if then is transitive

14

  • 1. If part:

R R 

2

R

R R R  

2

Definition of power: Definition of composition:

R R c a R c b R b a       ) , ( ) , ( ) , (

R R 

2

R c a  ) , (

Assumption: Therefore, is transitive

R

slide-8
SLIDE 8

8

15

  • 2. Only if part:

We will show that if is transitive then for all

R R Rn  1  n

Proof by induction on Inductive basis:

n 1  n R R R  

1

It trivially holds

16

Inductive hypothesis:

R Rk 

Assume that

n k   1

for all

slide-9
SLIDE 9

9

17

Inductive step:

R Rn 

1

We will prove

1

) , (

n

R b a

Take arbitrary We will show

R b a  ) , (

18

1

) , (

n

R b a R R b a

n 

 ) , (

n

R b x R x a x     ) , ( ) , ( : R b x R x a x     ) , ( ) , ( : R b a  ) , (

End of Proof

definition of power definition of composition inductive hypothesis

R Rn 

is transitive

R