Let $E=\{1/n:n\in\mathbb{N}\}$. Prove that a function is integrable on $[0,1]$. Would someone be kind enough to explain to me what the notation in this exercise means? This is only one exercise of 1/12 of a course, but I really want to know what it is. Thanks!
So the problem says:
"Let $E=\{1/n:n\in\mathbb{N}\}$. Prove that the function:
$$f(x) =
  \begin{cases}
   1 & \text{if } x \in E \\
   0 & \text{otherwise}
  \end{cases}$$
is integrable on $[0,1]$."
Answer: (The text in bold is what I don't understand)
Let $\epsilon>0$. Choose $N\in\mathbb{N}$ such that $N>\frac{2}{\epsilon}$. Then, for all $n\ge N$ we have that $\frac{1}{n}<\frac{\epsilon}{2}$.
Now, let $\delta=\min\left\{\frac{\epsilon}{4N},\frac{1}{4N}\right\}$ and define the partition as
$$P=\left\{0,\frac{\epsilon}{2},\frac{1}{N-1}-\delta,\frac{1}{N-1}+\delta,\frac{1}{N-2}-\delta,\frac{1}{N-2}+\delta,...,\frac{1}{2}-\delta,\frac{1}{2}+\delta,1-\delta,1\right\}.$$
So this is the first thing that confuses me... what are these partitions? The main thing that confuses me is how it goes from small numbers up to $\frac{1}{2}$ and then goes straight to $1-\delta$ and $1$. I just cannot see how this relates to a partition of $a, x_1, x_2,...,x_{n-1},x_n,b$, for example.
And also, why is $\delta=\min\left\{\frac{\epsilon}{4N},\frac{1}{4N}\right\}$?
Now, $\sup(f)=1$ on $[0,\epsilon/2]$ and on $\left[\frac{1}{N-k}-\delta,\frac{1}{N-k}+\delta\right]$ for all $k\le N-2$, and $\sup(f)=0$ on all other subintervals determined by $P$ (Why? I kind of see the logic of this, but I then do not see why we have further below that $\inf(f)=0$. What is $\inf(f)$ and $L(f,P)$?), so
$$U(f,P)=1*\frac{\epsilon}{2}+0+1*2\delta+0+1*2\delta+...+0+1*2\delta+0+º*\delta$$
Thus,
$$
\begin{align*}
 U(f,P) &< \frac{\epsilon}{2}+\frac{\epsilon}{2N}+...+\frac{\epsilon}{2N}+\frac{\epsilon}{4N} \\
 &= \frac{\epsilon}{2}+\sum\limits_{k=1}^{N-2} \frac{\epsilon}{2N}+\frac{\epsilon}{4N} \\
 &< \frac{\epsilon}{2}+\left(\frac{N-1}{N}\right)\frac{\epsilon}{2}
\end{align*}$$
On the other hand, $L(f,P)=0$ since $\inf(f)=0$ on any subinterval of $[0,1]$.
Therefore, $U(f,P)-L(f,P)=U(f,P)-0=U(f,P)<\epsilon$. Since the choise of $\epsilon>0$ was arbitrary, we see that the function $f$ is integrable.
 A: Before I begin, I want to emphasize that a proof like this is not usually conceived linearly. For instance, usually one does not magically get that expression for $\delta$ at the beginning of writing the proof; it stands for a small quantity, and its precise "smallness" (with respect to $\epsilon$) can be determined later as needed.

To show this is integrable, you need to show that there exists a partition $P$ such that $U(f,P)-L(f,P)$ can be made arbitrarily small. If you don't know what the upper sum $U(f,P)$ and lower sum $L(f,P)$ mean, you should reread your textbook. Also, $\inf(f)$ is the infimum (or loosely speaking, the "minimum") of $f$.
What kind of partition should we choose? First notice that on any interval you choose, $L(f,P)=0$ (any interval contains a point not in $E$, so $f$ takes on the value $0$ on this interval). So we just need to find a partition such that $U(f,P)$ is small. The intuition is to choose a partition where the intervals containing points of $E$ are small! (How small? This is where the tweaking in the definition of $\delta$ comes in.)
Visualize the interval $[0,1]$ and the points $\frac{1}{N}, \frac{1}{N-1},\ldots, \frac{1}{3},\frac{1}{2},1$. The partition $P$ alternates between small $2\delta$-intervals around these points and the large intervals in between. This is pretty self-explanatory, look at the definition of $P$ a little more closely. This matches the kind of partition that we described in the paragraph above.
Now forget about what $\delta$ is exactly; just leave it as a placeholder, and we will now determine how small exactly we need it to be. If you calculate $U(f,P)$ for this $P$, only the small intervals containing points of $E$ will contribute, and you get the line that you wrote above "Thus", which simplifies to $$U(f,P)=\frac{\epsilon}{2}+(N-2)2\delta+\delta < \frac{\epsilon}{2}+2N\delta.$$
From this, we see that choosing $\delta=\frac{\epsilon}{4N}$ will be "small enough" to get $U(f,P)<\epsilon$.

Note: I am not sure why they considered $\frac{1}{4N}$ for $\delta$, so if someone sees a mistake in my logic, please comment.
A: Big picture: 
Break up $E$ into a large but finite set $\{ 1/N,1/(N-1),\dots,1 \}$ and an infinite set $\{ 1/(N+1),1/(N+2),\dots \}$. Put the infinite portion into one subinterval of length $1/N$. Cover each member of the finite portion with a small subinterval. If $N$ is large enough and the subintervals are small enough, then we have covered all of $E$ with a set of small total length. The rest of the interval contributes nothing to both the lower and upper sum, so the lower sum is $0$ and the upper sum is small. The details are about negotiating "how large is large" and "how small is small". In particular we have to be careful to make the intervals small enough that the fact that there are $N$ of them is not a problem. 
Details:
Pick a large number $N$. ($N$ will depend on $\varepsilon$, but we will handle that later.) Cut $[0,1]$ into $A=[0,1/N]$ and $B=[1/N,1]$. For each $x \in E \cap B$ draw a small subinterval $I_x = [x-\delta,x+\delta]$. ($\delta$ will depend on $\varepsilon$, but we will handle that later.) $I_x$ contributes nothing to the lower sum and contributes $2 \delta$ to the upper sum, because it is of length $2 \delta$ and the maximum value of $f$ on $I_x$ is $1$. 
Now we have a number of pieces of the interval left uncovered. First there is $A$ (or rather, the part of $A$ that we didn't cover yet.) This contributes nothing to the lower sum and contributes at most $1/N$ to the upper sum. Second there is the rest of $B$. These pieces contribute nothing to both the lower and the upper sum, because all of $E$ has already been covered.
Now count the number of $I_x$ that you drew: you should have $N$ of them, since $E \cap B$ has $N$ elements. So the lower sum is $0$ and the upper sum is at most $1/N + 2N\delta$. So given an $\varepsilon$, choose $N$ so that $1/N < \varepsilon/2$ and choose $\delta$ so that $\delta < \varepsilon/4N$. Then $1/N + 2N \delta < \varepsilon$. 
There are two technicalities that I've glossed over. First of all we need $I_1 \subset [0,1]$, so $I_1 = [1-\delta,1]$ instead of $[1-\delta,1+\delta]$. Second we need the $I_x$ to be disjoint so that we have a well-defined partition. (Your book actually did not handle this technicality correctly.) The closest $x \in E \cap B$ are $1/N$ and $1/(N-1)$, which are $1/(N(N-1))$ apart. So we need $\delta < 1/(2N(N-1))$, so it is enough to have $\delta = \min \{ \varepsilon/4N, 1/2N^2 \}$. A side effect is that $I_{1/N} \subset [0,1]$, as required.
