Download Properties of Functions: Definitions, Special Functions, Inverse Functions, Composition - and more Exams Discrete Structures and Graph Theory in PDF only on Docsity! Functions, Complexity of Algorithms Section 1.8 Functions Functions 2 Definitions Function: Let A and B be sets. A function (mapping, map) f from A to B, denoted f : A → B, is a subset of A×B, and is a rule that assigns to each element a ∈ A exactly one element f(a) ∈ B, called the value of f at a. f associates with each x in A one and only one y in B We also say that f: A→B is a mapping from domain A to codomain B. A is called the domain and B is called the codomain. Functions 5 Definitions Example 2: Sequence of functions from R to R. Falling powers: xn = x(x - 1) · · · (x - n + 1). Example 3: C compiler maps the set of ASCII strings to the boolean set. Functions 6 Special Functions The floor function, denoted f ( x) = ⎣x⎦ or f(x) = floor(x), is the largest integer less than or equal to x. Note: the floor function is equivalent to truncation for positive numbers. The ceiling function, denoted f ( x) = ⎡x⎤ or f(x) = ceiling(x), is the smallest integer greater than or equal to x. Note: the ceiling function is equivalent to truncation for negative numbers. Functions 7 Properties of Functions Let f be a function from A to B. Definition: f is one-to-one (denoted 1-1) or injective if and only if f(x1)=f(x2) imply x1=x2. Note: this means that if a ≠ b then f(a) ≠ f(b). Definition: f is onto or surjective if every y in B has a preimage. Note: this means that for every y in B there must be an x in A such that f(x) = y. Definition: f is bijective if it is surjective and injective (one-to-one and onto). Functions 10 Properties of Functions Examples: Let A = B = R, the reals. Determine which are injections, surjections, bijections: f(x) = x f(x) = x2 f(x) = x3 f(x) = | x | Functions 11 Inverse Functions Definition: Let f be a bijection from A to B. Then the inverse of f, denoted f-1, is the function from B to A defined as f-1(y) = x iff f(x) = y Note: No inverse exists unless f is a bijection. Functions 12 Inverse Functions Example: Let f be defined by the diagram: