41. Some important types of functions
41.1.1 Identity function For any set $A$, the identity function $\operatorname{id}_{A}\colon A \to A$ is the function that takes an element to itself; in other words, for every element $a\in A$, $\operatorname{id}_{A}(a) = a$. Thus its graph is the diagonal of $A\times A$ (see 37.3).
41.1.2 Warning Do not confuse the identity function with the concept of identity for a predicate of Section 13.1.2, or with the concept of identity for a binary operation of Section 45.
41.1.3 Inclusion function If $A \subseteq B$, then there is an inclusion function $\operatorname{inc}\colon A \to B$ which takes every element in $A$ to itself regarded as an element of $B$. In other words, $\operatorname{inc}(a) = a$ for every element $a\in A$. Observe that the graph of $\operatorname{inc}$ is the same as the graph of $\operatorname{id}_{A}$ and they have the same domain, so that the only difference between them is what is considered the codomain ($A$ for $\operatorname{id}_{A}$, $B$ for the inclusion of $A$ in $B$).
41.1.4 Constant function If $A$ and $B$ are nonempty sets and $b$ is a specific element of $B$, then the constant function $C_{b}\colon A \to B$ is the function that takes every element of $A$ to $b$; that is, $C_{b}(a) = b$ for all $a\in A$. A constant function from $\mathrm{R}$ to $\mathrm{R}$ has a horizontal line as its graph.
41.1.5 Empty function If $A$ is any set, there is exactly one function $E\colon \emptyset \to A$. Such a function is an empty function. Its graph is empty, and it has no values. “An identity function does nothing. An empty function has nothing to do.”
41.1.6 Coordinate function If $A$ and $B$ are sets, there are two coordinate functions (or projection functions) $p_{1}\colon A \times B \to A$ and $p_{2}\colon A\times B \to B$. The function $p_{i}$ takes an element to its $i$th coordinate $(i = 1,2)$. Thus for $a\in A$ and $b \in B$, $p_{1}\langle a,b\rangle = a$ and $p_{2}\langle a,b\rangle = b$. More generally, for any Cartesian product $\prod_{i=1}^{n}A_{i}$ there are $n$ coordinate functions; the $i$th one takes a tuple $\langle a_{1},\ldots ,a_{n}\rangle$ to $a_{i}$.
41.1.7 Binary operations The operation of adding two real numbers gives a function
$$+ \colon \mathrm{R} \times \mathrm{R} \to \mathrm{R}$$
which is an example of a binary operation, treated in detail in Chapter 45.
41.1.8 Exercise For each function $F\colon A \to B$, give $F(2)$ and $F(4)$.
a) $A = B = \mathrm{R}$, $F$ is the identity function.
b) $A = B = \mathrm{R}$, $F = C_{42}$ (the constant function).
c) $A = \mathrm{R}^{+}$, $B = \mathrm{R}$, $F$ is the inclusion function. (Answer on page 245.)
41.1.9 Exercise Give the graphs of these functions. $A = \{ 1, 2, 3\}$, $B = \{ 2, 3\}$.
a) $\operatorname{id}_{A}$.
b) The inclusion of $B$ into $A$.
c) The inclusion of $B$ into $\mathrm{Z}$.
d) $C_{3}\colon A \to B$.
e) $p_{1}\colon A\times B \to A$. (Answer on page 245.)
Pages 63–64 of the book (PDF).