TITLE: (update) Is there always a real $x$ such that $\cos n_1 x + \cos n_2 x + \cos n_3 x < -2$?
QUESTION [20 upvotes]: Problem: Given three positive integers $0 < n_1 < n_2 < n_3$ such that
$$n_1 + n_2 \ne n_3, \quad n_2 \ne 2n_1, \quad n_3 \ne 2n_1, \quad n_3 \ne 2n_2,$$
is there always a real number $x$ such that
$$\cos n_1 x + \cos n_2 x + \cos n_3 x < -2?$$

This is a follow-up of the question in MO: Is there always a real $x$ such that $\cos n_1 x + \cos n_2 x + \cos n_3 x < -2$?
I checked that (brute force), the statement is true for all positive integers $1\le n_1 < n_2 < n_3 \le 1000$
with $n_1 + n_2 \ne n_3, \, n_2 \ne 2n_1, \, n_3 \ne 2n_1, \, n_3 \ne 2n_2$.
For $n_3 > 1000$, I randomly generate some $n_1, n_2, n_3$ without finding a counterexample.
I also found a related problem in MO:
The maximum of a real trigonometric polynomial.
Perhaps the problem here is easier to deal with.
My idea is to consider the case $\cos n_1 x = -1$ or
$\cos n_2 x = -1$ or $\cos n_3 x = -1$.
For example, $\cos n_3 x = -1$ leads to $x = \frac{(2k_3 + 1)\pi}{n_3}$ where $0\le k_3 \le n_3; k_3\in \mathbb{Z}$;
We consider $f(k_3) = \cos \frac{(2k_3 + 1)n_1\pi}{n_3} + \cos\frac{(2k_3 + 1)n_2\pi}{n_3} - 1$. However, I failed to go proceed.
I also tried non-negative trigonometric polynomials
and found this article: "Extremal Positive Trigonometric Polynomials", https://www.dcce.ibilce.unesp.br/~dimitrov/papers/main.pdf
Theorem 4 gives the necessary and sufficient condition for
$f(\theta) = a_0/2 + \sum_{k=1}^n a_k \cos k \theta$ to be non-negative on $\mathbb{R}$.

REPLY [25 votes]: In principle this problem can be resolved numerically in finite time, by exploiting the dichotomy between structure (small linear relations between the frequencies $n_1,n_2,n_3$) and randomness (equidistribution), though I do not know if the approach below can actually be implemented in a feasible amount of time.  (One could in fact use quantitative equidistribution theorems on tori for this, such as Proposition 1.1.17 of this book of mine, but I will take a more explicit approach here as it will likely give better numerical constants.)
We first claim that if $\cos(n_1 x) + \cos(n_2 x) + \cos(n_3 x) \geq -2$ for all $x$ then there must be a non-trivial linear relation $a_1 n_1 + a_2 n_2 + a_3 n_3 = 0$ between the $n_1,n_2,n_3$ with integers $a_1,a_2,a_3$ with $|a_1| + |a_2| + |a_3| \leq C$ for some effectively computable absolute constant $C$.  Indeed, use the Weierstrass approximation theorem to find a polynomial $P: {\bf R} \to {\bf R}$ such that
$$ \int_0^1 \int_0^1 \int_0^1 P( \cos(2\pi \theta_1) + \cos(2\pi \theta_2) + \cos(2\pi \theta_3) )\ d\theta_1 d\theta_2 d\theta_3 > \sup_{-2 \leq x \leq 3} P(x)$$
(this can be done by choosing $P$ to be large and positive on $[-3,-2]$ and small on $[-2,3]$).  Then we have
$$ \int_0^1 \int_0^1 \int_0^1 P( \cos(2\pi \theta_1) + \cos(2\pi \theta_2) + \cos(2\pi \theta_3) )\ d\theta_1 d\theta_2 d\theta_3 
\neq \int_0^1 P( \cos(2\pi n_1 \theta) + \cos(2\pi n_2 \theta) + \cos(2\pi n_3 \theta) )\ d\theta.$$
But expanding out the polynomial and extracting the Fourier coefficients we see that  the LHS and RHS in fact agree unless there is a non-trivial collision $a_1 n_1 + a_2 n_2 + a_3 n_3 = 0$ with $|a_1| + |a_2| + |a_3| \leq \mathrm{deg} P$. In order to make this algorithm run in as feasible a time as possible it is desirable to get $\mathrm{deg} P$ as small as one can; presumably this can be done numerically since for each fixed choice of degree, one has to solve a linear program in the coefficients of $P$.
Next, once one has restricted to the case $a_1 n_1 + a_2 n_2 + a_3 n_3=0$ for some fixed $a_1,a_2,a_3$, one can perform a similar argument to see that either one has $\cos(2\pi \theta_1) + \cos(2\pi \theta_2) + \cos(2\pi \theta_3) \geq -2$ on the entire hyperplane $\{ (\theta_1,\theta_2,\theta_3): a_1 \theta_1 + a_2 \theta_2 + a_3 \theta_3 =0\}$ (in which the answer to your question is negative), or else there must be a second constraint $b_1 n_1 + b_2 n_2 + b_3 n_3 = 0$ with $(b_1,b_2,b_3)$ independent of $(a_1,a_2,a_3)$ and with $|b_1|+|b_2|+|b_3|$ also bounded.  After reducing $n_1,n_2,n_3$ to lowest terms, this leaves one with an explicit finite list of candidate triples $(n_1,n_2,n_3)$ for which the question can be decided by case-by-case check. (To reduce the number of cases, one can normalise $0 \leq a_1 \leq a_2 \leq a_3$ (with $n_1,n_2,n_3$ now arbitrary integers) rather than $0 < n_1 < n_2 < n_3$.)