Given a semiring $S$, we get a monoid $M(S)$ as follows:

- The underlying set of $S$ is $S^2$
- The identity element is $(0,1)$
- The law of composition is given by $$(a,A)(b,B) = (Ba+b,AB),$$ where $a,A,b$ and $B$ range over the semiring $S$.

Let's refer to the $M(S)$ as the *semidirect monoid of $S$.* (See below for motivation.)

Question.Where can I learn more about these monoids? Are they studied anywhere?

**Motivation 0.** I originally "invented" the above formula due to its connection with positional notation for numbers. Here's an example computation that should hopefully illustrate the idea:
$$\begin{align*}(3,10)(6,10)(5,10) &= (30+6,100)(5,10) \\ &= (300+60+5,1000) \\ &= (365,1000)
\end{align*}
$$

So the number $365$ can be obtained by first taking the numbers $3$, $6$ and $5$, putting them in place of the $\Box$ symbol in the expression $(\Box,10)$ to obtain $(3,10),(6,10)$ and $(5,10)$, then multiplying these pairs in the monoid $M(\mathbb{N})$ and discarding the second entry.

This works for any base, even negative ones, and gives convenient notation for those situations where the base needs to change from one column to the next.

**Motivation 1.**

The operation also appears naturally when thinking about expanding out products of disjoint unions of sets. Suppose we expand out the product $$(X_0+X_1)(Y_0+Y_1) \cong X_0(Y_0+Y_1)+X_1(Y_0+Y_1) \cong X_0Y_0 + X_0Y_1 + X_1Y_0 + X_1Y_1.$$

We end up with four terms. Let's label them with the elements of the set $\{0,1,2,3\}.$ For example, $X_0Y_0$ would be in position $0$.

Now let's ask the question, in which position does $X_1Y_0$ wind up? Well, just compute: $$(1,2)(0,2) = (2+0,4) = (2,4).$$

So it should end up in position $2$, which it does.

In a similar vein: if we have a list of length $A$, the entries of which are lists of length $B$, the entries of which are lists of length $C$, then to work out where the item at location $(a,b,c)$ will end up once we flatten the list, we just compute $$(a,A)(b,B)(c,C).$$

**Motivation 2.**

A few hours ago, I noticed (essentially) the same formula appear on the page about the Poincare group.

This got me a bit excited. Here's the key observation:

Given monoids $P$ and $Q$ and a homomorphism $\varphi : P \rightarrow \mathrm{End}(Q),$ we can define that the outer semidirect product of $P$ and $Q$ across $\varphi$ to be the following monoid:

- The underlying set is $Q \times P$
- The identity element is $(1,1)$
- The law of composition is given by $$(a,A)(b,B) = (\varphi(B)(a)b,AB),$$ where $a,A,b$ and $B$ range over the semiring $S$.

(Note that I've changed the definition slightly from the standard group-theoretic one to get the opposite monoid from the one that would be obtained had the definition just been copied and pasted. This is to make semidirect products fit more cleanly with what I wrote above.)

Given a semiring $S$, the important observation is that the monoid $M(S)$ is the semidirect product of $(S,+,0)$ and $(S,\times,1)$ across the function $\varphi : (S,\times,1) \rightarrow \mathrm{End}(S,+,0)$ given by $\varphi(B) = (a \mapsto Ba).$

5more comments