$f\in L^2([0,1])$ and $\int_0^1 t^n f(t)\,dt = (n+2)^{-1}$ for all $n=0,1,2,\ldots$. Is $f(t)=t$ a.e.? I know how to prove the statement if $f$ is continuous, but the $L^2$ part is throwing me off. As far as I know, we can't use a version of Stone-Weierstrass, because $f$ isn't continuous. I'm pretty sure that the polynomials are dense in $L^2$, but I don't know if there is a sequence of polynomials that converge pointwise almost everywhere. If not, then dominated convergence isn't helpful either.
Is the statement even true? Any hints? Counterexamples?
Thanks.
Edit: I did some searching around StackExchange and found a good hint. I think what I'm going to mention works, and it would make sense given the class material. Basically, we can show that
$$\int_0^1g(t)(f(t)-t)\,dt = 0 $$
for any continuous $g$. Since $\sin$ and $\cos$ are continuous, we can say that
$$\int_0^1(f(t)-t)e^{2\pi i \kappa t}\,dt = 0$$
for any $\kappa$. The integral converges because $f\in L^2([0,1])$. Then the Fourier coefficients, $(f(t)-t)\hat{\,}(\kappa)$, are equal to 0, which implies that $f(x) = t$ a.e.
How does that look? Can someone think of a simpler way of going about this?
 A: Consider $g(t)=f(t)-t$. We have:
$$ \int_{0}^{1} t^n g(t)\,dt =0 \tag{1}$$
for any $n\in\mathbb{N}$, with $g\in L^2(0,1)$. The last constraint gives that $g(x)$ has an expansion in terms of shifted Legendre polynomials, but $(1)$ gives:
$$ \int_{0}^{1} P_n(2t-1)\,g(t)\,dt = 0 \tag{2} $$
so the coefficients of the previous expansion are zeroes only and $g\equiv 0$ almost everywhere on $(0,1)$, so $f(t)\equiv t$ a.e.. We exploited the fact that shifted Legendre polynomials give a complete orthogonal base of $L^2(0,1)$ with respect to the usual inner product, and Parseval's identity in such a context:
$$ h(t) = \sum_{n\geq 0} c_n\,P_n(2t-1)\quad\Longrightarrow\quad\int_{0}^{1}h(t)^2\,dt = \sum_{n\geq 0}\frac{c_n^2}{2n+1}.  \tag{3}$$
If you want an overkill, by Carlson's theorem the partial sums of the Fourier-Legendre series of $g(t)$ are almost everywhere pointwise convergent to $g(t)$ on $(0,1)$, but, as shown above, pointwise convergence is not really needed to prove $f(t)\equiv t$ a.e..
A: A lower-tech method: As @JackD'Aurizio notes, $\int_0^1 t^ng(t)\,dt=0$ for $n=0,1,2,\ldots$. This implies that $\int_0^1 p(t)g(t)\,dt=0$ for every polynomial, and then by Weierstrass that $\int_0^1 h(t)g(t)\,dt=0$ for each continuous function on $[0,1]$. Finally, because $g\in L^2[0,1]$, there is a sequence $(h_n)$ of continuous functions converging to $g$ in $L^2[0,1]$. Because 
$$
\left|\int_0^1 h_n(t)g(t)\,dt-\int_0^1 g(t)g(t)\,dt\right|\le\|h_n-g\|_2\cdot\|g\|_2
$$
it follows that $\int_0^t[g(t)]^2\,dt=0$.
A: $g(t) = f(t) - t$ will be in $L^2[0,1]$ with $\int_0^1 g(t) t^n\; dt = 0$ for all nonnegative integers $n$.
$$\exp(-2\pi i k t) = \sum_{n=0}^\infty \dfrac{(-2\pi i k t)^n}{n!} $$
the sum converging uniformly on $[0,1]$, and thus in $L^2$.  Therefore 
all the Fourier series coefficients
$$ \widehat{g}(k) = \int_0^1 g(t) \exp(-2\pi i k t)\; dt = \sum_{n=0}^\infty \int_0^1 g(t) \dfrac{(-2\pi i k t)^n}{n!} \; dt = 0$$
Parseval's theorem then says $g(t) = 0$ a.e.
A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
{1 \over s + 1} & = \int_{0}^{1}t^{s -1}\,\mathrm{f}\pars{t}\,\dd t =
\int_{0}^{\infty}t^{s -1}\,\bracks{t < 1}\mathrm{f}\pars{t}\,\dd t
\end{align}
$\ds{\bracks{\cdots}}$ is an Iverson Bracket.

$\ds{\ul{With}}$ the Mellin Transform $\ds{\pars{~\sigma > 0~}}$:
\begin{align}
\color{#f00}{\bracks{t < 1}\mathrm{f}\pars{t}} & =
\int_{\sigma - \infty\ic}^{\sigma + \infty\ic}{t^{-z} \over z + 1}\,
\,{\dd z \over 2\pi\ic} = t^{-\pars{-1}} = \color{#f00}{\large t}
\end{align}
