Can someone tell me whether my closure inverse part for showing that $Z(G)=\left \{ x\in G:gx=xg\; for \;all\; g\in G \right \}\leq G$ is correct? I used the one-step subgroup test.
Closure inverse: Let $x,y^{-1}\in Z(G)$. Then $xy^{-1}\in G$. Then $gx=xg$ and $gy^{-1}=y^{-1}g$ for all $g\in G$. Then $gxy^{-1}=xgy^{-1}$ or $gxy^{-1}=xy^{-1}g$. Then $xy^{-1}\in Z(G)$.
No. You should let $y\in Z(G)$ and not $y^{-1}\in Z(G)$.
But it is true that $y\in Z(G)$ implies $y^{-1}\in Z(G)$. This is because for $g\in G$, we have $gy=yg$. Multiplying $y^{-1}$ on both sides, we get $y^{-1}g=gy^{-1}$ which conclude that $y^{-1}\in Z(G)$.