If a function integrates to zero against every function with zero mean, then it is constant Struggling with this calculus problem:
Let $f : [0, 1] \to \mathbb R$   be
a smooth function. Show that if
$$ \int_{0}^{1}f(x)v(x)dx = 0 $$ 
for every smooth function $v : [0, 1] \to\mathbb R$ for which
$$ \int_{0}^{1}v(x)dx = 0 $$
then $f$ is constant. (Hint: integrate by parts.)
With by parts, I'm getting to $$  \left[f(x) \int v(x)dx\right] \bigg|_0^1  - \int_{0}^{1}\left(\int v(x)dx\,f(x)\right)$$ and don't know where to go. I'm not sure if I can make the integrals inside definite to make them zero by the definition. Can I use $$\int_{0}^{1}f(x) = f(1)-f(0) $$ Is that appropriate? It says the function is smooth. (continuous?)
 A: Let $m = \int_0^1 f(x) dx$. Then we have 
$$\int_0^1 (f(x)-m)^2 dx =0$$
Indeed: 
$$\int_0^1 (f(x)-m)^2 dx = \int_0^1 f(x) \cdot (f(x) -m) dx - \int_0^1 m\cdot (f(x) -m) dx$$
Now $\int_0^1 (f(x)-m)dx = \int_0^1 f(x) - m \cdot 1 = 0$ and so the first term above is zero (by hypothesis) and the second also. 
Therefore $f(x) \equiv m$.
A: Here is an approach that does not involve integration by parts directly.
Note that $\int_0^1 f(x) v(x) dx = \int_0^1 \int_0^x f'(t) dt dx = \int_0^1 f'(t) \int_t^1 v(x)dx dt$.
Let $\phi(t) = \int_t^1 v(x) dx$, we note that $\phi$ is smooth and $\phi(0) = \phi(1) = 0$ (under the assumption that $v$ has zero average). Furthermore, any smooth $\phi$ that matches at the end points corresponds to some zero average $v$ (specifically, $v= -\phi'$).
Hence we have $\int_0^1 f'(t) \phi(t)dt = 0$ for any smooth $\phi$ such that $\phi(0) = \phi(1)$. If $f'(t^*) > 0$ for some $t^*$, we can find a small interval containing $t^*$ such that $f'(t)>{1 \over 2} f'(t^*)$ on this interval. Then we can find a smooth $\phi$ such that the support of $\phi$ is contained in this interval, and $\int \phi = 1$. This would result in
$\int f' \phi \ge L{1 \over 2} f'(t^*) > 0$ (where $L$ is the length of the interval), a contradiction. Similarly if $f'(t^*) < 0$. Hence $f'(t) = 0$ everywhere, and so $f$ is constant.
