I asked <a href="https://math.stackexchange.com/questions/4760492/integer-solutions-of-2-cos-left-fracp-pin-right2-cos-left-fracq-pin-rig">this question</a> on MSE yesterday. Due to observations that I have made only after that, I feel that it may be a much harder problem than it looks like. So, I am posting the question here as well.

I came across the following problem while trying to solve an eigenvalue problem in my physics research. I want to know the integer solutions of the following equation
> $$ \cos\left(\frac{p\pi}n\right) + \cos\left(\frac{q\pi}n\right) + 2 \cos\left(\frac{p\pi}n\right) \cos\left(\frac{q\pi}n\right) = \frac{1}{2}$$
> where $p, q \in \{1, \dots, n-1\}$.

I have already observed that if $n = 6k$ for some $k \in \mathbb{N}$, then there is an immediate solution $p = 2k, q = 3k$. From numerical considerations, it seems that there are no solutions when $6 \not\mid n$. But, I do not have any explanation for it. Any help would be appreciated.