What is difference between idempotent magma and unital magma?

The example given in your table is a unital magma. It is not an idempotent magma, as $bb = a ≠ b$ and it is not a semigroup as $(aa)b = b ≠ 1 = aa = a(ab)$. Thus this example solves your first two questions.

Here is an example of an idempotent magma which is not a semigroup:

$\begin{array}{c|rrrr} & a & b & c \\ \hline a & a & a & b \\ b & b & b & b \\ c & c & c & c \end{array}$

If you want an idempotent magma with identity, just add an identity

$\begin{array}{c|rrrrr} & 1 & a & b & c \\ \hline 1 & 1 & a & b & c \\ a & a & a & a & b \\ b & b & b & b & b \\ c & c & c & c & c \end{array}$


Note that a magma can have at most one identity, but arbitrary many idempotent elements. The identity, if it exists, is always idempotent.

A magma is idempotent if all its elements are idempotent.

Your example magma is not idempotent because neither $a$ nor $b$ is an idempotent element ($a^2=1\ne a$, $b^2=a\ne b$).

Therefore your example fulfils the first two points in your list: It is an unital magma (as it contains an identity element, $1$), but not an idempotent magma (as not all of its elements are idempotent), and therefore also not an idempotent semigroup (actually is isn't a semigroup anyway, because it's not associative).

The term "an identity element of itself" doesn't make sense because an identity is defined globally (it is the identity of the magma, not of some element).

Note that you can create a magma with identity from any magma by just adding an identity, and an idempotent magma from any magma by simply replacing whatever value $x^2$ may have with $x$ (that is, in the table replace the diagonal elements with the row/column element).

For example, starting with your magma, \begin{array}{c|rrrr} & 1 & a & b \\ \hline 1 & 1 & a & b \\ a & a & 1 & a \\ b & b & b & a \end{array} which already has an identity, you get an idempotent magma \begin{array}{c|rrrr} & 1 & a & b \\ \hline 1 & \color{red}{1} & a & b \\ a & a & \color{red}{a} & a \\ b & b & b & \color{red}{b} \end{array} In this specific case, it happens to become also associative, and therefore a monoid (semigroup with identity).


There are lots of very nice non-idempotent structures, so let's start there. Consider $\mathbb{Z}$ (with addition). This is in fact a group (so in particular an associative unital semigroup), but clearly not idempotent (since the only idempotent element is $0$).


What about idempotent magmas and semigroups? The only difference between the two is associativity, so to separate the two we just need a non-associative idempotent operation. A useful example of this is the "midpoint" algebra on a three-element set $\{a,b,c\}$: the operation is given by setting $$a*b=b*a=c, \quad a*c=c*a=b, \quad b*c=c*b=a$$ and $$a*a=a,\quad b*b=b,\quad c*c=c.$$ This is obviously idempotent, but it is not associative since e.g. $$(a*a)*b=a*b=c\color{red}{\not=}b=a*c=a*(a*b).$$ Note that in fact this is a commutative idempotent magma which is non-unital and non-associative (= not a semigroup).

Meanwhile, the "left projection" operation on a nonempty set $A$ (given by $a*b=a$ for all $a,b\in A$) is trivially associative and idempotent (so an idempotent semigroup) but neither unital (unless $\vert A\vert=1$) nor commutative.


Finally, you ask for an associative, commutative, and non-unital magma. Here we get back to nice natural examples: for instance, the positive reals with addition works.

Of course, that's not idempotent. If you want an idempotent, commutative, associative, non-unital magma, simply consider for $X$ a set with more than one element the magma $(\mathcal{P}_{\not=\emptyset}(X); \cup)$ - elements of this magma are nonempty subsets of $X$, and the binary operation is union.


For an example of a unital, non-associative, non-commutative magma, we can start with subtraction on the integers and use a neat trick: adjoining a new element with desired properties.

Specifically, let $X=\mathbb{Z}\sqcup\{\xi\}$ for a new element $\xi$, and let $*$ be the binary operation on $X$ defined as follows:

  • If $a,b\in\mathbb{Z}$ then $a*b=a-b$.

  • If $a=\xi$ then $a*b=b$, and if $b=\xi$ then $a*b=a$.

That is, we've forcibly adjoined an identity element to the integers with subtraction. The resulting magma is still non-associative and non-commutative (any magma with a non-associative/non-commutative submagma is itself non-associative/non-commutative) but is now also unital.