Discrete Structure 3
Discrete Structure 3
Functions
The notion of functions, Types of functions
(one-to-one, onto, bijection, ceiling, and floor).
Function
• 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.
• A function is a mathematical relation such that each element of the do-
main of the function is associated with exactly one element of the range
of the function. In order for a relation to be a function no two ordered
pairs may have the same first element.
Functions
• A function, denoted by f, is a special type of binary relation.
• A function from set A to set B is a relation f ⊆ A × B that satisfies the following
two properties:
• Each element a ∈ A is mapped to some element b ∈ B.
• Each element a ∈ A is mapped to exactly one element b ∈ B.
E.g., consider a relation R that contains pairs (1, 1), (1, 2). The relation R is not a function,
because the element 1 is mapped to two elements, which violates the second require-
ment.
• The set is called the domain of the function , and the set is the codomain. The
domain and codomain of are denoted, respectively, and .
Two functions are equal when they have the same domain, have the
same codomain, and map each element of their common domain to
the same element in their common codomain
Function
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1f2 are also func-
tions from A to R defined for all x ∈ A by
• (f1 + f2)(x) = f1(x) + f2(x),
• (f1f2)(x) = f1(x)f2(x).
Let f be a function from A to B and let S be a subset of A. The image of S under the function f is
the subset of B that consists of the images of the elements of S. We denote the image of S by
The notation f (S) for the image of the set S under the function f is potentially ambiguous. Here, f
(S) denotes a set, and not the value of the function f for the set S.
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.