[proofplan]
For each listed algebraic structure, we verify the category axioms directly. The identity function on any object preserves the defining operations, so it is an admissible morphism. The composite of two admissible morphisms again preserves the same operations, and associativity and the identity laws follow from associativity and identity laws for composition of functions.
[/proofplan]
[step:Verify identities and composition in $\mathbf{Grp}$]
Let $G$, $H$, and $K$ be groups with operations written multiplicatively. For every group $G$, define
\begin{align*}
\operatorname{id}_G: G &\to G \\
x &\mapsto x.
\end{align*}
For all $x,y \in G$,
\begin{align*}
\operatorname{id}_G(xy) = xy = \operatorname{id}_G(x)\operatorname{id}_G(y),
\end{align*}
so $\operatorname{id}_G$ is a group homomorphism.
Now let
\begin{align*}
f: G &\to H, &
g: H &\to K
\end{align*}
be group homomorphisms. Their composite is the function
\begin{align*}
g \circ f: G &\to K \\
x &\mapsto g(f(x)).
\end{align*}
For all $x,y \in G$,
\begin{align*}
(g \circ f)(xy)
&= g(f(xy)) \\
&= g(f(x)f(y)) \\
&= g(f(x))g(f(y)) \\
&= (g \circ f)(x)(g \circ f)(y).
\end{align*}
Thus $g \circ f$ is a group homomorphism. Therefore the objects, morphisms, identity morphisms, and composition law specified for $\mathbf{Grp}$ are closed under the operations required of a category.
[/step]
[step:Verify identities and composition in $\mathbf{Ring}$]
Let $A$, $B$, and $C$ be unital rings. For every unital ring $A$, define
\begin{align*}
\operatorname{id}_A: A &\to A \\
a &\mapsto a.
\end{align*}
For all $a,b \in A$,
\begin{align*}
\operatorname{id}_A(a+b) &= a+b = \operatorname{id}_A(a)+\operatorname{id}_A(b), \\
\operatorname{id}_A(ab) &= ab = \operatorname{id}_A(a)\operatorname{id}_A(b), \\
\operatorname{id}_A(1_A) &= 1_A.
\end{align*}
Hence $\operatorname{id}_A$ is a unital ring homomorphism.
Now let
\begin{align*}
f: A &\to B, &
g: B &\to C
\end{align*}
be unital ring homomorphisms. Their composite is the function
\begin{align*}
g \circ f: A &\to C \\
a &\mapsto g(f(a)).
\end{align*}
For all $a,b \in A$,
\begin{align*}
(g \circ f)(a+b)
&= g(f(a+b)) \\
&= g(f(a)+f(b)) \\
&= g(f(a))+g(f(b)) \\
&= (g \circ f)(a)+(g \circ f)(b),
\end{align*}
and
\begin{align*}
(g \circ f)(ab)
&= g(f(ab)) \\
&= g(f(a)f(b)) \\
&= g(f(a))g(f(b)) \\
&= (g \circ f)(a)(g \circ f)(b).
\end{align*}
Finally, preservation of the unit gives
\begin{align*}
(g \circ f)(1_A) = g(f(1_A)) = g(1_B) = 1_C.
\end{align*}
Thus $g \circ f$ is a unital ring homomorphism. Therefore the specified data for $\mathbf{Ring}$ are closed under identities and composition.
[/step]
[step:Verify identities and composition in $R\text{-}\mathbf{Mod}$]
Fix a unital ring $R$. Let $M$, $N$, and $P$ be left $R$-modules. For every left $R$-module $M$, define
\begin{align*}
\operatorname{id}_M: M &\to M \\
m &\mapsto m.
\end{align*}
For all $m,n \in M$ and all $r \in R$,
\begin{align*}
\operatorname{id}_M(m+n) &= m+n = \operatorname{id}_M(m)+\operatorname{id}_M(n), \\
\operatorname{id}_M(rm) &= rm = r\,\operatorname{id}_M(m).
\end{align*}
Hence $\operatorname{id}_M$ is an $R$-module homomorphism.
Now let
\begin{align*}
f: M &\to N, &
g: N &\to P
\end{align*}
be $R$-module homomorphisms. Their composite is the function
\begin{align*}
g \circ f: M &\to P \\
m &\mapsto g(f(m)).
\end{align*}
For all $m,n \in M$ and all $r \in R$,
\begin{align*}
(g \circ f)(m+n)
&= g(f(m+n)) \\
&= g(f(m)+f(n)) \\
&= g(f(m))+g(f(n)) \\
&= (g \circ f)(m)+(g \circ f)(n),
\end{align*}
and
\begin{align*}
(g \circ f)(rm)
&= g(f(rm)) \\
&= g(rf(m)) \\
&= r\,g(f(m)) \\
&= r\,(g \circ f)(m).
\end{align*}
Thus $g \circ f$ is an $R$-module homomorphism. Therefore the specified data for $R\text{-}\mathbf{Mod}$ are closed under identities and composition.
[/step]
[step:Inherit associativity and identity laws from function composition]
It remains to verify the categorical associativity and identity laws for each of the three constructions. In all three cases, morphism composition is defined to be composition of underlying functions.
Let $A$, $B$, $C$, and $D$ denote four objects in one of the three proposed categories, and let
\begin{align*}
f: A &\to B, &
g: B &\to C, &
h: C &\to D
\end{align*}
be morphisms in that proposed category. For every element $a \in A$, associativity of function composition gives
\begin{align*}
((h \circ g) \circ f)(a)
&= (h \circ g)(f(a)) \\
&= h(g(f(a))) \\
&= h((g \circ f)(a)) \\
&= (h \circ (g \circ f))(a).
\end{align*}
Therefore $(h \circ g) \circ f = h \circ (g \circ f)$.
For every morphism
\begin{align*}
f: A &\to B
\end{align*}
and every $a \in A$,
\begin{align*}
(f \circ \operatorname{id}_A)(a) &= f(a), \\
(\operatorname{id}_B \circ f)(a) &= f(a).
\end{align*}
Hence $f \circ \operatorname{id}_A = f$ and $\operatorname{id}_B \circ f = f$.
Thus $\mathbf{Grp}$, $\mathbf{Ring}$, and $R\text{-}\mathbf{Mod}$ satisfy the identity, closure, associativity, and unit axioms for categories. This proves that each listed algebraic structure forms a category.
[/step]