## In a nonabelian p-group of order p³, the commutator subgroup and center are equal

Prove that if $p$ is a prime and $P$ a nonabelian group of order $p^3$, then $P^\prime = Z(P)$.

Since $P$ is nonabelian, we have $Z(P) \neq P$. Moreover, if $|Z(P)| = p^2$, then $P/Z(P) \cong Z_p$ is cyclic, so that $P$ is abelian; thus $|Z(P)| \neq p^2$. Since every $p$-group has a nontrivial center, we have $|Z(P)| = p$ by Lagrange.

Now $|P/Z(P)| = p^2$; we know that every group of order $p^2$ is abelian, thus we have $P^\prime \leq Z(P)$. Since $P$ is nonabelian, $P^\prime \neq 1$; thus $|P^\prime| \geq p$, and we have $P^\prime = Z(P)$.