A semi-group $S$ is called regular if for any $y \in S$ there exists $a \in S$ such that $yay=y$.
Let $S$ be a semi-group with more than two elements and $x \in S$ be such an element that $S - \{x\}$ forms a group. Prove that $S$ is regular if and only if $x^2=x$.
I attempted to prove at least one direction, but I didn't succeed. Here is my attempt:
If $x^2=x$ then $ax^2a=axa$ for any $a \in S-\{x\}$.
Now, suppose that $axa \in S-\{x\}$, therefore there exists $t \in S-\{x\}: t=axa$. Since $S-\{x\}$ is a group we can solve for $x$ and find $x=a^{-1}ta^{-1}$ that means $x \in S-\{x\}$ which is absurd. Therefore, $axa \notin S - \{x\}$ which forces $axa=x$. I'm not sure if this could help us to prove $\forall y \in S: yay=y$. I guess I'm done with this problem for now.
Any ideas on how to solve it are appreciated.
If $x^2=x$ and $G=S-\{x\}$ is a group, then we need to show $S$ is regular. Well, this amounts to checking two things:
(1) Is a group, viewed as a semigroup, regular? (Hint: inverses!)
(2) Is there an $a$ so that $xax=x$? (Hint: consider $x^3$)
Now the other direction. Suppose $S$ is regular and $G=S-\{x\}$ is a group. Let $1_G$ be the identity element of $G$, and for any $a\in G$ let $a^{-1}\in G$ be the inverse. For any $y\in S$ there is an $a\in S$ such that $yay=y$. In particular, there is such an $a$ so that $xax=x$. We want to show that $x^2=x$, so let us assume $x^2\neq x$.
(1) Show that $x^2\in G$.
(2) Show that $ax=1_G$. (Hint: $x^2ax=x^2$ and $x^2,a\in G$)
(3) Show that $x\in G$, which contradicts our assumption that $x^2\neq x$.