# Can a binary operation have an identity element when it is not associative and commutative? [duplicate]

I tried getting the answers in similar questions, everyone says that it's not necessary, but if $e$ is the identity element for any binary operation $*$, which is not associative and commutative, how can

$$a*e=a=e*a$$

when it is not commutative, i.e. $a*b \ne b*a$?

Even if we get a value by solving $a*e=a$. Will we get the same value by solving $e*a=a$ ? Please provide an example.

• If $\ast$ has both a left identity $l$ and a right identity $r$, then $l = l \ast r = r$. Jun 20, 2017 at 12:54
• See the wikipedia article on quasigroups, and specifically the section on loops. It has the additional assumption of divisibility, and as such left and right inverses, but is otherwise exactly what you're looking for. The examples section includes such familiar things as the integers with the subtraction operation and the non-zero rationals, reals or complex numbers with division. Jun 21, 2017 at 9:03
• what is the meaning of "not associative and commutative"? Is it "(not associative) and commutative" or "not (associative and commutative)"? Or "(not associative) and (not commutative)"? Aug 20, 2021 at 11:29
• Does this answer your question? Non-associative, non-commutative binary operation with a identity Apr 14 at 7:04

Asserting that the operation $$*$$ is not commutative means that there are elements $$a$$ and $$b$$ such that $$a*b\neq b*a$$. It does not mean that $$a*b\neq b*a$$ for any two distinct elements $$a$$ and $$b$$. Therefore, an operation may well not be commutative and, even so, to have an identity element. There is no contradiction here.

For an example of a non-commutative and non-associative algebraic structure with an identity element, take, for instance, the octonions.

An operation is commutative if for any $a$ and $b$, we have $ab=ba$. Finding one pair $a,b$ such that $ab=ba$ doesn't prove the operation is commutative; this has to hold for every pair.

Consider the set $\{a,b,c\}$ whose binary operation $\cdot$ is given by the following: $$a\cdot a = a\,\,\,\,\,\,\,\,\,\,\, a\cdot b=b\,\,\,\,\,\,\,\,\,\,\,a\cdot c=c$$ $$b\cdot a = b\,\,\,\,\,\,\,\,\,\,\, b\cdot b=b\,\,\,\,\,\,\,\,\,\,\,b\cdot c=c$$ $$c\cdot a = c\,\,\,\,\,\,\,\,\,\,\, c\cdot b=b\,\,\,\,\,\,\,\,\,\,\,c\cdot c=a$$ This operation has $a$ as an identity element. However, it is not commutative (since $b\cdot c\neq c\cdot b$) and it is not associative (since $b\cdot(c\cdot c)=b\neq a =(b\cdot c)\cdot c$).

Actually, given any set $S$ and operation $*$ on it (so possibly neither associative nor commutative), we can simply extend this with a new symbol $\color{red}0$ (i.e., $\color{red}0\notin S$) and on the set $S':=S\cup\{\color{red}0\}$ define an operation $\color{red}*$ by $$x\color{red}*y:=\begin{cases}x&\text{if }y=\color{red}0\\ y&\text{if }x=\color{red}0\\x*y&\text{otherwise} \end{cases}$$ Then $\color{red}*$ is not associative/commutative if $*$ is not associative/commutative. But $\color{red}0$ is neutral.

• Nice. Since all operators with identity can be viewed as arising from this process and because the probability that a randomly choses operator on a set with $n$ elements is either commutative or associative tends to $0$ as $n \rightarrow \infty$, you can show that most operators with identity are neither associative nor commutative. Jun 21, 2017 at 13:21
• @JohnColeman, not all operations admitting an identity arise in this way. For instance the group $\mathbb{Z}/(2)$ does not. If it did, we would have $1+1=1$, but instead $1+1=0$. Jul 11 at 22:32

It is possible. $*$ not being commutative means that $a*b\neq b*a$ for some $a,b$, not for all of them. So you may have $a*e=e*a=a$ without contradicting that $*$ is not commutative.

Without looking for esoteric and/or ad hoc examples, there is one you are certainly familiar with. The identity matrix is the identity element for matrix multiplication, which is not commutative. We have $A\,I=I\,A=A$ while in general $A\,B \neq B\,A$.

• This is nice, because although the OP mentioned nonassociativity, the only property invoked in her/his argument is noncommutativity. Therefore matrix addition is a good, familiar example.
– user13618
Jun 20, 2017 at 21:45
• @Ben Crowell, matrix multiplication, not addition. Addition is commutative. May 7, 2021 at 11:18
• @Ben Crowell, Also, you work at Fullerton and the OP is Fullatron. What a coincidence! May 7, 2021 at 11:20

Can a binary operation have an identity element when it is not associative and commutative?

Yes. Any non-commutative loop is an example of such algebraic structure. I am surprised that, searching the word loop with Ctrl + F in this page just before answering, I found only one occurrence in the comment by Arthur.

(...) how can

$$a*e=a=e*a$$

when it is not commutative (...) ?

As in the accepted answer, the operation $$*$$ is by definition commutative on the set $$A$$, if and only if $$a*b=b*a$$ for all $$a,b\in A$$.

No surprise if, in a given operation on a given set $$A$$, only some elements of $$A$$ commute with all the others: in a non-commutative binary operation with two-sided identity, the identity element commutes with all the others elements. Indeed, the definition of identity element $$e$$ for the binary operation $$*$$ on a set $$A$$ states: $$a*e=a=e*a,\quad\forall\,a\in A.$$

Of course :) And, further, we can create without too much effort an example which is even less than a loop. The finite magma of order $$4$$ given by the Cayley table $$\begin{array}{c|cccc} * & 1 & 2 & 3 & 4\\ \hline 1 & \color{red}{1} & \color{red}{2} & \color{red}{3} & \color{red}{4}\\ 2 & \color{red}{2} & 4 & 3 & 3\\ 3 & \color{red}{3} & 3 & 4 & 2\\ 4 & \color{red}{4} & 1 & 1 & 1\\ \end{array}$$ has the two-sided identity element $$1$$ while cancellation and division do not hold, it is not commutative since - e.g. - $$2*4\ne 4*2$$ and it is not even associative: $$(2*3)*4=3*4=2\ne 4=2*2=2*(3*4).$$
Isn't subtraction a binary function which has an identity ($x-0=x$) although it is not commutative ($5-0 > 0-5$) or associative ($5-(4-3) > (5-4)-3$)?
• Zero is only a right-identity for subtraction. $0 - x = x$ fails. Jun 20, 2017 at 18:45