If $f:\left[a,b \right]\rightarrow R$ is integrable and ${N}_{f}=\{x\in\left[a,b \right]: f(x)=0\}$ is dense, so $\int_{a}^{b}f(x)dx=0$
Solution 1:
You don't have to prove that $N_f$ is dense. That $N_f$ is dense is the very assumption of the claim $\int_a^bf(x)\>dx=0$.
The integral is the limit of Riemann sums $$R_{{\cal P},\> \xi}(f)=\sum_{k=1}^Nf(\xi_k)(x_k-x_{k-1})$$ when $\max_{1\leq k\leq N}(x_k-x_{k-1})\to0$. If $N_f$ is dense then however fine your partition ${\cal P}$ you can choose tags $\xi_k\in[x_{k-1},x_k]$ such that $f(\xi_k)=0$ for all $k$, hence $R_{{\cal P},\> \xi}(f)=0$. Since $f$ was assumed integrable the integral has to be $0$ in such a case.
Solution 2:
The simplest answer to your question is the one given by Christian Blatter. I show it as a simple corollary of the following important result (from an exercise in Apostol's Mathematical Analysis, problem 7.35, Page 180):
Theorem: If $f$ is Riemann integrable on $[a, b]$ and $$\int_{a}^{b}f(x)\,dx > 0$$ then there is a non-degenerate sub-interval $[c, d]\subseteq [a, b]$ such that $f(x) > 0$ for all $x \in [c, d]$.
To answer your question let's assume on the contrary that $\int_{a}^{b}f(x)\,dx > 0$ and then by above theorem $f$ is positive on some sub-interval $[c, d]$ and hence no point of $(c, d)$ lies in the closure of $A$ so that $\bar{A} \neq [a, b]$.
The case $\int_{a}^{b}f(x)\,dx < 0$ is handled by considering $-f$ in place of $f$. And thus we are forced to have the integral $\int_{a}^{b}f(x)\,dx = 0$.
Apostol offers the following beautiful proof of the theorem above via hint. Let us then assume that $$I = \int_{a}^{b}f(x)\,dx > 0$$ and let $M > 0$ be such that $f(x) \leq M$ for all $x \in [a, b]$. Consider the number $$h =\frac{I}{2(M + b - a)} > 0$$ and the set $$T = \{x\mid x \in [a, b], f(x) \geq h\}$$ By definition of Riemann integral we have a partition $$P = \{x_{0}, x_{1}, x_{2}, \dots, x_{n}\}$$ of $[a, b]$ and the corresponding Riemann sum $$S(P, f) = \sum_{k=1}^{n}f(t_{k})(x_{k} - x_{k - 1})$$ such that $S(P, f) > I/2$. Now the index $k$ in sum $S(P, f)$ above is divided into two sets $A, B$ as follows: $$A = \{k\mid [x_{k - 1}, x_{k}]\subseteq T\}, B = \{k \mid k \notin A\}$$ and the sum $S(P, f)$ is split into two sums as follows $$S(P, f) = \sum_{k \in A}f(t_{k})\Delta x_{k} + \sum_{k \in B}f(t_{k})\Delta x_{k}$$ If $k \in A$ then we note that $f(t_{k}) \leq M$ and if $k \in B$ then we choose $t_{k}$ such that $f(t_{k}) < h$. Then we can see that $$S(P, f) < M\sum_{k \in A}\Delta x_{k} + h(b - a)$$ and hence $$h(M + b - a) = \frac{I}{2} < S(P, f) < M\sum_{k \in A}\Delta x_{k} + h(b - a)$$ or $$\sum_{k \in A}\Delta x_{k} > h$$ so that $A$ is non-empty and hence we have a non-degenerate sub-interval $[x_{k - 1}, x_{k}] \subseteq T$ and thus $f(x) \geq h > 0$ on this sub-interval.
Note that the proof in Apostol's book unnecessarily assumes that $f(x)$ is non-negative. The estimation of sum $S(P, f)$ via splitting into two sums and then finding a bound for each of these two sums works without assuming $f$ is non-negative (the bounds are obtained by multiplication with $\Delta x_{k} > 0$ and addition of inequalities which are both valid steps in algebraic manipulation of inequalities).