Putnam 2013, Problem B-2

Let \( C = \bigcup_{N=1}^{\infty} C_N \), where \( C_N \) denotes the set of those 'cosine polynomials' of the form
\[
f(x) = 1 + \sum_{n=1}^N a_n \cos(2\pi n x)
\]
for which:
(i) \( f(x) \geq 0 \) for all real \( x \), and
(ii) \( a_n = 0 \) whenever \( n \) is a multiple of 3.

Determine the maximum value of \( f(0) \) as \( f \) ranges through \( C \), and prove that this maximum is attained.

Solution:
We claim that the maximum value of $f(0)$ is 3. This is attained for $N = 2$, $a_1 = \frac{4}{3}$, $a_2 = \frac{2}{3}$: in this case $f(x) = 1 + \frac{4}{3} \cos(2\pi x) + \frac{2}{3} \cos(4\pi x) = 1 + \frac{4}{3} \cos(2\pi x) + \frac{2}{3}(2\cos^2(2\pi x) - 1) = \frac{1}{3}(2\cos(2\pi x) + 1)^2$ is always nonnegative.