# The Unapologetic Mathematician

## Endomorphism rings

Today I want to set out an incredibly important example of a ring. This example (and variations) come up over and over and over again throughout mathematics.

Let’s start with an abelian group $G$. Now consider all the linear functions from $G$ back to itself. Remember that “linear function” is just another term for “abelian group homomorphism” — it’s a function that preserves the addition — and that we call such homomorphisms from a group to itself “endomorphisms”.

As for any group, this set has the structure of a monoid. We can compose linear functions by, well, composing them. First do one, then do the other. We define the operation by $\left[f\circ g\right](x)=f(g(x))$ and verify that the composition is again a linear function:
$\left[f\circ g\right](x+y)=f(g(x+y))=f(g(x)+g(y))=$
$f(g(x))+f(g(y))=[f\circ g](x)+[f\circ g](y)$
This composition is associative, and the function that sends every element of $G$ to itself is an identity, so we do have a monoid.

Less obvious, though, is the fact that we can add such functions. Just add the values! Define $\left[f+g\right](x)=f(x)+g(x)$. We check that this is another endomorphism:
$\left[f+g\right](x+y)=f(x+y)+g(x+y)=f(x)+f(y)+g(x)+g(y)=$
$f(x)+g(x)+f(y)+g(y)=[f+g](x)+[f+g](y)$
Now this addition is associative. Further the function ${}0$ sending every element of $G$ to the element ${}0$ of $G$ is an additive identity, and the function $\left[-f\right](x)=-f(x)$ is an additive inverse. The collection of endomorphisms with this addition becomes an abelian group.

So we have two structures: an abelian group and a monoid. Do they play well together? Indeed!
$\left[(f_1+g_1)\circ(f_2+g_2)\right](x)=\left[f_1+g_1\right](\left[f_2+g_2\right]((x))=$
$f_1(f_2(x)+g_2(x))+g_1(f_2(x)+g_2(x))=$
$f_1(f_2(x))+f_1(g_2(x))+g_1(f_2(x))+g_1(g_2(x))=$
$\left[f_1\circ f_2\right](x)+\left[f_1\circ g_2\right](x)+\left[g_1\circ f_2\right](x)+\left[g_1\circ g_2\right](x)=$
$\left[f_1\circ f_2+f_1\circ g_2+g_1\circ f_2+g_1\circ g_2\right](x)$
showing that composition distributes over addition.

So the endomorphisms of an abelian group $G$ form a ring with unit. We call this ring ${\rm End}(G)$, and like I said it will come up everywhere, so it’s worth internalizing.