[Math] How to show that if $f$ is Riemann int., then for each $\epsilon$ there exists a step function, $g(x)$, s.t. $\int |f(x)-g(x)| \ dx < \epsilon$

integrationreal-analysisriemann-integration

How do I show that if $f$ is Riemann integrable, then for each $\epsilon>0$ there exists a step function such that $\int |f(x)-g(x)| \ dx < \epsilon$?

I know that if $f$ is Riemann integrable, then the infimum of the upper Riemann sums minus the supremum of the lower Riemann sums is less than $\epsilon$ which implies that they are equal and this value is the integral $\int_a^b f(x) \ dx$.

Best Answer

Given $\epsilon>0$, choose a partition $P=\{a=x_{0}<\cdots<x_{n}=b\}$ such that $U(f,P)-L(f,P)<\epsilon$.

Let $c_{i}=\inf_{x\in[x_{i},x_{i+1}]}f(x)$, $i=0,...,n-1$. Set $g=\displaystyle\sum_{i=0}^{n-1}c_{i}\chi_{[x_{i},x_{i+1})}$, then \begin{align*} \int_{a}^{b}|f(x)-g(x)|dx&=\sum_{i=0}^{n-1}\int_{x_{i}}^{x_{i+1}}|f(x)-c_{i}|dx\\ &=\sum_{i=0}^{n-1}\int_{x_{i}}^{x_{i+1}}(f(x)-c_{i})dx\\ &\leq\sum_{i=0}^{n-1}\int_{x_{i}}^{x_{i+1}}\left(\sup_{x\in[x_{i},x_{i+1}]}f(x)-c_{i}\right)\\ &=\sum_{i=0}^{n-1}\left(\sup_{x\in[x_{i},x_{i+1}]}f(x)-\inf_{x\in[x_{i},x_{i+1}]}f(x)\right)(x_{i+1}-x_{i})\\ &=U(f,P)-L(f,P)\\ &<\epsilon. \end{align*}