Prove that $\inf{U(f,P)}\geq 1/2$ 
Define $f(x)=\begin{cases} x\;\;\;\text{if the point $x\in[0,1]$ is rational}\\ 0\;\;\;\text{if the point $x\in[0,1]$ is irrational} \end{cases}$
Prove that $\inf{U(f,P)}\geq 1/2$.


Let $P=\{x_1,x_2,\cdots,x_i\}$ be a partition of $[0,1]$ with $x_i=\frac{i}{n}$ where $i\geq 1$ and $n\in\mathbb{N}$. By the definition of supremum, $\sup(f(x_i))= x_i$, and for each sub-interval $[x_{i-1},x_i]$ of $[0,1]$, $\Delta_{x_i}=\frac{1}{n}$.
$$U(f,P)=\sum_{i=1}^{n}x_i(x_{i}-x_{i-1})=\sum_{i=1}^{n}\frac{i}{n}\cdot\frac{1}{n} =\frac{1}{n^2}\sum_{i=1}^{n}i=\frac{1}{n^2}\cdot\frac{n(n+1)}{2}=\frac{1}{2}+\frac{1}{2n}$$ Thus, $\inf U(f,P)=1/2$ as $n$ approaches to infinity.

For this question, I choose a particular partition that I can evaluate the upper sum to $1/2$, I thought that is not right since the question is asking for any partitions. Can someone give me a hint or suggestion to write an argument to show for any partition $P$ satisfies $\inf{U(f,P)}\geq 1/2$? Thanks
 A: Given any small positive real $\varepsilon > 0$, for any partition $P = \{x_0, x_1, \ldots, x_n\}$ of $[0, 1]$ such that $0 = x_0 < x_1 < \cdots < x_n = 1$,   since $\mathbb{Q}$ is dense in $\mathbb{R}$, for each $i$, there exists $q_i \in \mathbb{Q}$ such that $x_i - \varepsilon < q_i < x_i$, it then follows that
$$M_i = \sup_{I_i} f(x) - \inf_{I_i} f(x) \geq f(q_{i}) - 0 = q_i > x_{i} - \varepsilon, \quad i = 1, 2, \ldots, n.$$
Therefore, by noting that $x_i = \sum_{j = 1}^{i}(x_j - x_{j - 1})$, we have
\begin{align}
& U(P, f) \\
= & \sum_{i = 1}^n M_i(x_i - x_{i - 1}) \\
\geq & \sum_{i = 1}^n (x_{i} - \varepsilon)(x_i - x_{i - 1}) \\
= & \sum_{i = 1}^n\left[\sum_{j = 1}^{i}(x_{j} - x_{j - 1})\right](x_i - x_{i - 1}) - \varepsilon \\
= & \sum_{j = 1}^n\left[\sum_{i = j}^n(x_i - x_{i - 1})\right](x_j - x_{j - 1}) - \varepsilon \\
= & \sum_{j = 1}^n (x_n - x_{j - 1})(x_j - x_{j - 1}) - \varepsilon \\
= & 1 - \sum_{j = 1}^n x_{j - 1}(x_j - x_{j - 1}) - \varepsilon \\
\geq & 1 - U(P, f) - \varepsilon.
\end{align}
Hence $U(P, f) \geq \frac{1}{2} - \frac{\varepsilon}{2}$. Since $\varepsilon$ was arbitrarily small, the result follows. 
A: Another way: Let $P = \{x_0,x_1,\ldots,x_n\}$ be a partition of $[0,1]$, and let $M_i$ denote the supremum of $f$ on $[x_{i-1},x_i]$. There must exist a rational number $q$ in the interval $[(x_{i-1} + x_i)/2,x_i]$, and so it follows that $M_i \geq (x_{i - 1} + x_{i})/2$. This gives:
$$U(f,P) = \sum_{i = 1}^{n}M_i(x_i - x_{i - 1}) \geq \sum_{i = 1}^{n}\frac{x_{i -1} + x_i}{2} \cdot (x_i - x_{i - 1}) = \frac{1}{2}\sum_{i = 1}^{n}x_{i}^2 - x_{i - 1}^2 = \frac{1}{2}(x_n^2 - x_0^2) = \frac{1}{2}$$
A: Let $\mathcal P_0$ be a partition of $[0,1]$. Refine this partition if necessary to a partition $\mathcal P$ containing $n+1$ points so that $x_{i}-x_{i-1}=1/n.\ $Note that $x_0=0$, $x_{n}=1$ and in general $x_i=i/n$.
We have $U(\mathcal P_0)\geq U(\mathcal P)=\frac{1}{n}\sum_{i=1}^{n}f(x_i^{*})$. 
Now let $\epsilon >0$ and choose, using density of the rationals, $x_i^{*}\in [x_{i},x_{i-1}]$ so that $f(x_i^{*})\geq x_i-\epsilon$. 
Then 
$$U(\mathcal P_0)\geq U(\mathcal P)\geq \frac{1}{n}\sum_{i=1}^{n}(x_i-\epsilon)=\frac{1}{n}\sum_{i=1}^{n}x_i-\frac{1}{n}\sum_{i=1}^{n}\epsilon\geq \frac{1}{n}\sum_{i=1}^{n}\frac{i}{n}-\epsilon =\frac{n(n+1)}{2}\frac{1}{n^{2}}-\epsilon > \frac{1}{2}-\epsilon $$
and the result follows.
A: Another solution: Suppose $\mathcal{P} = x_{0}, x_{1}, \ldots, x_{N}$. We're going to show that $U( \operatorname{id}, \mathcal{P}) - U(f, \mathcal{P}) < \epsilon $ for every $\epsilon > 0$, and so $U(f, \mathcal{P}) = U(\operatorname{id}, \mathcal{P}) \geq \frac{1}{2}$, where $\operatorname{id}$ is the identity map on $[0, 1]$. Since $f \leq \operatorname{id}$, we know trivially that $U(f, \mathcal{P}) \leq U(\operatorname{id}, \mathcal{P})$.
Note that $U(\operatorname{id}, \mathcal{P}) = \sum_{k = 1}^{N} x_{k}(x_{k} - x_{k - 1})$, since $x_{k} = \sup [x_{k - 1}, x_{k}]$ and moreover we know by the fundamental theorem of calculus that $\int_{0}^{1} x \mathrm{d}x = \frac{1}{2} \leq U(\operatorname{id}, \mathcal{P})$.
Fix $\epsilon > 0$, and recall that $\mathbb{Q}$ is dense, so for every $x_{k}$, there exists a rational number $q_{k} \in [x_{k - 1}, x_{k}]$ such that $x_{k} - q_{k} < \frac{\epsilon}{N}$. Moreover, note that $q_{k} \leq \sup(\mathbb{Q} \cap [x_{k - 1}, x_{k}])$. Thus
\begin{align*}
U(\operatorname{id}, \mathcal{P}) - U(f, \mathcal{P}) & = \left( \sum_{k = 1}^{N} x_{k} (x_{k} - x_{k - 1}) \right) - \left( \sum_{k = 1}^{N} \sup(\mathbb{Q} \cap [x_{k - 1}, x_{k}]) (x_{k} - x_{k - 1}) \right) \\
& = \sum_{k = 1}^{N} \left( x_{k} - \sup(\mathbb{Q} \cap [x_{k - 1}, x_{k}]) \right) (x_{k} - x_{k - 1}) \\
& \leq \sum_{k = 1}^{N} (x_{k} - q_{k})(x_{k} - x_{k - 1}) \\
& < \sum_{k = 1}^{N} \frac{\epsilon}{N} (x_{k} - x_{k - 1}) \\
& = \epsilon \sum_{k = 1}^{N} (x_{k} - x_{k - 1}) \\
& = \epsilon \\
\Rightarrow U( \operatorname{id}, \mathcal{P}) - \epsilon & < U(f, \mathcal{P}) \\
\Rightarrow U(\operatorname{id}, \mathcal{P}) & \leq U(f, \mathcal{P}) .
\end{align*}
The last inequality follows because we showed this for all $\epsilon > 0$. Having established both sides of the inequality, we conclude that $U(f, \mathcal{P}) = U(\operatorname{id}, \mathcal{P}) \geq \frac{1}{2}$.
