Lecture 2 Functions
Lecture 2 Functions
What are the domain, codomain, and range of the function that assigns
grades to students described in the first slide?
Solution:
Let G be the function that assigns a grade to a student in our discrete mathematics
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.
Set of Ordered Pairs, A function can then be defined as a set of ordered pairs:
Example: {(2,4), (3,5), (7,3)} is a function that says "2 is related to 4", "3 is
related to 5" and "7 is related 3".
Also, notice that:
the domain is {2,3,7} (the input values) and the range is {4,5,3} (the output values)
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.
For the domain, we take the set {Abdul, Brenda, Carla, Desire, Eddie, Felicia}.
For codomain, which needs to contain all possible ages
of students.
Because it is highly likely that all students are less than 100 years old, we can take the
set of positive integers less than 100 as the codomain. (Note that we could choose a
different codomain, such as the set of all positive integers or the set of positive
integers between 10 and
90.
The range of the function is
Set of different ages of these students, which is the set {21, 22, 24}.
Types of function:
The function f (x) = x2 is not one-to-one, Because every input will have single and
different image.
Determine whether the function f (x) = x + 1 from the set of real numbers to
itself is one-to-one.
Onto function or Surjective
Solution:
Because all three elements of the codomain are images of elements in the domain, we
see that f is onto. This is illustrated in Figure 4. Note that if the codomain were {1, 2,
3, 4}, then f would not be onto.
Is the function f (x) = x2 from the set of integers to the set of integers onto?
Solution:
The function f is not onto because there is no integer x with x2 = −1, for instance.
One to One and Onto Function
(Bijection)
A function that is both a one and onto function is called a bijective function.
Here every element of the domain is connected to a distinct element in the
codomain and every element of the codomain has a pre-image.
Also in other words every element of set A is connected to a distinct element in
set B, and there is not a single element in set B which has been left out.
The function f is a one-to-one correspondence, or a bijection, if it is both one-to-
one and onto such a function is bijective.
Let f be the function from {a, b, c, d} to {1, 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 codomain are images of elements in the domain. Hence, f is a
bijection.