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.