Find the maximum trigonometric polynomial coefficient $A_{k}$ I posted this question on Math Stack Exchange but did not get any answer. I am trying my luck here.

Let $n,k$ be  given positive integers and $n>k$. If for all real numbers $x$ we have $$A_{1}\cos{x}+A_{2}\cos{(2x)}+\cdots+A_{n}\cos{(nx)}\le 1$$
Find the maximum value of $A_{k}$.

I don't know if this question has been studied
If  $n=2$ it is easy to solve it.
 A: Edit. After a conversation with Fedya I improve my previous answer.
Let $f(x)=\sum_{k=1}^nA_n\cos nx$. If $f(x)\leq 1$, then $A_k\leq 2.$
This is the best possible estimate which holds for all $n$. For fixed $n$ it can be improved, but this is difficult.
Proof. We want to maximize
$$A_k=\frac{2}{\pi}\int_0^\pi f(x)\cos kxdx$$
under the conditions that
$$\int_0^\pi f(x)dx=0,\quad\mbox{and}\quad f(x)\leq 1.$$
It is clear that the maximizing function is $f^*(x)=1-\pi\delta$,
where $\delta$ is the delta function representing the unit point mass at some point $x_0$ where takes its smallest value $\cos kx_0=-1$. And
the $k$-th Fourier coefficient of $f^*$ is $2$.
Edit 2. Another version of this problem is obtained by replacing the
restriction $f(x)\leq 1$ by the restriction $|f(x)|\leq 1$.
In this case, the estimate will be $|A_n|\leq 4/\pi$, and this is also
best possible in the class of all such trigonometric sums with any $n$.
A: I guess the following construct will help. The idea is that the set of coefficients which renders a trigonometric polynomial positive (just like the one you have) is a convex set, and is described by a set of LMI constraints. Such a characterization (essentially arising out of Kalman-Yakubovich-Popov Lemma) is routinely used in Control/Sys-Id. Refer to Lemma 2.1 of http://www.ent.mrt.ac.lk/iml/paperbase/TAC%20Collection/TAC/2005/october/7.pdf for the exact details pertaining to your problem. So, basically you end up with:
$$
\max ~~A_k~~
\mbox{subject to} ~~ \mbox{convex LMI constraints},
$$
which is a linear SDP and can be solved easily using CVX (or some such solver).
A: It is a known result:
$$\max A_k = 2 \cos \frac{\pi}{\lfloor \frac{n}{k} \rfloor + 2}, \quad 1\le k \le n.$$
See:

*

*Theorem 6 and the references therein, "Extremal Positive Trigonometric Polynomials", https://www.dcce.ibilce.unesp.br/~dimitrov/papers/main.pdf


*Theorem 16.2.4 in:  Qazi Ibadur Rahman and Gerhard Schmeisser, “Analytic Theory of Polynomials”, 2002.
