Section 8.2 Functions
Subsection 8.2.1 Functions
Definition 8.2.1.
Let \(X, Y\) be non-empty sets. A function (or map, or mapping), \(f\text{,}\) from the domain \(X\) (or \(D(f)\)) to the codomain \(Y\text{,}\) \(f: X \rightarrow Y\text{,}\) is a relation between \(X\) and \(Y\) such that,
All elements in the domain map to some element in the codomain. For all \(x \in X\text{,}\) there exists \(y \in Y\) such that \((x,y) \in f\text{.}\)
The function is well-defined. If \((x,y_1) \in f\) and \((x,y_2) \in f\text{,}\) then \(y_1 = y_2\text{.}\)
If \((x,y) \in f\text{,}\) we denote this by \(y = f(x)\text{.}\) Then, these requirements are,
For all \(x \in X\text{,}\) there exists \(y \in Y\) such that \(f(x) = y\text{.}\)
If \(f(x) = y_1\) and \(f(x) = y_2\text{,}\) then \(y_1 = y_2\text{.}\) Equivalently, if \(x_1 = x_2\text{,}\) then \(f(x_1) = f(x_2)\text{.}\)
If $f(x) = y$, then we say "$y$ is the image of $x$", or "$x$ maps to $y$".
The range of \(f\text{,}\) sometimes denoted by \(R(f)\text{,}\) is the set of all outputs of \(f\text{.}\) In other words,
\begin{equation*} R(f) = \set{f(x): x \in X} = \set{y \in Y: \exists x \in X \text{ such that } f(x) = y} \end{equation*}In general, \(R(f) \neq Y\text{.}\)
Definition 8.2.2.
Functions \(f\) and \(g\) are equal if and only if for all \(x_1 \in X\text{,}\) \(f(x_1) = f(x_2)\text{.}\)
Example 8.2.3.
Let \(f = \set{(x,y) \in \mathbb{Z}^2: 3x + y = 0}\text{.}\) Let \(x \in \mathbb{Z}\) such that \(y = -3x\text{.}\) Then, \(3x + (-3x) = 0\) satisfies the condition. Also, if \((x,y) \in f\) and \((x,z) \in f\text{,}\) then \(3x + y = 0\) and \(3x + z = 0\text{.}\) Thus, \(y = z\text{.}\)
Example 8.2.4.
Let \(X\) be a non-empty set. The identity function on \(X\) is \(Id_{X}: X \rightarrow X\text{,}\) \(Id_{X}(x) = x\text{.}\)
Example 8.2.5.
Operations like addition, subtraction, multiplication, and division can be thought of as functions. For example, addition can be thought of as the function,
In function notation, this is written as \(+((a,b)) = a + b\text{.}\) For example, \(+((2,3)) = 5\text{.}\)
Subsection 8.2.2 Examples of Non-Functions
Example 8.2.6.
The \(f(\frac{a}{b}) = a + b\) is not a function on the rational numbers. This is because for example, \(f(\frac{1}{2}) = 1 + 2 = 3\) but also \(f(\frac{1}{2}) = f(\frac{2}{4}) = 2 + 4 = 6 \neq 3\text{.}\)
The output of the function must not depend on the representation of the input element, and only depend on the input element itself.
Example 8.2.7.
Let \(f = \set{(x,y) \in \mathbb{Z}^2: 3x + 2y = 0}\text{.}\) Then, \(f\) is not a function, as for \(1 \in \mathbb{Z}\text{,}\) \(3 + 2y = 0\text{,}\) but \(y = -3/2 \notin \mathbb{Z}\text{.}\) Thus, \((1,y) \notin f\text{.}\)