# An easy way to classify groups of order $p^3$?

Let $p$ be an odd prime. Prove that there are (at most) two nonabelian groups of order $p^3$. One has generators $a,b$ with $|a|=p^2$, $|b|=p$, $bab^{-1}=a^{p+1}$, and the other has generators $a,b,c$ with $|a|=|b|=|c|=p$, $c=aba^{-1}b^{-1}$, $ca=ac$ and $cb=bc$.

This question has already been asked here, but the proof there uses semidirect products, so I want to know whether there are more elementary solutions.

Here is my attempt:

Let $G$ be nonablian of order $p^3$. It is easy to show that $\mathbf{Z}(G)=G'$ (where $\mathbf{Z}(G)$ is the center and $G'$ the derived subgroup) and their order is $p$. If $G$ has exponent $p$, there it is easy to show that it satisfies the second case, i.e., there are generators $a,b,c$ with $|a|=|b|=|c|=p$, $c=aba^{-1}b^{-1}$, $ca=ac$ and $cb=bc$.

Otherwise there exists $a\in G$ with $|a|=p^2$. This case is the difficult part. If there is $b'\in G$ such that $|b|=p$ and $G=\langle a,b\rangle$, then we can show that there is $b$ with $|b|=p$ and $bab^{-1}=a^{p+1}$. However, the existence of such a $b'$ is hard to prove.

Suppose there is no such $b'$. Then it is easy to show that $\mathbf{Z}(G)$ is the only subgroup of order $p$ in $G$, and all elements in $G\backslash\mathbf{Z}(G)$ has order $p^2$. This case cannot be eliminated, unless $p$ is an odd prime. Indeed, the quaternion group $\mathbf{Q}$ is an example of that. So it suffices to prove the following:

Let $p$ be a prime. Suppose $G$ is a nonabelian group of order $p^3$ such that $G$ has a unique subgroup of order $p$. Then $G\cong\mathbf{Q}$, the quaternion group.

From Rotman's An Introduction to the Theory of Groups I found a stronger result:

Theorem 5.43. If $G$ is a $p$-group having a unique subgroup of order $p$ and more than one cyclic subgroup of index $p$, then $G\cong\mathbf{Q}$, the quaternions.

However, this problem is an exercise from Chapter 4 of Rotman's book, prior to this theorem, which appears in Chapter 5. This problem also appears in Hungerford's Algebra text, where a theorem of this kind never appears. So I think there must be a much easier way to prove this, and that's the reason why I'm asking this question.

"So I think there must be a much easier way to prove this" - the question is what do you mean by "easier?" If it is only the semidirect product, then that is easier than many other approaches. The orginal proof is by Hölder. You can have a look. For $p=2$ the result is really easy (see Proposition $1.5.6$ on page $14$ below), but in general one needs the Heisenberg group and the affine group over rings $\mathbb{Z}/n\mathbb{Z}$, see here, Corollary $2.3.27$ on page $26$, and Theorem $2.2.11$ on page $20$. In particular, the affine group is, most naturally, a semidirect product.