# Stein-Shakarchi Real ananlysis problem 2.1: a function has integration 0 in any subset of a given interval.

This question is from Stein-Shakarchi Real Analysis problem 1 in chapter 2. For a function $f$ integrable on $[0,2\pi]$:

(1) Prove $\int_0^{2\pi}f(x)e^{-inx}\mathrm{d}x\to 0$ as $n\to\infty$

(2) Use (1) to prove if $E$ is a measurable subset of $[0,2\pi]$, then $\int_E\cos^2{(nx+u_n)}\mathrm{d}x\to\frac{1}{2}m(E)$ as $n\to\infty$ for any sequence $(u_n)$.

I've done part (1), but for part (2), after split the integral using trig identity I have:$\int_E\cos^2{(nx+u_n)}\mathrm{d}x=\frac{1}{2}m(E)+\frac{1}{2}\int_E\cos{(2nx+2u_n)}\mathrm{d}x$. Then I tried to show the last part goes to $0$ as $n$ goes to infinity. But I cannot make any progress. In particular, I don't know how to use $E$ being a subset of $[0,2\pi]$. Any help is much appreciated.

You can write $$\int_E \cos{(nx+u_n)} = \Re \left( e^{-iu_n} \int_E e^{-inx} \, dx \right) = \Re \left( e^{-iu_n} \int_0^{2\pi} \chi_{E}(x) e^{-inx} \, dx \right).$$ $E$ is measurable, so $\chi_E$ is integrable, and you can apply the first part. ($e^{-iu_n}$ is bounded for real $u_n$, so does not affect convergence to zero.)