TITLE: Bounding a Fourier coefficient of a non-negative periodic function in terms of its $L^2$-norm
QUESTION [12 upvotes]: This question is motivated by the earlier MO question:  Show that $(\sum_{k=1}^{n}x_{k}\cos{k})^2+(\sum_{k=1}^{n}x_{k}\sin{k})^2\le (2+\frac{n}{4})\sum_{k=1}^{n}x^2_{k}$ .
It is a cleaned up asymptotic version of that question.  
Let $f$ be a non-negative function, periodic with period $1$, and square integrable on ${\Bbb R}/{\Bbb Z}$.  Is it true that 
$$ 
|{\widehat f}(1)|^2 = \Big| \int_0^1 f(x) e^{-2\pi ix} dx \Big|^2 \le \frac 14 \int_0^1 f(x)^2 dx \ \ ? 
$$
Equality is attained for example when $f(x) = \max(0, \cos(2\pi x))$.  
Note that $|\widehat f(1)| =|\widehat f(-1)|$ and, since $f$ is non-negative, $|\widehat f(1)| \le \widehat f(0)$.  Therefore 
$$
\int_0^1 f(x)^2 dx = \sum_n |\widehat f(n)|^2 \ge 3 |\widehat f(1)|^2,
$$ 
so that the estimate holds with $1/3$ in place of $1/4$.  There is a lot of scope to improve this argument, and with a more careful application of Bessel's inequality I could get the constant $1/4+1/4\pi$.  But the claimed inequality looks very clean, and I wonder if (i) it is true!, (ii) is known in some context, and (iii) (hopefully) has an elegant proof?

REPLY [15 votes]: Your conjecture is indeed correct. The proof is based on the following simple yet powerful trick I learned many years ago: $|z| = \sup_{|v| = 1} \Re (zv)$. Therefore it is enough to only bound from above $\Re \left(\int_0^1 vf(x)e^{-2\pi ix}dx\right)$ for all $v\in \mathbb{T}$. And now it is clear by Cauchy-Schwarz that $f$ should be proportional to $\max(0, \Re(ve^{-2\pi ix}))$, and all such functions gives us $\frac{1}{4}$ ($f$ from the OP corresponds to the choice $v = 1$).