Given $f$ is a Lebesgue measurable function and $\int_0^1 x^{2n}f = 0 ~~~ \forall n$ , then show that $f = 0$ a.e. Given $f$ is a Lebesgue measurable function and $\int_0^1 x^{2n}f\,d\mu = 0 \quad \forall n$, then show that $f = 0$ a.e.
Of course, if it was given that $f \geq 0$ then this was pretty trivial.
My attempt : By contradiction.
Suppose $\exists A \subset [0,1]$ s.t. $\mu(A) >0$ and $f(x) \neq 0~~~~ \forall x \in A.$ Without loss of generality we may assume that $f(x) > 0~~~~\forall x \in A .$
And $\forall \epsilon>0 \exists $ a sequence of intervals such that $\mu(A \setminus I_n) <\epsilon$
$$\int_{[0,1]} x^{2n}f(x)\,d\mu = \int_Ax^{2n}f(x)\,d\mu + \int_{[0,1]\setminus A} x^{2n}f(x)\,d\mu$$
Now the first integral is strictly greater than 0. I was hoping I could use $x^{2n}$ to reduce $x^{2n}f$ on $I_n$, and so get the required contradiction.
Can someone help further my attempt, or give any other hint to solve this question. Deepest appreciation in advance.
 A: Here is a sketch of the proof. I believe you can fill in the details to complete the proof:

Assumption. $f$ is integrable on $[0,1]$ and satisfies $\int_{0}^{1}x^{2n}f(x)\,\mathrm{d}x=0$ for all $n\geq 0$.

Then by noting that the space of even polynomials on $[0,1]$ is dense in $C([0,1])$ w.r.t. the supremum norm, we have $\int_{0}^{1}\varphi(x)f(x)\,\mathrm{d}x=0$ for any continuous function $\varphi$ on $[0, 1]$. Now observe:

Lemma. Let $E\subseteq[0,1]$ be measurable. Then there exists a sequence of $\varphi_n:[0,1]\to[0,1]$ of continuous functions such that $\varphi_n \to \mathbf{1}_E$ almost everywhere.

Using this, we can find a sequence $\varphi_n : [0, 1] \to [-1, 1]$ of continuous functions such that $\varphi_n \to \operatorname{sign}(f)$ a.e. Then by the dominated convergence theorem,
$$ 0
= \lim_{n\to\infty} \int_{0}^{1} \varphi_n(x) f(x) \, \mathrm{d}x
= \int_{0}^{1} \lim_{n\to\infty} \varphi_n(x) f(x) \, \mathrm{d}x
= \int_{0}^{1} |f(x)| \, \mathrm{d}x, $$
which is sufficient to conclude the desired claim.

Addendum - Proof of Lemma.
1st Proof. Since $C([0,1])$ is dense in $L^1([0,1])$, there exists $(\psi_n)_{n\geq 1} \subseteq C([0, 1])$ such that $\psi_n \to \mathbf{1}_E$ in $L^1$. By passing to a subsequence if necessary, we can also assume that this convergence is pointwise a.e. Then the claim follows setting $\varphi_n = \max\{0, \min\{\psi_n, 1\}\}$. $\square$
In case OP is not familiar to $L^p$-theory, here is a more elemtary proof:
2nd Proof. Pick a closed set $F_n$ such that $F_n \subset E$ and
$$ \mu(E \setminus F_n) < 2^{-n}.$$
Then there exists a continuous function $\varphi_n : [0, 1] \to [0, 1]$ such that $\varphi_n \equiv 1$ on $F_n$ and
$$\mu(\operatorname{supp}(\varphi_n) \setminus F_n) < 2^{-n}. $$
For instance, set $\varphi_n(x) = \max\{0,1-k \operatorname{dist}(x, F_n)\}$ for a sufficiently large $k$. Now we claim that $\varphi_n \to \mathbf{1}_E$ almost everywhere. We will establish this by invoking the idea of Borel-Cantelli Lemma. Indeed, define the function $N : [0, 1] \to \mathbb{N}_0 \cup\{\infty\}$ by
$$ N(x) = \sum_{n=1}^{\infty} \mathbf{1}_{\{ \varphi_n(x) \neq \mathbf{1}_E(x) \}}. $$
Then we note that, for each $x \in [0, 1]$ and $n \geq 1$, we have
\begin{align*}
[\varphi_n(x) \neq \mathbf{1}_E(x)]
&\quad\Rightarrow\quad [x \in E \text{ and } \varphi_n(x) \neq 1] \text{ or } [x \notin E \text{ and } \varphi_n(x) \neq 0] \\
&\quad\Rightarrow\quad [x \in E \setminus F_n] \text{ or } [x \in \operatorname{supp}(\varphi_n)\setminus E].
\end{align*}
From this, we get
$$ \int_{[0,1]} N(x) \, \mathrm{d}x
= \sum_{n=1}^{\infty} \mu(\{ x : \varphi_n(x) \neq \mathbf{1}_E(x) \})
\leq \sum_{n=1}^{\infty} 2^{-(n-1)} < \infty. $$
In particular, this implies that $N$ is finite a.e., which in turn tells that $\varphi_n(x) = \mathbf{1}_E(x)$ eventually holds a.e. Therefore $\varphi_n \to \mathbf{1}_E$ pointwise a.e. as desired. $\square$
A: Make the substitution $x=\sqrt y$ to see that $\int_0^{1}y^{n}g(y)dy=0$ for all $n$ where $g(y)=f(y)y^{-1/2}$. (Integrability of $g$ follows from existence of $\int f(x)dx$ which is given). This shows that $\int p(y)g(y)dy=0$ for every polynomial $p$. Standard arguments using approximation  of integrable functions by continuous functions and then by polynomials completes the proof.
