Equivalent characterizations of groups

Let $S$ be a semigroup. Prove that the following are equivalent.

1. For every $a \in S$, there exists a unique $x \in S$ such that $ax$ is idempotent.
2. For every $a \in S$, there exists a unique element $x \in S$ such that $a = axa$.
3. $S$ is regular and contains exactly one idempotent.
4. $S$ is a group.

We will follow the strategy $(1) \Rightarrow (2) \Rightarrow (3) \Rightarrow (4)$.

$(1) \Rightarrow (2)$: Suppose that for every $a \in S$, there exists a unique $x \in S$ such that $ax$ is idempotent. Let $a \in S$. Now there exists a unique $x \in S$ such that $axax = ax$. Note that $a(xax)a(xax) = a(xax)$, so that (by the uniqueness of $x$) we have $x = xax$. Now $xaxa = xa$ and $x(axa)x(axa) = x(axa)$, so that $a = xax$. Suppose now that $a = aya$ for some $y \in S$. Then $ayay = ay$, and again by uniqueness, $y = x$. So for all $a \in S$ there exists a unique $x \in S$ such that $a = axa$.

$(2) \Rightarrow (3)$: Suppose that for all $a \in S$ there exists a unique $x \in S$ with $a = axa$. Now $S$ is regular by definition. Now $a(xax)a = axa = a$, so that by uniqueness, $x = xax$. So $x$ is an inverse for $a$. Now let $e \in S$ be idempotent (these exist in $S$ since for example $ax$ is idempotent) and let $a \in S$ with inverse $x$. Now $ea = eayea$ for some $y \in S$, so that $y = yeay$. Now $ye = yeaye$, so that $a = ayea$. So $ye = x$. Now $xe = ye^2 = ye = x$. Since every element of $S$ is the inverse of some other element, in fact $e$ is a right identity. A similar argument shows that $e$ is a left identity. So every idempotent is an identity. Since a semigroup can have at most one identity, $S$ has a unique idempotent.

$(3) \Rightarrow (4)$: Suppose $S$ is regular and has a unique idempotent $e$. Now for any $a \in S$, there exists an element $x \in S$ such that $a = axa$. Now $axax = ax$ and $xaxa = xa$, so that $xa$ and $ax$ are idempotent. Thus $ax = xa = e$. In particular, we have $ea = ae = a$ for all $a \in S$. So $e \in S$ is an identity element, and every $a \in S$ has an inverse with respect to $e$. So $S$ is a group.

$(4) \Rightarrow (1)$: Suppose $S$ is a group with identity $e$. Denote the inverse of $a$ by $a^{-1}$. Certainly $aa^{-1} = e$ is idempotent. Now if $x \in S$ is idempotent, we have $xx = x$, so that $xx^{-1} = xx^{-1}$, so $x = e$. So if $ab = e$ is idempotent, then $a^{-1}ab = a^{-1}$ and thus $b = a^{-1}$. That is, for every $a \in S$ there is a unique $x \in S$ such that $ax$ is idempotent.