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