In discrete mathematics and computer science, functions serve as the foundational mechanism for mapping elements between sets. This guide explores the formal definitions, algebraic properties, and distinct classifications of functions that underpin computational models, cryptography, and relational database theories.
Let and be any two sets. A function (or mapping/transformation) from to , denoted by , is an assignment of exactly one element to each element .
Mathematically, a function is a special type of relation. If (often written as ), we say that is the image of under , and is a of under . We express this relationship via the classic equation:
For any function :
DOMAIN (X) CODOMAIN (Y)
+------------+ +------------+
| x1 *-----+------------->|* f(x1) |
| | | |
| x2 *-----+-----\ |* f(x2) |
| | \------->| | <- RANGE (Subset of Y)
| x3 *-----+------------->|* f(x3) |
+------------+ | |
| y4 * | <- Element in Codomain
+------------+ but not in RangeWe can rigorously define the condition for a mapping to be a function using first-order logic. The assertion " is a function" is logically equivalent to the following formulations:
When functions map real numbers to real numbers (), we can define their algebraic sum and product point-wise:
Discrete mathematics frequently leverages specific integer-boundary functions over the real number domain, alongside fundamental inductive sequences.
The floor function assigns to the real number the largest integer that is less than or equal to . It is denoted by .
The ceiling function assigns to the real number the smallest integer that is greater than or equal to . It is denoted by .
Let be the set of all positive integers . The successor function is defined as:
This function serves as the basis for Peano's Axioms, establishing the foundational arithmetic structure of natural numbers:
Functions are classified based on the uniqueness of their mappings and the coverage of their codomain.
A function is injective (or an injection) if and only if no two distinct elements of the domain map to the same element of the codomain.
INJECTIVE (1-1) NON-INJECTIVE
A B A B
+---+ +---+ +---+ +---+
| 1*+---------->|*a | | 1*+---------->|*a |
| | | | | | /| |
| 2*+---------->|*b | | 2*+---------/ | |
| | | | | | | |
| 3*+---------->|*c | | 3*+---------->|*b |
+---+ +---+ +---+ +---+Or, equivalent by contraposition:
If is injective, the cardinality of the domain must be less than or equal to the cardinality of the codomain ().
A function is surjective (or a surjection) if and only if its range equals its codomain. This means every element in has at least one pre-image in .
SURJECTIVE (ONTO) NON-SURJECTIVE
A B A B
+---+ +---+ +---+ +---+
| 1*+---------->|*a | | 1*+---------->|*a |
| | /| | | | | |
| 2*+---------/ | | | 2*+---------->|*b |
| | | | | | | |
| 3*+---------->|*b | | 3*+---------->|*c | (unmapped)
+---+ +---+ +---+ +---+
Consider functions over the real numbers :
A function is a bijection (or a one-to-one correspondence) if and only if it is simultaneously injective and surjective.
BIJECTIVE MAPPING (1-1 & ONTO)
A B
+---+ +---+
| 1*+-------------->|*a |
| | | |
| 2*+-------------->|*b |
| | | |
| 3*+-------------->|*c |
+---+ +---+A bijection represents a perfect pairing between elements of and . If a bijection exists between two finite sets and , then .
Functions can be chain-linked together to form complex operations, and reversed if they meet strict structural criteria.
Let and be functions. The composition of and , denoted by , is a function from to defined by:
Note that the composition is only defined when the range of is a subset of the domain of .
A B C
+---+ +---+ +---+
| x*+------------->|g(x| | |
+---+ g +---+-----\ | |
\------>|* | f(g(x))
f +---+
\_______________________________________/
f o gFor any set , the identity function is defined by:
The identity function acts as the identity element under the operation of function composition. It is trivial to show that is always bijective.
If is a bijection, there exists an inverse function that reverses the mapping of .
f (Forward) ->
A B
+---+ +---+
| a*+----------------->|*b |
+---+ +---+
<- f^-1 (Inverse)If is bijective with inverse , then:
If a function is not bijective, its inverse relation is not a function because it will either map a single element to multiple pre-images (violating uniqueness) or fail to map some elements entirely.
To understand the algebraic structure of functions, they must be situated within the broader framework of binary relations.
A binary relation from set to set is any subset of the Cartesian product :
We write to denote that .
While functions are directed, single-valued mappings, other relations structure sets in symmetric or hierarchical ways:
Hasse Diagram of Divides relation on {2, 3, 6, 12, 18}:
12 18
\ / \
6 / \
/ \ / \
2 3 *A relation that maps each element of a domain set to exactly one element of a codomain set.
A one-to-one mapping where distinct domain elements map to distinct codomain elements.
An onto mapping where the range of the function is equal to its codomain.
A function that is simultaneously injective and surjective, making it completely invertible.
An operation that combines two functions by applying the second function to the output of the first.
Test your understanding with 5 questions
Let $f: \mathbb{R} \to \mathbb{R}$ be defined by the floor function $f(x) = \lfloor x \rfloor$. What is the exact range of $f$?
A function $f: A \to B$ is classified as injective (one-to-one) if and only if which of the following logical conditions holds true for all $x, y \in A$?
Given functions $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = x + 1$ and $g: \mathbb{R} \to \mathbb{R}$ defined by $g(x) = x^2$, what is the composite function $(g \circ f)(x)$?
Which of the following conditions is both necessary and sufficient for a function $f: A \to B$ to possess a well-defined inverse function $f^{-1}: B \to A$?
If a function $f: A \to B$ is represented as a binary relation $R \subseteq A \times B$, which structural property must $R$ satisfy?
6 Modules
6 Modules