Approximating continuous function by step functions Let $f$ be a continuous function on $[0,1]$.  For a given $\epsilon$ we know there are step functions$f_{1}$ and $f_{2}$ such that $f_{1} \leq f \leq f_{2}$ with $0 \leq \int_{0}^{1} (f_{2}(x) - f_{1}(x))  dx \leq \epsilon$.
Now let us assume $g(x)$ is a monotone increasing function.
I wish to prove the following:
For a given $\epsilon$ we know there are step functions$f_{1}$ and $f_{2}$ such that $f_{1} \leq f \leq f_{2}$ with $0 \leq \int_{0}^{1} (f_{2}(x) - f_{1}(x))  dg(x) \leq \epsilon$.
I could prove the first statement. But was unable to mimic the proof for the 2nd part.
Any help would be appreciated. Thanks in advance.
 A: A reasonable strategy is to just take the upper and lower sums approximating $\int_0^1 f\,dg$ and then let $f_2$ and $f_1$ be the step functions corresponding to the max/min on each interval. Unfortunately the existence of the Riemann-Stieltjes integral for $f_2-f_1$ is not so clear in this case. So we need to be careful in how $f_2,f_1$ are constructed.
A common result that will be useful to us is the following: If $h$ is bounded on $[a,b]$, $h$ has only finitely many points of discontinuity on $[a,b]$, and $g$ (which is taken to be monotone increasing, or more generally bounded variation) is continuous at each discontinuity of $h$, then $\int_a^b h\,dg$ exists. This is proven in Rudin and can be found in many other places (for example, Corollary 7.1.24 of the notes here). So all we need to do is choose $f_2$ and $f_1$ such that $g$ is continuous at each discontinuity of $h=f_2-f_1$.
Here is an explicit construction: Since $f$ is continuous on the compact interval $[0,1]$, it is uniformly continuous. Thus given $\epsilon>0$ there is $\delta>0$ such that $|s-t|<\delta$ implies $|f(s)-f(t)|<\epsilon$. Let $\Gamma =\{x_0,x_1,\dotsc, x_n\}$ with $0=x_0< x_1<\dotsm<x_n=1$ be a partition of $[0,1]$ such that $\Delta x_i = x_i-x_{i-1} <\delta$ for each $i$. We further assume that each $x_i$ is not a point of discontinuity for $g$ (this is possible since $g$ is monotone increasing, and thus has at most countably many points of discontinuity). Let $m_i$ and $M_i$ be the minimum and maximum of $f$ on $[x_{i-1}, x_{i}]$ respectively. Define a step function $f_1(x)= m_i$ when $x\in [x_{i-1},x_i)$ and $f_1(x) = m_n$ when $x\in[x_{n-1},x_n]$, and similarly for $f_2$ and $M_i$. Clearly $f_1\leq f\leq f_2$, and $0\leq f_2-f_1\leq \epsilon$ since the maximum and minimum differ by at most $\epsilon$ on each partition subinterval $[x_{i-1},x_i]$ by construction. The possible points of discontinuity of $f_2-f_1$ are the points of the partition $x_i$, but those were chosen such that $g$ was continuous at each of them. Hence $\int_0^1 (f_2-f_1)\,dg$ exists. In fact, for any choice of intermediate points $x_{i-1}<c_i<x_i$, the Riemann sum corresponding to the partition $\Gamma$ has
\begin{align}
R(f_2-f_1,\Gamma,g) &= \sum_{i=1}^n (f_2(c_i)-f_1(c_i))(g(x_i)-g(x_{i-1})) = \sum_{i=1}^n (M_i-m_i)(g(x_i)-g(x_{i-1})) \\
&\leq\epsilon\sum_{i=1}^n(g(x_i)-g(x_{i-1})) =\epsilon (g(1)-g(0)).
\end{align}
It is also easy to see that this estimate remains true for any refinement $\Gamma'\supset\Gamma$. Since
$$\int_0^1 (f_2-f_1)\,dg = \lim_{|\Gamma'|\to 0} R(f_2-f_1,\Gamma',g),$$
we conclude
$$\int_0^1 (f_2-f_1)\,dg\leq \epsilon(g(1)-g(0)).$$
Finally, given any $\epsilon'>0$ we can choose $\epsilon = \epsilon'/(g(1)-g(0))$ in the argument above to get the desired result.
