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

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}$.
