Let $G$ be a group, $|G|=12$, $H\leq G, |H|=6 , \exists x\in G ,x\notin H $ such that $o(x)=2$. Prove $|Z(G)|=12$ or $|Z(G)|=2$. 
Let $G$ be a group, $|G|=12$, $H\leq G, |H|=6, \exists x\in G,x\notin H$ such that $o(x)=2$. Prove $|Z(G)|=12$ or $|Z(G)|=2$.

My attempt:
$$Z(G)\leq G \implies |Z(G)|\mid |G| \implies |Z(G)|\mid 12.$$
Case 1: $$|Z(G)|=12 \implies G=Z(G),$$ so $G$ is an abelian group as required.
Case 2: $|Z(G)|=6 \implies H\triangleleft G, |G/Z(G)|=\frac{|G|}{|Z(G)|}=2$ hence $G/Z(G)$ is a cyclic, which implies $G$ is abelian. Contradiction.
Case 3: $|Z(G)|=4$ the same  case as above. $|G/Z(G)|=\frac{|G|}{|Z(G)|}=3$
Case 4: $|Z(G)|=3$ $|G/Z(G)|=\frac{|G|}{|Z(G)|}=4$, which implies $G/Z(G)$ is abelian. I am stuck here.
Case 5: $|Z(G)|=2$ as required.
Case 6: $|Z(G)|=1$
I get stuck in case $4,6$
In addition I can conclude that $o(x^{-1}yx)=o(y)$
Any help is welcome, thanks!
 A: Remember that $H$ is either isomorphic to $\Bbb Z_6$ or to $S_3$.
Just observe that if $H$ is cyclic then $G\cong H\rtimes \langle x\rangle$ and so $G$ is either $\Bbb Z_6\times \Bbb Z_2$ or $D_6$ (this is because ${\rm Aut}(\Bbb Z_6)\cong \Bbb Z_2$, so there are at most $2$ isomorphism classes for $G$) and thus the centre has order $12$ or $2$.
Suppose that $H\cong S_3$. Take a $3$-cycle $a\in H$. Since $H$ is a normal subgroup the unique conjugate of $a$ in $G$ is $a^2$, so its conjugation class has order $2$ and then the centraliser of $a$ in $G$ is a subgroup of order $6$ with nontrivial centre and so this centraliser is a cyclic order 6 subgroup of $G$. Taking $x$ to be a transposition in $H$ we are again in the first case, thus we conclude.
A: We have that $|G|=12$ and $H\le G$ with $|H|=6$ imply $H\triangleleft G$.
Since $H$ contains an element of order $2$ (by Cauchy's Theorem), if $G$ has a unique element of order $2$, then $a\in G\setminus H$ with $|a|=2$ is impossible. Hence $G$ can't be $\Bbb{Z}_{12}$ or Dicylic group.

Let $a\in G\setminus H$ such that $|a|=2$.
Then $K=\langle a\rangle \le G$ and $|K|=2$ and $H\cap K=\{e\}$. Hence $G\cong H\rtimes_{\varphi} K$, where $\varphi: K\to \textrm{Aut}(H) $

Case $1$: $H\cong \Bbb{Z}_6$
Then $\varphi :K\cong \Bbb{Z}_2 \to \textrm{Aut}(H)\cong \Bbb{Z_2}$. Hence $G\cong \Bbb{Z_6}\times \Bbb{Z_2}$

Case $2$: $H\cong D_3$ (the dihedral group of order six).
Then $G\cong D_3 \rtimes \Bbb{Z_2}$.
A: We can prove a stronger result. Any group of order $12$ having a subgroup of order $6$ has a center of order $12$ or $2$.
Indeed, either $G$ is abelian, or $G$ is not abelian. In the first case we have $|Z(G)|=12$, and in the second case we know that $G$ is a non-abelian group of order $12$, hence isomorphic to one of the groups $A_4, Dic_3$ or $D_6$ - see this reference, among others:
Classifying groups of order $12$.
We know that $|Z(A_4)|=1$, and also that $A_4$ has no subgroup $H$ of order $6$. On the other hand, $|Z(D_6)|=2$, and $D_6$ has subgroups of order $6$, for example $C_6$ generated by the rotations. The dicyclic group $Dic_3$ also satisfies $|Z(Dic_3)|=2$, so we are done.
A: If $|Z(G)|=6$ or $|Z(G)|=4$, then $G/Z(G)$  is nontrivial and cyclic: contradiction, as no such a group exists.
If $|Z(G)|=3$, then every noncentral element has centralizer of order $3$ or $6$, and hence the class equation yields:
$$12=3+4k+2l$$
contradiction, because $2\nmid 3$.
So we are left with ruling out the case $G$ centerless. Suppose it is; then, every nontrivial element has centralizer of order $2$, or $3$, or $4$, or $6$. The class equation then yields:
$$12=1+6k+4l+3m+2n \tag1$$
or, equivalently:
$$11-3m=2(3k+2l+n) \tag2$$
Therefore, $m=1$ or $m=3$. If $m=1$, then $(2)$ yields:
$$4=3k+2l+n$$
which is fulfilled by $(k,l,n)=$ $(1,0,1)$, $(0,0,4)$, $(0,1,2)$, $(0,2,0)$. If $m=3$, then $(2)$ yields:
$$1=3k+2l+n$$
which is fulfilled by $(k,l,n)=(0,0,1)$, only.
For $(m,k,l,n)=(1,1,0,1)$, $(1,0,0,4)$, $(1,0,1,2)$, $(1,0,2,0)$, the latter three 4-tuples lead to conjugacy classes setups which do not allow any union of size $6$, and hence not any normal subgroup of such an order is possible. The same conclusion holds for $(m,k,l,n)=(3,0,0,1)$. So, we are left to prove that the class equation $(1)$ gotten from $(m,k,l,n)=(1,1,0,1)$, namely $$12=1+6+3+2$$ contradicts some assumption. And in fact, $H$ must be the union of the conjugacy classes of size $1$, $2$ and $3$, and hence all the six elements of the other one conjugacy class (which is $G\setminus H$) have order $2$, because by assumption some has; but then $H$ must have odd order (see e.g. here): contradiction, because $H$ has order $6$.
So, finally, $|Z(G)|=12$ or $|Z(G)|=2$.
