the upper Riemann integral is equal to the upper Riemann sum (Analysis 1 by Tao) Proposition 11.3.12. (in Analysis 1 by Tao) Let $f: I \to \mathbb{R}$ be a bounded function on a bounded interval $I$. Then
$$\overline{\int}_If = \inf\{U(f, P): \text{$P$ is a partition of $I$}\}.$$
I know from the previous exercise that 
$$p.c. \int_I g \ge U(f,P),$$
where $g$ is piecewise constant function and majorizes $f$ ($p.c. \int$ denotes the piecewise constant integral). 
In this text, $\overline{\int}_If$ is defined as $\inf\{p.c.\int_I g: \text{$g$ is a piecewise constant function on $I$, and majorizes $f$\}}$, and $U(f, P) = \sum_{J \in P: J\not= \emptyset} (\sup_{x \in J}f(x) |J|)$.
From above, we can easily get $\overline{\int}_If \ge \inf\{U(f, P): \text{$P$ is a partition of $I$}\}.$
But how can we show the opposite inequality? 
 A: To show that $\displaystyle \overline{\int_I} f \leqslant \inf_P U(f,P)$, assume that  $\displaystyle\overline{\int_I} f > \inf_P U(f,P)$ and obtain a contradiction.
If $\displaystyle\overline{\int_I} f > \inf_P U(f,P)$, there exists a partition $P'  = (x_0,x_1,\ldots,x_n)$ such that 
$$ \sum_{j=1}^n M_j(x_j - x_{j-1}) =U(f,P') < \displaystyle\overline{\int_I} f  \leqslant \int_I g$$
where $M_j = \sup\{f(x): x_{j-1} \leqslant x \leqslant x_j\}$ and $g$ is any majorizing piecewise constant function. Since $M_j \geqslant f(x)$ for all $x \in [x_{j-1},x_j]$ it follows that the function $h$ such that $h(x) = M_j$ on $(x_{j-1}, x_j)$ and $h$ takes any value $h(x_j) \geqslant f(x_j)$ for $j=0,\ldots, n$ is such a majorizing function and we obtain the contradiction
$$\sum_{j=1}^n M_j(x_j - x_{j-1}) < \int_I h = \sum_{j=1}^n M_j(x_j - x_{j-1}) $$ 
A: Let $P$ be a partition of $I$ and let $U(f, P) = \sum_{J \in P;  J \neq \emptyset} \: (\sup_{x \in J} f(x)) \cdot|J|$. Define a piecewise constant function $g$ with respect to the same partition $P$ where for each non-empty $J \in P$, $g(x) = \sup_{x \in J} f(x)$ for all $x \in J$. Clearly, $g$ majorizes $f$ and so $$\overline\int_{I} f \leq p.c. \: \int_{I} \: g = \sum_{J \in P} \: c_{j} \cdot |J| = \sum_{J \in P;  J \neq \emptyset} \: (\inf_{x \in J} f(x)) \cdot|J| = U(f, P)$$
Therefore, $\overline\int_{I} f$ is a lower bound for $\{U(f, \: P) : P$ is a partition of $I\}$, which means $\overline\int_{I} f  \leq$ inf$\{U(f, \: P) : P$ is a partition of $I\}$. 
