Showing limit does not exist at c ≠0. Define $f(x)$ by $$f(x) = \left\{\begin{array}{cc}x,&amp;x\in\mathbb{Q}\\0,&amp;x \notin \mathbb{Q}.\end{array}\right.$$

Show that $\lim_{x \to 0} f(x)=0$ but $\lim_{x \to c} f(x)$ does not exist for any $c \neq 0$.

My attempt:

At $x = c$, the right hand limit (RHL) is
$\begin{align}
\lim_{x \to c^{+}}f(x) &amp; = \lim_{h \to 0} f(c + h) \\
&amp; = \lim_{h \to 0} c + h \\
&amp; = \lim_{h \to 0} c + 0 \\
&amp; = c. \tag{3}\label{3}
\end{align}$

The left hand limit (LHL) is
$\begin{align}
\lim_{x \to c^{-}}f(x) &amp; = \lim_{h \to 0}f(c - h) \\
&amp; = \lim_{h \to 0} 0 \\
&amp; = 0. \tag{4}\label{4}
\end{align}$

From $\ref{3}$ and $\ref{4}$,

$$\lim_{x \to c^{+}}f(x) \neq \lim_{x \to c^{-}}f(x),$$

so the limit does not exist at $x = c$.
Regarding the first part, for any $x \in \mathbb{R}$ it should be clear that $|f(x)|\leq |x|$ (note this is trivially true for irrationals), hence

$$\lim_{h\to 0} |f(0+h)| \leq \lim_{h \to 0} |0+h| = 0$$
so $\lim_{h\to 0} f(0+h) = 0 = f(0)$, hence $f$ is continuous at $x=0$.

On the other hand, take any $c \neq 0$. If $f$ were continuous at $c$ then we would need to show that for any $\epsilon &gt; 0$ there exists some $\delta&gt;0$ so that if $|x-c|&lt;\delta$ then $|f(x)-f(c)|&lt;\epsilon$.

To show that this doesn't work take any $\delta&gt;0$, if $c$ is rational then choose $x$ irrational in $(c-\delta, c+\delta)$, if $c$ is irrational then choose $x$ rational in $(c-\delta,c+\delta)$ so that $|c|&lt;|x|$, in either case, given that $c\neq 0$ we have
$$|f(x)-f(c )| = \begin{cases}|c| &amp; c\in\mathbb{Q}\setminus \{0\}\\|x| &amp; c\not\in\mathbb{Q}\\\end{cases}
\geq |c| &gt; 0$$
so $\epsilon$ cannot be made smaller than $|c|$, so there is no continuity at any $c\neq 0$.
Short answer:

In any neighborhood of $c&gt;0$, $\min_\limits x f(x)=0$ and $\max_\limits x f(x)\ge c$, hence $|f(x)-L|&lt;\delta$ is not possible.