Here's the proof of this fact from Schaum's book on group theory -
$1 \in Z(G)$ since $1g = g1$ for all $g \in G$. Consequently $Z(G) \neq \emptyset$.
If $g_1,g_2 \in Z(G)$ and $g \in G$, then $g(g_1 g_2^{-1}) =(g g_1) g_2^{-1} = g_1(g g_2^{-1}) = g_1 g_2^{-1}g$ since $g g_2 = g_2 g$ implies $g_2^{-1} g = g g_2^{-1}$. It follows that $Z(G)$ is a subgroup of $G$.
How does it follow that $Z(G)$ is a subgroup of $G$? I am not sure what this proof has done here to show that $Z(G)$ is a subgroup of $G$. It seems to have demonstrated closure..but I'm not sure if that was the goal as there should be brackets on the final $g_1 g_2^{-1}g$ to make it obvious that that was what they were doing, ie write it as $(g_1 g_2^{-1})g$.
Anyway, could someone explain to me exactly what the process is that they used to show that its a subgroup. Have they implicity demonstrated that all of the group axioms hold?