I have:
$$f(x)=\begin{cases} x,&\text{if }x\in\Bbb Q\\ 0,&\text{if }x\notin\Bbb Q\;, \end{cases}$$
This function is continuous at $x=0$, but discontinuous everywhere else? (Between $f(0)=0$ there is an irrational number where $f(x)=0$ either side of $x=0$?)
How would I go about explaining or proving this? (I am fully stuck on trying to start this question off)
Let $\epsilon > 0$. Let $\delta = \epsilon$. Note that $f(0) = 0$.
Let $x \in \mathbb R$ be such that $|x - 0| < \delta$, i.e. $|x| < \delta$. Then, $|x| < \epsilon$.
If $x \in \mathbb Q$, then $|f(x) - f(0)| = |f(x)| = |x| < \epsilon$.
If $x \notin \mathbb Q$, then $|f(x) - f(0)| = |f(x)| = |0| = 0 < \epsilon$.
Therefore $f$ is continuous at $0$.
Let $a$ be irrational and suppose that $f$ is continuous at a.
Due to the denseness of $\mathbb Q$ in $\mathbb R$, there is a sequence $(x_n)_n$ of rationals converging to $a$.
Due to the continuity of $f$ at $a$, we have that $(f(x_n))_n$ converges to $f(a)$.
$a$ is irrational, so $f(a) = 0$. Then, $f(x_n) \rightarrow 0$.
For each $n \in \mathbb N$, $f(x_n) = x_n$ since all the terms of $(x_n)_n$ are rationals. Thus, $x_n \rightarrow 0$. The uniqueness of limits gives $a = 0$.
Now, let $a$ be rational and use the denseness of $\mathbb R - \mathbb Q$ to prove that $a = 0$.
This shows that $f$ can't be continuous at any point but $0$.