In general, how many non-abelian groups of order $p^3$? In general, how many non-abelian groups of order $p^3$?

For $p=2$, there are 2 groups namely $Q_8$ and $D_4$.
For $p=3$, there are again 2 groups.
Can we conclude that for any $p$ there will be always 2 groups?
Help me to do this..
 A: You are right in your guess that there are exactly two non-Abelian groups of order $p^3$ for each prime $p$. The question is how one can prove this. You are trying to prove this by looking at the first couple of examples. But this is never a valid proof. In fact concluding that something is true for all values based on examples is a logical fallacy. See here: https://en.wikipedia.org/wiki/Proof_by_example.
You can find nice treatments about the groups of order $p^3$ on line. A simple search turned up for example these notes:


*

*http://www.math.uconn.edu/~kconrad/blurbs/grouptheory/groupsp3.pdf
A: Assume $p$ is odd. There are up to isomorphism two  non abelian groups of order $p^{3}$. You can prove first that the center and the commutator of such groups are equal and have order $p$. Now, you can prove the surprising property that the map $x \to x^{p}$ is a homomorphism (it requires some work), whose image is contained in the center of group. Which means that the image is either trivial or equal to the center, now consider the two cases, if all non identity elements have order $p$ and in the other case you'll have an element of order $p^{2}$. You can create isomorphisms between those groups and semi direct products, which are not hard to find!
