Docsity

Functions and Inverses Discrete Structures, Slides of Discrete Structures and Graph Theory

Partial preview of the text

Download Functions and Inverses Discrete Structures and more Slides Discrete Structures and Graph Theory in PDF only on Docsity!

Functions and Inverses

CS 2800: Discrete Structures, Spring 2015 Sid Chaudhuri

Recap: Relations and Functions

โ— A relation between sets A (the domain ) and B (the codomain ) is a set of ordered pairs (a, b) such that a โˆˆ A, b โˆˆ B (i.e. it is a subset of A ร— B)

  • (^) The relation maps each a to the corresponding b โ— (^) Neither all possible a 's, nor all possible b's, need be covered
  • (^) Can be one-one, one-many, many-one, many-many Alice Bob Carol CS 2800 CS 2110 CS 3110 David

A B

Cartesian product

Recap: Relations and Functions

โ— Instead of writing the function f as a set of pairs, we usually specify its domain and codomain as: f : A โ†’ B โ€ฆ and the mapping via a rule such as: f (Heads) = 0.5, f (Tails) = 0. or f : x โ†ฆ x 2 The function f maps x to x 2

Recap: Relations and Functions

โ— Instead of writing the function f as a set of pairs, we usually specify its domain and codomain as: f : A โ†’ B โ€ฆ and the mapping via a rule such as: f (Heads) = 0.5, f (Tails) = 0. or f : x โ†ฆ x 2 โ— Note: the function is f, not f(x)!

  • (^) f(x) is the value assigned by the function f to input x x f(x) f

Recap: Surjectivity

โ— A function if surjective (onto) if every element of the codomain has a preimage in the domain

  • (^) That is, for every b โˆˆ B there is some a โˆˆ A such that f(a) = b
  • (^) That is, the codomain is equal to the range/image Spring Summer Autumn

A B

Winter August September October November December January February March April May June July

Recap: Surjectivity

โ— A function if surjective (onto) if every element of the codomain has a preimage in the domain

  • (^) That is, for every b โˆˆ B there is some a โˆˆ A such that f(a) = b
  • (^) That is, the codomain is equal to the range/image Still Winter Road Construction Almost Winter

A B

Winter August September October November December January February March April May June July (Ithaca etc)

Composition of Functions

x y z 1 2 3 Even Odd A B C g f โ— The composition of two functions f : B โ†’ C g : A โ†’ B is the function f โ—‹ g : A โ†’ C defined as f โ—‹ g : x โ†ฆ f ( g (x) )

Composition of Functions

โ— The composition of two functions f : B โ†’ C g : A โ†’ B is the function f โ—‹ g : A โ†’ C defined as f โ—‹ g : x โ†ฆ f ( g (x) ) x y z Even Odd A C f โ—‹ g g โ—‹ f is not possible unless A = C!

Left Inverse of a Function

โ— g : B โ†’ A is a left inverse of f : A โ†’ B if g ( f (a) ) = a for all a โˆˆ A

  • (^) If you follow the function from the domain to the codomain, the left inverse tells you how to go back to where you started a (^) f(a) f A (^) B

Left Inverse of a Function

โ— g : B โ†’ A is a left inverse of f : A โ†’ B if g ( f (a) ) = a for all a โˆˆ A

  • (^) If you follow the function from the domain to the codomain, the left inverse tells you how to go back to where you started a (^) f(a) f

A? B

Right Inverse of a Function

โ— h : B โ†’ A is a right inverse of f : A โ†’ B if f ( h (b) ) = b for all b โˆˆ B

  • (^) If you're trying to get to a destination in the codomain, the right inverse tells you a possible place to start b A (^) B

Right Inverse of a Function

โ— h : B โ†’ A is a right inverse of f : A โ†’ B if f ( h (b) ) = b for all b โˆˆ B

  • (^) If you're trying to get to a destination in the codomain, the right inverse tells you a possible place to start b A (^) B

f

Right Inverse of a Function

โ— h : B โ†’ A is a right inverse of f : A โ†’ B if f ( h (b) ) = b for all b โˆˆ B

  • (^) If you're trying to get to a destination in the codomain, the right inverse tells you a possible place to start h(b) (^) b f h A (^) B

Note the subtle difference!

โ— The left inverse tells you how to exactly retrace your steps, if you managed to get to a destination

  • (^) โ€œSome places might be unreachable, but I can always put you on the return flightโ€ โ— The right inverse tells you where you might have come from, for any possible destination
  • (^) โ€œAll places are reachable, but I can't put you on the return flight because I don't know exactly where you came fromโ€