◀ ▲ ▶Branches / Algebra / Example: Examples of Magmas, Semigroups, and Monoids
Example: Examples of Magmas, Semigroups, and Monoids
(related to Chapter: Magmas, Semigroups, Monoids (Overview))
Examples of magmas.
 The set $\mathbb N$ together with the power operation $(n,m)\to n^m$ is not associative and it has only a leftneutral element.
 The set of rational numbers with the operation of building arithmetic mean $(p,q)\to \frac 12(p+q)$ is not associative and it has no neutral element.
 All of the below examples (a magma is more general than a semigroup).
 On the set $M_{n\times n}(\mathbb R)$ of $n\times n$ square matrices with real coefficients, we can define a binary operation $\ast$ by $(A,B)\to A\ast B:=AB + BA$, where $A$ and $B$ are matrices in $M_{n\times n}(\mathbb R)$ and $AB$ and $BA$ denote the matrix multiplication.^{1} The operation "$\ast$" is not associative for $n\ge 2$ and the semigroup has no neutral element.
 All of the below examples (a semigroup is more general than a monoid).
 In the set $(\mathbb N, + )$ of natural numbers together with addition the addition of natural numbers is associative with $0$ as a neutral element. Therefore it is a monoid. In addition, the addition of natuaral numbers is commutative.
 If $X$ is a nonempty set, then the set $(\mathcal F(X,X),\circ)$ of all functions $f:X\to X$ with the composition of functions "$\circ$" an operation is a monoid, since the composition of functions is associative and the identity function $f(x)=x$ for all $x\in X$ is its neutral element.
 The set $(\mathbb Z\times \mathbb Z,\ast)$ of pairs of integers with the operation $(a,b)\ast(c,d):=(ac,bd)$ is a monoid (the reader might verify the associativity property with the neutral element $(1,1)$.
 The set $(\Sigma^*,\cdot)$ of strings is a monoid.
Thank you to the contributors under CC BYSA 4.0!
 Github:

References
Bibliography
 Lang, Serge: "Algebra  Graduate Texts in Mathematics", Springer, 2002, 3rd Edition
 Fischer, Gerd: "Lehrbuch der Algebra", Springer Spektrum, 2017, 4th Edition
Footnotes