$f\in L^1[0,1]$ and $\int fg^{(n)}$=0 for all $g\in C^{\infty}_{c}(0,1)$, then $f$ is a polynomial of degree $n-1$ We consider the Lebesgue measure on $\mathbb{[0,1]}$ and real valued maps on $[0,1]$. Let $n$ be a fixed natural number. Suppose $f\in L^1[0,1]$ and $\int fg^{(n)}$=0 for all $g\in C^{\infty}_{c}(0,1)$. Does it then follow that $f$ is a polynomial of degree $(n-1)$?.
Even the easiest case $n=1$ baffles me. I tried defining $F(x)=\int_{0}^{x}f(t)dt$ so that $F$ is absolutely continuous and $F'=f$ almost everywhere. Integration by parts gives $$\int Fg''=Fg'|_{0}^{1}-\int fg'=-\int fg'=0$$ but I don't understand why this forces $F$ to be an affine map. Please enlighten me.
 A: While this is quite standard, it's not totally trivial to prove, if you want to do it from first principles. The basic statement that you need to establish is the $n=0$ case: if $f\in L^1(0,1)$ and $\int_0^1 fg \, dx = 0$ for all $g\in C_0^{\infty}(0,1)$, then $f=0$. I'm a bit too lazy right now to think in detail about how to best prove this in a fairly elementary way. There are many possible versions of the argument, and you can definitely read about this in many places.
Assuming this statement, you then probably want to observe that $h\in C_0^{\infty}(0,1)$ is the $n$th derivative $h=g^{(n)}$ of some $g\in C_0^{\infty}(0,1)$ if and only if $\int_0^1 x^k g(x)\, dx=0$ for $k=0,1, \ldots , n-1$. This implies the claim, by a piece of linear algebra: If now $f$ is such that always $\int_0^1 fg^{(n)}\, dx =0$, then for an arbitrary $g\in C_0^{\infty}(0,1)$, we can write
$$
g = \sum_{j=0}^{n-1} c_j g_j + \left( g - \sum c_jg_j \right), \quad c_j = \int x^j g ,
$$
with the $g_j$'s chosen in advance such that $\int x^k g_j = \delta_{jk}$ for $k=0,1,\ldots , n-1$.
The difference is an $n$th derivative, so
$$
\int gf = \sum c_j \int g_j f .
$$
This says that $f$ acts on $g\in C_0^{\infty}(0,1)$ in the same way as
$\sum d_j x^j$, with $d_j=\int g_jf$, so by the $n=0$ case, $f=\sum d_jx^j$.
