Upload
ali
View
214
Download
0
Embed Size (px)
Citation preview
8/19/2019 Discrete 2.3_2
1/19
Sec 2.3 Functions
Definition 1
Let A and B be nonempty sets. A function f from A to B is anassignment of exactly one element of B to each element of A. We write f (a) = b if b is the unique element of B assigned by the function f to the element a of A. If f is a function from A to B, we write f : A → B .
Remark: Functions are sometimes also called mappings ortransformations.
A function f : A → B can also be defined in terms of a relation fromA to B which is just a subset of A
×B .
A function f : A → B is defined in terms of a relation from A to B needs to contains one, and only one, ordered pair (a, b ) for everyelement a ∈ A.
See Figure 2 Page 134.
NADIA ALDHAMRI () 1 / 19
8/19/2019 Discrete 2.3_2
2/19
Sec 2.3 Functions
Definition 2
If f is a function from A to B, we say that A is the domain of f and B is the codomain of f . If f (a) = b, we say that b is the image of a and a is apreimage of b. The range of f is the set of all images of elements of A.Also, if f is a function from A to B, we say that f maps A to B.
Two functions are equal when they have the same domain, have thesame codomain, and map element of their common domain to thesame elements in their common codomain.
•Exercise 2 page 146: Determine whether f is a function from Z to R if.a)f (n) =
±n b)f (n) =
√ n2 + 1 c)f (n) = 1/(n2
−4).
NADIA ALDHAMRI () 2 / 19
8/19/2019 Discrete 2.3_2
3/19
Sec 2.3 Functions
•Exercise 6 page 146: Find the domain and range of these functions.a) the function that assigns to each pair of positive integers the first
integer of the pairb) the function that assigns to each positive integer its largest decimal
digitc) the function that assigns to a bit sting the number of ones minus the
number of zeros in the stringd) the function that assigns to each positive integer the largest integernot exceeding the square root of the integer.
e) the function that assigns to a bit string the longest stings of ones inthe strings.
NADIA ALDHAMRI () 3 / 19
8/19/2019 Discrete 2.3_2
4/19
Sec 2.3 Functions
Definition 3
Let f 1 and f 2 be functions from A to R. Then f 1 + f 2 and f 1f 2 are also functions from A to R defined by • (f 1 + f 2)(x ) = f 1(x ) + f 2(x ), • f 1f 2(x ) = f 1(x )f 2(x ).
Definition 4
Let f be a function from the set A to the set B and let S be a subset of A.The image of S under the function f is the subset of B that consists of the images of the elements of S. We denote the image of the S by f (S ), so
f (S ) =
{t
| ∃s
∈ S (t = f (s ))
}.
We also use the shorthand {f (s ) | s ∈ S } to denote this set.Remark:f (S ) denotes a set, and not the value of the function f for theset S .
NADIA ALDHAMRI () 4 / 19
8/19/2019 Discrete 2.3_2
5/19
Sec 2.3 Functions: One-to-One and Onto Functions
Definition 5
A function f is said to be one-to-one , or injective , if and only if f (a) = f (b ) implies that a = b for all a and b in the domain of f . Afunction is said to be an injection if it is one-to-one .
Contrapositive of the implication in the definition: A function f
is one-to-one if and only if f (a) = f (b ) whenever a = b .Remark: Expressing f is one-to-one using quantifiers as∀a∀b (f (a) = f (b ) → a = b ) or equivalently∀a∀b (a = b → f (a) = f (b )), where the universe of discourse is thedomain of the function.
NADIA ALDHAMRI () 5 / 19
8/19/2019 Discrete 2.3_2
6/19
Sec 2.3 Functions
•Exercise 10 page 146: Determine whether each of these function from
{a, b , c , d
} to itself is one-to-one.
a) f (a) = b , f (b ) = a, f (c ) = c , f (d ) = d .b) f (a) = b , f (b ) = b , f (c ) = d , f (d ) = c c) f (a) = d , f (b ) = b , f (c ) = c , f (d ) = d
NADIA ALDHAMRI () 6 / 19
8/19/2019 Discrete 2.3_2
7/19
Sec 2.3 Functions: Some conditions that guarantee that a
function is one-to-one
Definition 6
A function f whose domain and codomain are subsets of the set of real numbers is called increasing if f (x ) ≤ f (y ), and strictly increasing if f (x ) < f (y ), whenever x f (y ), whenever x
8/19/2019 Discrete 2.3_2
8/19
Sec 2.3 Functions
•Exercise 12 page 146: Determine whether each of these functions fromZ to Z is one-to-one.
a)f (n) = n − 1 b)f (n) = n2 + 1 c)f (n) = n3•Example 1 What are the truth values of these propositions? Justify youranswers.
A function that is increasing but not strictly increasing is necessary
one-to-one. [ ]A function that is strictly increasing or is strictly decreasing must beone-to-one. [ ]A function that is decreasing but not strictly decreasing is notnecessary one-to-one. [ ]
NADIA ALDHAMRI () 8 / 19
8/19/2019 Discrete 2.3_2
9/19
Sec 2.3 Onto Functions
Definition 7A function f from A to B is called onto or surjective, if and only if for every element b ∈ B there is an element a ∈ A with f (a) = b. A functionf is called a surjection if it is onto.
•Remark: A function f is onto if ∀y ∃x (f (x ) = y ), where the domain of x is . . . and the domain of y is . . . .
•Question: What is the relation between the codomain and therange of the onto function?
NADIA ALDHAMRI () 9 / 19
8/19/2019 Discrete 2.3_2
10/19
Sec 2.3 Functions
• Exercise 14 pages 146-147: Determine whether f : Z × Z → Z is ontoif
a)f (m, n) = 2m − n b)f (m, n) = m2 − n2 c)f (m, n) = m + n − 1d)f (m, n) = |m| − |n| e)f (m, n) = m2 − 4
Definition 8
The function f is a one-to-one correspondence, or a bijection, if it is bothone-to-one and onto.
Question: Give an example of a bijective function.Question: is the identity function ιA on a set A,
ιA : A → A where ιA(x ) = x for all x ∈ A,a bijection?
NADIA ALDHAMRI () 10 / 19
8/19/2019 Discrete 2.3_2
11/19
Sec 2.3 Functions
• Exercise 18 page 147: Determine whether each of these functions is abijection from R to R.
a)f (x ) = −3x + 4 b)f (x ) = −3x 2 + 7 c)f (x ) = (x + 1)/(x + 2)d)f (x ) = x 5 + 1.
NADIA ALDHAMRI () 11 / 19
8/19/2019 Discrete 2.3_2
12/19
Sec 2.3 Functions: Inverse Functions and Compositions of
Functions
Definition 9
Let f be a one-to-one correspondence from the set A to the set B . The inverse function of f is the function that assigns to an element b belonging to B the unique element a in A such that f (a) = b. The inverse functionof f is denoted by f −1. Hence, f −1(b ) = a when f (a) = b.
A one-to-one correspondence is called invertible because . . . . . . .
A function is not invertible if it is . . . . . . .
•See Remark Page 139 and Figure 6:
NADIA ALDHAMRI () 12 / 19
8/19/2019 Discrete 2.3_2
13/19
Sec 2.3 Functions
Definition 10
Let g be a function from the set A to the set B and let f be a functionfrom the set B to the set C. The composition of the functions f and g ,denoted by f ◦ g, is defined by (f ◦ g )(x ) = f (g (x )).•Exercise 32 page 147: Find f ◦ g and g ◦ f , where f (x ) = x 2 + 1 and
g (x ) = x + 2, are functions from R to R.
•See Remark Page 141 and Figure 7:
NADIA ALDHAMRI () 13 / 19
8/19/2019 Discrete 2.3_2
14/19
Sec 2.3 Functions: The Graphs of Functions
Definition 11
Let f be a function from the set A to the set B . The graph of the functionf is the set of ordered pairs {(a, b ) | a ∈ A and f (a) = b }.
•Exercise 58 page 148: Draw the graph of the function f (n) = 1 − n2from Z to Z.
NADIA ALDHAMRI () 14 / 19
8/19/2019 Discrete 2.3_2
15/19
Sec 2.3 Functions: Some Important Functions
Definition 12
The floor function assigns to the real number x the largest integer that is less than or equal to x. The value of the floor function at x is denoted by x . The ceiling function assigns to the real number x the smallest integer that is greater than or equal to x. The value of the ceiling function at x is denoted by x .•Example 2: Draw the graph of the functions f (x ) = x and f (x ) = x from R to R.
NADIA ALDHAMRI () 15 / 19
8/19/2019 Discrete 2.3_2
16/19
Sec 2.3 Functions: Table 1:Properties of the Floor and
Ceiling Functons
Table 1 Useful Properties of the Floor and Ceiling Func-tions (n is an integer)
(1a)x = n if and only if n ≤ x
8/19/2019 Discrete 2.3_2
17/19
Sec 2.3 Functions
•Example 27 page 145: Prove that if x is a real number, then
2x
=
x
+
x + 12
.
•Exercise 60 page 148: Draw the graph of the function f (x ) = x /2from R to R.
•Exercise 69 Pages 148-149: Prove or disprove each of these statement:
b)2x = 2x whenever x is a real number.d)xy = x y for all real numbers x and y .
NADIA ALDHAMRI () 17 / 19
S 2 3 F i
8/19/2019 Discrete 2.3_2
18/19
Sec 2.3 Functions
•Example 29 Page 145: The factorial function f : N → Z+, denoted byf (n) = n!.
•Exercise 16 page 147: Give an example of function from N to N that isone-to-one but not onto.onto but not one-to-one.both one-to-one and onto (but different from the identity function).
neither one-to-one nor onto.
Exercise 36 page 147: Let f be a function from the set A to the set B .Let S and T be subsets of A. Show that
a)f (S ∪ T ) = f (S ) ∪ f (T ).b)f (S ∩ T ) ⊆ f (S ) ∩ f (T )
NADIA ALDHAMRI () 18 / 19
8/19/2019 Discrete 2.3_2
19/19