the left inverse and right inverse in a ring [duplicate]

This question already has an answer here:

It is well-known that if $R$ is an Artin ring,and $ab=1$ in $R$ where $a,b\in R$,then $ba=1a$.(This is not difficult)this is a very hot in Mathematics. If $AB = I$ then $BA = I$

It seems it is not right for arbitrary ring that if $ab=1$,then $ba=1$. Can someone helps to give an example.

marked as duplicate by B. Mehta, 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(); } ); }); }); May 17 '18 at 16:01

Let e.g. $e_1,e_2,\dots$ be a basis, and consider $B:=e_k\mapsto e_{k+1}$ and $A:=e_k\mapsto e_{k-1}, \ e_1\mapsto 0$
2.Take any monoid $M$ that satisfies this, then consider its 'group ring' $\Bbb ZM$.