For a partition P, U(f, P) uses the supremum of f on each piece and L(f, P) the infimum; every lower sum is at most every upper sum, and refining P brings them together.
In Calculus 1 you approximated areas with rectangles whose heights came from left ends, right ends or midpoints. To prove anything, we want rectangles that are guaranteed to be too big and too small. Their heights come from the supremum and infimum of $f$ on each piece. This approach is due to Darboux, and it is how Lebl's book defines the integral.
🔑 Key idea
A partition of $[a, b]$ is $P = \{x_0 < x_1 < \cdots < x_n\}$ with $x_0 = a$, $x_n = b$. On each piece let $M_i = \sup\{f(x) : x \in [x_{i-1}, x_i]\}$ and $m_i = \inf\{f(x) : x \in [x_{i-1}, x_i]\}$. The upper sum is $U(f, P) = \sum M_i \Delta x_i$ and the lower sum is $L(f, P) = \sum m_i \Delta x_i$. Always $L(f, P) \le U(f, P)$; adding points to $P$ can only lower $U$ and raise $L$.
💡 Why it works
On each piece $m_i \le M_i$, so $L \le U$ for the same partition. If you add one point inside a piece, that piece splits into two; the supremum on each half is at most the supremum on the whole piece, so the new upper contribution is at most the old one, and similarly the lower contribution can only grow. So for any two partitions $P$ and $Q$, comparing both with their common refinement $P \cup Q$ gives $$L(f, P) \le L(f, P \cup Q) \le U(f, P \cup Q) \le U(f, Q).$$ Every lower sum is at most every upper sum, which lets us define the lower integral (the sup of all lower sums) and the upper integral (the inf of all upper sums).
Upper (blue) and lower (green) rectangles for $x^{2}$ on $[0, 2]$; the gold strips are the gap $U - L$. Refine the partition and watch the gap shrink.
Worked examples
✏️ Worked example: An increasing function
For $f(x) = x^{2}$ on $[0, 2]$ with $P = \{0, \frac{1}{2}, 1, 2\}$, find $U(f, P)$ and $L(f, P)$.
$f$ increases on $[0, 2]$, so on each piece the sup is at the right end and the inf at the left end.
Using the ends when $f$ is not monotone. On a piece that contains a turning point, the supremum or infimum is at the turning point, not at an end. In the second example, using the ends of $[1, 2]$ would give $m_2 = 0$ and miss the dip to $-\frac{1}{4}$. Check each piece: is $f$ monotone there? If not, compare the ends with the critical points inside.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.