Let $[a,b]$ a closed and bounded subset of $\mathbb{R}$. Let $f: [a,b] \longmapsto \mathbb{R}$ be a continuous function. Is it true that if $$\int_{c}^{d}f(x)dx=0 $$ for every closed interval $[c,d]\subset(a,b)$, then it must be $f(x)=0$ for all $x \in [a,b]$?
Also, if $f:\mathbb{R} \longmapsto \mathbb{R}$ is a continuous function such that $$\int_{c}^{d}f(x)dx=0 $$ for every closed and bounded set $[c,d]\subset\mathbb{R}$, then it must be $f=0$ on $\mathbb{R}$?
Hope someone can give me a hint.
For the first part, assume that there exists $x_0 \in (a,b)$ such that $f(x_0) \ne 0$. WLOG, assume $f(x_0)>0$. (Replace $f$ by $-f$ if necessary.) Due to the continuity of $f$, there exists $\delta>0$ such that for all $x \in (a,b)$, $|f(x_0)-f(x)| > \dfrac{f(x_0)}{2} > 0$ whenever $|x_0-x| < \delta$.
Apply the First Mean Value Theorem for definite integrals, whose proof doesn't depend on differentiation, on $f$: there exists $\xi \in (x_0-\delta,x_0+\delta)$ such that
$$0 = \int_{x_0-\delta}^{x_0+\delta} f = f(\xi) \, ((x_0+\delta)-(x_0-\delta)) = 2\delta f(\xi) > 0$$
Contradiction. Therefore, $f \equiv 0$ on $(a,b)$. (i.e. on $[a,b]$)
For the second part, note that closed and bounded interval is an instance of closed and bounded sets, so apply the previous part and we are done.