Exercise 9.8.5 in Analysis 1 by Tao (continuous function) 

(a) For given $x, y \in \mathbb{R}$ with $x < y$, we know from proposition 5.4.14 that there exists $r' \in \mathbb{Q}$ such that $x < r' < y$. Since $q$ is bijection, there exists $n'$ such that $q(n') = r'$. Therefore, $f(x) < f(x) + g(q(n')) = f(x) + 2^{-n'} \le f(y)$. 
(b) Note that $x > q(n') = r'$. Therefore, $f(x) = \sum_{r \in Q; r<x} g(r) \ge \sum_{r \in Q; r<r'} + 2^{-n'} = f(r')+2^{-n'}$. Consider the sequence $x_m = r' + \frac1n$. $(x_n)_{m=1}^\infty$ converges to $r'$ and every $x_m > r'$. Thus,$\lim_{m\to\infty}f(x_m) \ge f(r')+2^{-n'} >f(r')$. Thus, $f(x)$ is not continuous at rational numbers. 
I am struggling with (c). I appreciate if you give some help. 
 A: I'm also self-studying Tao's Analysis.
Here is my attemp (sorry about the grammar I'm not a native English speaker):
Let $n \in \mathbf{N}$, let $E_n$ be a set where
$$
    E_n = \{r \in \mathbf{Q} : g(r) \geq 2^{-n}\},
$$
and let $f_n : \mathbf{R} \to \mathbf{R}$ be a function
$$
    f_n(x) = \sum_{r \in E_n : r < x} g(r) = \sum_{r \in \mathbf{Q} : r < x \land g(r) \geq 2^{-n}} g(r).
$$
Since $q$ is bijective, there are at most $n + 1$ rationals satisfying $r \in \mathbf{Q} \land g(r) \geq 2^{-n}$, thus $E_n$ is finite and non-empty.
Since $\mathbf{R} \setminus \mathbf{Q} \subseteq \mathbf{R}$, by Lemma 9.1.11 $\forall\ x_0 \in \mathbf{R} \setminus \mathbf{Q}$, $x_0$ is an adherent point of $\mathbf{R} \setminus \mathbf{Q}$.
Let $\varepsilon \in \mathbf{R}^+$ and let $\delta = \min\{|r - x_0| : r \in E_n\}$.
Since $x_0 \notin \mathbf{Q}$, we have $\delta > 0$.
Then we have
\begin{align*}
             & \forall\ x \in \mathbf{R} \setminus \mathbf{Q}, |x - x_0| < \delta  \\
    \implies & \big(\forall\ r \in E_n, |x - x_0| < \delta \leq |r - x_0|\big) \\
    \implies & \big(\forall\ r \in E_n, |x - x_0| < |r - x_0|\big)             \\
    \implies & \big(\forall\ r \in E_n, -|r - x_0| < x - x_0 < |r - x_0|\big)  \\
    \implies & \big(\forall\ r \in E_n \land r < x_0, r - x_0 < x - x_0 < x_0 - r\big) \\
    \implies & \big(\forall\ r \in E_n, r < x_0 \land r < x\big)                       \\
    \implies & \{r \in E_n : r < x\} = \{r \in E_n : r < x_0\}                         \\
    \implies & f_n(x) = f_n(x_0)                                                       \\
    \implies & 0 = |f_n(x) - f_n(x_0)| < \varepsilon.
\end{align*}
Since $\varepsilon$ is arbitrary, by Definition 9.3.6 we have $\lim_{x \to x_0 ; x \in \mathbf{R} \setminus \mathbf{Q}} f_n(x) = f_n(x_0)$, and by Definition 9.4.1 $f_n$ is continuous at $x_0$.
Now we show that $f$ is continuous at $x_0$.
We have
\begin{align*}
     & \forall\ x \in \mathbf{R} \setminus \mathbf{Q}, |f(x) - f_n(x)|                                                                           \\
     & = |\sum_{r \in \mathbf{Q} : r < x} g(r) - \sum_{r \in E_n : r < x} g(r)|                                                                  \\
     & = |\sum_{r \in \mathbf{Q} : r < x} g(r) - \sum_{r \in \mathbf{Q} : r < x \land g(r) \geq 2^{-n}} g(r)|                                    \\
     & = |\sum_{r \in \mathbf{Q} : r < x \land g(r) < 2^{-n}} g(r)|                                           & \text{(by Proposition 8.2.6(c))} \\
     & = \sum_{r \in \mathbf{Q} : r < x \land g(r) < 2^{-n}} g(r)                                                                                    \\
     & = \sum_{r \in \mathbf{Q} : r < x \land g(r) \leq 2^{-(n + 1)}} g(r)                                                                           \\
     & \leq \sum_{r \in \mathbf{Q} : g(r) \leq 2^{-(n + 1)}} g(r)                                                                                    \\
     & \leq \sum_{k = n + 1}^\infty 2^{-k}                                                                                                           \\
     & = 2^{-(n + 1)} \bigg(\sum_{k = 0}^\infty 2^{-k}\bigg)                                                                                         \\
     & = 2^{-n}.                                                                                                  & \text{(by Lemma 7.3.3)}
\end{align*}
By Proposition 5.4.14, $\forall\ \varepsilon \in \mathbf{R}^+$, $\exists\ n \in \mathbf{N}$ such that $2^{-n} < \varepsilon / 2$.
From the proof above we also have
$$
    \forall\ x \in \mathbf{R} \setminus \mathbf{Q}, |x - x_0| < \delta \implies f_n(x) = f_n(x_0) \\
$$
Combine the results above we have
\begin{align*}
     & |f(x) - f(x_0)|                              \\
     & = |f(x) - f_n(x) + f_n(x) - f(x_0)|          \\
     & \leq |f(x) - f_n(x)| + |f_n(x) - f(x_0)| \\
     & = |f(x) - f_n(x)| + |f_n(x_0) - f(x_0)|  \\
     & \leq 2^{-n} + 2^{-n}                             \\
     & < \varepsilon / 2 + \varepsilon / 2              \\
     & = \varepsilon.
\end{align*}
Since $\varepsilon$ is arbitrary, by Definition 9.3.6 we have $\lim_{x \to x_0 ; x \in \mathbf{R} \setminus \mathbf{Q}} f(x) = f(x_0)$, and by Definition 9.4.1 $f$ is continuous at $x_0$.
A: Hint/Sketch:
Fix an irrational $x \in \mathbb{R}\setminus \mathbb{Q}$ and let $\varepsilon > 0$.  From here, we may define $N = \max(0,\lceil-\log_2\varepsilon\rceil)$ and $$\delta = \frac{1}{2}\min_{0\leq n \leq N}(|q(n)-x|).$$ Show that $0 < \delta < \infty$ and if $|q(n)-x| \leq \delta$, then $n > N$.
In particular, this means
$$f(x+\delta) - f(x-\delta) = \sum_{\substack{r \in \mathbb{Q} \\ x-\delta \leq r < x+\delta}}g(r) \leq \sum_{n>N} 2^{-n} = 2^{-N} < \varepsilon.$$
To finish, suppose $y\in \mathbb{R}$ such that $|x-y| < \delta.$  Then since $f$ is monotone increasing, $$|f(x)-f(y)| \leq f(x+\delta) - f(x-\delta) < \varepsilon.$$
