I am trying to prove this inequality but I am not sure where does the coefficient $\pi$ come from.
Desired Inequality: $$\sum_{n=1}^\infty \left(\int_E \cos 2nxdx\right)^2\le \pi |E|,$$ where $E$ is a subset of $[0,2\pi]$ and its Lebesgue measure $|E|\ge\pi$.
I know when $n\to\infty$, the integrand $\cos2nx$ will have sufficiently small period and it will oscillate very rapidly in $E$, which forces the integral $\left(\int_E \cos 2nxdx\right)^2\to 0$. So I am good with the problem of convergence of the series. But I am not sure how to proceed calculating the actual upper bound of the series. In particular, no clues on where does the coefficient $\pi$ come from.
Thanks for any help.
Hint: Let $f(x)=\chi_E(x)$ for $x\in[0,2\pi]$, i.e., $f(x)=1$ for $x\in E$ and $f(x)=0$ for $x\in[0,2\pi]\setminus E$, then by Parseval's identity we have $$\int_0^{2\pi}|f(x)|^2\,dx=2\pi\sum_{n\in\mathbb Z}|c_n|^2,\tag{1}$$ where $c_n=\frac1{2\pi}\int_0^{2\pi}f(x)e^{-inx}\,dx$ for $n\in\mathbb Z$. Here we can see the appearence of $\pi$.
The details are as follows: