Let $p$ be a prime number. Let $G$ be a group order order $p^3$. Show for any $g,h \in G$, we have $g^p h = hg^p$
If $|g|=1$, then we're done.
If $|g|=p$, then we're done.
If $|g|=p^3$, then group is cyclic. So we're done.
We assume that $|g|=p^2$. For similar reasons, we have $|h|=p$ or $p^2$.
Consider $\langle g \rangle \cap \langle h \rangle$.
If $\langle g \rangle \cap \langle h \rangle= \{ e\} $, then we have at least $p^2+p-1$ distinct elements in $\langle g \rangle \cup \langle h \rangle$.
My question is that does this imply that there exists some $g^k$ or $h^l$ in the centre $Z(G)$. And why?
I thought of using the class equation. But all I can get is that the centre is at least of order $p$. I don't see we can say that there exists some $g^k$ or $h^l$ in the centre $Z(G)$.
Any help is appreciated!