Let $G$ be a non-abelian group of order $p^3$, $p$ prime. Show that $Z(G)$ is a group of order $p$. Deduce that $G/Z(G)$ is abelian.
From the class equation I can get that $p| |Z(G)|$, so $|Z(G)|=\{p,p^2,p^3\}$ it can't be of the order $p^3 $ because that would give us that $G$ is abelian.
If $|Z(G)|=p^2$ how to continue ? I don't see how a contradiction can appear.
Any hints how to continue ?
Let us use that $G/Z(G)$ is cyclic iff $G$ is abelian. Using this, let us prove the result:
We know that $| Z(G)|\in\{p,p^2,p^3\}$ ($Z(G)\neq 0$ since $p$-groups have non trivial center). By hypothesis $G$ is not abelian, so $|Z(G)|\neq p^3$. If $|Z(G)|= p^2$ then $|G/Z(G)|=p $, and so $G/Z(G)$ is cyclic (a group of prime order is always cyclic), which is a contradiction since $G$ is not abelian. Then $|Z(G)|=p$
For the second part notice that $|G/Z(G)|=p^2 $. Since there are only two groups of order $p^2$, which are $C_{p^2}$ and $C_p\times C_p$, both of them abelian, then $G/Z(G)$ must be abelian.