Query about a proof of Riemann integrability of step/simple functions Let $f:[a,b]\to\Bbb{R}$ be a step function is of the form $$f=a_11_{[a,t_1]}+\sum\limits_{i=2}^n a_{i} 1_{(t_{i-1},t_{i}]}$$ i.e. in simple words $f(x)=a_1$ for all $x\in [a,t_1]$ and $f(x)=a_{i}$ for all $x\in(t_{i-1},t_{i}]\ \forall i\ge 2$.
I write $E_1=[a,t_1],E_{i}=(t_{i-1},t_i]\ \forall i\ge 2$, then $$f=\sum\limits_{i=1}^n a_{i} 1_{E_{i}}$$
Define
$$
\mathcal{CI}(f)=\sum\limits_{i=1}^n a_{i}(t_i-t_{i-1})
$$
We have to prove that for all $\epsilon >0$, there exists $\delta>0$ such that
$$
\left|\mathcal{CI}(f)-\sum\limits_{j=1}^k f(\xi_j)(s_j-s_{j-1})\right|<\epsilon
$$
for any portion $\mathcal{P}=\{a=s_0<\cdots<s_k=b\}$ with $\lVert \mathcal{P}\rVert(:=\text{max}\{s_j-s_{j-1}|\ j=1,\ldots,n\})<\delta$ and for any choice of $\xi_j\in(s_j,s_{j-1})$
I have tried to prove it in the following manner-
Let $\mathcal{P}=\{a=s_0<\cdots<s_k=b\}$ be a partition of $[a,b]$ and choose any $\xi_j\in (s_{j-1},s_j)$. Define a step function $g:[a,b]\to\mathbb{R}$ as follows-
$$g=\sum\limits_{j=1}^k f(\xi_j)1_{F_j}\text{ where } F_1=[a,s_1],F_j=(s_{j-1},s_j]\ \forall j\ge 2$$
Then as per our notation $\mathcal{CI}(g)=\sum\limits_{j=1}^k f(\xi_j)(s_j-s_{j-1})$
We have to approximate $|\mathcal{CI}(f)-\mathcal{CI}(g)|$. I have tried in the following manner-
$\mathcal{CI}(f)=\sum\limits_{i=1}^n a_i\lambda(E_i)$
$=\sum\limits_{i=1}^n a_i\lambda(E_i\cap [a,b])$
$=\sum\limits_{i=1}^n a_i\lambda(E_i\cap\bigsqcup\limits_{j=1}^k F_j)$
$=\sum\limits_{i=1}^n\sum\limits_{j=1}^k a_i\lambda(E_i\cap F_j)$
Similarly, $\mathcal{CI}(g)=\sum\limits_{i=1}^n\sum\limits_{j=1}^k f(\xi_j)\lambda(E_i\cap F_j)$
Then $|\mathcal{CI}(f)-\mathcal{CI}(g)|=|\sum\limits_{i,j} x_i-f(\xi_j)\lambda(E_i\cap F_j)|\le \sum\limits_{i,j}(|x_i|+|f(\xi_j)|)|\lVert \mathcal{P}\rVert\le 2nk \lVert f\rVert_{\infty} \lVert P\rVert$
Where $\lVert f\rVert_\infty=\text{sup}|f|$.
Here $n,\lVert f\rVert_\infty$ is fixed, but $k$ could vary. So I am unable to give approximation $|\mathcal{CI}(f)-\mathcal{CI}(g)|<\epsilon$.
There is a hint provided in the book that is-
Show that,
$$
\left|\mathcal{CI}(f)-\sum\limits_{j=1}^k f(\xi_j)(s_j-s_{j-1})\right|<(n-1)\lVert P\rVert \underset{i}{\text{max}}{|a_i|}
$$
But I'm unable to prove that. Can anyone help me in this regard? Thanks for help in advance.
 A: Form the partition $Q$ with points $a = x_0 < x_1  < \ldots  < x_m = b$ where
$$\{x_0,x_1, \ldots x_m\} = \{t_0,t_1, \ldots, t_n\}\cup\{s_0,s_1, \ldots, s_k\}$$
Note that $Q$ has at most $n-1$ more points and subintervals than  the partition $P = (s_0,s_1,\ldots, s_k)$. The maximum difference in the number of points occurs when  $\{t_1, \ldots, t_{n-1}\}\cap\{s_1, \ldots, s_{k-1}\}= \emptyset. $
We can write $\mathcal{CI}(f)$ and  $\mathcal{CI}(g)$ as sums of the form
$$\mathcal{CI}(f) = \sum_{p=1}^m\alpha_p(x_p-x_{p-1}),\quad\mathcal{CI}(g) = \sum_{p=1}^m\beta_p(x_p-x_{p-1}),$$
where $\alpha_p, \beta_p \in \{a_0,a_1,\ldots, a_n\}$ and $\alpha_p$ and $\beta_p$ are different on at most $n-1$ new subintervals introduced by forming partition $Q$.  We must have $|\alpha_p - \beta_p| \leqslant 2M$ where $M = \max(|a_0|,|a_1|,\ldots,|a_n|)$, and, thus
$$\left|\mathcal{CI}(f)- \mathcal{CI}(g) \right|< (n-1)\cdot \|Q\|\cdot 2M < (n-1) \cdot \|P\|\cdot 2M $$
Choose a partition $P$ such that $\delta = \|P\| < \frac{\epsilon}{2(n-1)M}$ to finish.
