Uploaded by trdxd19

Discrete Mathematics: Functions Lecture Slides

advertisement
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
Download