# How to prove $f(x)$ is integrable function on $[0,2]$

Let

$$f(x) = \begin{cases} 1, & 0 \le x < 1 \\ 0, & x=1 \\ 1, & 1<x \le2 \end{cases}$$

How Prove that $f(x)$ integrable on $[0,2]$

I know that $f(x)$ defined and Bounded on [a,b] then $f(x)$ integrable

$iff$

$\forall ϵ>0$ there is Partition $P$ so that

$$U(f;P)-L(f;P)<ϵ$$

how can i prove that?

thanks

Notice that on any interval $(a,b)\subset [0,2]$ we have that $\max_{x\in (a,b)}{f(x)}=1$ and $$\min_{x\in (a,b)}f(x)=\begin{cases} 0 & \mbox{ if } 1\in (a,b),\\ 1 & \mbox{ otherwise.} \end{cases}$$
Let $n\in \mathbb{N}$ and let $P=(P_i)_{i\in I}$ be any partition such that $P_j=(1-\frac{1}{n},1+\frac{1}{n})$ for some $j$. Clearly $U(f;P)=2$. Notice that $L(f;P)=2-\frac{2}{n}$. Since $n$ was chosen arbitrarily, we can get $U(f;P)-L(f;P)$ as small as we want.
Here's a hint: For intervals $x$ without one, the Upper and Lower sums are simply one, and their difference is then $0 \leq \epsilon$. But for every partition, there is some segment of the partition which contains $x = 1$ for which the lower sum is then zero, and the upper sum is one. We need to show that this difference can be made less than epsilon for all epsilon. But this is fairly simple, because we simply make the interval containing $x=1$ very small, depending on the value of epsilon. For example, if we are trying to "challenge" $\epsilon/2$ then we can make the interval containing $x=1$ less than $\epsilon/3$ and we meet the integrability criterion. In general, if we have finitely many points of discontinuity, the function will be Riemann Integrable(provided it is bounded).
Let $g(x)=1-f(x)$, then $g$ is zero everywhere except $g(1)=1$.
$\displaystyle \forall n>0,\quad \underbrace{0}_{L(g,P)}\le\int_0^2g(t)dt=\int_{1-\frac 1n}^{1+\frac 1n}g(t)dt\le\underbrace{\int_{1-\frac 1n}^{1+\frac 1n}1\,dt}_{U(g,P)}=\frac 2n\to 0$
So $\displaystyle \int_{0}^{2}f(t)dt=\int_{0}^{2} 1\,dt=2$