I need verification for this proof:
Q: Suppose $f: (0,1)\rightarrow \mathbb{R}$ is defined by
$f(x) = \begin{cases}\frac{1}{n} & \text{if }\text{x is rational with x} = \frac{m}{n}\text{ in lowest terms}; \\0 & \text{ if }x\text{ irrational.} \end{cases}$
a) Prove that $f$ is discontinuous at each rational number in $(0,1)$.
b) Prove that $f$ is continuous at each irrational number in $(0,1)$.
My attempt for part a):
Let $x\in (0,1) \bigcap \mathbb{Q}$ and choose $\epsilon< \frac{1}{n}$. Then there exists an irrational number $y$ which implies that $|f(x) - f(y)| = |\frac{1}{n} - 0| = |\frac{1}{n}|< \epsilon$.
Thus, there is an $\epsilon$ for which there is no $\delta$ such that $|f(x) - f(y)|<\epsilon$ when $|x-y|<\delta$.
For part b): Taking hints into consideration let $c$ be an irrational number in $(0,1)$ and $\epsilon > 0$. Then there is a natural number such that $\frac{1}{n} < \epsilon$.
If we choose $\delta$ small enough that the interval $(c-\delta,c+\delta)$ contains no rational numbers with denominator less than $n$, then it follows that for $x$ in this interval we have $|f(x) - f(y)| = f(x)\leq \frac{1}{n} < \epsilon$.
So $f$ is discontinuous on $D(f) = (0,1)\bigcap \subset \mathbb{Q}$.
A function $f$ is continuous in $x_0$ if for each neighborhood $\mathcal E$ of $f(x_0)$, there is a neighborhood $\mathcal D$ of $x_0$ whose image is in $\mathcal E$. In simpler terms:
Now, you have $x_0$ any irrational in $(0,1)$, and $f(x_0)=0$. You don't need to prove for any $\varepsilon$ but for a sequence $\varepsilon_n$ such as $$\lim_{n\to\infty}\varepsilon_n = 0$$
For example, let $\frac{p_n}{q_n}$ be a rational aproximation to $x_0$, have $\varepsilon_n=\frac1{q_n}$, and you should be able to finish the proof.