Suppose $f$ is continuous on $[a,b]$, that $f(x) \geq 0 \ \forall x \in [a,b]$, and $\int_{a}^{b} f(x) dx = 0$. Prove that $f(x) = 0 \ \forall x \in [a,b]$
I have seen various posts on this:
$f\geq 0$, continuous and $\int_a^b f=0$ implies $f=0$ everywhere on $[a,b]$
and many more. I follow these proofs, but I want to understand why mine is incorrect. I will explain why I know it is flawed after showing it since without context, it won't make sense.
Since $f$ is continuous, the mean value theorem for integrals tells me $\exists c \in (a,b)$ s.t.
$f(c) = \frac{\int_{a}^{b} f(x)dx}{b-a} = \frac{0}{b-a} = 0$
Now, since $f$ is continuous on $[a,b]$, specifically, it is continuous at $c$, I know $\forall x \in [a,b], \forall \epsilon > 0, \exists \delta > 0$ s.t. whenever $|x - c| < \delta, |f(x) - f(c)| < \epsilon$.
But, $f(c) = 0$. So, $|f(x) - f(c)| = |f(x)| < \epsilon$
Therefore, $f(x) = 0$
Now, the reason I know my proof is flawed is because I never used the fact that $f(x) \geq 0$. This assumption cannot be dropped as there are a plethora of counterexamples (for one of many counterexamples, take $\sin(x)$ on $[0,2\pi]$). Despite knowing this, and reading the other proofs, I am still struggling to see where the invalid step is in my proof. I'd like to understand what part of my proof is incorrect that way I won't make a similar mistake again on other proofs. Does anyone see where I made a false move? Thanks in advance!