The center of a non-Abelian group of order 8 Let G be a non-Abelian group of order 8. Prove that $|Z(G)|\leq2$.
(The center $Z(G)$ is defined as $Z(G)=\{ a\in G | ag=ga$  for all $g\in G \}$).
I deduced from Lagrange's theorem that $|Z(G)|\in\{1,2,4,8 \}$ and ruled out $8$ because $|Z(G)|=8\Rightarrow Z(G)=G$ and $Z(G)$ is Abelian while $G$ is non-Abelian.
I'm trying without success to rule out 4. Any ideas?
 A: If $Z(G)$ has order 4, $G/Z(G)$ has order $2$ and must therefore be cyclic. That implies $G$ is abelian.
A: Let G be a group such that $G/Z(G)$ is cyclic. There exists $g \in G$ such that $gZ(G)$ generates the group $G/Z(G)$. Let $g_{1}$ and $g_{2}$ belong to $G$. Then, $g_{1}Z(G)=g^{k_{1}}Z(G)$ and $g_{2}Z(G)=g^{k_{2}}Z(G)$, for some integers $k_{1}$ and $k_{2}$. Then, we can find $h_{1}$ and $h_{2}$ in $Z(G)$ such that $g_{1}=g^{k_{1}}h_{1}$ and $g_{2}=g^{k_{2}}h_{2}$. $g_{1}g_{2}=g^{k_{1}}h_{1}g^{k_{2}}h_{2}=g^{k_{1}}g^{k_{2}}h_{1}h_{2}=g^{k_{2}}h_{2}g^{k_{1}}h_{1}=g_{2}g_{1}$, where we have used that the powers of $g$ commute together, and that the $h_{1}$ and $h_{2}$ commute with all elements in the group (some steps are missing). Hence $G/Z(G)$ (in this case) cannot have order 1, cannot have order 2, so the center must have order 2 or 1. A good exercise :prove that it $|Z(G)|=2$.
A: If $|Z(G)| = 4$, then for all $x \in G$ you have $C_G(x) = Z(G)$ or $C_G(x) = G$, and in both cases $x \in Z(G)$.
