Proof that a group is abelian if every square is the identity.

I need to prove that for $(\mathbf G, \circ)$ a group, if for every $a\in\mathbf G$ $$a\circ a=e$$ where $e$ is identity element of that group, then the group is abelian group.$$\\$$My proof: $$\text{We know that:}\\a\circ e=a=e\circ a\\b\circ e=b=e\circ b\\b\circ b=e=a\circ a\text{, so if}\\a\circ a=b\circ b\text{, then}\\a\circ (e\circ a)=(e\circ b)\circ b\\a\circ(b\circ b\circ a)=(a\circ a\circ b)\circ b\\(a\circ b)\circ (b\circ a)=(a\circ a)\circ(b\circ b)=e\circ e=e\\(a\circ b)\circ (b\circ a)=e\Rightarrow a\circ b=b\circ a$$ And I'm not really sure of the last step. Is this proof proper?


Your proof is correct as others pointed out (although the last line might require further clarification). Let me provide a shorter way though:

\begin{align} a \circ b &= \underbrace{(b\circ b)}_{e} \circ (a \circ b) \circ \underbrace{(a\circ a)}_{e} \\ &= b\circ \underbrace{((b \circ a) \circ( b \circ a))}_{e}\circ a \\ &= b \circ a \end{align}


The proof is valid if you meant $a^2=e$ for all $a\in G$ at the beginning. Here's a variant:

We can read $(ab)^2=e$ as $ab=(ab)^{-1}$. Thus from the general rule of computing product inverses $$ ab=b^{-1}a^{-1}. $$ But also $a^2=b^2=e$, so that $a^{-1}=a$ and $b^{-1}=b$. Plugging in the previous displayed formula we get $$ ab=ba. $$


The last step is not good: there are groups where you have elements $x,y$ satisfying $xyyx = e$ and $xy \neq yx$, so on its own, knowing $abba = e$ is not sufficient to conclude $ab = ba$.


The third line is incorrect. You cannot get that $b\circ b = e$ (consider $\mathbb{Z}_4^+$, where $2 + 2 = 0$ but $1+1 \neq 0$).