1. Integrate this function

Let $f: \mathbb {R} \rightarrow \mathbb {R}$ be defined by $f(x) = 1$ if $x= \frac {1}{n} \ \ \ n \in \mathbb {N}$, and $f(x) = 0$ otherwise.

Prove that $\int ^1 _0 f$ exist and find its value.

Question so far:

Define a partition P on [0,1] with $P = \{ a_0=0 , a_1,a_2,...,a_{N-1},a_N=1 \}$

Define $M_j = sup \{ f(x) : x \in [x_j,x_{j+1}]$
$m_j = inf \{ f(x) : x \in [x_j,x_{j+1}]$

So I need to show that for any given $\epsilon > 0$, we will have $U(f,P)-L(f,P)< \epsilon$, but how should I process? Thanks.

Let $f: \mathbb {R} \rightarrow \mathbb {R}$ be defined by $f(x) = 1$ if $x= \frac {1}{n} \ \ \ n \in \mathbb {N}$, and $f(x) = 0$ otherwise.

Prove that $\int ^1 _0 f$ exist and find its value.
obviously $L(f,P)=0,$ for any partition $P$ of [0,1]. so: $\int_{-} f = 0.$ suppose $n \geq 2.$ let $r= \frac{1}{2n^2}$ and define the partition $P_n$ by:

$x_0=0, \ \ x_1=\frac{1}{n}, \ \ x_2=\frac{1}{n} \ + \ r, \ \ x_{2i+1}=\frac{1}{n-i} \ - \ r, \ \ x_{2i+2}= \frac{1}{n-i} \ + \ r, \ \ 1 \leq i \leq n-2,$ and $x_{2n-1}=1-r, \ \ x_{2n}=1.$ see that

$U(f,P_n)=\frac{2n-1}{n^2}$ and thus: $0 \leq \int^{-} f - \int_{-} f = \int^{-} f \leq U(f,P_n) = \frac{2n-1}{n^2}.$ therefore $f$ is integrable and $\int_0^1 f = 0. \ \ \ \Box$

3. Thanks for your help, but there is something that I ain't clear about here.

Now, I know that
$
U(f,P_n) = \sum ^{2n-1}_{j=0}[sup \{ f(x) : x \in [x_j,x_{j+1}](x_{j+1}-x_j),$
but how does this equals to $\frac{2n-1}{n^2}
$
?

Thanks again!