Uploaded by trdxd19

Lecture 6

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