A Fun Categorical View of Rings

This note was inspired by a really fun discussion with Justin Lubin during our Fall 2023 Category Theory Reading Group meeting. Thanks Justin!

Monoids, Groups, and Categories

We start first with some basic algebraic structures and category theory.

Definition (Monoid and Group).

Let $G$ be a set, and $\cdot: G\times G\to G$ be a binary operation. We say that $(G,\cdot, e)$ is a monoid if $\cdot$ is associative, and there is an identity $e \in G$ such that $e\cdot x = x\cdot e = x$ for all $x \in G$.

If additionally, for every $x \in G$ there is a $y\in G$ such that $x\cdot y = y\cdot x = e$, then $(G,\cdot,e)$ forms a group. Put simply, a group is a monoid with inverses. Finally, if $\cdot$ is also commutative, then the group is said to be abelian.

Definition (Category).

A category is a collection of objects and arrows, where

  • each arrow $f : A \to B$ has a source object $A$ and a target object $B$,
  • (composition): if $f:A\to B$ and $g:B\to C$ are arrows, then $g\circ f: A \to C$ is an arrow,
  • (associativity of $\circ$): for all $f:A\to B$, $g:B\to C$, $h:C\to D$, we have $h\circ(g\circ f) = (h\circ g)\circ f,$
  • (identity): and there is an arrow $1_X: X\to X$ for every object $X$ such that for all $f:A\to X$ and $g:X\to B$, we have $1_X\circ f = f$ and $g\circ 1_X = g$.

A classic example of a category is $\cSet$, where the objects are sets and the arrows are functions between sets. While $\cSet$ is an important category and is quite intuitive, it's important to keep in mind that general categories can behave surprisingly differently, which can be confusing when the underlying objects and arrows are still sets and functions but with additional structure.

Viewing Monoids and Groups as Categories

Now, consider some monoid $(G,\cdot)$. Define the category $\cG$ as follows:

  • there is a single object $*$,
  • for every $x \in G$, there is an arrow $f_x:* \to *$, and no more,
  • for every $x,y \in G$, $f_{x\cdot y} = f_x\circ f_y$.

So compositions are defined, but what about the other properties of a category? Notice the following:

  • by the associativity of $\cdot$, $x\cdot(y\cdot z) = (x\cdot y)\cdot z$ implies $f_x\circ (f_y\circ f_z) = (f_x \circ f_y)\circ f_z$,
  • $f_e$ satisfies $f_e\circ f_x = f_{e\cdot x} = f_x$, and symmetrically on the right.

Thus composition is indeed associative, and $1_* = f_e$. What we have shown is that any monoid defines a one-object category, and vice-versa! If $(G,\cdot, e)$ is a group, we have an even stronger property: for any arrow $f_x$, there is an arrow $f_y$ such that $f_x\circ f_y = f_y\circ f_x = 1_*$. In other words, every arrow has an inverse.1

In summary, we can think of monoids and groups as categories with a single object, and arrows corresponding to currying the monoid/group operation with specific elements.

Rings, Functors, and Rings as a "Monoid of Endofunctors"

We can now define a ring succinctly, using monoids and groups:

Definition (Ring).

A ring is a set $R$ together with two binary operations $\oplus$ and $\otimes$ on $R$, such that $(R,\oplus, 0)$ is an abelian group, $(R,\otimes, 1)$ is a monoid, and $\otimes$ distributes over $\oplus$: $x\otimes(y \oplus z) = x\otimes y\oplus x\otimes z$, and symmetrically on the right.

So how do we define a ring categorically? Let's start by reproducing $\cG$ as before except over $(R,\oplus)$. Let's denote this category by $\cR^\oplus$ to emphasize the operation being considered.

Abusing notation for now, the distributivity property can be written something like \[ x \otimes (f_y\circ f_z) = (x\otimes f_y) \circ (x\otimes f_z). \tag{1} \] This suggests the following: multiplying by $x$ transforms arrows in a way that respects composition.

Functors

Conveniently, a central concept in category theory is that of a functor, which is a map between categories that does just what we want.

Definition (Functor).

Let $\cC$ and $\cD$ be categories. A functor $F:\cC\to\cD$ is a mapping such that

  • each object $X \in \cC$ is mapped to an object $F(X)\in \cD$,
  • each arrow $f:A\to B$ in $\cC$ is mapped to an arrow $F(f): F(A)\to F(B)$ in $\cD$,
  • for every $X\in\cC$, $F(1_X) = 1_{F(X)}$,
  • and $F(g\circ f) = F(g)\circ F(f)$.

An endofunctor is a functor from a category back to itself.

The "Monoid of Endofunctors"

Going back to equation (1), let's write $x\otimes -$ as a unary "function" $F_x(-)$. Then, (1) becomes \[ F_x(f_y\circ f_z) = F_x(f_y)\circ F_x(f_z). \] Hopefully, it should now be clear that this is an endofunctor! We can fill in the rest mechnically:

  • $F_x(*) = *$,
  • $F_x(f_y) = f_{x\otimes y}$,
  • and $F_x(f_0) = f_{x\otimes 0} = f_{0}$.

In summary, $F_x$ is an endofunctor on $\cR^\oplus$ representing left-multiplication by $x$. We thus have a collection of endofunctors $\mF$ on $\cR^\oplus$ that captures left-multiplication in $R$. Right-multiplication (denote it by $G_x$) is analogous, except $G_x(f_y) = f_{y\otimes x}$.

The cool thing about category theory is that you can just keep layering abstractions on top of each other! Indeed, there is a category of categories, where the objects are individual categories and the arrows are functors between categories. Inspired by this, we can now define the ring $R$ as a category $\cR$:

  • there is a single object, namely $\cR^\oplus$,
  • for every $x\in R$, there is an arrow $F_x:\cR^\oplus\to\cR^\oplus$ and an arrow $G_x:\cR^\oplus\to\cR^\oplus$ corresponding to left and right multiplication by $x$,
  • $F_x \circ F_y = F_{x\otimes y}$, and likewise for $G_x,G_y$.

Furthermore, since $(R,\otimes,1)$ is a monoid, we automatically get that $F_1 = G_1 = 1_{\cR^\oplus}$, and that associativity holds in $\cR$ (which makes it a category, and indeed the "same" category as we defined earlier for a monoid). However, because we have distingushed left and right multiplication, it's worth checking that the operations commute -- that is, it shouldn't matter which side you multiply by first.2

\[ F_x\circ G_y (f_z) = F_x(f_{z\otimes y}) = f_{x\otimes (z\otimes y)} = f_{(x\otimes z)\otimes y} = G_y(f_{x\otimes z}) = G_y\circ F_x (f_z). \]

Another interesting property is that for any $x,y\in R$, \[ F_x(f_y) = f_{x\otimes y} = G_y(f_x). \]

Finally, let's work out an example expression where we apply distributivity: \[ \begin{align*} x\otimes y\otimes (z\oplus w)\otimes u &\mapsto G_u\circ(F_x\circ F_y)(f_z\circ f_w)\\ &= G_u\circ((F_x\circ F_y)(f_z)\circ (F_x\circ F_y)(f_w))\\ &= (G_u\circ F_x\circ F_y)(f_z)\circ (G_u\circ F_x\circ F_y)(f_w) \mapsto (x\otimes y\otimes z\otimes u) \oplus (x\otimes y\otimes w\otimes u). \end{align*} \] Neat!


  1. If we forget about $G$ entirely, we could in fact take this categorical constraint as the definition of a group. If we allow more than just one object, this becomes a groupoid

  2. This feels kind of clunky, and is probably a consequence of not using the "proper" machinery of monoid objects, but this is beyond me at the moment...