I am trying to find a counter example to disprove the following statement:
If $H = \{g^2 | g\in G\}$ is a subgroup of $G$ then $G$ is abelian.
I can't seem to find one. I suspect it should involve either matrices or permutations since neither commute in general and so these would be good candidates. Please can someone give a simple counter example or provide a hint.
For $k\in\Bbb{N}$ let $C_k:=\Bbb{Z}/k\Bbb{Z}$. The semidirect product $G:=C_7\rtimes C_3$ coming from the unique nontrivial homomorphism $C_3\ \longrightarrow\ \operatorname{Aut}(C_7)$ is non-abelian of order $3\times7=21$. Hence $$H=\{g^2\mid g\in G\}=G,$$ so $H$ is a subgroup of $G$. The same argument works for any non-abelian group $G$ of odd order.
Note that the smallest non-abelian group $S_3$ is also a counterexample; in this case $$H=\{g^2\mid g\in S_3\}=\langle(1\ 2\ 3)\rangle.$$