Prove that a function is equal to a constant. Assume that $f(x)$ is continuous on $[a,b]$. And for any continuous function $g$  if $\int_a^bg(x)dx=0$ then $\int_a^bf(x)g(x)dx=0$,
 show that $f(x)$ is a constant.
I tried to convert this question to show$f'(x)\equiv0$ but this seems impossible by using the mean value theorem or the Rolle theorem. 
Any ideas?
 A: Take $g(x)=f(x)-\dfrac{1}{b-a}\int_a^b f(x) dx$.  Certainly for this choice of $g$, we have that $g$ is continuous and $\int_a^b g(x) dx=0$
We then observe that if $\int_a^b f(x)\,g(x)\,dx=0$, then 
$$\int_a^b f^2(x)dx=\dfrac{1}{b-a}\left(\int_a^b f(x) dx\right)^2$$
But by the Cauchy-Scwartz Inequality 
$$\left(\int_a^b f(x) dx\right)^2\le \int_a^b f^2(x)\, dx\,\,\int_a^b (1)^2\,dx\implies\,\int_a^b f^2(x)\, dx\ge \dfrac{1}{b-a}\left(\int_a^b f(x) dx\right)^2$$
with equality holding only when $f(x)$ is a constant.  And that is that!
A: Outline, with some middle steps missing.
Show that if the above is true for $f$, the it is true for $f_1(x)=f(x)-C$ for $C$ any constant. Then show:
$$\int_a^b f_1(x)\,dx = 0$$
For a parrticular $C$.
So, let $g(x)=f_1(x)$ and we get tht:
$$\int_a^b f_1(x)^2 \,dx = 0$$
Therefore, show $f_1(x)=0$ for all $x$, and thus that $f(x)=C$ for all $x$.
A: Your idea of showing $f'(x)\equiv 0$ doesn't work because $f$ is not necessarily differentiable. However, it can be done if we assume that $f$ has a continuous derivative.
Let $G$ be a differentiable function on $[a,b]$ with $G(a)=G(b)=0$. Now $g=G'$ has $\int_a^b g(x) dx = 0$, so integrating by parts, we get
$$
\int_a^b f'(x) G(x) \,dx = \left[f(x) G(x) \right]_{x=a}^b - \int_a^b f(x)g(x)\,dx = 0.
$$
If $f'(x)$ is nonzero at any point, then because $f'$ is continuous there is an open interval $(c,d) \subseteq [a,b]$ where $f'$ has only one sign. Without loss of generality, let's assume $f'$ is positive in $(c,d)$ (otherwise we may consider $-f'$ in the following). Let $G$ be a function which is zero outside $(c,d)$ and has positive values in $(c,d)$. (Such a function exists but giving a full definition here would be troublesome because $G$ needs to be continuous so I'll skip it.) Then
$$
\int_a^b f'(x) G(x) \,dx > 0,
$$
which is a contradiction.
