I was given the following problem. Given $$ f:[0,1] \longrightarrow \mathbb{R}, f(x)= \begin{cases} 0 & 0\leq x\leq \frac{1}{2} \\ 1 & \frac{1}{2}< x \leq 1 \end{cases} $$
Prove that $f$ is integrable in $[0,1]$ and show that $$ \int_0^1 f\, = \frac{1}{2}. $$
So, proving $f$ is integrable I think I understand fairly well. I chose a partition $ P = \{x_0, x_1, ..., x_n \} $ such that $ \frac{1}{2} \in (x_{t-1},x_t)$ and $ |x_t - x_{t-1}| < \epsilon $ with $ \epsilon > 0 $ for some $t \in \{1, 2, ..., n\}$. It naturally follows that the upper and lower sums under partition $P$ are $ U(f,P) - L(f,P) < \epsilon $, and thus the function is integrable. However, I fail to produce a convincing argument as to why the integral is $\frac{1}{2}$. The textbook I'm using just states that "it's obvious that $\frac{1}{2} $ is the only number that is $ L(f,P) \leq \frac{1}{2} \leq U(f,P) $ for every partition $ P $", but I don't quite see it. Is there a way to make this argument more explicitly, choosing a particular partition?
Take any partition $P=\{ x_0, x_1, \dots, x_n \}$ of $[0,1]$. If $x_k = 1/2$ for some $0 \leq k \leq n$ then I believe you can easily show $\displaystyle L(f,P) \leq \frac{1}{2} \leq U(f,P)$. Otherwise, consider $P'$ refinement of $P$ which includes $1/2$. Then you have the following chain of inequalites $L(f,P) \leq L(f,P') \leq \dfrac{1}{2} \leq U(f,P') \leq U(f,P)$.