Non-Abelian group $G$ in which $x\mapsto x^3$ is a homomorphism Arpit Kansal showed here that a group $G$ in which $x\mapsto x^3$ is an isomorphism is Abelian. He first showed that we have $a^3b^3=b^3a^3$ for all $a,b\in G$ (only using that $x\mapsto x^3$ is homomorphism) and then used injectivity of $x\mapsto x^3$ to get $ab=ba$ for all $a,b\in G$.
Is there a non-Abelian group $G$ in which $x\mapsto x^3$ is a homomorphism?
 A: Smallest example: there exists a non-abelian group of order $27$, and of exponent 3 ($x^3=1$ for all $x \in G$), which can be constructed as all $3 \times 3$ upper diagonal matrices with 1's on the diagonal and entries in the field of 3 elements. Note that the proof of Arpit depends only on the injectivity of the power map.
A: Let $G$ be a non-Abelian group such that order of its element be $3$, for example see here or this, then obvious that $x\rightarrow x^3$ is a homomorphism. For complete of this type group see this. About extend of this problem: there is non-Abelian group such that order of its element be $n$; this completely related to the "Burnside's problem".
A: As suggested by @Nicky Hekster Consider the Heisenberg group of all matrices of the form
$$\left(\begin{array}{ccc}
1 & x & y\\
0 & 1 & z\\
0 & 0 & 1
\end{array}\right),$$
where $x,y,z\in\mathbb{Z}/3\mathbb{Z}$.This group has exponent $3$ i.e. for every $g \in G$ we have $g^3=e$. Just to make sure that $G$ is non abelian consider the following matrices and show that these matrices don't commute.  $$\left(\begin{array}{ccc}
1 & 1 & 0\\
0 & 1 & 2\\
0 & 0 & 1
\end{array}\right),$$ $$\left(\begin{array}{ccc}
1 & 1 & 0\\
0 & 1 & 1\\
0 & 0 & 1
\end{array}\right)$$
