educate continuity of a function $f(x)=0$ How can I educate the continuity of $f(x)$, as $f(x)=0\ \forall x \in \mathbb{Q}$ and $f(x)=x\ \forall x \notin  \mathbb{Q}$? Because there is real number between every rational number.
 A: Here's a non-$\epsilon-\delta$ answer to complement the other answer.

Lemma: If $f$ is a continuous function on a topological space $X$, and $g$ is another continuous function such that $f(x)=g(x)$ for all $x$ in a dense subset $D$ of $X$, then $f=g$ on all of $X$.

First notice that $g(x)=x$ and $h(x)=0$ are both continuous functions on $\mathbb{R}$. Then notice that $\mathbb{Q}$ and $\mathbb{R}\setminus\mathbb{Q}$ are both dense in $\mathbb{R}$.
Now if $f$ were continuous, it would have to be equal to both $g$ and $h$, but $g$ and $h$ are obviously not equal... contradiction!
A: Let us proceed by the $\epsilon$-$\delta$ definition of continuity.
It is to be shown that 
$$\forall \epsilon >0 \exists \delta >0: |x|<\delta \implies |f(x)-f(0)|<\epsilon$$
Since $f(0) = 0$, this comes down to $|f(x)|<\epsilon$. Now take $\delta = \epsilon$.
Suppose that $x \in \Bbb R$ has $|x| < \delta$.
Then if $x \in \Bbb Q, |f(x)| = 0 < \epsilon$. If $x \notin \Bbb Q, |f(x)| = |x| < \delta = \epsilon$.
Thence $f$ is continuous at $0$. At other points a similar case distinction can be used to show that $f$ is discontinuous.
