Show that $G$ is a group if the cancellation law holds when identity element is not sure to be in $G$ Having already read through show-that-g-is-a-group-if-g-is-finite-the-operation-is-associative-and-cancel, however in Herstein's Abstract Algebra, I was required to prove it when we're not sure if identity is in the set.
If $G$ is a finite set close under an associative operation such that $ax=ay$ forces $x=y$ and $ua=wa$ forces $u=w$, for every $a, x, y, u, w\in G$, prove that $G$ is a group.
How to show it then? I have no idea what to do at all.
 A: For each $a\in G$, the map $l_a\colon G\to G, x\mapsto ax$ is injective beacuse $$l_a(x)=l_a(y)\implies ax=ay\implies x=y.$$
 As $G$ is finite, $l_a$ is a bijection. Pick $a\in G$ and let $e=l_a^{-1}(a)$.
Then $ae=l_a(e)=a$ and hence for all $x\in G$ we have $ex=x$ because $aex=ax$. The element $e$ is left neutral.
Doing the same trick with right multiplication $r_a\colon x\mapsto xa$, we obtain a right neutral $e'$. 
From $e'=ee'=e$ we find that $e$ is a (two-sided) neutral.
Using bijectivity of multiplication again, we find that each $x\in G$ has a left and a right inverse $e=xl_x^{-1}(e)$ and $e=r_x^{-1}(e)x$, which are in fact the same because $x=ex=xl_x^{-1}(e)x$ and $x=xe=xr_x^{-1}(e)x$.
A: For an element $a\in G$, there will exist an element $e\in G$ such that $ae=a$ (why?). Now you can show, using associativity and cancellation, that $e$ is both a left and right identity for every element of $G$ (not just $a$), and you can use the argument from before to finish.
A: The key here is $G$ being finite, so you can use the pigeonhole principle. Take some $a\in G$ and look at the set
$$A=\{\, ab \mid b \in G\, \} \subseteq G.$$


*

*If $a\in A$, then $ab=a$ for some $b$.

*If $a\notin A$, then $A\subsetneq G$, so two of the products have to coincide, since $G$ is finite (pigeonhole principle). So we have $b\neq b'$ with $ab=ab'$. Since cancellation laws hold we conclude $b=b'$, a contradiction.


So for every $a\in G$ we always have some $b\in G$ such that $ab=a$.
Can you take it from here?
A: Using the pigeonhole principle:
Consider the set $A=${$ab|b\in G$}, where $a\in G $ is fixed. If $a\notin A$, then since $a\in G$ and all elements in $A$ is in $G$, $A\subset G$. then consider the mapping $f :G\to A, f(b)=ab$, by pigeonhole principle, it's not an injection. Therefore exist some $b,b'\in G(b\neq b',ab=ab' $), and this forces $b=b'$, a contradiction. Therefore $a\in A$ and consequently $a=ab$ for some $b\in G$, this is true only when $G$ contains an identity element $e$. Consider an arbitrary element $a\in G$, then it must also be in $A$. Suppose it wasn't, then $A\subset G$, then $f$ wouldn't be an injection, a contradiction. Therefore, $A=G$. So $e\in A$, therefore exists some $b\in G(ab=e)$, therefore the inversion is checked. Therefore G is a group. 
