830 likes | 1.02k Views
Foundations of Discrete Mathematics. Chapter 3. By Dr. Dalia M. Gil, Ph.D. Function. A function from a set A to a set B is a binary relation f from A to B with the property that, For every a A, there is exactly one b B such that (a, b) f. Function.
E N D
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
Function • A function from a set A to a set B is a binary relation f from A to B with the property that, • For every a A, there is exactly one b B such that (a, b) f.
Function • A function f can see as a subset of A x B with the property that for each a A, • there is just one pair (a, b) in f having first coordinate a.
Function • If A = {1, 2, 3}, B = {x, y}, and f={(1,x), (2, y), (3,x)}, then f is just the rule that associates x with 1, y with 2, and x with 3.
Function: Key Points • Everya in A must be the first coordinate of an ordered pair in the function. • A = {1, 2, 3} and B = {x, y}, the set g={(1,x),(3,y)} is not a function from A to B. • g contains no ordered pair with first coordinate 2.
Function: Key Points 2.Each element of A must be the first coordinate of exactly one ordered pair (no repetition). • A = {1, 2, 3} and B = {x, y}, the set h={(1,x),(2,x),(3,y),(2,y)} is not a function from A to B. • 2 is the first coordinate of two pairs.
Function: Example 1 • Suppose A is the set of surnames of people listed in the Salt Lake City telephone directory f = {(a, b)| a is on page n} is a function from A to the set of natural numbers?
Function: Example 1 • By definition of f, each element of A is the first coordinate of a pair in f, so • Some surnames are undoubtedly listed on a number of different page. • f is not a function.
Function • f is a function from A to B, • each b B, which is uniquely determined by the element a A, • b is denoted f(a) and called the image of a. (a, b) f if and only if b = f(a).
Function Notation f : A → B • It means that f is a function from A to B. • A and B are sets.
Function Notation f : a b • It means that f(a) = b • a and b are elements.
Function Notation f = { (1, x), (2, y), (3, x)} could be described by x y z 1 f: 2 3
Function Notation f = x2 f: R →R that associates with any x R, its square x2; that is, x x2 f = { (x, x2) | x R} as a binary relation.
Functions Let f : A → B be a function from A to B. • The domain of f (dom f) is the set A. • The target of f is the set B.
Functions Let f : A → B be a function from A to B. • The range or image of f (rng f) is rng f ={b B| (a, b) f for some a A} ={b B| b = f(a) for some a A}
Onto Function • A function is onto or surjective if its range is the target, rng f = B • every b B is of the form b = f (a) for some a A
Onto Function • For any b B, the equation b = f(x) has a solution a A.
One-to-One Function A function is one-to-one (1-1) or injective if and only if different elements of A have different images. • a1 ≠ a2→ f(a1) ≠ f(a2) • If f(a1) = f(a2), then a1 = a2
Bijective Function A function is bijection or bijective if it is both • one-to-one and • onto.
One-to-One Function If f(a1) = f(a2), then a1 = a2 a1 ≠ a2→ f(a1) ≠ f(a2)
Example : Discrete Function A={1, 2, 3, 4}, B ={x, y, z} and f = {(1,x),(2,y), (3, z), (4, y)} The f is a function A → B Domain: A and target: B rng f = {x, y, z} = B, f is onto f(2) =f(4) = y but 2 ≠ 4, f is not one-to-one
Example : Discrete Function A={1, 2, 3}, B ={x, y, z, w} and f = {(1,w),(2,y), (3, x)} The f is a function A → B Domain: A and target: B rng f = {x, y, w} ≠ B, f is not onto f(1) ≠ f(2) ≠ f(3), f is one-to-one
Example : Discrete Function A={1, 2, 3}, B ={x, y, z} and f = {(1,z),(2,y), (3, y)} and g = {(1,z), (2,y), (3,x)} f and g are functions A → B dom f = dom g = A and target B rng f = {z, y} ≠ B, f is not onto rng g = {z, y, x} = B, g is onto
Example : Discrete Function A={1, 2, 3}, B ={x, y, z} and f = {(1,z),(2,y), (3, y)} and g = {(1,z), (2,y), (3,x)} f and g are functions A → B f(2) = f(3), 2 ≠ 3, f is not one-to-one g(1) ≠ g(2) ≠ g(3), g is one-to-one
Example : Discrete Function Let f: Z → Z by f(x)= 2x – 3 dom f = Z and target Z To find rng f, note that brng f ↔ b = 2a – 3 for some integer a ↔ b = 2a – 3 – 1 + 1 ↔ b = 2(a – 2) + 1 for some integer a if and only if b is odd.
Example : Discrete Function Let f: Z → Z by f(x)= 2x – 3 dom f = Z and target Z The range of f is the set of odd integers f ≠ Z, f is not onto brng f ↔ b = 2a – 3 if and only if b is odd.
Example : Discrete Function Let f: Z → Z by f(x)= 2x – 3 dom f = Z and target Z f is one-to-one. if f(x1) = f(x2), then 2x1 – 3 = 2x2 – 3 and x1 = x2
Example : Discrete Function Let f: N → N by f(x)= 2x – 3 f(1) = 2(1) – 3 = -1 and -1 N Hence, no function has been defined.
Problem about a Function Define f: Z → Z by f(x)= x2 – 5x +5 Determine whether f is one-to-one and/or onto. Consider f(x1) = f(x2) x12 – 5x1 + 5 = x22 – 5x2 + 5 x12 – x22= 5x1 – 5x2 + 5 – 5 (x1 – x2)(x1 + x2) = 5(x1 – x2)
Problem about a Function Define f: Z → Z by f(x)= x2 – 5x +5 (x1 – x2)(x1 + x2) = 5(x2 – x1) (x1 + x2) = 5 There are solutions with x1 ≠ x2. Any x1, x2 satisfying x1 + x2 = 5
Problem about a Function Define f: Z → Z by f(x)= x2 – 5x +5 (x1 + x2) = 5 x1 = 2, x2 =3, x1 + x2 = 5 Since f(2) = f(3) = -1, f is not one-to-one
Problem about a Function Define f: Z → Z by f(x)= x2 – 5x +5 f(x)= x2 – 5x +5, x R, • is a parabola with vertex (5/2, -5/4) • any integers < -1 is not in rng f • 0 is not in rng f because x2 – 5x +5 = 0 has not integer solutions. f is not onto.
The Identity Function For any set A, the identity function on A is the function A : A → A defined by A(a) = a for all a A. In terms of ordered pairs A = {(a, a) | a A } A is read “yota sub A”
The Identity Function The identity function on a set A is one-to-one If (a1) = (a2), then a1 = a2 , [(a1) = a1 and (a2) = a2 ], so is one-to-one
The Identity Function The identity function on a set A is onto the equation a = (x) has a solution for any a. If x = a, then (x) = (a) = a so is onto
The Absolute Value Function The absolute value of a number x, denoted |x|, is defined by x if x ≥ 0 |x|= -x if x < 0
The Absolute Value Function The domain R and range [0, ) = {y R | y ≥ 0}. It is not one-to-one For example |2| = |-2|
The Floor Function For any real number x, the floor of x, written x, is the greatest integer less than or equal to x, that is, the unique integer x satisfying x – 1 < x x
The Floor Function x – 1 < x x 2.01 = 2, 15 = 15, 1.99 = 1, -2.01 = -3
The Ceiling Function For any real number x, the ceiling of x, written x, is the least integer greater than or equal to x, that is, the unique integer x satisfying x x <x + 1
The Ceiling Function x x <x + 1 2.01 = 3, 15 = 15, 1.99 = 2, -2.01 = -2
The Inverse of a Function A function f: A → Bhas an inverse if and only if the set obtained by reversing the ordered pairs of f is a function B → A.
The Inverse of a Function If f: A → B has an inverse, the function f -1= {(a, b) | (a, b) f} is called the inverse of f.
The Inverse of a Function If f: A → B has an inverse, then f -1 has an inverse that is f ( f -1 )-1= f is called the inverse of f. If A= {1, 2, 3, 4} and B = {x, y, z, t} f ={(1, x), (2, 2), (3, z), (4, t)} f -1 ={(x,1), (y, 2), (z, 3), (4, t)}
The Inverse of a Function A function f: A → B has an inverse, B →A if and only if f is one-to-one and onto.
The Inverse of a Function For any function g (x, y) g y = g(x) (b, a) f -1 a = f -1(b) a= f-1(b) ↔ (b, a) f-1↔ (a, b) f ↔ b = f(a) a= f -1(b) if and only if f(a) = b a= f -1(b) ↔ f(a) = b
The Inverse of a Function Example 1, For f , = f -1(-7), then f() = 7 Example 2, For f , f(4) = 2, then 4 = f -1(2)
The Inverse of a Function If: R → Ris defined by f(x) = 2x – 3 is one-to-one and onto, so an inverse function exists. if y = f -1(x), then x = f(y) = 2y – 3 Thus, y = ½(x + 3) = f -1(x)
The Inverse of a Function Let A = {x R | x 0}, B = {x R | x ≥ 0}, and define f: A → B by f(x) = x2 This squaring function with domain restricted so that is one-to-one as well as onto. Since f is one-to-one and onto, it has an inverse.
The Inverse of a Function f: R → R+ by f(x) = 3x is one-to-one and onto. Find the f-1(x) y = f -1(x) f(y) = x 3y = x y = log3 x f-1 (x) = log3 x