NB: This part of Exercise 1.9.2 of "Fundamentals of Semigroup Theory," by John Howie. There is a similar question here but it doesn't ask for the specific definition below.
The Definition:
Definition: A semigroup $S$ is a group if there exists an $e$ in $S$ such that for all $a$ in $S$, $ea=a$ and for all $x$ in $S$ there exists an $y$ in $S$ such that $yx=e$.
The Problem:
Let $S$ be a semigroup. Show that $S$ is a group (as defined above) if and only if for all $a$ in $S$, $aS=S=Sa$.
Thoughts:
Fix $a\in S$. It is enough to show that both $\lambda_a: S\to S$, given by $s\mapsto as$, and $\rho_a: S\to S$, given by $s\mapsto sa$, are bijections.
Subproblem:
How do I show that $xe=x$ for any $x$ in $S$ given the definition above?
My Attempt:
I'm stumped.
Since $aS = S = Sa$ for all $a \in S$, all elements of $S$ are both $\mathcal{R}$- and $\mathcal{L}$-equivalent. It follows that $S$ consists of a single $\mathcal{H}$-class. This $\mathcal{H}$-class contains the product of (any) two of its elements and hence it is a group by Theorem 2.2.5 of Howie's book.
EDIT. This answer to this question answers your question. Indeed, it is shown in this answer that there exists a right identity in $S$. Of course a dual proof would show the existence of a left identity $e$. Now, since for all $x \in S$, $e \in xS$, there exists $y$ such that $yx = e$.