Prove that if $G$ is a group with $(ab)^{2}=a^{2}b^{2}$ for all $a,b\in G$, then $G$ is abelian.
I am not sure how to prove this. This is my work so far:
Proof so far: $G$ is abelian iff $ab=ba$. If $(ab)^{2}=a^{2}b^{2}$ for all $a,b\in G$, then $(ae)^{2}=a^{2}e^{2}=a^{2}$ or $a=a$ for all $a\in G$.
I am not sure whether I am approaching this correctly at this point, since it looks a little silly to me. If this is the right way, I am not sure how to continue.