TITLE: Length of Interval
QUESTION [8 upvotes]: I'm currently going through Terence Tao's book on measure theory and I'm having a little trouble with one of his exercises.  He tells us to observe that:
$|I| = \lim_{n \to \infty} \frac{1}{N}\#\left(I \cap\frac{\mathbf{Z}}{N}\right)$
where $|I|$ is the length of any real interval, $\#|A|$ is the cardinality of a finite set, $N$ is an integer, and $\frac{\mathbf{Z}}{N}=\{\frac{n}{N}: n \in \mathbf{Z}\}$
I can convince myself that it's true for easy intervals like $(2,3)$.  But I'm having trouble proving it for the general case, or for "hard" intervals like $(2.113,2.114)$.  Does anyone have any tips to get started?

REPLY [9 votes]: Assume WLOG that $I=[a,b]$ with $a\leq b$.
Let $N$ be a positive integer and $x\in I\cap\frac{\mathbb Z}{N}$, $x=\frac{q}{N}$
Then $Na\leq q\leq Nb$, hence $\#(I\cap\frac{\mathbb Z}{N})= \lfloor Nb\rfloor-\lceil Na\rceil+1$ and $$\frac{1}{N}\#(I\cap\frac{\mathbb Z}{N})=\frac{\lfloor Nb\rfloor-\lceil Na\rceil+1}{N}=\frac{Nb-Na}{N}+O(\frac{1}{N})=b-a+o(1)=|I|+o(1)$$