We first need to establish a clear definition as to what a function, domain, codomain, and range is.
|Definition: A Function $f$ is a rule that assigns each element $x \in A$ in the Domain of $f$ to exactly one element $y \in B$ in the Codomain of $f$ such that $b = f(a)$. The Range of $f$ often denoted $R(f) \subseteq B$ is the set of all possible values of $f(x)$.|
The diagram above illustrates a function that takes elements from the domain and maps them to exactly one element in the codomain. The subset of elements that are "mapped to" of the codomain is called the range. We should note that it is perfectly fine for two elements in the domain to map to the same element in the range. However, if one element in the domain maps to two elements in the range, then we no longer have a function.
We will now classify some important types of functions.
Different Types of Functions
|Definition: A function $f$ is called an Injection, Injective Function, or One-to-One Function if for all $m, n \in A$ where $m \neq n$ satisfies that $f(m) \neq f(n)$.|
From our definition we note that every element $x \in A$ maps to a unique element $y \in B$.
In our first example at the top of the page, there were two elements in the domain that mapped to the same element in the range. Such a function is not one-to-one. In terms of equations, a function can easily be determined to be one-to-one if it passes what is known as the horizontal line test. If you take any horizontal line, it should intersect the function at most one time.
|Definition: A function $f$ is called a Surjection, Surjective Function, or an Onto Function if $B = R(f)$, that is, the codomain of $f$ is equal to the range of $f$. For every $b \in B$, $b = f(a)$ for some $a \in A$.|
Therefore, our definition of a surjection says that all elements x in the domain map to all elements y in the codomain at least once.
As you can see from the diagram above, there are no elements in the codomain that aren't mapped to, and hence $B = R(f)$.
|Definition: A function $f$ is called a Bijection or Bijective Function if $f$ is both injective and surjective, that is, for all $m, n \in A$ where $m \neq n$ satisfies $f(m) \neq f(n)$, and $B = R(f)$, so for every $b \in B$, $b = f(a)$ for some $a \in A$.|