Classifying $2$-groups with cyclic center of order $2^n$ and index $4$ 
If $G$ is a $2$-group with cyclic center having order of $Z(G)=2^n$ and index of $|G/Z(G)|=4$, then how many groups of a particular order are possible?

I know that there are two possibilities for such a group:


*

*$G = \langle x,y,s \mid x^2 = y^2 = 1\rangle$ with $x,y \in G$ and $s$ is generator of center,

*$G = \langle x,y,s \mid x^2 = y^2 = s\rangle$, where $Z(G) = \langle s \rangle$ and $|G/Z(G)|=4$.


Further I know some properties of these groups:


*

*$x^2 \in Z(G)$ for every $x \in G$,

*$xy = yx$ or $xy = eyx$ for $e \in Z(G)$.


How to prove that these are the only two possibilities?

If $x^2 = s^{2k}$ for some $k$ then $(xs^{-k})^2=1$ so by replacing $x$ by $xs^{-k}$, we may assume that $x^2=1$.
If $(xs^{-k})^2=s$ so by replacing $x$ by $xs^{-k}$, we may assume that $x^2=s$.
So we may assume that $x^2=1$ or $s$ and similarly $y^2=1$ or $s$, and also $z^2=1$ or $s$, where $z=1$ or $s$. So by replacing $x$ or $y$ by $z$ if necessary, we can get either $x^2=y^2=1$ or $x^2=y^2=s$, giving the two possibilities.
To show that the groups are uniquely defined up to isomorphism, we also have to show that the commutator $[x,y] = x^{-1}y^{-1}xy$ is determined. Since $[x,y] \in Z(G)$, we have $[x,y]^2 = [x^2,y] = 1$. So (since $G$ is nonabelian) we must have $[x,y]= s^{2^{n-1}}$ in both cases.
