Suppose $\mathbb{Q} \cap [0,1]=\{r_1,r_2,r_3,...\}$ (We can do this because $\mathbb{Q}$ is countable and $\mathbb{Q} \cap [0,1] \subset \mathbb{Q}$. Let $x \in (0,1)$. Define $$f(x)=\sum_{r_n<x}{\frac{1}{2^n}}$$ Show that
a) $f$ is continuous at every irrational point $x \in (0,1) $.
b) $f$ is discontinuous at every rational point $x \in (0,1)$.
My attempt:
a) What I'm trying to show here is that the left-hand limit and the right-hand limit exist and they are equal.
Let $a \in \mathbb{R} \backslash \mathbb{Q}$. Note that $|f(a+\delta)-f(a)|=\sum_{a < r_n < a + \delta}{\frac{1}{2^n}}$. We have $a < r_n$ because $a$ is irrational. Also $\frac{1}{2^n}>0$ for all $n \in \mathbb{N}$. Hence, we have $\sum_{a < r_n < a + \delta}{\frac{1}{2^n}}<\frac{1}{2^N}+\frac{1}{2^{N+1}}+...=\frac{\frac{1}{2^N}}{1-\frac{1}{2}}=\frac{1}{2^{N-1}}$. By taking $\delta=\log_2(\frac{2}{\epsilon})$, we have shown that the right-hand limit of $f$ exists. By applying the same argument, we can show that $|f(a)-f(a-\delta)|<\epsilon$
b) Let $a \in \mathbb{Q}$. Then we have $|f(a+\delta)-f(a)|=\sum_{a \leq r_n < a + \delta}{\frac{1}{2^n}}$. Then I don't know how to proceed from here.
Can someone help me to verify my attempt above for part a)? Also can someone give some hints on how to continue part b)?