[Math] Show that f is continuous on x if and only if x is irrational

continuityfunctionsproof-verificationreal-analysis

Let $f : [0, 1] → R$ be given by the formula

$f(x) = \frac{1}b$ if $x = \frac{a}b$, where $a$ and $b$ have no common factor,

$f(x) = 0$ if $x$ irrational.

Show that $f$ is continuous at $x$ if and only if $x$ is irrational. (Hint: Use the
density properties of rationals and irrationals.)

My attempt: Let $\epsilon > 0$. Suppose $x$ is irrational, then $f(x) = 0$.

$|x-x| < \delta$

$|f(x) – x| = |-x| = x$

So we can choose $\delta = \epsilon$ so that $\epsilon > x$ (I'm unsure of this part).

Suppose $x$ is rational, $f(x) = \frac{1}b$. We want to show that is discontinuous. Suppose there is a $\delta$ that works for $|\frac{1}b-x| < \epsilon$. Let $\epsilon = \frac{1}2$. Let $x= \min(\delta, \frac{3}4)$

$|\frac{1}4 – \frac{3}4| = |-\frac{1}2| = \frac{1}2$

And $1/2$ is not greater than a $1/2$. So it is a contradiction.

Best Answer

For $x_0\in [0,1]$, we want to show $f$ is continuous at $x_0$ if and only if $x_0$ is irrational.

First, suppose $x_0\in [0,1]$ is rational.

Then $f(x_0) > 0$.

Since the irrationals are dense in $[0,1]$, there is a sequence $t_1,t_2,t_3,... \in [0,1]$ of irrational numbers such that $t_n$ approaches $x_0$, as $n$ approaches infinity.

So we have ${\displaystyle{\lim_{n\to \infty}t_n}}=x_0$, but ${\displaystyle{\lim_{n\to \infty}f(t_n)}}=0 \ne f(x_0)$, hence $f$ is not continuous at $x_0$.

Next, suppose $x_0\in [0,1]$ is irrational.

Necessarily, $x\in (0,1)$.

Fix $\epsilon>0$.

Choose an integer $B > {\large{\frac{1}{\epsilon}}}$.

There are only finitely many rationals in $(0,1)$ with denominators less than $B$, hence, for some $\delta > 0$, we have an interval $(x_0-\delta,x_0+\delta) \subseteq (0,1)$ which contains none of them.

If $x\in (x_0-\delta,x_0+\delta)$, and $x$ is irrational, then $f(x) = 0$.

If $x\in (x_0-\delta,x_0+\delta)$, and $x$ is rational, then $0 < f(x) \le {\large{\frac{1}{B}}} < \epsilon$.

In either case, $|f(x)| < \epsilon$. \begin{align*} \text{Then}\;\;&|x-x_0| < \delta\\[4pt] \implies\;&x\in (x_0-\delta,x_0+\delta)\\[4pt] \implies\;&|f(x)| < \epsilon\\[4pt] \implies\;&|f(x)-f(x_0)| < \epsilon\\[4pt] \end{align*} hence $f$ is continuous at $x_0$.