Let $G$ be a group. Define $\varphi:G\to G$ by $\varphi(x) = x^2$. When is $\varphi$ a homomorphism? Clearly, $\varphi$ is a homomorphism whenever $G$ is abelian. Conversely, if $\varphi$ is a homomorphism then for any $x,y\in G$, we get $xyxy = \varphi(xy) = \varphi(x)\varphi(y) = x^2y^2$.

So, $xyxy = xxyy$. Canceling the $x$ from the left and the $y$ from the right gives $yx = xy$. Hence, $G$ is abelian!

One might wonder about higher power maps. What about $\varphi(x) = x^3$. Again, $\varphi$ is a homomorphism if $G$ is abelian. **What about the converse?** We claim that the converse holds if $\varphi$ is injective.

Here's a proof: for any $x,y\in G$, we compute $\varphi(xy)$ and $\varphi(yx)$ in two ways, to get $xyxyxy = x^3y^3$ and $yxyxyx = y^3x^3$.

From the first, we see $yxyxy = x^2y^3$. Putting this into the second relation gives $x^2y^3x = y^3x^3$, or equivalently, $y^3 = x^{-2}y^3x^2 = (x^{-2}yx)^3$. Since we assumed $\varphi$ to be injective, $y = x^{-2}yx^2$ or $x^2y = yx^2$. In other words: squares are in the center.

Now we use this fact:

$$x^3y^3 = xyxyxy = yxyx^2y = yxy^2x^2 = y^3x^3 = yxyxyx.$$

Thus $(xy)^3 = (yx)^3$ and so $xy = yx$ by the injectivity of $\varphi$.

Of course, this seems to suggest that there should be some nonabelian group $G$ for which $x\mapsto x^3$ is a homomorphism that is necessarily not injective. Can you find such a group? What about higher power maps?