Using Darboux sums to calculate $\int f(x)\,dx$ I am given the following function:
$$
f(x) = \begin{cases} 1 & \text{for } 0 \le x < 1, \\ 0 & \text{for } x = 1, \\ 1 & \text{for } 1<x\le 2. \end{cases}
$$
and I need to calculate the following integral usin Darboux Sums:
$$\int_0^2 f(x) \, dx$$
This is my work so far:
I've split up $[0,2]$ into  $\left(0\lt 1-\frac1n\lt 1+\frac1n\lt2 \right)$.
For:
$$\left[0,1-\frac1n\right]: \inf(f)=\sup(f)=1$$
$$\left[1+\frac1n,2\right]: \inf(f)=\sup(f)=2$$
$$\left[-\frac1n,1+\frac1n\right]: \sup(f)=1$$
Now for some Darboux Sums:
$$U(f,P_n)=1 \left(1-\frac1n\right) + 1\left(\frac{2}{n}\right)+2\left(1-\frac{1}{n}\right)=3-\frac1n$$
$$L(f,P_n)=1\left(1-\frac1n\right)+0()+2\left(1\frac1n\right)=3-\frac{3}{n}$$
Up until now I think I did ok, but the next few steps I am unsure of:
$$U(f,P_n)-L(f,P_n)= 1\left(\frac{2}{n}\right) = \frac{2}{n}$$
Okay now according to the definition:
$\forall \varepsilon > 0 $ we can pick $ n\in \mathbb N$ such that
$$U(f,P_n)-L(f,P_n)= 1\left(\frac{2}{n}\right) = \frac{2}{n} < \varepsilon$$
This is where I'm clueless as to how to continue in order to calculate the area using the definition, and would appreciate any help in correcting any mistakes up until here or giving me hints to any future steps.
 A: I believe, with Nick's suggestion, you will have shown that $f$ is integrable, however, you are also asking how to find the value of the integral. If you take the limit at $n\to\infty$ of either your lower or upper sum, you will have it.  Be sure you make the suggested corrections, because 3 is obviously not the value.
A: I think it is easier to break this integral up into 3 parts which means we have three lower and upper sums to work with. 
Let $P_{1,n}=\{x_0=0,...,x_n=1-\frac{1}{n}\}, P_{2,n}=\{x_0=1-\frac{1}{n}, x_1=1+\frac{1}{n}\},{ P_{3,n}=\{x_0=1+\frac{1}{n}, ... ,x_n=2\}}$  
where on $P_{1,n}$ and $P_{3,n}$ we have that $(x_i-x_{i-1})=\frac{1-\frac{1}{n}}{n}=\frac{1}{n}-\frac{1}{n^2}$ for $1\le i \le n$ and on $P_{2,n}$ we have that $(x_1 - x_0)=\frac{2}{n}$
Since $f=1$ on $[0,1-\frac{1}{n}] \cup[1+\frac{1}{n},2] $ we have that the $\sup f=\inf f$ so $U(f,P_{1,n})=U(f,P_{3,n})=L(f,P_{1,n})=L(f,P_{3,n})$ so we just need to calculate one of those sums.
$U(f,P_{1,n})= \sum_{i=1}^n(x_i-x_{i-1})\cdot1=\sum_{i=1}^n\left(\frac{1}{n}-\frac{1}{n^2}\right)=1-\frac{1}{n}$ 
On $[1-\frac{1}{n},1+\frac{1}{n}]$ we have $\sup f =1$ and $\inf f =0$ so we need to calculate $U(f,P_{2,n})$ and $L(f,P_{2,n})$ separately.
$U(f,P_{2,n}) =(x_1-x_0)\cdot 1=\frac{2}{n}$ and $L(f,P_{2,n})=(x_1-x_0)\cdot 0=0$
Now we have everything we need to find $\int_0^2f$
Let $P_n$ be the partition on $[0,2]$ that is just a combination of $P_{1,n},P_{2,n},P_{3,n}$ 
$U(f,P_n)=\left(1-\frac{1}{n} \right) + \frac{2}{n} + \left( 1-\frac{1}{n}\right)$ and $L(f,P_n)=\left(1-\frac{1}{n} \right) + 0 + \left( 1-\frac{1}{n}\right)$ 
So $U(f,P_n)-L(f,P_n) = \frac{2}{n} \le \epsilon$ for all $n\ge \frac{2}{\epsilon}$ and $U(f,P_n) \rightarrow 2$ and also $L(f,P_n)\rightarrow 2$ so $\int_0^2f =2$
