Is the pointwise maximum of two Riemann integrable functions Riemann integrable? Let $f,g$ be Riemann integrable functions, prove that the function $ h(x) $ defined by $$
h\left( x \right) = \max \left\{ {f\left( x \right),g\left( x \right)} \right\}
$$
is also Riemann integrable.
 A: Call $\Delta_\sigma(u)$ the difference between the upper and lower Darboux sums of a function $u$ with respect to a subdivision $\sigma$. By definition of Riemann integrability, $\inf\limits_\sigma\Delta_\sigma(f)=\inf\limits_\sigma\Delta_\sigma(g)=0$. Call $M_I(u)$ and $m_I(u)$ the supremum and the infinum of a function $u$ on an interval $I$. 
Then, for every interval $I$, $M_I(h)=\max\{M_I(f),M_I(g)\}$ and $m_I(h)\geqslant\max\{m_I(f),m_I(g)\}$, hence 
$$
M_I(h)-m_I(h)\leqslant\max\{M_I(f)-m_I(f),M_I(g)-m_I(g)\},
$$
which implies
$$
M_I(h)-m_I(h)\leqslant M_I(f)-m_I(f)+M_I(g)-m_I(g).
$$
Summing this over the intervals $I$ defining a subdivision $\sigma$, one gets $\Delta_\sigma(h)\leqslant\Delta_\sigma(f)+\Delta_\sigma(g)$.
For every positive $t$, there exists $\sigma$ such that $\Delta_\sigma(f)\leqslant t$ and $\tau$ such that $\Delta_\tau(g)\leqslant t$. For every subdivision $\varrho$ containing $\sigma$ and $\tau$, one gets 
$$
\Delta_\varrho(h)\leqslant \Delta_\varrho(f)+\Delta_\varrho(g)\leqslant\Delta_\sigma(f)+\Delta_\tau(g)\leqslant2t. 
$$
This proves that $\inf\limits_\sigma\Delta_\sigma(h)=0$ hence $h$ is Riemann integrable. 
A: Hint
Use the fact that $\max(f(x), g(x)) = \frac{f(x)+g(x)+|f(x)-g(x)|}{2}$
Edit
To use this fact we need to prove that if $f$ is Riemann integrable, so is $|f|$. For this we set for some interval $A$ where $f$ is bounded: $$ M = \sup{\{f(x) : x \in A\}}$$
 $$ m = \inf{ \{f(x) : x \in A\} }$$ $$ M' = \sup{\{|f(x)| : x \in A\}}$$
 $$ m' = \inf{ \{|f(x)| : x \in A\} }$$
And I will let you prove that $M' - m' \leq M - m$.
With this in mind, if $f$ is Riemann integrable on $[a,b]$ then take some partition $P$ of $[a,b]$, and using the previous fact prove that $$0 \leq U(|f|, P) - L(|f|, P) \leq U(f, P) - L(f, P)$$
Where U and L are the upper and lower sums respectively.
This will allow you to use the Riemann integrability criterion and conclude that $|f|$ is also integrable on $[a,b]$.
