Functions Lecture 12 A B f( ) =
Functions function, f, from set A to set B associates an element, with an element The domain of f is A. The codomain of f is B. For every input there is exactly one output.
Functions
f(S) = |S| f(string) = length(string) f(student) = student-ID f(x) = is-prime(x)
≤ 1 arrow in A B f( ) = Injections (one-to-one) is an injection iff every element of B is f of at most 1 thing |A| ≤ |B|
Surjections (Onto) A B 1 arrow in is a surjection iff every element of B is f of something f( ) = |A| ≥ |B|
Bijections A B is a bijection iff it is surjection and injection. f( ) = exactly one arrow in |A| = |B|
Functions a. One-to-one,b. Onto,c. One-to-one,d. neitherd. Not a Not ontonot one-to-one and ontofunction a1aa1a1 1 b2b1b2b2a2b2b1b2b2a2 c3c2c3c3b3c3c2c3c3b3 4d3d4d4c44d3d4d4c4 8
FunctionDomainCodomainInjective?Subjective?Bijective? f(x)=sin(x)Real f(x)=2 x RealPositive real f(x)=x 2 RealPositive real Reverse string Bit strings of length n In-Class Exercises
Inverse Sets A B Given an element y in B, the inverse set of y := f -1 (y) = {x in A | f(x) = y}.
Inverse Function A B f( ) = exactly one arrow in Informally, an inverse function f -1 is to “undo” the operation of function f. There is an inverse function f -1 for f if and only if f is a bijection.
Composition of Functions Two functions f:X->Y’, g:Y->Z so that Y’ is a subset of Y, then the composition of f and g is the function g 。 f: X->Z, where g 。 f(x) = g(f(x)). X Y Z Y’
Function fFunction gInjective?Subjective?Bijective? f:X->Y f subjective g:Y->Z g injective f:X->Y f subjective g:Y->Z g subjective f:X->Y f injective g:Y->Z g subjective f:X->Y f bijective g:Y->Z g bijective f:X->YF -1 :Y->X In-Class Exercises