# Integer solutions of $2\cos\left(\frac{p\pi}n\right)+2\cos\left(\frac{q\pi}n\right)+4\cos\left(\frac{p\pi}n\right)\cos\left(\frac{q\pi}n\right)=1$

I asked this question 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.

Now that I have an answer to it, I will keep this question open for two more days to see if any other answers come in that use more elementary methods, and then accept the answer.

• Posted also on Math.SE. Please don't do that. Like never. Most likely you didn't think about it, but what may happen is that people waste time rediscovering ideas posted elsewhere. Some may find it a bit impolite. It is a strong recommendation that you either post on one site only, or otherwise crosslink the two versions so that all and sundry are aware of each others ideas. Aug 30, 2023 at 21:05
• Two references that may be relevant. Conway and Jones, Trigonometric diophantine equations, Acta Arithmetica XXX (1976) 229-240 (Theorem 6 gives all vanishing sums of nine or fewer roots of unity), matwbn.icm.edu.pl/ksiazki/aa/aa30/aa3033.pdf and my paper, Myerson, G. Rational products of sines of rational angles. Aequat. Math. 45, 70–82 (1993). doi.org/10.1007/BF01844426 Aug 31, 2023 at 3:57
• @Gerry, your comment would make a fine answer to this old MSE question also. Aug 31, 2023 at 4:28
• @JyrkiLahtonen I am extremely sorry, I didn't know this, I am new to this place. I will never repeat this again. I will edit both my questions immediately.
– user506548
Aug 31, 2023 at 12:30
• Don't worry about it too much. It was clear (at least to me) that you were simply unaware of this norm. Aug 31, 2023 at 14:17

Yes, these are the only solutions. Let $$\alpha = e^{p \pi i/n}$$ and $$\beta = e^{q \pi i/n}$$. So the equation is $$4 \left( \frac{\alpha+\alpha^{-1}}{2} \right) \left( \frac{\beta+\beta^{-1}}{2} \right) + 2 \left( \frac{\alpha+\alpha^{-1}}{2} \right) + 2 \left( \frac{\beta+\beta^{-1}}{2} \right) =1.$$

We rewrite this as $$\alpha \beta + \alpha + \alpha \beta^{-1} + \beta + \beta^{-1} + \alpha^{-1} \beta + \alpha^{-1} + \alpha^{-1} \beta^{-1} = 1.$$ $$\alpha \beta + \alpha + \alpha \beta^{-1} + \beta + 1+\beta^{-1} + \alpha^{-1} \beta + \alpha^{-1} + \alpha^{-1} \beta^{-1} = 2.$$ $$(\alpha+1+\alpha^{-1}) (\beta + 1 + \beta^{-1}) = 2. \quad \label{1}\tag{\ast}$$ So we want to solve equation \eqref{1} in roots of unity. The conjecture in the question, which we will prove, is that the only solutions are $$(\alpha, \beta) = (e^{\pm i \pi/3}, e^{\pm i \pi/4})$$ or $$(e^{\pm i \pi/4}, e^{\pm i \pi/3})$$, so $$(\alpha+1+\alpha^{-1}, \beta + 1 + \beta^{-1}) = (2,1)$$ or $$(1,2)$$.

This solution uses the language of algebraic number theory, which I'm afraid may not be familiar to the original poster, but I can't figure out how to do this in a more elementary way.

Let $$R = \mathbb{Z}[e^{\pi i/n}]$$. Let $$\mathfrak{p}$$ be a prime of $$R$$ lying over the prime $$2$$ in $$\mathbb{Z}$$, and let $$v : R \to \mathbb{Q}$$ be the $$\mathfrak{p}$$-adic valuation, normalized so that $$v(2)=1$$. So equation \eqref{1} gives $$v(\alpha+1+\alpha^{-1}) + v(\beta+1+\beta^{-1}) = 1. \label{2}\tag{\clubsuit}$$

Lemma Let $$\eta$$ be a primitive $$m$$-th root of unity. Then $$v(\eta+1+\eta^{-1}) = \begin{cases} \infty & m = 3 \\ 1/2^k & m = 3 \cdot 2^{k+1} \ \text{for} \ k \geq 0 \\ 0 & \text{otherwise} \end{cases}.$$

Proof: The case $$\eta=1$$ (so $$m=1$$) is easy to check by hand, so we assume that $$\eta \neq 1$$ from now on.

We have $$\eta+1+\eta^{-1} = \eta^{-1} \frac{\eta^3-1}{\eta-1}$$ so $$v(\eta+1+\eta^{-1}) = v(\eta^3-1) - v(\eta-1). \label{3}\tag{\diamondsuit}$$ If $$\omega$$ is a primitive $$\ell$$-th root of unity, then $$v(\omega-1) = \begin{cases} \infty & \ell=1 \\ 1/2^k & \ell = 2^{k+1} \\ 0 & \text{otherwise} \end{cases}. \label{4} \tag{\heartsuit}$$ (See, for example, Chapter 8 in Washington's Introduction to Cyclotomic Fields.)

Since $$\eta$$ is a primitive $$m$$-th root of unity, $$\eta^3$$ is a primitive $$m/\text{GCD}(m,3)$$-th root of unity, so combining \eqref{3} and \eqref{4} gives the claim. $$\square$$

Now, plug the Lemma into \eqref{2}. The only ways to write $$1$$ as a sum of numbers in $$\{ \infty, 1, 1/2, 1/4, \cdots, 0 \}$$ are $$1+0$$, $$0+1$$ and $$1/2+1/2$$.

If we are in the $$1+0$$ case, then $$\alpha$$ must be a primitive $$6$$-th root of unity, so $$\alpha+1+\alpha^{-1} = 2$$ and $$\beta + 1 + \beta^{-1} = 1$$, giving that $$\beta$$ is $$\pm i$$. Similarly, in the $$0+1$$ case, $$\alpha$$ is $$\pm i$$ and $$\beta$$ is a primitive $$6$$-th root of unity.

Finally, we are left with the $$1/2+1/2$$ case. In this case, $$\alpha$$ and $$\beta$$ should be primitive $$12$$-th roots of unity. This means that $$\alpha+1+\alpha^{-1}$$, and $$\beta+1+\beta^{-1}$$ should be $$1 \pm \sqrt{3}$$. We get a near miss: $$(1+\sqrt{3})(1-\sqrt{3})$$ is $$-2$$, not $$2$$, so this solution to \eqref{2} doesn't yield a solution to \eqref{1}.

• This is a beautiful solution (+1)! I will wait for two more days to see if there are any more solutions using more elementary methods, and then accept it.
– user506548
Aug 30, 2023 at 17:31
• There seems to be no need to open the brackets and close them again (in the beginning) Aug 30, 2023 at 17:32
• I personally did it using the Mathematica command MinimalPolynomial[E^(-2 Pi I/12) + 1+ E^(2 Pi I/12), x] and then, when I saw that I got a quadratic, solving that quadratic. But a more reasonable method would be to remember that $\cos(\pm \pi/6) = \sqrt{3}/2$ and $\cos(\pm 5 \pi/6) = -\sqrt{3}/2$ :). Aug 30, 2023 at 17:48
• The equation obtained in the beginning claims that the sum of 9 roots of unity is 0. It is possible to (elementarily) describe all such 9-tuples, and then to check which of them are of the required form; that would be elementary, but I will not do that without a computer aid… Aug 30, 2023 at 23:42
• @Ilya, Conway & Jones did that in the paper I cite in my comment on OP's question. Aug 31, 2023 at 6:13