A function $f(x)$ is defined:
$$f(x)=\cases{x,& $x \in \mathbb{Q} $\cr 0, &$~x \notin \mathbb{Q}$}$$
where $\mathbb{Q}$ denotes the set of rational numbers.
Prove that $f(x)$ is only continuous at $x=0$.
A function $f(x)$ is defined:
$$f(x)=\cases{x,& $x \in \mathbb{Q} $\cr 0, &$~x \notin \mathbb{Q}$}$$
where $\mathbb{Q}$ denotes the set of rational numbers.
Prove that $f(x)$ is only continuous at $x=0$.
Copyright © 2021 JogjaFile Inc.
HINT:
It follows from the density of $\Bbb Q$ in $\Bbb R$ namely:
Continuity at $x=0$ is clear:
Given $\epsilon>0$ take $\delta=\epsilon$ and you'll have that $$ |f(y)-f(x)|=|f(y)|<\epsilon $$ whenever $|y|<\delta$ because $f(y)$ is either $0$ or $y$.
If $x\neq0$ you use the density of $\Bbb Q$ to show that you can find arbitrarily close $y$ near $x$ such that $|f(y)-f(x)|$ is larger than a suitably chosen $\epsilon$.
To work this out carefully, you have to distinguish between the two cases $x\in\Bbb Q$ and $x\notin\Bbb Q$.