Definition B.1.1.
A function \(f:S \to T\) is an assignment between sets \(S\) and \(T\) satisfying the condition that for all \(a, b \in S\text{,}\) if \(a = b\) in \(S\text{,}\) then \(f(a) = f(b)\) in \(T\) i.e., \(f\) is well-defined. The set \(S\) is called the domain of \(f\) and the set \(T\) is called the codomain of \(f\). The subset of the codomain that can be obtained as \(f(x)\) for some \(x\) in the domain is called the range of \(f\), denoted
\begin{equation*}
\mathrm{range}(f) = \{ z \in T \, | \, z = f(a) \text{ for some } a \in S \}.
\end{equation*}
Given a function \(f:S \to T\text{,}\) we say that \(f\) is injective (equivalently, one-to-one) provided for all \(a, b \in S\text{,}\) if \(f(a) = f(b)\text{,}\) then \(x = y\text{.}\)
Given a function \(f:S \to T\text{,}\) we say that \(f\) is surjective (equivalently, onto) provided for every \(y \in T\text{,}\) there exists \(a \in S\) satisfying \(f(a) = y\text{.}\)
A function that is both injective and surjective is called bijective (equivalently, a bijection).
Example B.1.2.
Recall that
\begin{equation*}
[0,\infty) = \{ x \in \mathbb{R} \, \colon \, 0 \le x \}.
\end{equation*}
The assignment \(g:\mathbb{R} \to \mathbb{R}\) given by \(g(x) = y\) satisfying \(y^2 = x\) is not a function. Indeed, \(g(x)\) is undefined for \(x \lt 0\text{;}\) in this sense, the domain is too big. Even restricting the domain to nonnegative inputs, we find that \(g(4)\) is ambiguous, because both \(y = 2\) and \(y = -2\) satisfy \(y^2 = 4\text{.}\)
The assignment \(h:[0,\infty) \to [0,\infty)\) given by \(h(x) = \sqrt{x}\) is a function. Restricting the domain to \([0,\infty)\) ensures each input has at least one output, and restricting the codomain to \([0,\infty)\) ensures that output is unique.
Example B.1.3. Complex Conjugation.
The complex numbers are defined to be the set
\begin{equation*}
\mathbb{C}= \{ a + b\, i \, | \, a, b \in \mathbb{R}, i^{2} = -1\}
\end{equation*}
with addition defined by collecting like terms and multiplication defined using the distributive property and the rule \(i^2 = -1\text{:}\)
\begin{equation*}
(a + b \, i) + c + d\, i = (a + c) + (b + d) \, i
\end{equation*}
and
\begin{equation*}
(a + b \,i)(c + d \, i) = (ac-bd) + (ad+bc)\, i.
\end{equation*}
Two complex numbers \(a + b\, i\) and \(c+d\, i\) are equal provided \(a = c\) and \(b = d\text{.}\) When we write \(a - b\, i\text{,}\) we understand it as a shorthand for \(a + (-b)\, i\text{.}\)
We will verify that the assignment \(C: \mathbb{C}\to \mathbb{C}\) given by \(C(a+b \, i) = a - b\, i\) is a bijective function.
(Function.) Recall, our goal is to show that the same input to \(C\) yields the same output, even if we can write the input in cosmetically different ways. So, we’ll start with an input element written in two ways: suppose \(a + b\, i = c + d\, i\) in the domain of \(C\text{.}\) This equality implies that \(a = c\) and \(b = d\text{.}\) This means \(-b = -d\text{,}\) too, which ensures that \(C(a+b\, i) = a - b\, i = c - d\, i = C(c + d\, i)\) in the codomain of \(C\text{,}\) as desired..
(Injective.) In this case, our goal is to show that if input elements yield the same outputs, the inputs were the same to begin with. So, we’ll start with two elements that give the same output: suppose \(C(a + b\, i) = C(c + d\, i)\) in the codomain. This implies that \(a - b\, i = c - d\, i\text{,}\) which means \(a = c\text{,}\) \(-b = -d\text{,}\) and hence \(b = d\text{.}\) Thus \(a + b\, i = c + d\, i\) in the domain, as desired.
(Surjective.) Now our goal is to show that given an arbitrary element of the codomain, we can find an element of the domain that maps to it. So, we’ll start with a complex number in the codomain: suppose \(a + b\, i \in \mathbb{C}\text{.}\) It follows that \(a - b\, i \in \mathbb{C}\) is an element of the domain for which \(C(a - b\, i) = C(a + (-b)\, i) = a - (-b)\, i = a + (-(-b))\, i = a + b\, i\) as desired.
Proof.
Suppose \(f: S \to T\) and \(g : T \to U\) are functions. Let \(a, b \in S\text{,}\) \(t = f(a), s = f(b) \in T\text{.}\)
If \(a = b\text{,}\) then \(t = f(a) = f(b) = s\) because \(f\) is a function. Similarly, \(t = s\) implies \(g(t) = g(s)\) because \(g\) is a function. It follows that \(a = b\) implies
\begin{equation*}
g\circ f (a) = g(f(a)) = g(t) = g(s) = g(f(b)) = g \circ f (b),
\end{equation*}
and therefore \(g \circ f\) is a function.
Suppose now that \(f:S \to T\) is injective. This means that if \(g \circ f (a) = g \circ f (b)\text{,}\) we have that \(g(t) = g(f(a)) = g(f(b)) = g(s)\text{.}\) Since \(g\) is injective, \(f(a) = f(b)\text{,}\) and since \(f\) is injective, \(a = b\text{.}\) Now we have that \(g \circ f(a) = g \circ f(b)\) implies \(a = b\text{,}\) so \(g \circ f\) is injective.
The rest of the proof is left as an exercise to the reader.