I know there are questions on this already but I wanted to check if my attempt at proving it was valid, and I couldn't find anyone else presenting the same one in any other post. My attempt is as follows:
Since there must be a unique identity, and a unique inverse for each element, I believe that without loss of generality I can let the group be $G = \{e, a, a^{-1}, b\}$ where $e$ is the identity and $a,b$ are some other elements not equal to $e$.
Then by a previous result we know that the identity element is commutative and that an element and its inverse commute with each other. This tells us that $e.x=x.e$ for all $x$ in G, and that $a.a^{-1}=a^{-1}.a$. This leaves only $a.b$ and $a^{-1}.b$ to check.
One of $a$ or $a^{-1}$ must be an inverse for $b$ and since $a,a^{-1}$ are arbitrary, say it is $a$. Then we have $a.b=b.a$. If we multiply both sides of this equality by $a^{-1}$ on the left and right we are left with $b.a^{-1}=a^{-1}.b$ which is the final possibility. We have shown that all elements in $G$ commute with each other so $G$ is abelian.
I know this proof relies on some other results which of course must be proven too but I know how to proof these, so given these are previously proven is this proof valid?
All elements in such a group have order $1,2$ or $4$.
If there's an element with order $4$, we have a cyclic group – which is abelian. Otherwise, all elements $\ne e$ have order $2$, hence there are distinct elements $a,b,c$ such that $\{e,a,b,c\}= G$.
Note that, by the cancellation law, $ab\ne a$ or $b$, and similarly $ab\ne e$. Henceforth, $c=ab$. But it's also $ba$ for the same reasons. So $ab=ba$, and the group is abelian.
Note: actually this group is isomorphic to Klein's Vierergruppe $\;\mathbf Z/2\mathbf Z\times\mathbf Z/2\mathbf Z$.