Let $G$ be a semigroup such that $\forall a\in G$, $\exists b \in G$ such that $a = aba$ and $\exists! e \in G$ such that $e^2=e$. Prove that $G$ is a group.
This is an exercise problem from my introductory Abstract Algebra course and we've just started groups and subgroups.
Since we already know $G$ is a semigroup, I only need to show that $G$ has an identity and every element of $G$ has an inverse. However, I'm not really sure on how to do that.
We also had a theorem which says that
If $\forall a,b \in G$, $\exists x,y \in G$ such that $ax=b$ and $ya=b$, then $G$ is a group.
But I don't think I can't use it here.
Any hints would be much appreciated. Thanks