Abstract Algebra/Functions

Definition
A function $$\operatorname{f}$$ is a triplet $$(A, B, G)$$ such that: In addition the following two properties hold:
 * $$A$$ is a set, called the domain of $$\operatorname{f}$$
 * $$B$$ is a set, called the codomain of $$\operatorname{f}$$
 * $$G$$ is a subset of $$A \times B$$, called the graph of $$\operatorname{f}$$
 * 1) $$\forall x \in A, \exists y \in B \mid (x,y) \in G$$.
 * 2) $$\forall x \in A, y \in B, y' \in B\mbox{, then } (x,y) \in G \mbox{ and } (x,y') \in G \Rightarrow y=y'$$.

$$\forall x \in A$$ we write $$\operatorname{f}(x)$$ for the unique $$y \in B$$ such that $$(x,y) \in G$$.

We say that $$\operatorname{f}$$ is a function from $$A$$ to $$B$$, which we write:
 * $$\operatorname{f}:A \rightarrow B$$

Example
Let's consider the function from the reals to the reals which squares its argument. We could define it like this:
 * $$\operatorname{f}:\mathbb{R} \rightarrow \mathbb{R}$$
 * $$\operatorname{f}:x \mapsto x^2$$

Remark
As you see in the definition of a function above, the domain and codomain are an integral part of the definition. In other words, even if the values of $$\operatorname{f}(x)$$ don't change, changing the domain or codomain changes the function.

Let's look at the following four functions.

The function:
 * $$\operatorname{f_1}:\mathbb{R} \rightarrow \mathbb{R}$$
 * $$\operatorname{f_1}:x \mapsto x^2$$

is neither injective nor surjective (these terms will be defined later).

The function:
 * $$\operatorname{f_2}:\mathbb{R} \rightarrow \mathbb{R}_{\geq 0}$$
 * $$\operatorname{f_2}:x \mapsto x^2$$

is not injective but surjective.

The function:
 * $$\operatorname{f_3}:\mathbb{R}_{\geq 0} \rightarrow \mathbb{R}$$
 * $$\operatorname{f_3}:x \mapsto x^2$$

is injective but not surjective.

The function:
 * $$\operatorname{f_4}:\mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$$
 * $$\operatorname{f_4}:x \mapsto x^2$$

is injective and surjective

As you see, all four functions have the same mapping but all four are different. That's why just giving the mapping is insufficient; a function is only defined if its domain and codomain are known.

Image and preimage
For a set $$E$$, we write $$\mathcal{P}(E)$$ for the set of subsets of $$E$$.

Let $$\operatorname{f}:A \rightarrow B$$. We will now define two related functions.

The image function:
 * $$\operatorname{f}:\mathcal{P}(A) \rightarrow \mathcal{P}(B),S \subseteq A \mapsto \{\operatorname{f}(x) \mid x \in S\}$$

The preimage function:
 * $$\operatorname{f^{-1}}:\mathcal{P}(B) \rightarrow \mathcal{P}(A),T \subseteq B \mapsto \{x \in A \mid \operatorname{f}(x) \in T\}$$

Note that the image and preimage are written respectively like $$\operatorname{f}$$ and its inverse (if it exists). There is however no ambiguity because the domains are different. Note also that the image and preimage are not necessarily inverse of one another. (See the section on bijective functions below).

We define $$\operatorname{Im}_{\operatorname{f}}:=\operatorname{f}(A)$$, which we call the image of $$\operatorname{f}$$.

For any $$y \in B$$, we call $$\operatorname{f^{-1}}(\{y\})$$ the support of $$y$$.

Proposition: Let $$\operatorname{f}:A \rightarrow B$$. Then
 * 1) $$\forall S \subseteq A, S \subseteq f^{-1}(f(S))$$
 * 2) $$\forall T \subseteq B, f(f^{-1}(T)) \subseteq T$$

Example
Let's take again the function:
 * $$\operatorname{f}:\mathbb{R} \rightarrow \mathbb{R}$$
 * $$\operatorname{f}:x \mapsto x^2$$

Let's consider the following examples:
 * $$\operatorname{f^{-1}}(\{4\})=\{-2,2\}$$
 * $$\operatorname{f^{-1}}(\mathbb{R}_{< 0}) = \emptyset$$
 * $$\operatorname{f}(\mathbb{R}_{\geq 0}) = \mathbb{R}_{\geq 0}$$

Further definitions
Let $$\operatorname{f}:B \rightarrow C$$ and $$\operatorname{g}:A \rightarrow B$$. We define $$\operatorname{f} \circ \operatorname{g}:A \rightarrow C$$ by $$(\operatorname{f} \circ \operatorname{g})(x) := \operatorname{f}(\operatorname{g}(x))$$, which we call the composition of $$\operatorname{f}$$ and $$\operatorname{g}$$.

Let $$A$$ be a set. We define the identity function on A as
 * $$\operatorname{id_A}:A \rightarrow A, x \mapsto x$$

Properties
Definition: A function $$\operatorname{f}:A \rightarrow B$$ is injective if
 * $$\forall x \in A, x' \in A, \operatorname{f}(x) = \operatorname{f}(x') \Rightarrow x = x'$$

Lemma: Consider a function $$\operatorname{f}:A \rightarrow B$$ and suppose $$A \neq \emptyset$$. Then $$\operatorname{f}$$ is injective if and only if there exists a function $$\operatorname{g}:B \rightarrow A$$ with $$\operatorname{g} \circ \operatorname{f} = \operatorname{id_A}$$.

Proof:

$$'\Rightarrow'$$:

Suppose $$\operatorname{f}$$ is injective. As $$A \neq \emptyset$$ let's define $$m$$ as an arbitrary element of $$A$$. We can then define a suitable function $$\operatorname{g}:B \rightarrow A$$ as follows:

\operatorname{g}(y):= \left\{ \begin{array}{ll} \mbox{the unique } x \in A \mid \operatorname{f}(x) = y & \text{, if } y \in \operatorname{Im}_{\operatorname{f}}\\ m & \text{, else}\\ \end{array} \right. $$ It is now easy to verify that $$\operatorname{g} \circ \operatorname{f} = \operatorname{id_A}$$.

$$'\Leftarrow'$$:

Suppose there is a function $$\operatorname{g}:B \rightarrow A$$ with $$\operatorname{g} \circ \operatorname{f} = \operatorname{id_A}$$. Then $$\forall x,x' \in A, \operatorname{f}(x) = \operatorname{f}(x') \Rightarrow \operatorname{g}(\operatorname{f}(x)) = \operatorname{g}(\operatorname{f}(x')) \Rightarrow x = x'$$. $$\operatorname{f}$$ is thus injective.

Q.E.D.

Definition: A function $$\operatorname{f}:A \rightarrow B$$ is surjective if
 * $$\forall y \in B, \exists x \in A \mid \operatorname{f}(x) = y$$

Lemma: Consider a function $$\operatorname{f}:A \rightarrow B$$. Then $$\operatorname{f}$$ is surjective if and only if there exists a function $$\operatorname{g}:B \rightarrow A$$ with $$\operatorname{f} \circ \operatorname{g} = \operatorname{id_B}$$.

Proof:

$$'\Rightarrow'$$:

Suppose $$\operatorname{f}$$ is surjective. We can define a suitable function $$\operatorname{g}:B \rightarrow A$$ as follows:
 * $$\operatorname{g}(y):= \mbox{an } x \in A \mid \operatorname{f}(x) = y$$

It is now easy to verify that $$\operatorname{f} \circ \operatorname{g} = \operatorname{id_B}$$.

$$'\Leftarrow'$$:

Suppose there is a function $$\operatorname{g}:B \rightarrow A$$ with $$\operatorname{f} \circ \operatorname{g} = \operatorname{id_B}$$. Then $$\forall y \in B \mbox{, let } x := \operatorname{g}(y)$$. Then $$\operatorname{f}(x) = \operatorname{f}(\operatorname{g}(y)) = y$$. $$\operatorname{f}$$ is thus surjective.

Q.E.D.

Definition: A function $$\operatorname{f}:A \rightarrow B$$ is bijective if it is both injective and surjective.

Lemma: A function $$\operatorname{f}:A \rightarrow B$$ is bijective if and only if there exists a function $$\operatorname{g}:B \rightarrow A$$ with $$\operatorname{g} \circ \operatorname{f} = \operatorname{id_A}$$ and $$\operatorname{f} \circ \operatorname{g} = \operatorname{id_B}$$. Furthermore it can be shown that such a $$\operatorname{g}$$ is unique. We write it $$\operatorname{f^{-1}}:B \rightarrow A$$ and call it the inverse of $$\operatorname{f}$$.

Proof:

Left as an exercise.

Proposition: Consider a function $$\operatorname{f}:A \rightarrow B$$. Then
 * 1) $$f$$ is injective iff $$\forall S \subseteq A, f^{-1}(f(S))=S$$
 * 2) $$f$$ is surjective iff $$\forall T \subseteq B, f(f^{-1}(T))=T$$
 * 3) $$f$$ is bijective iff the image and preimage of $$f$$ are inverse of each other

Example: If $$A$$ and $$B$$ are sets such that $$B\subseteq A$$, there exists an obviously injective function $$i\,:\, B\rightarrow A$$, called the inclusion $$B\subseteq A$$, such that $$i(b)=b$$ for all $$b\in B$$.

Example: If $$\sim$$ is an equivalence relation on a set $$X$$, there is an obviously surjective function $$\pi\,:\,X\rightarrow X/\sim$$, called the canonical projection onto $$X/\sim$$, such that $$\pi(x)=[x]$$ for all $$x\in X$$.

Theorem: Define the equivalence relation $$\sim$$ on $$A$$ such that $$a\sim b$$ if and only if $$f(a)=f(b)$$. Then, if $$f:A\rightarrow B$$ is any function, $$f$$ decomposes into the composition


 * $$A\stackrel{\pi}{\longrightarrow} A/\sim \stackrel{\tilde{f}}{\longrightarrow} \mathrm{im}f \stackrel{i}{\longrightarrow} B$$

where $$\pi$$ is the canonical projection, $$i$$ is the inclusion $$\mathrm{im}\,f\subseteq B$$, and $$\tilde{f}$$ is the bijection $$\tilde{f}([a])=f(a)$$ for all $$a\in A$$.

Proof: The definition of $$\tilde{f}$$ immediately implies that $$f=i\circ\tilde{f}\circ\pi$$, so we only have to prove that $$\tilde{f}$$ is well defined and a bijection. Let $$a,a^\prime \in A$$. Then $$[a]=[a^\prime] \,\Rightarrow \, a\sim a^\prime \,\Rightarrow\, f(a)=f(a^\prime)$$. This shows that the value of $$\tilde{f}([a])$$ is independent of the representative chosen from $$[a]$$, and so it is well-defined.

For injectivity, we have $$\tilde{f}([a])=\tilde{f}([a^\prime])\,\Rightarrow\, f(a)=f(a^\prime) \,\Rightarrow\, [a]=[a^\prime]$$, so $$\tilde{f}$$ is injective.

For surjectivity, let $$b\in \mathrm{im}\,f$$. Then there exists an $$a\in A$$ such that $$f(a)=b$$, and so $$\tilde{f}([a])=b$$ by definition of $$\tilde{f}$$. Since $$b$$ is arbitrary in $$\mathrm{im}\,f$$, this proves that $$\tilde{f}$$ is surjective.

Q.E.D.

Definition: Given a function $$f\,:\,X\rightarrow Y$$, $$f$$ is a

(i) Monomorphism if given any two functions $$g,h\,:\,W\rightarrow X$$ such that $$f \circ g = f \circ h$$, then $$g=h$$.

(ii) Epimorphism if given any two functions $$g,h\,:\,Y\rightarrow Z$$ such that $$g \circ f = h \circ f$$, then $$g=h$$.

Theorem: A function between sets is

(i) a monomorphism if and only if it is injective.

(ii) an epimorphism if and only if it is surjective.

Proof: (i) Let $$f\,:\,B\rightarrow C$$ be a monomorphism. Then, for any two functions $$g,h\,:\,A\rightarrow B$$, $$f(g(a))=f(h(a)) \,\Rightarrow\, g(a)=h(a)$$ for all $$a\in A$$. This is the definition if injectivity. For the converse, if $$f$$ is injective, it has a left inverse $$f^\prime$$. Thus, if $$f(g(a))=f(h(a))$$ for all $$a\in A$$, compose with $$f^\prime$$ on the left side to obtain $$g(a)=h(a)$$, such that $$f$$ is a monomorphism.

(ii) Let $$f\,:\,A\rightarrow B$$ be an epimorphism. Then, for any two functions $$g,h\,:\, B\rightarrow C$$, $$g(f(a))=h(f(a))\,\Rightarrow\, g(b)=h(b)$$ for all $$a\in A$$ and $$b\in B$$. Assume $$\mathrm{im} f \neq B$$, that is, that $$f$$ is not surjective. Then there exists at least one $$b\in B$$ not in $$\mathrm{im}\,f$$. For this $$b$$ choose two functions $$g,h$$ which coincide on $$\mathrm{im}\, f$$ but disagree on $$\{b\}$$. However, we still have $$g(f(a))=h(f(a))$$ for all $$a\in A$$. This violates our assumption that $$f$$ is an epimorphism. Consequentally, $$f$$ is surjective. For the converse, assume $$f$$ is surjective. Then the epimorphism property immediately follows.

Q.E.D.

Remark: The equivalence between monomorphism and injectivity, and between epimorphism and surjectivity is a special property of functions between sets. This not the case in general, and we will see examples of this when discussing structure-preserving functions between groups or rings in later sections.

Example: Given any two sets $$A$$ and $$B$$, we have the canonical projections $$\pi_A\,:\,A\times B \rightarrow A$$ sending $$(a,b)$$ to $$a$$, and $$\pi_B\,:\, A\times B\rightarrow B$$ sending $$(a,b)$$ to $$b$$. These maps are obviously surjective.

In addition, we have the natural inclusions $$i_A\,:\, A\rightarrow A\coprod B$$ and $$i_B\,:\, B\rightarrow A\coprod B$$ which are obviously injective as stated above.

Universal properties
The projections and inclusions described above are special, in that they satisfy what are called universal properties. We will give the theorem below. The proof is left to the reader.

Theorem: Let $$A,B,C$$ be any sets.

(i) Let $$f\,:\,C\rightarrow A$$ and $$g\,:\,C\rightarrow B$$. Then there exists a unique function $$u\,:\,C\rightarrow A\times B$$ such that $$f=\pi_A\circ u$$ and $$g=\pi_B\circ u$$ are simultaneously satisfied. $$u$$ is sometimes denoted $$f\times g$$.

(ii) Let $$f\,:\,A\rightarrow C$$ and $$g\,:\,B\rightarrow C$$. Then there exists a unique function $$u\,:\,A\coprod B \rightarrow C$$ such that $$f=u\circ i_A$$ and $$g=u\circ i_B$$ are simultaneously satifsied.

The canonical projections onto quotients also satisfy a universal property.

Theorem: Define the equivalence relation $$\sim$$ on $$X$$ and let $$f\,:\,X\rightarrow Y$$ be any function such that $$a\sim b \,\Rightarrow\, f(a)=f(b)$$ for all $$a,b\in X$$. Then there exists a unique function $$\bar{f}\,:\,X/\sim \rightarrow Y$$ such that $$f=\bar{f}\circ \pi$$, where $$\pi\,:\,X\rightarrow X/\sim$$ is the canonical projection.