If $f\in C[a,b]$ and if $\int\limits_a^bf(x)g(x)dx=0, $ 
If $f\in C[a,b]$ and if 
$$\mathrm{\int\limits_a^b}f(x)g(x)dx=0, \,\,\,\,(*)$$
  for every $g\in C[a,b]$, then $f\equiv 0$.

My Approach: Since  $(*)$ holds for every $g\in C[a,b]$, in particular for $g=f$, and  hence 
$$\mathrm{\int\limits_a^b}f^2(x)dx=0,\Rightarrow f\equiv 0.$$
But in book there is a hint as:
Hint: Assume $f(x_0)\neq 0 $ and use the continuity of $f$ to obtain an interval $(x_0-\delta,x_0+\delta)$ in which $\mid f(x) \mid \geq\frac{\mid f(x_0) \mid }{2}$. Then find a function $g\in C[a,b]$ for which the above integral is different from zero. 
My questions: 
1) Is my approach true?
2) Could you please in using this hint to solve this problem? I couldn't use it effectively.  
Thanks in advance...
 A: Your approach is correct, if you already know that $\int_a^b f^2(x)dx = 0$ implies $f=0$, then your proof is complete. However, the theorem that $\int_a^b f(x)dx =0 $ implies $f=0$ is typically a corollary of this result, so to avoid circular reasoning you should be comfortable giving a proof of this result. In fact, the proofs of these two results are essentially the same.
By contraposition, let's consider that $f(x_0) \neq 0$. Without loss, assume $f(x_0) > 0$, otherwise consider $-f$. By continuity we can show that $f > 0$ on a closed ball $B$ around $x_0$. Then since $f$ is continuous and $B$ is compact, $f$ achieves a minimum on $B$. But $m:=\min_B f > 0$, since $f(x_0)>0$. Choose a $g$ which is zero outsize of $B$ and $1$ on a ball $B_2$ of half the size of $B$. Then
$$
\int_a^b f(x)g(x)dx = \int_{B_2} f(x)g(x)dx = \int_{B_2} f(x)dx \geq \int_{B_2}m dx = m |B_2| >0
$$
where $|B_2|$ denotes the length of the ball (interval). Thus we have shown that if $f(x_0)\neq 0$, we can find a $g$ with $\int_a^b f(x)g(x)dx \neq 0$.
A: Another approach is to use the first mean value theorem for integration. Assuming there is a $x_{0}
 $ such that $f\left(x_{0}\right)>0
 $, so there exist a interval $\left(x_{0}-\epsilon,x_{0}+\epsilon\right)
 $ such that $f\left(x\right)>0
 $ for all $x\in\left(x_{0}-\epsilon,x_{0}+\epsilon\right).
 $ So we take a continuous function $g
 $ such that $g\left(x\right)>0
 $ for all $x\in\left(x_{0}-\epsilon,x_{0}+\epsilon\right)
 $ and $0
 $ otherwise. We have that exists a $c\in\left(x_{0}-\epsilon,x_{0}+\epsilon\right)
 $ such that $$0=\int_{a}^{b}f\left(x\right)g\left(x\right)dx=\int_{x_{0}-\epsilon}^{x_{0}+\epsilon}f\left(x\right)g\left(x\right)dx=2\epsilon f\left(c\right)g\left(c\right)>0
 $$ which is absurd. 
