## § The cutest way to write semidirect products

Given two monoids $(M, +, 0_M)$ and $(N, \times, 1_N)$, and a homomorphism $\phi: N \rightarrow End(M)$, where $End(M)$ is the endomorphism group of $M$. We will notate $\phi(n)(m)$ as $n \cdot m \in M$. Now the semidirect product $M \ltimes_\phi N$ is the set $M \times N$ equipped with the multiplication rule:
• $(m, n) (m', n') = (m + n \cdot m', nn')$
This can also be written down as:
$\begin{bmatrix} 1 & 0 \\ m & n \end{bmatrix} \begin{bmatrix} 1 & 0 \\ m' & n' \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ m + n \cdot m' & n \times n' \end{bmatrix}$
This way of writing down semidirect products as matrices makes many things immediately clear:
• The semidirect product is some kind of "shear" transform, since that's what a shear transformation looks like, matrix-wise.
• The resulting monoid $M \ltimes_{\phi} N$ has identity $(0_M, 1_N)$, since for the matrix to be identity, we need the 2nd row to be $(0, 1)$.
• The inverse operation if $(M, N)$ were groups would have to be such that
$\begin{bmatrix} 1 & 0 \\ m + n \cdot m' & n \times n' \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$
Hence:
• $nn' = 1$ implies that $n' = 1/n$.
• $m + n m' = 0$ implies that $m' = -m/n$.
which is indeed the right expression for the inverse.