Upper and lower integration inequality I would like to learn how to prove that the following inequality holds.
Let $F$ be a bounded function on an interval $[a,b]$, so that there exists $B\geq 0$ such that $|f(x)| \leq B$ for every $x\in [a,b]$.
Show that 
$[
U(f^2,P) -L(f^2,P) \leq 2B [ U(f,P) -L(f,P) ]
]$
for all partitions $P$ of $[a,b]$.
 A: Notation. For any finction $\varphi:[a,b]\to\mathbb{R}$ we denote 
$$
M_{[\alpha,\beta]}(\varphi)=\sup\limits_{x\in[\alpha,\beta]}\varphi(x)\qquad
m_{[\alpha,\beta]}(\varphi)=\inf\limits_{x\in[\alpha,\beta]}\varphi(x)
$$
where $[\alpha,\beta]\subset[a,b]$. For a given partition $P=\{\Delta_1,\ldots,\Delta_n\}$ of $[a,b]$ we denote
$$
U(f,P)=\sum\limits_{i=1}^n M_{\Delta_i}(f)|\Delta_i|\qquad
L(f,P)=\sum\limits_{i=1}^n m_{\Delta_i}(f)|\Delta_i|
$$

Proposition. Let $f:[a,b]\to\mathbb{R}$ be a real valued bounded function such that $|f(x)|\leq B$ for all $x\in[a,b]$. Let $P$ be partition of $[a,b]$, then
  $$
U(f^2,P)-L(f^2,P)\leq 2B(U(f,P)-L(f,P))
$$

Proof For each $i\in\{1,\ldots,n\}$ we have
$$
\begin{align}
M_{\Delta_i}(f^2)-m_{\Delta_i}(f^2)
&=M_{\Delta_i}(|f|^2)-m_{\Delta_i}(|f|^2)\\
&=M_{\Delta_i}(|f|)^2-m_{\Delta_i}(|f|)^2\\
&=(M_{\Delta_i}(|f|)+m_{\Delta_i}(|f|))(M_{\Delta_i}(|f|)-m_{\Delta_i}(|f|))\\
&\leq 2B(M_{\Delta_i}(|f|)-m_{\Delta_i}(|f|))\\
&\leq 2B(M_{\Delta_i}(f)-m_{\Delta_i}(f))\\
\end{align}
$$
Hence
$$
\begin{align}
U(f^2,P)-L(f^2,P)
&=\sum\limits_{i=1}^n(M_{\Delta_i}(f^2)-m_{\Delta_i}(f^2))|\Delta_i|\\
&\leq\sum\limits_{i=1}^n 2B(M_{\Delta_i}(f)-m_{\Delta_i}(f))|\Delta_i|\\
&2B(U(f,P)-L(f,P))
\end{align}
$$
Remark. This proof used several standard properties of $M_\Delta$ and $m_\Delta$ functions. These properties are proved below.


Lemma. Let $\varphi:[a,b]\to\mathbb{R}$ be a real valued bounded function such that $|\varphi(x)|\leq K$ for all $x\in[a,b]$. Let $\Delta\subset[a,b]$ then  
  
  
*
  
*$M_\Delta(\varphi)-m_\Delta(\varphi)=\sup_{x,y\in\Delta}|\varphi(x)-\varphi(y)|\tag{1}$
  
*$M_\Delta(|\varphi|)-m_\Delta(|\varphi|)\leq M_\Delta(\varphi)-m_\Delta(\varphi)\tag{2}$
  
*$M_\Delta(|\varphi|)\leq K\qquad m_\Delta(|\varphi|)\leq K\tag{3}$
  

Proof. 1) For all $x,y\in\Delta$ we have $m_\Delta(\varphi)\leq \varphi(x)\leq M_\Delta(\varphi)$ and $m_\Delta(\varphi)\leq \varphi(y)\leq M_\Delta(\varphi)$, so 
$$
|f(x)-f(y)|\leq M_\Delta(\varphi)-m_\Delta(\varphi)\tag{*}
$$
Fix $\varepsilon>0$, then there exist $\tilde{x}\in\Delta$, $\tilde{y}\in\Delta$ such that
$M_\Delta(\varphi)<\varphi(\tilde{x})+\varepsilon/2$ and $m_\Delta(\varphi)>\varphi(\tilde{y})-\varepsilon/2$. Hence
$$
M_\Delta(\varphi)-m_\Delta(\varphi)<\varphi(\tilde{x})-\varphi(\tilde{y})+\varepsilon\tag{**}
$$
Since $\varepsilon>0$ is arbtrary $(\,^{*})$ and $(\,^{**})$ implies
$$
M_\Delta(\varphi)-m_\Delta(\varphi)=\sup\limits_{x,y\in\Delta}|\varphi(x)-\varphi(y)|
$$
2) For all $x,y\in\Delta$ we have $||\varphi(x)|-|\varphi(y)||\leq|\varphi(x)-\varphi(y)|$, hence using $(1)$ we get
$$
M_\Delta(|\varphi|)-m_\Delta(|\varphi|)=\sup\limits_{x,y\in\Delta}||\varphi(x)|-|\varphi(y)||\leq\sup\limits_{x,y\in\Delta}|\varphi(x)-\varphi(y)|=M_\Delta(\varphi)-m_\Delta(\varphi)
$$
3) Since $|\varphi(x)|\leq K$ for all $x\in\Delta$, then
$$
m_\Delta(|\varphi|)\leq M_\Delta(|\varphi|)\leq K
$$

Lemma. Let $\varphi:[a,b]\to[c,d]$ be a real valued function. Let $\psi:[c,d]\to\mathbb{R}$ be continuous non decreasing function. Then for any interval $\Delta\subset[a,b]$ we have
   $M_\Delta(\psi\circ \varphi)=\psi(M_\Delta(\varphi))\qquad m_\Delta(\psi\circ\varphi)=\psi(m_\Delta(\varphi))\tag{4}$

Proof. For all $x\in\Delta$ we have $\varphi(x)\leq M_\Delta(\varphi)$. Since $\psi$ is a non decreasing function, then for all $x\in\Delta$ we get $\psi(\varphi(x))\leq\psi(M_\Delta(\varphi))$. This implies
$$
M_\Delta(\psi\circ\varphi)\leq \psi(M_\Delta(\varphi))\tag{***}
$$
Fix $\varepsilon>0$. Since $\psi$ is continuous and non decreasing there exist $\delta>0$ such that $\psi(M_\Delta(\varphi))-\psi(t)<\varepsilon$ for all $M_\Delta(\varphi)-\delta<t<M_\Delta(\varphi)$. Moreover from definition of supremum we can find $\tilde{x}\in\Delta$ such that $M_\Delta(\varphi)-\delta<\varphi(\tilde{x)}<M_\Delta(\varphi)$. Now we set $t=\varphi(x)$ to get 
$$
\psi(M_\Delta(\varphi))<\psi(\varphi(\tilde{x}))+\varepsilon\tag{****}
$$
Since $\varepsilon>0$ is arbitrary from $(\,^{***})$ and $(\,^{****})$ we get
$$
M_\Delta(\psi\circ \varphi)=\psi(M_\Delta(\varphi))
$$
The proof of the other equality is similar.
