I know that, in a ring with identity $R$, if $a$ has exactly one right inverse $b$, then $a$ is invertible. Indeed:
$$a(ba-1+b)=aba-a+ab=a-a+1=1,$$
so that $ba-1+b=b$, thus $ba=1$.
However, is it still true for any monoid, that is, if, in a monoid $X$, $a$ has exactly one right inverse $b$, then is $a$ invertible?
If $X$ is finite, then the answer is yes. Indeed, in a finite monoid $X$, if $a$ has some right inverse $b$, then $x\mapsto xa$ is an injective function from $X$ to itself, so by finiteness of $X$ the function is surjective, thus there is a $c$ such that $ca=1$, therefore $a$ is invertible.
The answer is "no" for monoids. Consider the (bicyclic) monoid $B$ generated by 2 functions $\mathbb{N}\to \mathbb{N}$. The function $p$ is the shift: $p(n)=n+1$. The function $q$ is the pseudoinverse of $p$: $q(n)=n-1$ if $n>1$ and $q(1)=1$. Then $pq=1$ ($p$ acts first) so $q$ is a right inverse of $p$. From this it immediately follows that every element from $B$ has the form $q^kp^m$ for some non-negative integers $k,m$. This also easily implies that $p$ does not have any other right inverses in $B$. But $p$ does not have an inverse since $qp\ne 1$.