DOC PREVIEW
UVA CS 202 - Functions

This preview shows page 1-2-15-16-17-32-33 out of 33 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

FunctionsDefinition of a functionFunction terminologyMore functionsEven more functionsFunction arithmeticOne-to-one functionsMore on one-to-oneOnto functionsMore on ontoOnto vs. one-to-oneBijectionsIdentity functionsInverse functionsMore on inverse functionsCompositions of functionsSlide 18Slide 19Slide 20Graphs of functionsUseful functionsRosen, question 8 (§1.8)Ceiling and floor propertiesCeiling property proofFactorialProving function problemsSlide 28Slide 29Slide 30Slide 31Quick surveySlide 33Slide 3411FunctionsFunctionsCS/APMA 202CS/APMA 202Rosen section 1.8Rosen section 1.8Aaron BloomfieldAaron Bloomfield22 Definition of a functionDefinition of a functionA function takes an element from a set A function takes an element from a set and maps it to a UNIQUE element in and maps it to a UNIQUE element in another setanother set33 Function terminologyFunction terminologyR Zf4.34DomainCo-domainPre-image of 4Image of 4.3f maps R to Zf(4.3)44 More functionsMore functions12345“a”“bb““cccc”“dd”“e”A string length functionABCDFAliceBobChrisDaveEmmaA class grade functionDomain Co-domainA pre-imageof 1The imageof A55 Even more functionsEven more functions12345“a”“bb““cccc”“dd”“e”Not a valid function!Also not a valid function!12345aeiouSome function…Range66 Function arithmeticFunction arithmeticLet fLet f11(x) = 2x(x) = 2xLet fLet f22(x) = x(x) = x22ff11+f+f22 = (f = (f11+f+f22)(x) = f)(x) = f11(x)+f(x)+f22(x) = 2x+x(x) = 2x+x22ff11*f*f22 = (f = (f11*f*f22)(x) = f)(x) = f11(x)*f(x)*f22(x) = 2x*x(x) = 2x*x22 = 2x = 2x3377 One-to-one functionsOne-to-one functions12345aeioA one-to-one function12345aeioA function that is not one-to-oneA function is one-to-one if each element in A function is one-to-one if each element in the co-domain has a unique pre-imagethe co-domain has a unique pre-image88 More on one-to-oneMore on one-to-oneInjective is synonymous with one-to-oneInjective is synonymous with one-to-one““A function is injective”A function is injective”A function is an injection if it is one-to-oneA function is an injection if it is one-to-oneNote that there can Note that there can be un-used elements be un-used elements in the co-domainin the co-domain12345aeioA one-to-one function99 Onto functionsOnto functions12345aeioA function that is not ontoA function is onto if each element in the A function is onto if each element in the co-domain is an image of some pre-imageco-domain is an image of some pre-image1234aeiouAn onto function1010 1234aeiouAn onto functionMore on ontoMore on ontoSurjective is synonymous with ontoSurjective is synonymous with onto““A function is surjective”A function is surjective”A function is an surjection if it is ontoA function is an surjection if it is ontoNote that there can Note that there can be multiply used be multiply used elements in the elements in the co-domainco-domain1111 Onto vs. one-to-oneOnto vs. one-to-oneAre the following functions onto, one-to-Are the following functions onto, one-to-one, both, or neither?one, both, or neither?1234abc123abcd1234abcd1234abcd1234abc1-to-1, not ontoOnto, not 1-to-1Both 1-to-1 and onto Not a valid functionNeither 1-to-1 nor onto1313 BijectionsBijectionsConsider a function that isConsider a function that isboth one-to-one and onto:both one-to-one and onto:Such a function is a one-to-one Such a function is a one-to-one correspondence, or a bijectioncorrespondence, or a bijection1234abcd1414 Identity functionsIdentity functionsA function such that the image and the A function such that the image and the pre-image are ALWAYS equalpre-image are ALWAYS equalf(x) = 1*xf(x) = 1*xf(x) = x + 0f(x) = x + 0The domain and the co-domain must be The domain and the co-domain must be the same setthe same set1515 Inverse functionsInverse functionsR Rf4.38.6Let f(x) = 2*xf-1f(4.3)f-1(8.6)Then f-1(x) = x/21616 More on inverse functionsMore on inverse functionsCan we define the inverse of the following Can we define the inverse of the following functions?functions?An inverse function can ONLY be done defined An inverse function can ONLY be done defined on a bijectionon a bijection1234abc123abcdWhat is f-1(2)?Not onto!What is f-1(2)?Not 1-to-1!1717 Compositions of functionsCompositions of functionsLet (f ○ g)(x) = f(g(x))Let (f ○ g)(x) = f(g(x))Let f(x) = 2x+3Let f(x) = 2x+3Let g(x) = 3x+2Let g(x) = 3x+2g(1) = 5, f(5) = 13g(1) = 5, f(5) = 13Thus, (f ○ g)(1) = f(g(1)) = 13Thus, (f ○ g)(1) = f(g(1)) = 131818 Compositions of functionsCompositions of functionsg ff ○ gg(a)f(a)(f ○ g)(a)g(a)f(g(a))aAB C1919 Compositions of functionsCompositions of functionsg ff ○ gg(1)f(5)(f ○ g)(1)g(1)=5f(g(1))=131RR RLet f(x) = 2x+3 Let g(x) = 3x+2f(g(x)) = 2(3x+2)+3 = 6x+72020 Compositions of functionsCompositions of functionsDoes f(g(x)) = g(f(x))?Does f(g(x)) = g(f(x))?Let f(x) = 2x+3Let f(x) = 2x+3Let g(x) = 3x+2Let g(x) = 3x+2f(g(x)) = 2(3x+2)+3 = 6x+7f(g(x)) = 2(3x+2)+3 = 6x+7g(f(x)) = 3(2x+3)+2 = 6x+11g(f(x)) = 3(2x+3)+2 = 6x+11Function composition is not commutative!Function composition is not commutative!Not equal!2121 Graphs of functionsGraphs of functionsLet f(x)=2x+1Plot (x, f(x))This is a plotof f(x)x=1f(x)=3x=2f(x)=52222 Useful functionsUseful functionsFloor: Floor: xx means take the greatest integer means take the greatest integer less than or equal to the numberless than or equal to the numberCeiling: Ceiling: xx means take the lowest integer means take the lowest integer greater than or equal to the numbergreater than or equal to the numberround(x) = floor(x+0.5)round(x) = floor(x+0.5)2323 Rosen, question 8 (§1.8)Rosen, question 8 (§1.8)Find these valuesFind these values1.11.11.11.1-0.1-0.1-0.1-0.12.992.99-2.99-2.99½+½+½½½½ + + ½½ + ½ + ½1122-1-10033-2-2½+1½+1 = = 3/23/2 = 1 = 10 + 1 + ½0 + 1 + ½ = = 3/23/2 = 2 = 22424 Ceiling and floor propertiesCeiling and floor propertiesLet n be an integerLet n be an integer(1a)(1a)xx = n if and only if n ≤ x < n+1 = n if and only if n ≤ x < n+1(1b)(1b)xx = n if and only if n-1 < x ≤ n = n if and only if n-1 < x ≤


View Full Document

UVA CS 202 - Functions

Download Functions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Functions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Functions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?