Functions EXERCISE
Functions EXERCISE
FUNCTION
DEF1:Let A and B be nonempty sets. A function f from A to B is an
assignment 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.
EXAMPLE Let f be the function that assigns the last two bits of a bit string of length 2
or greater to that
string. For example, f (11010) = 10. Then, the domain of f is the set of all bit strings of
length
2 or greater, and both the codomain and range are the set {00, 01, 10, 11}. ▲\
EXAMPLE Let f : Z → Z assign the square of an integer to this integer. Then, f (x) = x2,
where the domain
of f is the set of all integers, the codomain of f is the set of all integers, and the range of
f is
the set of all integers that are perfect squares, namely, {0, 1, 4, 9, . . . }.
Onto Function.
A function f from A to B is called onto, or a surjection, if and only if for every element
b ∈ B there is an element a ∈ A with f (a) = b.A function f is called surjective if it is
onto.
Inverse Functions
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 function of f is denoted by f
−1. Hence, f
−1(b) = a when
f (a) = b.
EXAMPLE Let f be the function from {a, b, c} to {1, 2, 3} such that f (a) = 2, f (b) = 3,
and f (c) = 1.
Is f invertible, and if it is, what is its inverse?
Solution: The function f is invertible because it is a one-to-one correspondence. The
inverse
function f
−1 reverses the correspondence given by f , so f
−1(1) = c, f
−1(2) = a, and
f
−1(3) = b.
Compositions of Functions
Let g be a function from the set A to the set B and let f be a function from the set B to
the
set C. The composition of the functions f and g, denoted for all a ∈ A by f ◦ g, is defined
by
(f ◦ g)(a) = f (g(a)).
EXAMPLE Let g be the function from the set {a, b, c} to itself such that g(a) = b, g(b)
= c, and g(c) = a.
Let f be the function from the set {a, b, c} to the set {1, 2, 3} such that f (a) = 3, f (b)
= 2, and
f (c) = 1. What is the composition of f and g, and what is the composition of g and f ?
Solution: The composition f ◦ g is defined by (f ◦ g)(a) = f (g(a)) = f (b) = 2,
(f ◦ g) (b) = f (g(b)) = f (c) = 1, and (f ◦ g)(c) = f (g(c)) = f (a) = 3.
Note that g ◦ f is not defined, because the range of f is not a subset of the domain of
g.▲
EXAMPLE Let f and g be the functions from the set of integers to the set of integers
defined by
f (x) = 2x + 3 and g(x) = 3x + 2. What is the composition of f and g? What is the
composition
of g and f ?
Solution: Both the compositions f ◦ g and g ◦ f are defined. Moreover,
(f ◦ g)(x) = f (g(x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7
and
(g ◦ f )(x) = g(f (x)) = g(2x + 3) = 3(2x + 3) + 2 = 6x + 11.
EXERCISE
QUESTION Let X = {1, 2, 3, 4}. Determine whether each relation on X is a function from X
into X.
(a) f = {(2, 3), (1, 4), (2, 1), (3.2), (4, 4)}
(b) g = {(3, 1), (4, 2), (1, 1)}
(c) h = {(2, 1), (3, 4), (1, 4), (2, 1), (4, 4)}
ANSWER:
Recall that a subset f of X×X is a function f: X → X if and only if each a ∈ X appears as the first
coordinate
in exactly one ordered pair in f.
(a) No. Two different ordered pairs (2, 3) and (2, 1) in f have the same number 2 as their first
coordinate.
(b) No. The element 2 ∈ X does not appear as the first coordinate in any ordered pair in g.
(c) Yes. Although 2 ∈ X appears as the first coordinate in two ordered pairs in h, these two ordered
pairs are equal.
QUESTION Let A = {a, b, c},B = {x, y, z},C = {r, s, t}. Let f: A → B and g: B → C be defined
by:
f = {(a, y)(b, x), (c, y)} and g = {(x, s), (y, t ), (z, r)}.
Find: (a) composition function g◦f: A → C; (b) Im(f ), Im(g), Im(g◦f ).
ANSWER:
(a) Use the definition of the composition function to compute:
(g◦f )(a) = g(f (a)) = g(y) = t
(g◦f )(b) = g(f (b)) = g(x) = s
(g◦f )(c) = g(f (c)) = g(y) = t
That is g◦f = {(a, t ), (b, s), (c, t)}.
ANSWER:
Compute g◦f as follows:
(g◦f )(x) = g(f (x)) = g(2x + 1) = (2x + 1)2 − 2 = 4x2 + 4x − 1.
Observe that the same answer can be found by writing
y = f (x) = 2x + 1 and z = g(y) = y2 − 2
and then eliminating y from both equations:
z = y2 − 2 = (2x + 1)2 − 2 = 4x2 + 4x – 1
ANSWER:
(a) The function f: A → B is not onto since 3 ∈ B is not the image of any element in A.
The function g: B → C is not onto since z ∈ C is not the image of any element in B.
The function h: C → D is onto since each element in D is the image of some element of C.
(b) The function f: A → B is not one-to-one since a and c have the same image 2.
The function g: B → C is one-to-one since 1, 2 and 3 have distinct images.
The function h: C → D is not one-to-one since x and z have the same image 4.
ANSWER:
Note that σ sends 1 into 3 and τ sends 3 into 6. So the composition τ◦σ sends 1 into 6. I.e. (τ◦σ)(1) =
6. Moreover,
τ◦σ sends 2 into 6 into 1 that is, (τ◦σ)(2) = 1, Similarly,
(τ◦σ)(3) = 5, (τ ◦σ)(4) = 3, (τ ◦σ) = 2, (τ ◦σ)(6) = 4
Thus
b) Look for 1 in the second row of σ. Note σ sends 5 into 1. Hence σ−1(1) = 5. Look for 2 in the second
row of σ.
Note σ sends 6 into 2. Hence σ−1(2) = 6. Similarly, σ−1(3) = 1, σ−1(4) = 3, σ−1(5) = 4, σ−1(6) = 2.
Thus
ANSWER:
(a) Suppose (g◦f )(x) = (g◦f )(y); then g(f (x)) = g(f (y)). Hence f (x) = f (y) because g is one-to-one.
Furthermore,
x = y since f is one-to-one. Accordingly g◦f is one-to-one.
(b) Let c be any arbitrary element of C. Since g is onto, there exists a b ∈ B such that g(b) = c. Since f
is onto, there
exists an a ∈ A such that f (a) = b. But then
Hence each c ∈ C is the image of some element a ∈ A. Accordingly, g◦f is an onto function.
QUESTION Let f: R → R be defined by f (x) = 2x −3. Now f is one-to-one and onto; hence f
has an inverse function
f−1. Find a formula for f−1.
QUESTION
Let y be the image of x under the function f :
y = f (x) = 2x − 3
Consequently, x will be the image of y under the inverse function f−1. Solve for x in terms of y in the
above equation:
x = (y + 3)/2
Then f−1(y) = (y + 3)/2. Replace y by x to obtain
f−1(x) = (x + 3)/2
which is the formula for f−1 using the usual independent variable x.