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!
As $\epsilon$ gets smaller, the $\delta$-interval around $c$ where $|f(x)| \lt \epsilon$ is true gets smaller.
In order for "$\forall \epsilon \gt 0, |f(x)| \lt \epsilon$" to imply "$f(x) = 0$", it has to be true for some fixed $x$. In your argument, the location of $x$ "moves around" as you change $\epsilon$.
It's possible that $x$ may be "fixed but arbitrary", and the argument still works, but your $x$ has a (hidden) dependence on $\epsilon$.
If you want to see this in action, let $f(x) = x-\frac{1}{2}$ on $[0,1]$. Then $c = \frac{1}{2}$, and you can explicitly compute $\delta$ in terms of $\epsilon$. Fix a value of $x$ near (but not at) $\frac{1}{2}$, and as you let $\epsilon$ get smaller, your fixed $x$ value will at some point no longer lie in $(c-\delta, c+\delta)$, and $|f(x)| \lt \epsilon$ will stop being true.
(Incidentally, this problem of using variables to represent values, and not tracking if it represents a fixed value, or ranges over some set, and whether or not it depends on another variable, happens all the time. Our notation is bad at encoding it, and teachers would rather not get bogged down spending time to make it explicit. Making mistakes with it so that you learn to not make them again in the future is part of the infamous "mathematical maturity".)