$f(x)=q$ if $x=p/q$, properly reduced is unbounded at every point. Define the function $f$ as follows: 
$$f(x) =
\begin{cases}
q,  & \text{if $x=p/q$,properly reduced} \\
0, & \text{if $x$ is irrational}
\end{cases}$$
Prove that for every real number $x_0$, $f$ fails to be bounded at $x_0$, i.e. there does not exist any neighborhood of $x_0$ for which $f$ is bounded at. 
It's enough to consider only rational points. Given any $x_0 \in \mathbb Q$, and any $\delta$-neighborhood of $x_0={p\over q}$ contains infinitely many rational points. So given any $M \gt 0$, in fact, greater than $q$, there can be only finitely many rationals in the $\delta$-neighborhood of $x_0$ with denominator less than or equal to $M$. Thus, there must be a rational in a properly reduced form with denominator greater than $M$ in the specified $\delta$-neighborhood of $x_0$, and so the value of the function at this point would be greater than $M$. Hence, $f$ is unbounded at any neighborhood of $x_0$. 
This is my solution and I think it's correct but I'm unsure how to rigorously show the bolded part. That is, how can I write it down to guarantee that there are only finitely many rationals satisfying the assertion? I'd appreciate a formal explanation on this part.
 A: You can justify this for example in the following way: 
let $x, x' $ distinct rationals with denominator $q$, then $|x-x'|\ge 1/q$. Thus any interval $[a,a+ 1/2q]$ constains at most one such number.
From this you get an explict bound on the number in a $\delta$-neighborhood as $\lceil \delta (2q) \rceil$. Or, you say an intervall of length $1$ can thus contain at most $2q$ such numbers and you assume $\delta < 1$. 
Then consider the sum over all $q \le M$ of which there are only finitely many. 
Or show that: for $x, x' $ distinct rationals with denominators $\le M$, one has $|x-x'|\ge 1/M^2$. (Note that the common denominator is at most the product of the two denominators.) And argue in a similar way. 
A: "It's enough to consider only rational points." << If you want to be rigorous, you may start by developing that (it's true but useless nonetheless).
Then, in general if you doubt your own argument's rigour, I'd suggest to go "$\epsilon, \delta$" and go back to axioms/statements you're 100% sure about.
Here's a draft example: 
Let $x \in \mathbb R$ and $\delta > 0$. We will show that $\forall M \in \mathbb N$, there exists $r \in \mathbb Q$ st $|x-r|<\delta$ and $f(r) > M$.
So let $M \in \mathbb N$. The set $A$ of rationals $r=p/q$ st $r \not=x$, $|x-r|<\delta$ and $q \le M$ is finite (because $|p| = |r|q \le |r|M \le (|x|+\delta)M$ and $q \le M$). (It is non empty because of $\mathbb Q$'s density).
So there is an element $r_0 \in A$ which is $\not= x$ and closer to $x$ than all others (if in doubt, see that the function $r \in A \mapsto |x-r|$ reaches its minimum, which has to be $>0$). 
Now there is at least a rational $r' =p'/q'\in \;]x,r_0[$ (again, density). Given that $r'\not= x$, $|x-r'| < \delta$ and $r' \not\in A$, by definition of $A$ we have $q' > M$, hence $f(r') > M$. QED
