# a question about the character table of dihedral group

As we know, quaternion group $$Q_8$$ and dihedral group $$D_8$$ have the same character table, but they are not isomorphic.I have proven that if the order of a group $$G$$ is not divided by $$8$$,and $$G$$ has the same character table as $$D_{2n}$$,then $$G$$ is isomorphic to $$D_{2n}$$. My question is what groups have the same character table with $$D_{2n}$$. I want to know all of them.

The only ways you can express a real number as the sum of two roots of unity are as $w+w^{-1}$ or as $w+(-w) = 0$. We have the equality $w+w^{-1}=1+(-1)$ when $w$ is a primitive $4$th root of $1$, which is why we cannot always distinguish between elements of orders $2$ and $4$ from their characters in $2$-dimensional representations.
But for $n \ge 3$ and $n \ne 4$, if you choose a faithful character $\chi$ of $D_{2n}$, then there will be an element $g$ with $\chi(g) = w+w^{-1}$ with $w$ a primitive $n$-th root of $1$, so $g$ must have order $n$. It has two conjugates, so the other one must be $g^{-1}$ and hence there exists $h \in G$ with $h^{-1}gh=g^{-1}$. Since $h^2 \in \langle g \rangle$, $h^2=1$ or (when $n$ is even) $h^2=g^{n/2}$. So the group is either $D_{2n}$ or (when $n$ is even) the generalized quaternion group $Q_{2n}$, and these do indeed have the same character table.
This argument does not work for $n=4$, but you can do that case separately.