Center of $D_6$ is $\mathbb{Z}_2$

I wrote up a general classification for the centers of $D_n$, (the dihedral group of order $2n$, not $n$) just the other week. Perhaps it will be useful to read:

If $n=1,2$, then $D_n$ is of order $2$ or $4$, hence abelian, and $Z(D_n)=D_n$. Suppose $n\geq 3$. We have the presentation $$ D_n=\langle x,y:x^2=y^n=1,\; xyx=y^{-1}\rangle. $$ Then $yx=xy^{-1}$ implies the reduction $y^kx=xy^{-k}$. An element is in the center iff it commutes with $x$ and $y$, since $x$ and $y$ generate $D_n$. Let $z=x^iy^j$ be in the center. From $zy=yz$ we see $$ x^iy^{j+1}=yx^iy^j\implies x^iy=yx^i. $$ But $i\neq 1$, else we have $xy=yx=xy^{-1}$, so $y^2=1$, a contradiction since $n\geq 3$. So $i=0$, and $z=y^j$. Then from the equation $zx=xz$, we have $$ y^jx=xy^j=xy^{-j} $$ which implies $y^{2j}=1$. Thus $j=0$ or $j=n/2$. If $n$ is odd, we must necessarily have $j=0$, and $z=1$. If $n$ is even, either possibility works. But $y^{n/2}$ is indeed in the center as it clearly commutes with $y$, as well as with $x$ since $y^{n/2}x=xy^{-n/2}=x(y^{n/2})^{-1}=xy^{n/2}$. Summarizing, we have, for $n\geq 3$, $$ Z(D_n)=\begin{cases} \{1,y^{n/2}\} & \text{if }n\equiv 0\pmod{2},\\ \{1\} & \text{if }n\equiv 1\pmod{2}. \end{cases} $$