Let $G$ be a group of order $8$ and $y$ be an element of $G$ of order $4$. Prove that $y^2 \in Z(G)$ [duplicate]

The question Let $$G$$ be a group of order $$8$$ and $$x$$ be an element of $$G$$ of order $$4$$. Prove that $$x^2 \in Z(G)$$ already posted here. But the answer is not given there. SO I have tried to solve the problem.

Let us consider the subgroup $$H=\langle x\rangle=\{e,x,x^2,x^3\}$$. Then $$[G:H]=2$$. The cosets of $$H$$ in $$G$$ are $$H$$ and $$g-H$$. The quotient group is of order $$2$$. Therefore $$(G-H)^2=H, H$$ being the identity element in the quotient group.
Let $$x\in H$$. Then $$x^2\in H$$. If $$x\in G-H$$. Then $$(xH)^2=(G-H)^2=H\implies x^2H=H\implies x^2\in H$$. Therefore for every $$x\in G, x^2\in H$$. If I can show that $$H=Z(G)$$, then everything is done. Is it possible to show this ?

marked as duplicate by Alan Wang, YuiTo Cheng, Shogun, Jyrki Lahtonen group-theory StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jun 9 at 5:54

• It's not true. Consider $D_4$, the dihedral group of order 8. $D_4$ is generated by $a$ and $t$, with $a$ of order 4, $t$ of order 2, and $tat^{-1} = a^{-1}$. So clearly in this instance $\langle a \rangle$ is not equal to the center of $D_4$. – Rylee Lyman Jun 9 at 2:52
• I don't think it's a counterexample, see clearly the question.@RyleeLyman – Hongyi Huang Jun 9 at 2:59
• @Hongyi Huang At the end of the question the OP asked if $H=Z(G)$. Rylee Lyman is answering that this is not true. – Julian Mejia Jun 9 at 4:52

You can't show that $$H=Z(G)$$ because then $$G/Z(G)\cong\Bbb C_2$$ is cyclic. Then $$G$$ would be abelian.
If $$G$$ is nonabelian, then $$G\cong D_4$$, the dihedral group, or $$G\cong Q_8$$, the quaternions. See here.