[proofplan]
We prove both directions of the equivalence. The forward direction uses the definitions of the upper and lower integrals as infimum and supremum over partitions: choosing partitions that nearly attain these extrema and taking their common refinement produces a partition with small upper-lower gap. The reverse direction uses the squeeze: the upper-lower gap bounds $I^*(f) - I_*(f)$ from above, forcing equality.
[/proofplan]
[step:Prove that Riemann integrability implies the existence of partitions with arbitrarily small upper-lower gap]
Assume $f$ is Riemann integrable on $[a,b]$, so $I^*(f) = I_*(f) =: I$. Fix $\varepsilon > 0$. By definition, $I^*(f) = \inf_P U(P,f)$, so there exists a partition $P_1$ with $U(P_1, f) < I + \varepsilon/2$. Similarly, $I_*(f) = \sup_P L(P,f)$, so there exists a partition $P_2$ with $L(P_2, f) > I - \varepsilon/2$.
Let $P = P_1 \cup P_2$ be the common refinement. Refinement can only decrease upper sums and increase lower sums, so $U(P,f) \leq U(P_1,f)$ and $L(P,f) \geq L(P_2,f)$. Therefore
\begin{align*}
U(P,f) - L(P,f) \leq U(P_1,f) - L(P_2,f) < \left(I + \frac{\varepsilon}{2}\right) - \left(I - \frac{\varepsilon}{2}\right) = \varepsilon.
\end{align*}
[guided]
We want to find a single partition $P$ with $U(P,f) - L(P,f) < \varepsilon$. The difficulty is that the partitions witnessing $U$ close to $I^*(f)$ and $L$ close to $I_*(f)$ may be different. The resolution is to take their common refinement, which inherits both good properties simultaneously.
Since $I^*(f) = \inf_P U(P,f) = I$, the infimum definition guarantees a partition $P_1$ with $U(P_1,f) < I + \varepsilon/2$. Similarly, $I_*(f) = \sup_P L(P,f) = I$ gives a partition $P_2$ with $L(P_2,f) > I - \varepsilon/2$.
Let $P = P_1 \cup P_2$. Since $P$ is a refinement of both $P_1$ and $P_2$, the monotonicity of upper and lower sums under refinement gives
\begin{align*}
U(P,f) &\leq U(P_1,f) < I + \frac{\varepsilon}{2}, \\
L(P,f) &\geq L(P_2,f) > I - \frac{\varepsilon}{2}.
\end{align*}
Subtracting:
\begin{align*}
U(P,f) - L(P,f) < \left(I + \frac{\varepsilon}{2}\right) - \left(I - \frac{\varepsilon}{2}\right) = \varepsilon.
\end{align*}
The common refinement trick is the standard device for combining two approximate extrema into a single object.
[/guided]
[/step]
[step:Prove that the partition criterion implies Riemann integrability]
Assume that for every $\varepsilon > 0$, there exists a partition $P$ with $U(P,f) - L(P,f) < \varepsilon$. For every partition $P$, the definitions of the upper and lower integrals give
\begin{align*}
0 \leq I^*(f) - I_*(f) \leq U(P,f) - L(P,f).
\end{align*}
The first inequality holds because $I_*(f) \leq I^*(f)$ always, and the second because $I^*(f) \leq U(P,f)$ and $L(P,f) \leq I_*(f)$.
By hypothesis, the right-hand side can be made smaller than any $\varepsilon > 0$. Since $I^*(f) - I_*(f)$ is a fixed non-negative real number bounded above by every positive real number, it must equal zero. Therefore $I^*(f) = I_*(f)$, and $f$ is Riemann integrable.
[guided]
We have the hypothesis that $U(P,f) - L(P,f)$ can be made arbitrarily small. We want to conclude that $I^*(f) = I_*(f)$. The key is the chain of inequalities relating these quantities.
For any partition $P$, the lower sum is bounded above by the lower integral and the upper integral is bounded above by the upper sum:
\begin{align*}
L(P,f) \leq I_*(f) \leq I^*(f) \leq U(P,f).
\end{align*}
This gives $0 \leq I^*(f) - I_*(f) \leq U(P,f) - L(P,f)$. The quantity $I^*(f) - I_*(f)$ does not depend on $P$ — it is a fixed non-negative number. By hypothesis, for every $\varepsilon > 0$ we can choose $P$ making the right-hand side less than $\varepsilon$. So $I^*(f) - I_*(f)$ is a non-negative number that is less than every positive number, which forces $I^*(f) - I_*(f) = 0$. Therefore $f$ is Riemann integrable.
[/guided]
[/step]