I want to prove that in a group of order $pq^2$, if $p$ divides $|Z(G)|$, then $G$ is abelian.
I know that in this case, the order of $G/Z(G)$ must be $q^2$.
If $G/Z(G)\simeq \mathbb{Z}/{q^2}\mathbb{Z}$, then we are done, because $\mathbb{Z}/{q^2}\mathbb{Z}$ is cyclic.
But what happens if $G/Z(G)\simeq \mathbb{Z}/{q}\mathbb{Z}\times \mathbb{Z}/{q}\mathbb{Z}$? I think I'm missing something trivial..
Let suppose $|Z(G)|=p$ (else $G/Z(G)$ is cyclic).
Let $S$ be the subgroup generated by an element $s$ of order $q$ and consider $C(S)$, the centralizer of $S$ (the biggest subgroup of $G$ such that every element of $C(S)$ commutes with every element of $S$).
What about the cardinality of this subgroup?
Hence $C(S)=G$ (looking at their the cadinality) and then we have an absurd because this means that $|Z(G)| > p$.