Download as pdf or txt
Download as pdf or txt
You are on page 1of 54

Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Set Theory and Boolean Algebra


Functions

Juhi Kesarwani Ashish Kumar Kesarwany

Mathematics Division, School of Advanced Sciences and Languages


VIT Bhopal University, Bhopal-Indore Highway, Kothrikalan, Sehore, Madhya Pradesh,
466114, India

February 9, 2024
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Table of Contents

1 Functions

2 One-to-One and Onto Functions

3 Inverse Function

4 Composition of Functions

5 Exercises
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Functions
Definition(Function)
Let A and B be non-empty 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.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Functions
Definition(Function)
Let A and B be non-empty 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.

Figure 1: Assignment of Grades in a Discrete Mathematics Class.


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Functions are sometimes also called mappings or transformations.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Functions are sometimes also called mappings or transformations.

Definition (Domain, Co-domain and Range)


If f is a function from A to B , we say that A is the domain of f and B
is the co-domain of f . If f (a) = b, we say that b is the image of a and a
is a pre-image 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.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Functions are sometimes also called mappings or transformations.

Definition (Domain, Co-domain and Range)


If f is a function from A to B , we say that A is the domain of f and B
is the co-domain of f . If f (a) = b, we say that b is the image of a and a
is a pre-image 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.

Figure 2: The Function f Maps A to B.


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Arrow diagrams
If X and Y are finite sets, you can define a function f from X to Y by
drawing an arrow diagram. You make a list of elements in X and a list
of elements in Y , and draw an arrow from each element in X to the
corresponding element in Y , as shown in Figure 3.

Figure 3: Arrow diagram


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Arrow diagrams
If X and Y are finite sets, you can define a function f from X to Y by
drawing an arrow diagram. You make a list of elements in X and a list
of elements in Y , and draw an arrow from each element in X to the
corresponding element in Y , as shown in Figure 3.

This arrow diagram does de-


fine a function because
1. Every element of X has
an arrow coming out of
it.
2. No element of X has
two arrows coming out
of it that point to two
different elements of Y .
Figure 3: Arrow diagram
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Which of the arrow diagrams in Figure define functions from X = {a, b, c}
to Y = {1, 2, 3, 4}?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Which of the arrow diagrams in Figure define functions from X = {a, b, c}
to Y = {1, 2, 3, 4}?

Solution
Only (c) defines a function. In (a) there is an element of X , namely b,
that is not sent to any element of Y ; that is, there is no arrow coming out
of b. And in (b) the element c is not sent to a unique element of Y ; that
is, there are two arrows coming out of c, one pointing to 2 and the other
to 3.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
What are the domain, codomain, and range of the function that assigns
grades to students described in the Figure below.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
What are the domain, codomain, and range of the function that assigns
grades to students described in the Figure below.

Solution
Let f be the function that assigns a grade to a student in our discrete
mathematics class. Note that f (Adams) = A, for instance. The domain of
f is the set {Adams, Chou, Goodfriend, Rodriguez, Stevens}, and the co-
domain is the set {A, B, C , D, F }. The range of f is the set {A, B, C , F },
because each grade except D is assigned to some student.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Every function is a relation but converse need not be true, i.e., if
f : A → B then f is a relation. We can write f as following

f = {(a, f (a)) : a ∈ A}
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Every function is a relation but converse need not be true, i.e., if
f : A → B then f is a relation. We can write f as following

f = {(a, f (a)) : a ∈ A}

Example
Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24),
(Carla, 21), (Desire, 22), (Eddie, 24), and (Felicia, 22). Here each pair
consists of a graduate student and this student’s age. Specify a function
determined by this relation.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Remark
Every function is a relation but converse need not be true, i.e., if
f : A → B then f is a relation. We can write f as following

f = {(a, f (a)) : a ∈ A}

Example
Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24),
(Carla, 21), (Desire, 22), (Eddie, 24), and (Felicia, 22). Here each pair
consists of a graduate student and this student’s age. Specify a function
determined by this relation.

Solution
If f is a function specified by R, then f (Abdul) = 22, f (Brenda) = 24,
f (Carla) = 21, f (Desire) = 22, f (Eddie) = 24, and f (Felicia) = 22.
(Here, f (x) is the age of x, where x is a student.) For the domain, we
take the set {Abdul, Brenda, Carla, Desire, Eddie, Felicia}. We also need
to specify range, which is the set {21, 22, 24}.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Consider the following relation on {1, 2, 3, 4, 5}.

R = {(1, 2), (1, 3), (2, 3), (3, 5), (4, 5)}.

Then R is not a function.


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Consider the following relation on {1, 2, 3, 4, 5}.

R = {(1, 2), (1, 3), (2, 3), (3, 5), (4, 5)}.

Then R is not a function.

Solution
If possible suppose R is a function and let us denote it by f . Then, we
have f (1) = 2, f (1) = 3. This is a contradiction.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1 f2 are also
functions from A to R defined for all x ∈ A by

(f1 + f2 )(x) = f1 (x) + f2 (x), (f1 f2 )(x) = f1 (x)f2 (x).


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1 f2 are also
functions from A to R defined for all x ∈ A by

(f1 + f2 )(x) = f1 (x) + f2 (x), (f1 f2 )(x) = f1 (x)f2 (x).

Example
Let f1 and f2 be functions from R to R such that f1 (x) = x 2 and f2 (x) =
x − x 2 . What are the functions f1 + f2 and f1 f2 ?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1 f2 are also
functions from A to R defined for all x ∈ A by

(f1 + f2 )(x) = f1 (x) + f2 (x), (f1 f2 )(x) = f1 (x)f2 (x).

Example
Let f1 and f2 be functions from R to R such that f1 (x) = x 2 and f2 (x) =
x − x 2 . What are the functions f1 + f2 and f1 f2 ?

Solution
From the definition of the sum and product of functions, it follows that

(f1 + f2 )(x) = f1 (x) + f2 (x) = x 2 + x − x 2 = x

and
(f1 f2 )(x) = f1 (x)f2 (x) = x 2 (x − x 2 ) = x 3 − x 4
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition (One-one Functions)


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 . A function is said
to be an injection if it is one-to-one.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition (One-one Functions)


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 . A function is said
to be an injection if it is one-to-one.

Note that a function f is one-to-one if and only if f (a) ̸= f (b) whenever


a ̸= b. This way of expressing that f is one-to-one is obtained by taking
the contrapositive of the implication in the definition.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition (One-one Functions)


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 . A function is said
to be an injection if it is one-to-one.

Note that a function f is one-to-one if and only if f (a) ̸= f (b) whenever


a ̸= b. This way of expressing that f is one-to-one is obtained by taking
the contrapositive of the implication in the definition.

Example
Determine whether the function f from {a, b, c, d} to {1, 2, 3, 4, 5} with
f (a) = 4, f (b) = 5, f (c) = 1, and f (d) = 3 is one-to-one.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Definition (One-one Functions)


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 . A function is said
to be an injection if it is one-to-one.

Note that a function f is one-to-one if and only if f (a) ̸= f (b) whenever


a ̸= b. This way of expressing that f is one-to-one is obtained by taking
the contrapositive of the implication in the definition.

Example
Determine whether the function f from {a, b, c, d} to {1, 2, 3, 4, 5} with
f (a) = 4, f (b) = 5, f (c) = 1, and f (d) = 3 is one-to-one.

Solution

The function f is one-


to-one because f takes
on different values at
the four elements of
its domain.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Determine whether the function f (x) = x 2 from the set of integers to the
set of integers is one-to-one.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Determine whether the function f (x) = x 2 from the set of integers to the
set of integers is one-to-one.

Solution
The function f (x) = x 2 is not one-to-one because, for instance, f (2) =
f (−2) = 4, but 2 ̸= −2.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Determine whether the function f (x) = x 2 from the set of integers to the
set of integers is one-to-one.

Solution
The function f (x) = x 2 is not one-to-one because, for instance, f (2) =
f (−2) = 4, but 2 ̸= −2.

Note that if change the domain from set of integers to set of Natural
numbers then the above function becomes one-one.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Determine whether the function f (x) = x 2 from the set of integers to the
set of integers is one-to-one.

Solution
The function f (x) = x 2 is not one-to-one because, for instance, f (2) =
f (−2) = 4, but 2 ̸= −2.

Note that if change the domain from set of integers to set of Natural
numbers then the above function becomes one-one.
Example
Determine whether the function f (x) = x + 1 from the set of real
numbers to itself is one-to-one.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Determine whether the function f (x) = x 2 from the set of integers to the
set of integers is one-to-one.

Solution
The function f (x) = x 2 is not one-to-one because, for instance, f (2) =
f (−2) = 4, but 2 ̸= −2.

Note that if change the domain from set of integers to set of Natural
numbers then the above function becomes one-one.
Example
Determine whether the function f (x) = x + 1 from the set of real
numbers to itself is one-to-one.

Solution
The function f (x) = x + 1 is a one-to-one function. To demonstrate this,
note that
f (x) = f (y ) =⇒ x + 1 = y + 1 =⇒ x = y
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Onto functions

Definition (Onto Functions)


A 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 such that f (a) = b. A
function f is called a surjection if it is onto.
In other words, a function f : A → B is onto if and only if every element
of B has a pre-image in A.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Onto functions

Definition (Onto Functions)


A 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 such that f (a) = b. A
function f is called a surjection if it is onto.
In other words, a function f : A → B is onto if and only if every element
of B has a pre-image in A.

Example
Is the function f (x) = x 2 from the set of integers to the set of integers
onto?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Onto functions

Definition (Onto Functions)


A 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 such that f (a) = b. A
function f is called a surjection if it is onto.
In other words, a function f : A → B is onto if and only if every element
of B has a pre-image in A.

Example
Is the function f (x) = x 2 from the set of integers to the set of integers
onto?

Solution
The function f is not onto because the element −1 does not have a pre-
image in Z under f , for instance.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Is the function f (x) = x + 1 from the set of integers to the set of
integers onto?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Is the function f (x) = x + 1 from the set of integers to the set of
integers onto?

Solution
This function is onto, because for every integer y there is an integer x such
that f (x) = y . To see this, note that f (x) = y if and only if x + 1 = y ,
which holds if and only if x = y − 1.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Is the function f (x) = x + 1 from the set of integers to the set of
integers onto?

Solution
This function is onto, because for every integer y there is an integer x such
that f (x) = y . To see this, note that f (x) = y if and only if x + 1 = y ,
which holds if and only if x = y − 1.

Example
Let f : Z → {−1, 1} be a function defined by
(
1 if n is even,
f (x) = .
−1 if n is odd

Is f injective? Is f surjective?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Is the function f (x) = x + 1 from the set of integers to the set of
integers onto?

Solution
This function is onto, because for every integer y there is an integer x such
that f (x) = y . To see this, note that f (x) = y if and only if x + 1 = y ,
which holds if and only if x = y − 1.

Example
Let f : Z → {−1, 1} be a function defined by
(
1 if n is even,
f (x) = .
−1 if n is odd

Is f injective? Is f surjective?

Solution
f is surjective but not injective.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Bijection

Definition(Bijection)
The function f is a one-to-one correspondence, or a bijection, if it is both
one-to-one and onto.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Bijection

Definition(Bijection)
The function f is a one-to-one correspondence, or a bijection, if it is both
one-to-one and onto.

Example
Let f be the function from {a, b, c, d} to {l, 2, 3, 4} with f (a) = 4,
f (b) = 2, f (c) = 1, and f (d) = 3. Is f a bijection?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Bijection

Definition(Bijection)
The function f is a one-to-one correspondence, or a bijection, if it is both
one-to-one and onto.

Example
Let f be the function from {a, b, c, d} to {l, 2, 3, 4} with f (a) = 4,
f (b) = 2, f (c) = 1, and f (d) = 3. Is f a bijection?

Solution
The function f is one-to-one and onto. It is one-to-one because no two
values in the domain are assigned the same function value. It is onto
because all four elements of the co-domain are images of elements in the
domain. Hence, f is a bijection.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let A be the set of all workers in a factory. Assume that each worker has
a fixed monthly salary. With each worker we associate a rational number
by the following rule f . If n is the amount of monthly salary of a worker
a, then f (a) = n. Is f : A → Q a function? Is f injective? Is f surjective?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let A be the set of all workers in a factory. Assume that each worker has
a fixed monthly salary. With each worker we associate a rational number
by the following rule f . If n is the amount of monthly salary of a worker
a, then f (a) = n. Is f : A → Q a function? Is f injective? Is f surjective?

Solution
Yes! f is a function because for each worker there corresponds a unique
positive rational number,f is a function from A into Q.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Inverse Function
Definition(Inverse Function)
Let f : A → B be a bijection. 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. If the inverse function of a function exists
then we say that function is invertible.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let f : Z → Z be such that f (x) = x + 1. Is f invertible, and if it is, what
is its inverse?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let f : Z → Z be such that f (x) = x + 1. Is f invertible, and if it is, what
is its inverse?

Solution
The function f has an inverse because it is a one-to-one correspondence,
as we have shown. To reverse the correspondence, suppose that y is the
image of x, i.e., y = f (x) , so that y = x +1. Then x = y −1. This means
that y − 1 is the unique element of Z that is sent to y by f . Consequently,
f −1 (y ) = y − 1. Thus, f −1 : Z → Z such that f −1 (y ) = y − 1.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let f : Z → Z be such that f (x) = x + 1. Is f invertible, and if it is, what
is its inverse?

Solution
The function f has an inverse because it is a one-to-one correspondence,
as we have shown. To reverse the correspondence, suppose that y is the
image of x, i.e., y = f (x) , so that y = x +1. Then x = y −1. This means
that y − 1 is the unique element of Z that is sent to y by f . Consequently,
f −1 (y ) = y − 1. Thus, f −1 : Z → Z such that f −1 (y ) = y − 1.

Example
Let f be the function from R to R with f (x) = x 2 . Is f invertible?
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Example
Let f : Z → Z be such that f (x) = x + 1. Is f invertible, and if it is, what
is its inverse?

Solution
The function f has an inverse because it is a one-to-one correspondence,
as we have shown. To reverse the correspondence, suppose that y is the
image of x, i.e., y = f (x) , so that y = x +1. Then x = y −1. This means
that y − 1 is the unique element of Z that is sent to y by f . Consequently,
f −1 (y ) = y − 1. Thus, f −1 : Z → Z such that f −1 (y ) = y − 1.

Example
Let f be the function from R to R with f (x) = x 2 . Is f invertible?

Solution
Because f (−2) = f (2) = 4, f is not one-to-one. So, f is not invertible.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Composition of Functions
Definition (Composition of Functions)
Let f : A → B and g : B → C be two functions. The composition of the
functions g and f , denoted by g ◦ f , is defined by (g ◦ f )(a) = g (f (a)).

Figure 4: Composition of maps


Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

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 g and f ? What is the composition of f and g ?

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


(g ◦ f )(x) = g (f (x)) = g (2x + 3) = 3(2x + 3) + 2 = 6x + 11
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Exercise 1:
Why is f not a function from R to R if
1 f (x) = x1 ?

2 f (x) = x?

3 ± 1 + x 2?

Exercise 2:
Find the domain and range of the following function.
The function that assigns each non-negative integer to its last digit.

Exercise 3:
Determine whether each of these functions {a, b, c, d} to itself is one-one.
1 f (a) = b, f (b) = a, f (c) = c, f (d) = d.
2 f (a) = b, f (b) = b, f (c) = d, f (d) = c.
3 f (a) = d, f (b) = b, f (c) = c, f (d) = d.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Exercise 4:
Determine whether f : Z × Z → Z is onto if
1 f (m, n) = 2m − n
2 f (m, n) = m2 − n2
3 f (m, n) = m + n + 1
4 f (m, n) = |m| − |n|
5 f (m, n) = m2 − 4.

Exercise 5:
Determine whether each of these functions is a bijection from R to R.
1 f (x) = −3x + 4
2 f (x) = −3x 2 + 7
x+1
3 f (x) = x+2
5
4 f (x) = x + 1
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Exercise 6:
Give an example of a function which is
1 Injective but not surjective.
2 Surjective but not injective.
3 Bijective
4 Neither injective nor surjective.
5 Constant
Explain with the help of arrow diagrams.

Exercise 7:
Let f , g , h : Z → Z be functions such that f (x) = 2x, g (x) = x 2 and
h(x) = x + 1, then find f ◦ (g ◦ h) and (f ◦ g ) ◦ h. Show that
f ◦ (g ◦ h) = (f ◦ g ) ◦ h.
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Exercise 8:
Determine whether each of the following functions is injective, surjective,
both, or neither. In each case, you should provide a proof or a counterex-
ample as appropriate.
1 Define f : R → R by f (x) = x 2 .
2 Define g : R → [0, ∞) by g (x) = x 2 .
3 Define h : R → R by h(x) = x 3 .
4 Define k : R → R by k(x) = x 3 − x.
5 Define g : N → N by
(
n
2 if n is even
g (x) = n+1
2 if n is odd
6 Define Define f : Z → N by
(
2n + 1 if n ≥ 0
f(n) =
−2n if n < 0
Functions One-to-One and Onto Functions Inverse Function Composition of Functions Exercises

Exercise 9:
Define f : N → Z by
(
n
2 if n is even
f (n) = 1−n
2 if n is odd

Show that f is a bijective map.

Exercise 10:
Solve
1 Given f (x) = 3x − 2 find f −1 (x).

2 Given g (x) = x − 3 find g −1 (x).
x +4
3 Given h(x) = find h−1 (x).
2x − 5

You might also like