A definite integral inequality Suppose $f(x)$ has continuous derivative on $[-\pi, \pi]$, $\,f(-\pi)=f(\pi)\,$ and $\,\int_{-\pi}^{\pi}\, f(x)\, dx=0$. Then prove that:
$$
\int_{-\pi}^{\pi} [\,f'(x)]^2\, dx \ge \int_{-\pi}^{\pi} f^2(x)\, dx,
$$
with the equal sign holding if and only if $\,f(x)=A\cos x+B\sin x$.
Thanks for your help!

If $f: [-\pi,\pi]\to\mathbb R$ is continuously differentiable, then $f$ and $f'$ are also $L^2$, and hence they are expressed as
$$
f(x)=\sum_{k\in\mathbb Z}\hat f_k\,\mathrm{e}^{ikx} \quad \text{while}\quad
f'(x)=\sum_{k\in\mathbb Z}ik\,\hat f_k\,\mathrm{e}^{ikx},
$$
and we have that
$$
\int_{-\pi}^\pi|\,f(x)|^2\,dx=2\pi\sum_{k\in\mathbb Z}|\,\hat f_k|^2
 \quad \text{while}\quad
\int_{-\pi}^\pi|\,f'(x)|^2\,dx=2\pi\sum_{k\in\mathbb Z}k^2|\,\hat f_k|^2
$$
If $\int_{-\pi}^\pi f(x)\,dx=0$, then $\,\hat f_0=0$, and hence
$$
\int_{-\pi}^\pi|\,f'(x)|^2\,dx\ge \int_{-\pi}^\pi|\,f(x)|^2\,dx,
$$
with the "=" to hold only if $\hat f_k=0$, for all $|k|\ne 0$, i.e., if $f(x)=a\cos x+b\sin x$.
Note. This is the well-known Wirtinger's inequality, which is a Poincaré type inequality.
