TITLE: Introduction to Measure Theory, length of an Interval.
QUESTION [6 upvotes]: Let $I$ be an interval on real line, (in the form of $(a, b)$,$[a,b)$,$(a,b]$ or $[a,b]$, where $a,b \in \mathbb R$) and $|I|:= b-a$. 
Prove that
$$
|I| = \lim_{N\to\infty}\frac{\#\left(I\cap\tfrac{\mathbb Z}{N}\right)}{N},
$$
where $\tfrac{\mathbb Z}{N} := \left\{\tfrac{n}{N} \;\middle|\; n\in \mathbb Z \right\}$ and $\#$ denotes the cardinality of a finite set.
This is an observation Terence Tao used at the beginning in his An Introduction to Measure Theory. My idea is to express $\#\left(I\cap\tfrac{\mathbb Z}{N}\right)$ in terms of $N$ with coefficient $(b-a)$ and some other neglectable terms, but I am struggling on how to do it when $I = (a,b)$ where $a,b$ are irrational.
Great thanks!

REPLY [5 votes]: First take $I = [a,b]$; then
\begin{align*}
\#\left(I \cap \tfrac{\mathbb Z}{N}\right) &= \#\left\{ \tfrac{n}{N} : n \in \mathbb Z, \quad a \leq \tfrac{n}{N} \leq b \right\} \\
&= \#\left\{ n \in \mathbb Z : 0 \leq n \leq N(b-a) \right\} \\
&= \#\left\{ n \in \mathbb Z : 0 \leq n \leq \lfloor N(b-a) \rfloor \right\} \\
&= \# \{ n \in \mathbb Z : 0 \leq n \leq \underbrace{N(b-a) - \varepsilon}_{\in \mathbb Z} \} \\ &= 1 + N(b-a) - \varepsilon \tag{2}
\end{align*}
for some $0 \leq \varepsilon < 1$. Hence
$$
|I| = \lim_{N\to\infty} \frac{\#\left(I \cap \tfrac{\mathbb Z}{N}\right)}{N} = \frac{1 + N(b-a) - \varepsilon}{N} = b-a.
$$
Had we started in stead with $I$ as $(a,b)$, $(a,b]$, or $[a,b)$, the quantity in $(2)$ could change by at most $\pm 1$ (by adjusting the inequality signs in the line above), and this does not change the subsequent limit, so $|I| = b-a$ in these cases, too.

REPLY [3 votes]: $$a_n:=\min \left(I\cap{1\over n}\mathbb Z\right),\qquad b_n:=\max \left(I\cap{1\over n}\mathbb Z\right)\\
\implies \#\left(I\cap{1\over n}\mathbb Z\right)=n(b_n-a_n)+1\\
$$

$\lim_{n}a_n=a$

Proof: The rationals are dense in $\mathbb{R}\implies\exists $ a rational sequence $\{r_n={p_n\over q_n}\}$ with $\lim_n q_n=+\infty:\lim_nr_n=a$. We're assuming $q_n>0,\;\gcd(|p_n|,q_n)=1$ i.e. ${p_n\over q_n}$ is $r_n$ writen in lowest terms.
Clearly $|a-a_n|\le|a-k|\;\forall k\in\left(I\cap{1\over n}\mathbb Z\right)$. $r_n\in\left(I\cap{1\over q_n}\mathbb Z\right)\implies|a-a_{q_n}|\le|a-r_n|$. Taking limit we see $\lim_n|a-a_{q_n}|=0\implies\lim_n a_{q_n}=a$. 

$\lim_n b_n=b$

Proof: Similar
$$\therefore \lim_n{1\over n}\#\left(I\cap{1\over n}\mathbb Z\right)=\lim_n(b_n-a_n+{1\over n})=b-a$$