Q:

Is there always a partition that gives the Riemann Integral?

The Riemann Integral of a bounded function $f$ on a compact set $A$ is defined if $$U(f) = \inf\{U(f,P) \mid P \in \mathcal{P}\} = \sup \{ L(f, P) \mid P \in \mathcal{P} \} = L(f)$$
where $\mathcal{P}$ is the set of all partitions of $A$ and $L(f, P), U(f, P)$ are the lower and upper sums of $f$ with respect to $P$.
Question: Is it true that there always exists some $P \in \mathcal{P}$ such that $U(f) = U(f, P)$? 
I think this would be true if the set of upper sums were compact (and thus would contain its infimum). It's clear that this set is bounded, but I'm not sure that it is necessarily closed.

A:

This is not the case. Consider $f(x)=x$ on $[0,1]$. we know that $U(f)=1/2$, but given any partition $P=\{0=a_1,a_2,...,a_k=1\}$, if we look at the contribution of the rectangle between $a_{n-1}$ and $a_n$, we should get
$$1/2(a_n^2-a_{n-1}^2).$$
Instead we get
$$a_n^2-a_na_{n-1}.$$
Since $a_{n-1}<a_n$,
$$1/2(a_n+a_{n-1})<a_n,$$
so 
$$1/2(a_n^2-a_{n-1}^2)=1/2(a_n+a_{n-1})(a_n-a_{n-1})$$
$$<a_n(a_n-a_{n-1})=a_n^2-a_na_{n-1}.$$
Since this is true for each of the $k-1$ rectangles considered, any upper Riemann sum is strictly greater than the Riemann integral.
In fact, if I am not mistaken, the only time you can get a partition to match the Riemann integral is if your function is piecewise constant.

