If a group $G$ has odd order, then the square function is injective.

Solution 1:

Let $|G|=2n-1$. Assume $a^2=b^2$. Then $a=a\cdot a^{2n-1}=(a^2)^n=(b^2)^n=b$.

Solution 2:

In general, $m,n \in \mathbb{Z}_{>0}$ with $\gcd(m,n)=1$ and $G$ is a group of order $n$, then the function $f:G\rightarrow G$ defined by $f(x)=x^m$ is a bijection.

Proof. By Bézout choose $k,l \in \mathbb{Z}$ with $km+ln=1$ and proceed in a similar way as in Hagen's proof.

Following lhf's remark (thanks!), the converse is also true: assume that $f(x)=x^m$ is a bijective function. Let $p$ be a prime with $p|n$. We will show that $p$ does not divide $m$: by Cauchy's Theorem there exists an $x \in G$ with $ord(x)=p$. Since $f(1)=1^m=1$ and $x \neq 1$, $x^m$ must be a non-trivial power of $x$. Hence $ord(x^m)=p$ and this can only be the case if $p \nmid m$. It follows that $m$ and $n$ must be relatively prime $\square$.

Solution 3:

Hagen's answer is the best. But here is another take that uses the abelian case for the general case:

Take $g\in G$ and consider the restriction $\phi$ of $f$ to $C=\langle g \rangle$, the cyclic group generated by $g$. Because $C$ is a subgroup, $\phi$ maps $C$ to $C$. Because $C$ is abelian, $\phi$ is a homomorphism $C\to C$. Since $C$ has odd order, $\ker \phi$ is trivial and $\phi$ is injective. So $\phi$ is surjective, because $C$ is finite. But this means that $f$ itself is surjective and hence injective, because $G$ is finite.