Proving $\int_{I} f \geq 0$ for an integrable function that is positive at rationals

Let $$I$$ be a generalized rectangle in $$\mathbb{R}^{n}$$ and suppose $$f :I \rightarrow \mathbb{R}$$ is integrable. Suppose $$f(x) \geq 0$$ if $$x$$ is a point in $$I$$ with a rational component. Prove $$\int_{\mathbf{I}} f \geq 0$$ holds.

My try:

By the integrability of $$f$$,

\begin{align*} \int_{\mathbf{I}} f &= \text{sup}\{L(f, \mathbf{P}) \mid \mathbf{P} \text{ is a partition of the generalized rectangle } \mathbf{I}\} \\ &= \text{inf}\{U(f, \mathbf{P}) \mid \mathbf{P} \text{ is a partition of the generalized rectangle } \mathbf{I}\} \end{align*}.

Since $$f(x) \geq 0$$ if a component of $$x$$ is in $$\mathbb{Q}$$, for any partition $$\mathbf{P} = (P_1, P_2 \ldots, P_k)$$ and generalized rectangle $$J$$, we get

$$U(f, P_{k}) = \text{sup}\{f(x) \mid x \in J\} \cdot \text{vol } \mathbf{J} \geq 0.$$

So $$\text{inf}\{U((f, P)\}, \text{sup}\{L((f, P)\} \geq 0$$

and result follows.

Is my proof orrect?

• Are you talking about Riemann integrability? – Lord Shark the Unknown Apr 19 at 4:36
• @LordSharktheUnknown Yes, obviously. – amsmath Apr 19 at 4:40
• @amsmath, if you dont know how the function is defined at irrationals, then how can you conclude that $\inf$ is also non-negative? – user5325 Apr 19 at 4:46
• @Michael The german page is better. ;-) – amsmath Apr 19 at 4:56
• @Michael, thanks for pointing out! I agree that $\inf$ is non-negative. But in that case by definition of Riemann integral, value of the integral is the limit of upper sums (which are equal to lower sums) and since each upper sum is $\geq 0$, the limit will be $\geq 0$. – user5325 Apr 19 at 4:56

Note that as you have rightly pointed out, for any partition, $$P$$, the upper sum and lower sums are equal and upper sum is non-negative. Thus, $$\int_I f = \lim_{\|P\|\to 0} \mathcal{U}(P,f).$$ Since each term in the limit is non-negative, the limit is non-negative. Hence $$\int_I f \geq 0.$$