Integrable on an Interval Let $f(x)$ be defined for $0 \leq x \leq 1$ by
                \begin{equation}
       f(x)=\begin{cases}
           1, & \text{if $x = 1/n$, $n \in \mathbb{N}$},\\
          0, & \text{else}.
       \end{cases} \nonumber
    \end{equation}
            Prove that $f$ is integrable on $[0, 1]$ and find $\int_0^1 f$.
Teacher tried explaining in class, but it didn't make sense to me.
 A: Your function is just the indicator or characteristic funcion of $\;\left\{\frac1n\right\}:\;$
$$f(x)=\begin{cases}1\;,\;&x=\frac1n\\{}\\0\;,&x\in[0,1]\setminus\left\{\frac1n\right\}\end{cases}$$
For any partition $\;P=\left\{\,x_0=0<x_1<\ldots<x_m=1\,\right\}\;$ of $\;[0,1]\;$, we have that its Riemann sum associated is, for some $\;c_k\in[x_{k-1},\,x_k]\;$ :
$$\sum_{k=1}^mf(c_k)(x_k-x_{k-1})=\begin{cases}x_i-x_{i-1}\;,\;&\exists\,i\;\;\text{such that}\;\;c_i=\frac1n\in[x_{i-1},\,x_i]\\{}\\0\;,&\text{otherwise}\end{cases}$$
But since we must take the limit when $\;n\to\infty\;$ together with the condition that 
$\;\max\limits_{1\le i\le m}(x_i-x_{i-1})\xrightarrow{}0\;$, we get anyway that the Riemann sum is always zero in the limit, no 
matter what $\;c_i$'s are chosen, and this mean the integral exists and equals zero.
A: It's not clear whether you wanted Riemann or Lebesgue integrals.
For Lebesgue measure you need to verify first that $f$ is measurable.  That means proving that $\{x: f(x)<a\}$ is measurable for all real $a$.  Such sets are (a) the entire real line for $a> 1$, (b) the empty set for $a\le 0$, and (c) the real line with the exception of a countable set of points if $0< a\le 1$. Sets (a) and (b) are obviously measurable; set (c) is measurable because all countable sets are measurable and the difference of two measurable sets is measurable.  Thus, $f$ is measurable. 
Because $f\ge 0$ and $f$ is measurable, it has a Lebesgue integral.  However, the definition of "integrable" sometimes excludes functions whose Lebesgue integral is $\infty$, so just in case: take $g(x)=0$ for all $x$, obviously a measurable function.  We have $f$ differing from $g$ on a countable set, which has measure zero (all countable sets do).  The integral of $f$ is thus the integral of $g$ which is $0$.
A: f is simple, so f is intregrable.
Since $f$ is a simple function, we have $\int_0^1 f dx=\lambda( \left\lbrace 1/n \right\rbrace )$ with $\lambda$ the Lebesgue measure, but the Lebesgue mesure of a singleton is $0$, therefore the value of the integral is $0$.
