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

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$.