Discrete Mathematics - Functions
Discrete Mathematics - Functions
Lukáš Vyhnálek
More Detail
A Function assigns to each element of a set, exactly one element of a related set. Functions find
their application in various fields like representation of the computational complexity of algorithms,
counting objects, study of sequences and strings, to name a few. The third and final chapter of this
part highlights the important aspects of functions.
Function - Definition
A function or mapping (Defined as f : X → Y ) is a relationship from elements of one set X to
elements of another set Y (X and Y are non-empty sets). X is called Domain and Y is called
Codomain of function ‘f’.
Function ‘f’ is a relation on X and Y such that for each x ∈ X , there exists a unique y ∈ Y
such that (x, y) ∈ R . ‘x’ is called pre-image and ‘y’ is called image of function f.
A function can be one to one or many to one but not one to many.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_functions.htm 1/4
8/31/22, 11:02 PM Discrete Mathematics - Functions
Example
f : N → N , f (x) = 5x is injective.
f : N → N , f (x) = x
2
is injective.
f : R → R, f (x) = x
2
is not injective as (−x)
2
= x
2
every b ∈ B , there exists some a ∈ A such that f (a) = b . This means that for any y in B,
Example
f : N → N , f (x) = x + 2 is surjective.
f : R → R, f (x) = x
2
is not surjective since we cannot find a real number whose square
is negative.
and surjective.
Problem
Prove that a function f : R → R defined by f (x) = 2x– 3 is a bijective function.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_functions.htm 2/4
8/31/22, 11:02 PM Discrete Mathematics - Functions
Hence, f is injective.
Here, 2x– 3 = y
Hence, f is surjective.
Inverse of a Function
The inverse of a one-to-one corresponding function f : A → B , is the function g : B → A ,
f (x) = y ⇔ g(y) = x
Example
g : Z → Z , g(x) = x − 5 .
A Function f : Z → Z , f (x) = x
2
is not invertiable since this is not one-to-one as
(−x)
2
= x
2
.
Composition of Functions
Two functions f : A → B and g : B → C can be composed to give a composition gof .
Example
Let f (x) = x + 2 and g(x) = 2x + 1 , find (f og)(x) and (gof )(x) .
Solution
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_functions.htm 3/4
8/31/22, 11:02 PM Discrete Mathematics - Functions
Composition always holds associative property but does not hold commutative property.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_functions.htm 4/4