# Is left inverse implying right inverse in matrix a property of structure?

If $$A$$ is a square matrix and there exists a square matrix $$B$$ such that $$AB =1$$, than it is known that $$BA=1$$. This property is proved with some properties from linear algebra. Although I've never seen it be proved just by structures of matrix multiplication, I couldn't find a counterexample of a set with structures of matrix multiplication but left inverse doesn't imply right inverse.

To be more specific, let $$X$$ be a set and binary operation $$\cdot$$ is defined on $$X$$. If $$\cdot$$ is associative and $$X$$ has left and right identity(which will be the same), than does $$A \cdot B = 1$$ for some $$A, B\in X$$ implies $$B \cdot A = 1$$?

If not, what other properties of matrix multiplication should we add to this structure of $$(X,\cdot)$$ in order to get the property?

• Left and right identity will not necessily be the same. – amsmath Oct 25 '19 at 2:47
• It is not true in general; see math.stackexchange.com/questions/70777/… – Elliot G Oct 25 '19 at 2:50
• @amsmath No, I mean I'd like to know the operation such that if there exists an element which has a left inverse then the element also has a right inverse(Then the two inverses must be same.). – coxehj4142 Oct 25 '19 at 2:52
• @coxehj4142 Then why do you write something about left and right identities? – amsmath Oct 25 '19 at 2:54
• It is not enough; a monoid may have elements with one-sided inverses but no inverse on the other side. If $A$ is infinite, the set of all functions $f\colon A\to A$ is a monoid under composition, and if $f$ is surjective but not injective then there exists $g$ such that $f\circ g=\mathrm{id}_A$, but there is no element such that $h\circ f=\mathrm{id}_A$. It really is something special about matrices and the way they act, not about the monoid structure. – Arturo Magidin Oct 25 '19 at 2:56

Take $$X = \{f:\mathbb R\to\mathbb R\}$$ equipped with composition $$\circ$$. Can you think of a function that is surjective but not injective?
If you just consider one operation, that is, if you work with monoids, the answer is no. A counterexample is the bicyclic monoid, which is the quotient of the free monoid on two generators $$a$$ and $$b$$ under the relation $$ab = 1$$.
What other properties of matrix multiplication should we add to this structure of $$(X,\cdot)$$ in order to get the property?