MODULE
IV BASIC STRUCTURES
Lesson 3: Functions and Relations
In this lesson, you will be able to:
• define what is a function;
• determine the domain and codomain of a function;
• relate a function with relations;
• differentiate the types of functions; and
• determine the types of correspondences.
Introduction
There are instances that we assign to each element of a set a particular element of
a second set. For example, suppose that each student in a computer programming class is
assigned a final grade from the set {100, 99, 98, ..., 65}. This assignment of grades is
illustrated in Figure 1 which is an example of a function.
Arce 100
Castro 99
Dela Cruz 98
Endozo :
Fernandez 85
Manuel 84
Montemayor 83
Soriano :
65
Figure 1. Assignment of Grades in a Computer Programming Class.
Function Defined
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
2
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 are also called mappings or transformations.
Functions are specified in various ways. Sometimes we directly state the
assignments, as in Figure 1. Often we give a formula, such as f (x) = x + 1, to define a
function. Other times, we use a computer program to specify a function.
Example: What are the domain, codomain, and range of the function that assigns grades to
students described below?
Solution: Let G be the function that assigns a grade to a student in a class. Note that
G(Adams) = A, for instance. The domain of G is the set {Adams, Chou, Goodfriend,
Rodriguez, Stevens}, and the codomain is the set {A, B, C, D, F}. The range of G is the set
{A,B,C, F}, because each grade except D is assigned to some student.
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 a preimage of b. The range or image
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 represents a function f from A to B.
Figure 2. The Function f Maps A to B.
3
Functions and Relations
A function f : A → B can also be defined in terms of a relation from A to B. Take note
that a relation from A to B is just a subset of A × B. A relation from A to B that contains one,
and only one, ordered pair (a, b) for every element a ∈ A, defines a function f from A to B.
This function is defined by the assignment f (a) = b, where (a, b) is the unique ordered pair
in the relation that has a as its first element.
Example: Let R be the relation with ordered pairs (Mishka, 18), (Yuan, 22), (Kalea, 24),
(Kalani, 22), (Maria, 24), and (Yusef, 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(Mishka) = 18, f(Yuan) = 22, f(Kalea) = 24,
f(Kalani) = 22, f(Maria) = 24, and f(Yusef) = 22. (Here, f(x) is the age of x, where x is a
student.) For the domain, we take the set {Mishka, Yuan, Kalea, Kalani, Maria, Yusef}. We
also need to specify a codomain, which needs to contain all possible ages of students.
Because it is highly likely that all students are less than 40 years old, we can take the set of
positive integers less than 40 as the codomain. The range of the function we have specified
is the set of different ages of these students, which is the set {18, 22, 24}.
One-to-One and Onto Functions
One-to-One Function. Some functions never assign the same value to two different
domain elements. These functions are said to be one-to-one. A function f is said to be one-
to-one, or an injunction, 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 injective if it is one-to-one.
Figure 3. A One-to-One Function.
4
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.
Figure 4. An Onto Function.
Figure 5. Examples of Different Types of Correspondences.
5
YOUR TURN…
Directions: Complete the table below by writing the pre-image and/or image of the
mapping of the sets. Also, write the type of correspondence whether the mapping is
one-to-one and/or onto on the space provided.
1. f : A → B
Set A Set B
x x +5
2
-2
-1
Type of correspondence: ____________________
2. f : A → B
Set A Set B
x 3x + 4
Type of correspondence: ____________________
1. Showthat the square of an even number is an even number using a direct proof.