Kaplansky's theorem of infinitely many right inverses in monoids? There's a theorem of Kaplansky that states that if an element $u$ of a ring has more than one right inverse, then it in fact has infinitely many. I could prove this by assuming $v$ is a right inverse, and then showing that the elements $v+(1-vu)u^n$ are right inverses for all $n$ and distinct.
To see they're distinct, I suppose $v+(1-vu)u^n=v+(1-vu)u^m$ for distinct $n$ and $m$. I suppose $n>m$. Since $u$ is cancellable on the right, this implies $(1-vu)u^{n-m}=1-vu$. Then $(1-vu)u^{n-m-1}u+vu=((1-vu)u^{n-m-1}+v)u=1$, so $u$ has a left inverse, but then $u$ would be a unit, and hence have only one right inverse.
Does the same theorem hold in monoids, or is there some counterexample? 
 A: No. The free counterexample is the monoid $M$ generated by three elements $x, a, b$ where $xa = xb = 1$ and we impose no other relations. Its elements can concretely be described as words on the alphabet $\{ x, a, b \}$ in which $x$ never appears to the left of $a$ or $b$ with the obvious composition and in this monoid $a$ and $b$ are the only right inverses of $x$. (The point is that each element of the monoid has a unique normal form of minimal length and it is straightforward to find a normal form of the product of $x$ and another element in normal form; if the other element starts with $a$ or $b$ then we cancel it and otherwise we can do no further canceling.) 

My first attempt to write down a counterexample failed very badly:


*

*It was commutative. This can't work because right inverses are left inverses in a commutative monoid. 

*It was finite. This can't work because finite monoids acts faithfully on finite sets (namely themselves), so right inverses are also left inverses in this case. 

*Every element in it was idempotent. This can't work because non-identity idempotents are never right-invertible: if $x^2 = x$ and $xy = 1$, then $1 = xy = x^2 y = x$. 

A: Let $S$ be the semigroup of functions from $\mathbb N=\{z\in \mathbb Z|z\geq 0\}$ to itself, with the composition written traditionally: $(f\circ g)(x)=f(g(x)).$
Let $f\in S$, $f(0)=f(1)=0$ and for $n\geq 2,\,f(n)=n-1.$ Suppose $f\circ g=\operatorname{id}$. Then for $n\geq 1$, we must have $g(n)=n+1$. However, $g(0)$ can be chosen to be either $0$ or $1$ and the equality holds.
