TITLE: Prove that $\exists a<b$ s.t. $f(a)=f(b)=0$ when $\int_0^1f(x)dx=\int_0^1xf(x)dx=0$
QUESTION [7 upvotes]: The exact question is: 

$f:[0,1]\rightarrow\mathbb{R}$ is a continuous function such that
  $\int_0^1f(x)=\int_0^1xf(x)=0$. Prove that $\exists a,b \in [0,1], a<b$
   such that $f(a)=f(b)=0$.

By using mean value theorem of integration, we get some $a,b$ s.t $f(a)=f(b)=0$, but how can we show that $a\neq b$.

REPLY [19 votes]: We are given that $\displaystyle \int^1_0 (ax+b)f(x) dx =0 .$ Suppose $f$ is not identically zero for otherwise the result is trivial. The condition $\displaystyle \int^1_0 f(x) dx = 0 $ implies there is at least one sign-changing root, say at $ m$ (that is, the function has different signs after passing through $m$, or more formally, $f(m+\epsilon)f(m-\epsilon)< 0 $ for all sufficiently small $\epsilon>0.$) Suppose this is the only sign-changing root. Then $ (x-m)f(x) $ does not change signs and is not identically $0$ either,  so $\int^1_0 (x-m) f(x) \neq 0 $, contradicting the first statement. Thus there are at least $2$ distinct sign-changing roots.
This idea can be employed in proving the generalized result: If $ f\in C( [0,1], \mathbb{R} ) $ is such that $ \displaystyle \int^1_0 x^k f(x) dx = 0 $ for all $ k= 0, 1,2,\cdots, n-1 $ then $f$ has at least $n$ distinct sign-changing roots in $[0,1].$