Prove that $f$ is identically equal to $0$ on a closed interval I was given $f$ is continuous on $[a,b]$ and $\int_a^bf(x)g(x)dx=0$ for all continuous function $g$ on $[a,b]$. 
How do I prove that $f$ is identically equal to $0$ on $[a,b]$?
I tried to assume $f$ does not equal to $0$ to get a contradiction, but got stuck. Can I reach this problem with a different approach?
 A: Hint: If $\int_a^b fg=0$ for all $g$ continuous on $[a,b]$ then 
$$\int_a^b f(x)^2dx=0.$$
A: If you want to go the contradiction route, here's one. Assume there is some $c\in (a, b)$ s.t. $f(c) \neq 0$. Just for simplicity's sake, say $f(c)\gt 0$.
By definition of continuity, there is some $\epsilon >0$ such that for any $x \in (c-\epsilon, c+\epsilon)$, we have $f(x) > 0$. Let $g$ be a function which is $0$ outside that interval, and positive within the interval. Then
$$
\int_a^bf(x)g(x)dx
$$
is strictly positive. Thus we have a contradiction. (The case $f(c)< 0$ is completely analogous, only the integral is strictly negative. Still, we have a contradiction.)
An example of a $g$ with the properties we want (just to convince you that it exists) is the funtion which is equal to $0$ outside the interval $(c-\epsilon, c+\epsilon)$, and within the interval is equal to $\epsilon^2 - (x-c)^2$
A: Then $ \int_{a}^{b}f(x)^2dx = 0 $. If $ f $ is not null, there exist $ x \in [a,b]: f(x)^2 >0 $ by continuidty $ f>c $ in some interval $ I \subset \Omega $. Thus $ \int_{a}^{b}f(x)^2dx \ge  \int_{a}^{b}c^2 = c^2 |I| > 0 $. Contradiction.
A: Another option is for each $x \in (a,b)$, construct a sequence of continuous functions (say piecewise linear) $\{p_n\}$ with the property that $\int_a^b f(y) p_n(y) dy \to f(x)$ as $n \to \infty$.  Basically, we want a sequence of functions of total integral 1 so that the majority of the mass of these functions is contained in increasingly smaller intervals around $x$.  
