Section 0.2 Functions
Definition 0.2.1. Functions.
Let \(X\) and \(Y\) be two sets. A function from \(X\) to \(Y\), denoted \(f\colon X\rightarrow Y\text{,}\) is a rule which, given any input \(x\in X\text{,}\) returns an output \(y\in Y\text{.}\) In this case we write \(y=f(x)\) and call \(y\) the image of \(x\) under \(f\), or the value of \(f\) at \(x\). Similarly, we say \(f\) maps (or sends) the input \(x\) to the output \(y\text{.}\)
The set \(X\) is called the domain of \(f\text{;}\) the set \(Y\) is called the codomain of \(f\text{.}\)
When we wish to indicate what rule defines the function, we use the elaborated notation
\begin{align*}
f\colon X \amp\rightarrow Y\\
x \amp\mapsto f(x)\text{.}
\end{align*}
This is read as “The function \(f\) with domain \(X\) and codomain \(Y\) maps an input \(x\) to the output \(f(x)\)”.
Example 0.2.2.
Consider the function
\begin{align*}
f\colon \mathbb{Z}\amp \rightarrow \mathbb{Z}\\
x\amp\mapsto x^2 \text{.}
\end{align*}
This function has domain and codomain equal to \(\mathbb{Z}\) and maps an integer to its square.
Example 0.2.3. Arithmetic operations as functions.
Our familiar arithmetic operations can be expressed as functions whose inputs are pairs of numbers: addition is the function
\begin{align*}
a\colon \R\times \R \amp\rightarrow \R \\
(x,y) \amp\mapsto x+y
\end{align*}
and multiplication is the function
\begin{align*}
m\colon\mathbb{R}\times \mathbb{R} \amp \rightarrow \mathbb{R}\\
(x,y)\amp\mapsto xy
\end{align*}
As with sets and tuples, we are obliged to specify what we mean for two functions to be equal. The definition below makes clear how the the domain and codomain, as well as the rule that takes inputs to outputs, are all essential ingredients of a function.
Definition 0.2.5. Function equality.
Functions \(f\) and \(g\) are equal if
they have the same domain \(X\) and codomain \(Y\text{,}\) and
for all \(x\in X\text{,}\) we have \(f(x)=g(x)\text{.}\)
Definition 0.2.6. Image of a set.
Given a function \(f\colon X\rightarrow Y\) and a subset \(A \subseteq X\text{,}\) the image of \(A\) under \(f\), denoted \(f(A)\text{,}\) is defined as
\begin{equation*}
f(A)=\left\{ y \in Y \colon f(a)=y \text{ for some } a \in A \right\}\text{.}
\end{equation*}
In other words, \(f(A)\) is the set of all outputs \(f(a)\text{,}\) where \(a\in X\text{.}\)
The image of \(f\), denoted \(\operatorname{im} f\text{,}\) is the set of all outputs of \(f\text{:}\) i.e.,
\begin{equation*}
\operatorname{im} f=f(X)=\left\{ y \in Y \colon f(x)=y \text{ for some } x \in X \right\}\text{.}
\end{equation*}
Definition 0.2.7. Injective, surjective, bijective.
Let \(f\colon X\rightarrow Y\) be a function.
-
Injective.
The function \(f\) is injective (or one-to-one) if for all \(x,x'\in X\text{,}\) if \(f(x)=f(x')\text{,}\) then \(x=x'\text{:}\) equivalently, if \(x\ne x'\text{,}\) then \(f(x)\ne f(x')\text{.}\)
-
Surjective.
The function \(f\) is surjective (or onto) if for all \(y\in Y\text{,}\) there is an \(x\in X\) such that \(f(x)=y\text{:}\) equivalently, \(\im f=Y\text{.}\)
-
Bijective.
The function \(f\) is bijective (or a one-to-one correspondence) if it is injective and surjective.
Example 0.2.8. Role of domain and codomain in injectivity and surjectivity.
Consider the following three functions
\begin{align*}
f\colon \R \amp\rightarrow \R \amp g\colon [0,\infty)\amp\rightarrow \R \amp h\colon [0,\infty)\amp \rightarrow [0,\infty) \\
x \amp\mapsto x^2 \amp x \amp\mapsto x^2 \amp x \amp\mapsto x^2 \amp \text{.}
\end{align*}
Although all three functions are defined using the same rule (\(x\mapsto x^2\)), they are not equal thanks to their differing domains and/or codomains. The choice of domain and codomain in these examples also plays a crucial role in determining whether the function is injective and/or surjective. The function \(f\) is neither injective (\(f(-2)=f(2)=4\)) nor surjective (\(f(X)=[0,\infty)\ne \R\)); the function \(g\) is injective but not surjective; the function \(h\) is both injective and surjective, hence bijective.
Definition 0.2.9. Function composition.
Suppose \(f\colon Z\rightarrow W\) and \(g\colon X\rightarrow Y\) are functions satisfying \(Y\subseteq Z\text{.}\) The composition of \(f\) and \(g\) is the function \(f\circ g\colon X\rightarrow W\) defined as \(f\circ g\, (x)=f(g(x))
\text{,}\) for all \(x\in X\text{.}\)
Definition 0.2.10. Identity and inverse functions.
For any set \(X\) the identity function on \(X\) is the function \(\id_X\colon X\rightarrow X\) defined as \(\id_X(x)=x\) for all \(x\in X\text{.}\)
A function \(f\colon X\rightarrow Y\) is invertible if there is a function \(g\colon Y\rightarrow X\) satisfying \(g\circ f=\id_X\) and \(f\circ g=\id_Y\text{:}\) i.e.,
\begin{align*}
g(f(x))\amp =x \text{ for all } x\in X, \\
f(g(y))\amp=y \text{ for all } y\in Y \text{.}
\end{align*}
The function \(g\) in this case is called the inverse of \(f\text{,}\) denoted \(g=f^{-1}\text{.}\)
Theorem 0.2.11. Invertible is equivalent to bijective.
A function \(f\colon X\rightarrow Y\) is invertible if and only if it is bijective.
Proof.
The proof of this theorem is left as an example of proving “if and only if” statements. See
Example 0.5.3.