Proving that $m(E) = 0$ if for all $n$, $\int_E x^n \cos x\, d x = 0$ 
Suppose that $E\subset [0,2\pi]$ is measurable and $\int_E x^n \cos x\,dx = 0$ for all $n =0,1,2,\cdots$. Then prove that $m(E)=0$. 

In a non-rigorous fashion, if $\sum_{1}^{\infty} a_nx^n = \sec x$ (the Taylor series), then 
$$m(E) = \int_E 1 dx = \int_E \sum a_n x^n \cos x \overset{?}{=} \sum a_n\int_E x^n \cos x = 0.$$
But I'm unable to show the equality (labeled with a question mark). Can you provide a hint or an answer? 

This is problem 18.27 from Real Analysis, Carothers (so I think that there is a very elementary solution to this problem without any reference to strong theorems). 
 A: This doesn't require much more than Chebyshev's inequality. If $f \ge 0$ on a set $A$ and $\displaystyle \int_A f \, dx = 0$, then $f = 0$ almost everywhere on $A$, because
$$ m(A \cap \{f > 0\} ) \le  \sum_{n=1}^\infty m(A \cap \{f > \tfrac 1n\})$$ and  $$m(A \cap \{f > \tfrac 1n\}) \le n \int_A f \, dx = 0$$ for all $n \in \mathbb N$.
The hypothesis $\displaystyle \int_E x^n \cos x \, dx = 0$ for all $n$ is equivalent to the hypothesis $$ \int_{[0,2\pi]} p(x) \cos x \chi_E(x) \, dx = 0$$ for every polynomial $p(x)$.  In particular,
$$ \int_{[0,2\pi]} \left( x - \frac{\pi}{2} \right)\left( x - \frac{3\pi}{2} \right) \cos x \chi_E(x) \, dx = 0.$$
It is quick to check that $$\left( x - \frac{\pi}{2} \right)\left( x - \frac{3\pi}{2} \right) \cos x \chi_E(x) \ge 0$$ on $[0,2\pi]$, so you are led to conclude that
$$\left( x - \frac{\pi}{2} \right)\left( x - \frac{3\pi}{2} \right) \cos x \chi_E(x) = 0$$ almost everywhere in $[0,2\pi]$. Let $B$ denote the set where this function is positive. If $\chi_E(x) > 0$ then either $x \in B$ or $x = \frac \pi 2$ or $x = \frac{3\pi}{2}$, so that $$E \subset B \cup \left\{ \frac \pi 2, \frac{3\pi}{2} \right\}$$ implying $m(E) = 0$.
A: If you can use that $\{1, x, x^2, \cdots\}$ is $C_0$ dense in $C[0,2\pi]$ and $C[0, 2\pi]$ is $L^2$ dense in $L^2[0,2\pi]$, then 
$$\int_E x^n \cos x dx = 0 \Rightarrow \int_0^{2\pi} x^n \chi_E \cos x dx = 0\Rightarrow \chi_E \cos x  =0$$
almost everywhere. Thus $m(E) = 0$. 
