ISTANBUL AYDIN UNIVERSITY FACULTY OF ENGINEERING ELECTRICAL & ELECTRONICS ENGINEERING DEPT. EEE247: DISCRETE MATHEMATICS 6. Functions Instructor: Assist. Prof. Dr. Mohammed ALKRUNZ Electrical & Electronics Engineering Dept. Functions,,, ο§ From calculus, you are familiar with the concept of a real-valued function “π”, which assigns to each number π₯ ∈ β a particular value π¦ = π(π₯), where π¦ ∈ β. ο§ But, the notion of a function can also be naturally generalized to the concept of assigning elements of any set to elements of any set. Formal Definition: ο§ For any set, A, B, we say that a function π from (or “mapping”) A to B (π. π΄ → π΅) is a particular assignment of exactly one element π(π₯) ∈ π΅ to each element π₯ ∈ π΄. ο§ Two inputs could give one output such as π¦ = π₯ 2 , but it is not possible for one input to give two outputs. (i.e., two locations at one time) 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 2 Functions,,, Graphical Representations: ο§ Functions can be represented graphically in several ways: π a π π =π π A B “Venn Diagram” 28 November 2022 “Bipartite Graph” Dr. M. Alkrunz EEE247: Discrete Mathematics “Plot” 3 Functions,,, Functions that we’ve seen so far: ο§ A proposition can be viewed as a function from “situation” to truth values. ο A logic system called “Situation Theory”. ο π ≡ "ππ‘ ππ πππππππ“, s ≡ "ππ’π π ππ‘π’ππ‘πππ βπππ, πππ€“ ο π π ∈ π, πΉ ο§ A propositional operator can be viewed as a function from ordered pairs of truth values to truth values: π ο ∨ πΉ, π ο → π, πΉ 28 November 2022 =π =πΉ π» π Dr. M. Alkrunz EEE247: Discrete Mathematics π(π₯) ∨ π π» 4 Functions,,, Functions that we’ve seen so far: ο§ A predicate can be viewed as a function from objects to propositions (or truth values): ο π ≡ "ππ 7 ππππ‘ π‘πππ“, ο π ππππ ≡ "ππππ ππ 7 ππππ‘ π‘πππ“ ≡ πΉπππ π ο§ A bit string of length “n” can be viewed as a function from the numbers 1, 2, … , π (bit positions) to the bits 0, 1 ο π΅ = 101, π‘βππ π΅ 3 = 1 ο§ A set "π“ over universe “π” can be viewed as a function from the elements of “π” to π, πΉ ο π= 3, 28 November 2022 π 0 = πΉ, π 3 =π Dr. M. Alkrunz EEE247: Discrete Mathematics 5 Functions,,, Functions that we’ve seen so far: ο§ A set operator such as “β, β, −” can be viewed as a function from pairs of sets to sets. οβ 1, 3 , 3, 4 = 3 Some Functions Terminology: ο§ If π. π΄ → π΅ and π π = π, where (π ∈ π΄ and π ∈ π΅), then: ο ο ο ο “A” is the domain of π. “B” is the codomain of π. “b” is the image of “a” under π. “a” is a pre-image of “b” under π. 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics In general, “b” may have more than 1 pre-image 6 Functions,,, Range V.S. Codomain: ο§ Suppose I declare to you that: “π is a function mapping students in this class to the set of grades π΄, π΅, πΆ, π·, πΉ ” οΌ At this point (without exam), the codomain of π is: π¨, π©, πͺ, π«, π , and its range is: unknown. οΌ Suppose that grades turns out all A’s and B’s, then the range of π will be π΄, π΅ , but its codomain is: π΄, π΅, πΆ, π·, πΉ . οΌ On other hand, the range is the actual output. οΌ The range: π ⊆ π΅ of π is π ∃π π π = π 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 7 Functions,,, Constructing Function Operators ο± If • (“dot”) is any operator over B, then we extend • to also denote an operator over functions π. π΄ → π΅. ο E.g., Given any binary operator •: π΅ × π΅ → π΅, and functions π, π. π΄ → π΅, we define π•π : π΄ → π΅ to be the function defined by ∀π ∈ π΄, π•π π = π π •π π . ο± +, × (“plus”, “times”) are binary operators over R. (Normal addition and multiplication). ο Therefore, we can also add and multiply functions π, π. π → π ο π + π : π → π , where π + π π₯ = π π₯ + π π₯ ο π × π : π → π , where π × π π₯ = π π₯ × π π₯ 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 8 Functions,,, Constructing Function Operators ο± For functions π: π΄ → π΅ and π: π΅ → πΆ, there is a special operator called “Compose, β ”. [Composition Function] ο It composes (creates) a new function out of π, π by applying π to the results of π. ο π β π : π΄ → πΆ, where π β π π = π(π π ). ο Note π(π) ∈ π΅, So π(π π ) is defined and ∈ πΆ. ο Note that “β” (like Cartesian ×, but unlike +, ∧, ∪) is non-commuting. (Generally, π β π ≠ π β π 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 9 Functions,,, Example: Let π π₯ = 2π₯ + 3 and π π₯ = 3π₯ + 2, then: ο πβπ π₯ =π π π₯ = 2 3π₯ + 2 + 3 = 6π₯ + 4 + 3 = 6π₯ + 7 ο πβπ π₯ =π π π₯ = 3 2π₯ + 3 + 2 = 6π₯ + 9 + 2 = 6π₯ + 11 One-to-One Functions: ο± A function is one-to-one (1-1), or injective, or an injection iff every element of its range has only one pre-image. ο± Formally, given π: π΄ → π΅, π₯ is injective” βΆ≡ ¬∃π₯, π¦ π₯ ≠ π¦ ∧ "π(π₯) = π(π¦)" ο± I mean, there no exist two pre-images give one image. 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 10 Functions,,, ο± Only one element of the domain is mapped to any given one element of the range. ο± Domain and range have the same cardinality. What about the codomain?!! [it could be greater or equal to the range) ο± Each element of the domain is injected into a different element of the range. 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 11 Functions,,, Example: “one – to – one ” 28 November 2022 Not “one – to – one ” Not “one – to – one ” Two pre-images give one image One input gives two outputs (not a function) Dr. M. Alkrunz EEE247: Discrete Mathematics 12 Functions,,, Sufficient Condition for (1-1) Functions: ο± For functions π over numbers, ο π is strictly (or monotonically) increasing iff π₯ > π¦ → π π₯ > π(π¦) for all π₯, π¦ in the domain. ο π is strictly (or monotonically) decreasing iff π₯ > π¦ → π π₯ < π(π¦) for all π₯, π¦ in the domain. Strictly Increasing Function π(π) π(π) π(π) π(π) π 28 November 2022 Strictly Decreasing Function π π Dr. M. Alkrunz EEE247: Discrete Mathematics π 13 Functions,,, ο If π is either strictly increasing or strictly decreasing, then π is one to one. ο± Example: π₯ 3 ο± Converse is not necessarily true. Example: 1Τπ₯ [at zero we have 2 values] 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 14 Functions,,, Onto Functions: ο± A function π. π΄ → π΅ is onto or surjective or surjection iff its range is equal to its codomain. ο± ∀ π ∈ π΅, ∃ π ∈ π΄: π π = π [I mean there exist a value in the domain produce the range, or all elements in the codomain could be produced from domain]. ο± An Onto function maps the set A onto (over, covering) the entirely of the set B, not just over a piece of it. ο± E.g., for domain and codomain “R”, π₯ 3 is Onto, whereas π₯ 2 is not [WHY?!!] οΌ In π₯ 3 , the range and codomain is the real numbers, R. οΌ In π₯ 2 , the range and codomain is not the real numbers, R. Namely, the codomain is the real numbers while the range is the positive real numbers. 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 15 Functions,,, Example: 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 16 Functions,,, Bijections: ο± A function π is one-to-one correspondence, or a bijection, or reversible, or invertible, iff it is both One-to-one and Onto. ο± For bijections π: π΄ → π΅, there exists an inverse of π, written π −1 : π΄ → π΅ which is the unique function such that π −1 β π = πΌ (identity Function) Identity Function: ο± For any domain “A”, the identity function πΌ: π΄ → π΄ (written as, πΌπ΄ ) is the unique function such that (∀ π ∈ π΄: πΌ π = π) οΌ Examples: adding to zero, multiplying by one, AND with true, OR with false, Union with null, Intersection with domain. 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 17 Functions,,, A couple of Key Functions: ο± In discrete math, we will frequently use the following functions over real numbers: ο π₯ (“floor of x”) is the largest (greatest integer function) integer ≤ π₯. ο π₯ (“ceiling of x”) is the smallest integer ≥ π₯. Visualizing Floor and Ceiling Functions: ο± Real numbers “fall to their floor” or “rise to their ceiling”. ο± Note that if π₯ ∉ π, then −π₯ ≠ − π₯ and −π₯ ≠ − π₯ ο± Note that if π₯ ∈ π, then π₯ = π₯ = π₯. −π π 1.6 =…., π −1.4 =….., −π −1.4 =….., −π −3 = −3 =….. ο± Example: 1.6 =…., 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 18 Functions,,, Plots with Floor/Ceiling: ο Sets that do not include all of their limit points are called “Open Sets”. ο In a plot, we draw a limit point of a curve using an open dot (circle) if the limit point is not on the curve, and with a closed dot (solid) if it is on the curve. π π 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 19 Exercise,,, 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 20 *Questions 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 21 *Thanks 28 November 2022 Dr. M. Alkrunz EEE247: Discrete Mathematics 22