# Commutative Algebra/Functors, natural transformations, universal arrows
## Functors
### Definitions

There are two types of functors, covariant functors and contravariant functors. Often, a covariant functor is simply called a functor.
Definition 2.1:
Let ${\mathcal {C}},{\mathcal {D}}$ be two categories. A covariant functor $F:{\mathcal {C}}\to {\mathcal {D}}$ associates
* to each object $A$ of ${\mathcal {C}}$ an object $F(A)$ of ${\mathcal {D}}$, and
* to each morphism $f:A\to B$ in ${\mathcal {C}}$ a morphism $F(f):F(A)\to F(B)$,
such that the following rules are satisfied:
* For all objects $A$ of ${\mathcal {C}}$ we have $F(1_{A})=1_{F(A)}$, and
* for all morphisms $f:A\to B$ and $g:B\to C$ of ${\mathcal {C}}$ we have $F(g\circ f)=F(g)\circ F(f)$.
Definition 2.2:
Let ${\mathcal {C}},{\mathcal {D}}$ be two categories. A contravariant functor $F:{\mathcal {C}}\to {\mathcal {D}}$ associates
* to each object $A$ of ${\mathcal {C}}$ an object $F(A)$ of ${\mathcal {D}}$, and
* to each morphism $f:A\to B$ in ${\mathcal {C}}$ a morphism $F(f):F(B)\to F(A)$,
such that the following rules are satisfied:
* For all objects $A$ of ${\mathcal {C}}$ we have $F(1_{A})=1_{F(A)}$, and
* for all morphisms $f:A\to B$ and $g:B\to C$ of ${\mathcal {C}}$ we have $F(g\circ f)=F(f)\circ F(g)$.

### Forgetful functors

I'm not sure if there is a precise definition of a forgetful functor, but in fact, believe it or not, the notion is easily explained in terms of a few examples.
Example 2.3:
Consider the category of groups with homomorphisms as morphisms. We may define a functor sending each group to it's underlying set and each homomorphism to itself as a function. This is a functor from the category of groups to the category of sets. Since the target objects of that functor lack the group structure, the group structure has been forgotten, and hence we are dealing with a forgetful functor here.
Example 2.4:
Consider the category of rings. Remember that each ring is an Abelian group with respect to addition. Hence, we may define a functor from the category of rings to the category of groups, sending each ring to the underlying group. This is also a forgetful functor; one which forgets the multiplication of the ring.

## Natural transformations

Definition 2.5:
Let ${\mathcal {C}},{\mathcal {D}}$ be categories, and let $F,G:{\mathcal {C}}\to {\mathcal {D}}$ be two functors. A natural transformation is a family of morphisms in ${\mathcal {D}}$ $\eta _{X}:F(X)\to G(X)$, where $X$ ranges over all objects of ${\mathcal {C}}$, that are compatible with the images of morphisms $f:X\to Y$ of ${\mathcal {C}}$ by the functors $F$ and $G$; that is, the following diagram commutes:
Example 2.6:
Let ${\mathcal {C}}$ be the category of all fields and ${\mathcal {D}}$ the category of all rings. We define a functor
    $F:{\mathcal {C}}\to {\mathcal {D}}$
as follows: Each object $\mathbb {F}$ of ${\mathcal {C}}$ shall be sent to the ring $R_{\mathbb {F} }$ consisting of addition and multiplication inherited from the field, and whose underlying set are the elements
    $S_{\mathbb {F} }\{\overbrace {1_{\mathbb {F} }+1_{\mathbb {F} }+\cdots +1_{\mathbb {F} }} ^{n{\text{ times}}}|n\in \mathbb {N} _{0}\}\cup \{\overbrace {-1_{\mathbb {F} }-1_{\mathbb {F} }-\cdots -1_{\mathbb {F} }} ^{n{\text{ times}}}|n\in \mathbb {N} \}$,
where $1_{\mathbb {F} }$ is the unit of the field $\mathbb {F}$. Any morphism $f:\mathbb {F} \to \mathbb {G}$ of fields shall be mapped to the restriction $f\upharpoonright _{S_{\mathbb {F} }}$; note that this is well-defined (that is, maps to the object associated to $\mathbb {G}$ under the functor $F$), since both
    $f(1_{\mathbb {F} }+1_{\mathbb {F} }+\cdots +1_{\mathbb {F} })=f(1_{\mathbb {F} })+f(1_{\mathbb {F} })+\cdots +f(1_{\mathbb {F} })=1_{\mathbb {G} }+1_{\mathbb {G} }+\cdots +1_{\mathbb {G} }$
and
    $f(-1_{\mathbb {F} }-1_{\mathbb {F} }-\cdots -1_{\mathbb {F} })=-f(1_{\mathbb {F} })-f(1_{\mathbb {F} })-\cdots -f(1_{\mathbb {F} })=-1_{\mathbb {G} }-1_{\mathbb {G} }-\cdots -1_{\mathbb {G} }$,
where $1_{\mathbb {G} }$ is the unit of the field $\mathbb {G}$.
We further define a functor
    $G:{\mathcal {C}}\to {\mathcal {D}}$,
sending each field $\mathbb {F}$ to its associated prime field $\mathbb {F} _{\text{prime}}$, seen as a ring, and again restricting morphisms, that is sending each morphism $f:\mathbb {F} \to \mathbb {G}$ to $f\upharpoonright _{\mathbb {F} _{\text{prime}}}$ (this is well-defined by the same computations as above and noting that $f$, being a field morphism, maps inverses to inverses).
In this setting, the maps
    $\eta _{\mathbb {F} }:R_{\mathbb {F} }\to \mathbb {F} _{\text{prime}}$,
given by inclusion, form a natural transformation from $F$ to $G$; this follows from checking the commutative diagram directly.

## Universal arrows

Definition 2.7 (universal arrows):
Let ${\mathcal {C}},{\mathcal {D}}$ be categories, let $F:{\mathcal {C}}\to {\mathcal {D}}$ be a functor, let $Y$ be an object of ${\mathcal {D}}$. A universal arrow is a morphism $g:Y\to F(X)$, where $X$ is a fixed object of ${\mathcal {C}}$, such that for any other object $Z$ of ${\mathcal {C}}$ and morphism $h:Y\to F(Z)$ there exists a unique morphism $f:X\to Z$ such that the diagram
commutes.