Find a counterexample of a stronger corollary to the Lebesgue’s theorem on Riemann integrability (or prove?)

integrationmeasure-theoryreal-analysisvector analysisvolume

So last class we saw Lebesgue's theorem on Riemann integrability (that is, a function is integrable over a bounded set in $\mathbb{R}^n$ if and only if its set of discontinuities has measure zero). Now, we also take this definition for volume of a set:

We say a bounded set has volume when the Riemann integral $\int_A 1_A$ exists, and we call that value the volume of A (where $1_A(x) = 1$ if $x \in A$ and $1_A(x)=0$ otherwise).

I know that volume zero implies measure zero but in general measure zero doesn't imply volume zero (there are sets with measure zero but no volume). So this leads us to the following "corollary", which we stated in class but didn't prove:

Let $f:A \subset \mathbb{R}^n \to \mathbb{R}$ a bounded function over a bounded set $A$ such that $f(x) \geq 0, \forall x \in A$ and $\int_A f(x)\ dx = 0$ (Riemann integral). Show that the set $\{x \in A: f(x) \neq 0\}$ has volume zero.

I've seen that corollary over and over again in several sources but with a small difference: they all replace volume by measure. So this combined with my small introduction (measure zero not always implies volume zero) makes me think the stronger version (that with volume zero) is not true (otherwise, why don't all just write volume?). My previous attempt to build a counterexample lead to naught (see this question), but I still think that weird functions and weird sets where the corollary's false exist. In particular, maybe a function with a set of discontinuities with measure zero but no volume.

So, can anyone come up with a counterexample? Thanks in advance!

Best Answer

Thomae's function $f \colon [0, 1] \to [0, \infty)$ is Riemann integrable with $\int_{0}^{1}f(x)\,dx = 0$. But $\{x : f(x) \neq 0\} = \mathbb{Q} \cap [0, 1]$, which is not Riemann measurable.