# Example of a monoid with two distinct left inverses [duplicate]

In a monoid, if an element has two distinct left inverses, it cannot have a right inverse, and hence cannot have a two-sided inverse.

I'm wondering if there's an easy example that I could use to illustrate this fact.

## marked as duplicate by user26857, rschwieb abstract-algebra StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Apr 29 '17 at 22:31

• Also answered well here – rschwieb Apr 29 '17 at 22:34

Let $M$ be the set of functions from $\mathbb{Z}_{\geq 0}$ to itself, which is a monoid under composition. Take $f(n) = n+1$. Then for each element $a\in\mathbb{Z}_{\geq 0}$, the function $$g_a(n):=\begin{cases} n-1&:n\geq 1,\\a&:n=0,\end{cases}$$ is a left inverse of $f$. It is easy to see directly $f$ cannot have a two-sided inverse because it is not surjective.
For a set $S$, let $M(S)$ be the monoid of all maps $S \to S$ under composition. If $S$ is infinite then there are maps that are injective but not surjective, and they have infinitely many left inverses but no right inverse. Similarly, maps that are surjective but not injective have infinitely many right inverses but no left inverse.
Let $M$ be the monoid of all functions from $\mathbb{R}$ to $\mathbb{R}$, with the operation of composition.
Consider the functions $f,g,h \in M$ defined by \begin{align*} f(x) &= e^x\\[4pt] g(x) &= \begin{cases} \ln{x}&\text{if}\;x > 0\\[4pt] 0&\text{otherwise}\\[4pt] \end{cases}\\[4pt] h(x) &= \begin{cases} \ln{x}&\text{if}\;x > 0\\[4pt] 1&\text{otherwise}\\[4pt] \end{cases} \end{align*}
Then $g,h$ are left inverses of $f$ in $M$, but $f$ has no right inverse in $M$.