Help with integrals of a generic function f(x) I was given the following Maths exercise, but I am not able to come up with a solution. 
Let $f:[0,1]$ in $R$ be a continuous function satisfying:
$\int_{0}^{1} f(x) dx=0$ and $\int_{0}^{1} xf(x) dx=0$ 
show that $f$ vanishes at least twice in $]0,1[$.
 A: Part 1: Assume that $f(x)\not=0$ on $]0,1[$. Then the sign of $f$ is constant on $]0,1[$ because of the Intermediate Value Theorem. Assume WLOG that $f(x)>0$.
Now by assumption $a=f(1/2)>0$. By continuity there is an interval $]1/2-\delta,1/2+\delta[$ where $f(x)>a/2$. Then we have (since $f(x)>0$):
$$0=\int_0^1 f(x)dx\geq\int_{1/2-\delta}^{1/2+\delta} f(x)dx>a\delta$$
which is a contradiction since $a, \delta>0$.
This contradiction shows that $f$ has a zero $c$ on $]0,1[$. 
Part 2: Assume now that $f(x)\not=0$ on $]0,1[$ except at $x=c$. Again we may assume that $f(x)>0$ on $]0,c[$ and $f(x)<0$ on $]c,1[$.
Integrating by parts give
$$0=\int_0^1 xf(x)dx = [xF(x)]_0^1 -\int_0^1 F(x)dx=F(1)-\int_0^1 F(x)dx$$
where
$$F(x)=\int_0^x f(t)dt$$
By assumption $F(1)=0$ so that
$$\int_0^1 F(x)dx=0$$
Since $F$ is continuous, we know according to Part 1 that $F$ must have a zero $d\in ]0,1[$, that is
$$\int_0^d f(x)dx=0$$
Clearly $d\not=c$ since $f(x)>0$ on $]0,c[$.
Since the integral over $[0,1]$ is $0$ we also have
$$\int_d^1 f(x)dx=0$$
One of the intervals $[0,d]$ and $[d,1]$ does not contain the zero $c$ (recall $d\not=c$). The results of Part 1 applied to $f$ on this interval give us another zero $c'$.
