Finding points of continuity 
Define a real valued function $f$ as follows: if $x\in\mathbb{R}$ is irrational, set $f(x)=0$. If $x$ is rational  and non-zero, represent it as $p/q$, with $p\in\mathbb{Z}$ and $q\in\mathbb{N}$ having no common factors and let $f(x)=2^{-q}$. Set $f(0)=1$. Find all points where $f$ is continuous. 

I am not entirely sure of my solution, but here it goes:


*

*If $x_n \to 0$ and the elements in this sequence are irrational, then $f(x_n) \to 0 \neq f(0)$, thus $f$ cannot be continuous at $0$.

*If $x\in\mathbb{R}\setminus\mathbb{Q}$, then taking $y=\frac{p}{q}\in (x-\delta,x+\delta)$ rational for any $\delta$ gives us $|f(x)-f(y)|=\frac{1}{2^q}$. Hence $f$ cannot be continuous at irrational points.

*If $x=\frac{p}{q}$ then taking $y\in (x-\delta,x+\delta)$ irrrational for any $\delta$ gives us $|f(x)-f(y)|=\frac{1}{2^q}$. Hence $f$ cannot be continuous at rational points.


This is not a homework problem, so feel free to give as much help and detail as you find necessary.

Here's an $\varepsilon$-$\delta$ proof that $f$ is continuous at irrational points.  Let $x_0$ be irrational.  We are given $\varepsilon>0$.  We seek $\delta>0$ small enough so that whenever $|x-x_0|<\delta$ then $|f(x)-f(x_0)| = f(x) < \varepsilon$.  Let the nonnegative integer $q$ be large enough so that $2^{-q} < \varepsilon$.  All we have to do is make $\delta$ small enough so that no rationals with denominator smaller than $q$ are in the interval $(x_0-\delta, x_0+\delta)$.  Now observe that in the interval $(x_0-1, x_0+1)$ only finitely many rationals have denominator smaller than $q$.  Since $x_0$ is not one of that rationals, there is some interval about $x_0$ that contains none of them.
