TITLE: In a non-commutative monoid, is the left inverse of an element also the right inverse?
QUESTION [9 upvotes]: Assume there is an element $a\in M$, where $M$ is a non-commutative monoid. If there exists $a b\in M$ such that $a * b = n$, where $n$ is the neutral, does it follow that $b * a = n$?
I want to say no, because the axioms which define a group shouldn't be redundant ($a * b = b * a = n$ is the 4th axiom). But the following logic seems to prove that the inverse is automatically associative:
$b * n = b$
$b * (a * b) = b$
$(b*a) * b = b$
Thus for the last line to be true, $b*a$ has to evaluate to $n$.

REPLY [4 votes]: The answer is yes if $M$ is finite, no otherwise. For this you only have to consider for each $a\in M$, the function
$$\begin{align*}
T_a:M&\rightarrow M\\
x&\mapsto a*x
\end{align*}\text{.}$$
Then, if there is a $b$ such that
$$b*a=1\text{,}$$
this means that $T_a$ is injective since
$$\text{id}_M=T_b\circ T_a=T_{b*a}\text{.}$$
In this case, if $M$ is finite, this implies that $T_a$ is bijective and $T_b$ its inverse. Thus
$$b*a=1$$
due to
$$T_{b*a}=T_b\circ T_a\text{.}$$
However, when $M$ is infinite, this implication is false, i.e., there are functions that are injective and no surjective. For a concrete example with a monoid consider the monoid $M$ of functions $\mathbb{N}_0\rightarrow \mathbb{N}_0$ generated by the functions given by
$$
f:n\mapsto\begin{cases}
0 & \text{ if }n=0\\
n-1& \text{ if }n\neq 0
\end{cases}\text{ and }
g:n\mapsto n+1\text{.}
$$
Then $f\circ g=\text{id}$ but not in the other way. (Note here how we are using the injective but not surjective function trick.)