Question related to Riemann Sums I was reading the book of Real Analysis by H.L.Royden and they have given the definition of Riemann sums and Riemann integral as follows:
After this definition they have given the following footnote
Now I am not getting what the footnote 1 is saying. I think the statement of that note 1 is not always true. For example if we take the Dirichlet function (which is 0 on rationals and 1 on irrationals ) then the footnote 1 is not true. Am I correct or am I missing something?
(Edit:) My thoughts on why the foot note does not work for Dirichlet function:
We define $f:[0,1]\rightarrow \mathbb R$ by $f(x)=0$ if $x\in\mathbb Q$ and $f(x)=1$ otherwise.
Now consider any partition $P$ of $[0,1]$. Then for any subinterval $[x_{i-1},x_i]$ we get $m_i=0$ because each subinterval will definitely have infinitely may rationals. Also $M_i=1$ because each subinterval will definitely have infinitely many irrationals. Then Lower sum will be 0 and upper sum will be 1.
 A: If $f$ is the Dirichlet function, then we get the same values for the upper and lower integrals if we use the first definitions of $m_i$ and $M_i$. If $x_{i-1} < x_i$, then any interval from $x_{i-1}$ to $x_i$ (whether it is (half) open or (half) closed) will contain both a rational and an irrational number; in fact infinitely many of both. If you are not convinced that this is the case for open intervals, then an argument would be: If $[x_{i-1}, x_i]$ contains infinitely many (ir)rationals, then $(x_{i-1}, x_i)$ does as well, since we have only removed finitely many points from the interval, namely the endpoints.

Let us call the first definition using strict inequalities "definition 1" and the other definition "definition 2", and let us write $m_i$ and $m_i'$ respectively in the two definitions. Similarly, write $L$ and $L'$ for lower sums and $\underline I$ and $\underline I'$ for lower integrals, where we use $m_i$ and $m_i'$ respectively. The footnote is saying that, while $m_i(f)$ and $m_i'(f)$ might not generally agree, we still have $\underline I(f) = \underline I'(f)$.
We need a few facts about these integrals: Clearly we have $L'(f,P) \leq L(f,P)$, since we take infimums over larger sets on the left-hand side. It follows that $\underline I'(f) \leq \underline I(f)$.
Let $f \colon [a,b] \to \mathbb{R}$ be bounded. If $P$ is a partition of $[a,b]$, let $g_P \colon [a,b] \to \mathbb{R}$ be the function that agrees with $f$ on the interiors of each subinterval of $P$, and let $g_P(x_i) = \sup_{x \in [a,b]} f(x)$. Then $m_i(f) = m_i'(g_P)$, using obvious notation, and so $L(f,P) = L'(g_P,P)$.
Now let $\epsilon > 0$, and choose a partition $P$ such that $\underline I(f) - L(f,P) < \epsilon$. Since $g_P$ arises from $f$ by modifying $f$ in finitely many points, we have $\underline I(f) = \underline I(g_P)$ (see below). Furthermore, $\underline I(f) = \underline I(g_P) \geq \underline I'(g_P)$, so $0 \leq \underline I'(g_P) - L'(g_P,P) < \epsilon$. It follows that
$$ \begin{align}
0 \leq \underline I(f) - \underline I'(f)
    & = \underline I(f) - \underline I'(g_P) \\
    & = \bigl( \underline I(f) - L(f,P) \bigr) - \bigl( \underline I'(g_P) - L'(g_P,P) \bigr) \\
    & < \epsilon.
\end{align} $$
And since $\epsilon$ was arbitrary, $\underline I(f) = \underline I'(f)$. And clearly we can do the same for upper integrals, defining $g_P$ slightly differently.

We just need to justify that modifying a function in finitely many points does not change the upper/lower integrals. It suffices to show that the integrals do not change if we modify the function at a single point. The case of finitely many points then follows by induction.
Let me sketch the proof for the upper integral. It is not difficult to show that
$$ \overline {\int_a^b} (f + g) \leq \overline {\int_a^b} f + \overline {\int_a^b} g, $$
for bounded $f$ and $g$. Let $g$ be identically zero except at a single point $c \in (x_{i-1}, x_i)$, at which $g(c) > 0$. Then by choosing partitions such that $x_i - x_{i-1}$ is very small we can make $M_i(g)$ as small as we want. Hence $\overline {\int_a^b} g = 0$. It follows that
$$ \overline {\int_a^b} f \leq \overline {\int_a^b} (f + g) \leq \overline {\int_a^b} f, $$
where the first inequality is due to the upper integral being increasing in the integrand.
A: Let's focus on upper Darboux sums and upper Darboux integral. The story for lower sums and integrals is similar.
Let us repeat the definitions for sake of clarity. Assume $f:[a, b] \to\mathbb {R} $ is bounded on $[a, b] $ with supremum $M$ and infimum $m$. Let $P=\{x_0,x_1,\dots,x_n\}$ be a partition of $[a, b] $ so that $$a=x_0<x_1<\dots<x_n=b$$ and define $$M_i=\sup\, \{f(x) \mid x\in(x_{i-1},x_i)\} ,M'_i=\sup\,\{f(x)\mid x\in[x_{i-1},x_i] \}$$ and $$U(f, P) =\sum_{i=1}^n M_i(x_i-x_{i-1}),U'(f,P)=\sum_{i=1}^n M'_i(x_i-x_{i-1})$$ and $$U(f) =\inf\, \{U(f, P) \mid P\in\mathcal{P} [a, b] \} =\inf \, A\, \text{ (say)} $$ and $$U'(f) =\inf\, \{U'(f, P) \mid P\in\mathcal{P} [a, b] \} =\inf\, A'\text{ (say)} $$ where $\mathcal{P} [a, b] $ is the set of all partitions of $[a, b] $.
Let's observe that we have $$M_i\leq M'_i, m\leq M_i, m\leq M'_i$$ and hence the upper sums $U(f, P) $ as well as $U'(f, P) $ are bounded below by $m(b-a) $ so that $U(f), U'(f) $ exist. Moreover for every element $a=U(f, P) \in A$ we have a corresponding element $a'\in U'(f, P) \in A'$ with $a\leq a'$. And vice versa for every element $a'\in A'$ there is a corresponding element $a\in A$ with $a\leq a'$.
Under these conditions we must have $\inf A\leq \inf A'$. To prove their equality we need to show that given any $\epsilon>0$ and given any member $a\in A$ we have a member $a'\in A'$ with $|a-a'|<\epsilon $.
Let us then start with partition $P$ of $[a, b] $ with upper sum $U(f, P) =\sum_{i=1}^{n}M_i(x_i-x_{i-1})$ and let $\delta =\min_{i=1}^{n}(x_i-x_{i-1})$. Let $k$ be a positive integer such that $1/k<\delta/2$.
We shall construct a sequence of partitions $P_k$ such that $$\lim_{k\to\infty} U'(f, P_k) = U(f, P) $$ The partition $P_k$ consists of all the points of $P$ as well as the points $$a+(1/k),b-(1/k),x_i\pm(1/k),i=1,2,\dots,n-1$$ so that there are a total of $(3n+1)$ points in $P_k$. And let us write $$M'_{ik} =\sup\, \{f(x) \mid x\in[x_{i-1}+(1/k),x_i-(1/k)]\} $$ and note that $$\lim_{k\to\infty} M'_{ik} =\sup\,\{f(x)\mid x\in(x_{i-1},x_i)\}=M_i$$ The sum $U'(f, P_k) $ contains terms corresponding to intervals $[x_{i-1}+(1/k),x_i-(1/k)]$ and these terms tend to $M_i(x_i-x_{i-1})$ and a finite number (exactly $2n$) of terms each of which is bounded in absolute value by $B/k$ where $B $ is a positive bound for $|f|$ on $[a, b] $ and these terms tend to $0$. It follows that $U'(f, P_k) \to U(f, P) $ as $k\to\infty $.
Therefore given any $\epsilon >0$  and an upper sum $U(f, P) $ we can find a partition $P'$ such that $|U'(f, P') - U(f, P) |<\epsilon $. We just have to choose $P'$ as one of the $P_k$ obtained by using $\epsilon $ in the limit definition. Thus our goal is achieved.
A: Let $f$ be bounded on $[a,b]$.
Let $ P=\{a=x_{0} < x_{1} < x_{2} < ...< x_{n} =b\}$ be any partition of $[ a,b]$.
Define $U( P,f): =\sum_{i=1}^nM_{i} \Delta x_{i}$, where $\displaystyle M_{i} =\sup \ f[ x_{i-1} ,x_{i}], 1\le i\le n$.
Let $U'( P,f): =\sum M_{i} '\Delta x_{i}$, where $\displaystyle M_{i} '=\sup f( x_{i-1} ,x_{i}), 1\le i\le n$.
$\inf U'( P,f)$ and $\inf U( P,f)$ ( where infimum is taken over all partitions of $[a,b]$) both exist as $f$ is bounded on $[a,b]$.
Claim: $\displaystyle \inf U'( P,f) =\inf U( P,f)$.
Proof: For any partition $P$, it is clear (Refer Note below) that $ U'( P,f) \leq U( P,f)$, whence it follows that $\inf U'( P,f) \leq \inf U( P,f).\tag 1$
Let $\displaystyle P=\{a=x_{0} < x_{1} < ...< x_{n} =b\}$ be any partition of $\displaystyle [ a,b]$.
Let $\displaystyle S:=\{|x_{i} -x_{i-1} |:\ 1\leq i\leq n\}$
Let $\displaystyle \delta _{n} =\frac{1}{4} .\min\left\{\frac{1}{4}\min S,\ \frac{1}{n^{3}}\right\}$
Let $\displaystyle A=\left\{x_{i} \in P:\ \sup \ f[ x_{i-1} ,x_{i}] \neq \sup \ f( x_{i-1} ,x_{i})\right\}$
Let's refine $\displaystyle P$ to $\displaystyle P'\ $by surrouding points of $\displaystyle A$ by adding points of the type $\displaystyle \{x_{i} -\delta _{n} ,x_{i} +\delta _{n}\}$.
Hence
$\displaystyle  \begin{array}{{>{\displaystyle}l}}
U( P',f) -U'( P',f) =0+\sum _{i\ \text{runs over i's corresponding to points in A}} \ ( M_{i} -M_{i} ') \delta _{n}\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \leq 2\sup f[ a,b]( 2n) \delta _{n} < \frac{\sup f[ a,b]}{n^{2}}
\end{array}$
Hence, given any $\displaystyle \epsilon  >0$ there exists $\displaystyle P$ such that
$\displaystyle 0< U( P,f) -U'( P,f) < \epsilon $
$\displaystyle U( P,f) =( U( P,f) -U'( P,f)) +U'( P,f) < \epsilon +U'( P,f)$
$\displaystyle \implies\inf U( P,f) -\inf \ U'( P,f) \leq \epsilon \tag 2$
Since $\epsilon\gt 0$ is arbitrary, plainly we have the equality by $(1)$ and $(2)$.
This shows the equality of upper Riemann integrals (not sums) in footnote and in the definition, in the image posted in OP.
Similar arguments as above can be used to show equality of lower integrals also.
Note: If $g$ is a function defined on the closed and bounded interval $[p,q]$ then $\sup g[p,q]\ge \sup g(p,q)$.
