Proving that the limit doesn't exist. I'm trying to prove that the limit of 
$f(x)=\left\{
 \begin{array}{ll}
  x-1  & \mbox{if } x\in\mathbb{Q}\\
  5-x & \mbox{if }x\in\mathbb{R}-\mathbb{Q}
 \end{array}
\right.$ doesn't exist when $x\rightarrow a,$ for every $a\neq3.$ 
I have some problems proving it. My attempt is based in given $\delta>0$  there exists $x$ (in fact a lot) such as $0<|x-a|<\delta$ and $f(x)>a/2$ and $0<|x-a|<\delta$ and $f(x)<-a/2.$But this idea only works when we have $x>5$ or $x<1.$
I cannot prove it in the other cases. Is there another way easier to prove it?
I'd appreciate any kind of help. Thanks in advance!
By the way, I proved that the limit exists when $a\rightarrow3$ because of lateral limits.
 A: You can use the fact that, given any real number $a$, you can find a sequence $(b_n)$ consisting of rational numbers and a sequence $(c_n)$ consisting of irrational numbers, both converging to $a$.
If the limit $\lim_{x\to a}f(x)$ exists, then also
$$
\lim_{n\to\infty}f(b_n)
$$
and
$$
\lim_{n\to\infty}f(c_n)
$$
exist and they're equal to the first limit. However,
$$
\lim_{n\to\infty}f(b_n)=\lim_{n\to\infty}(b_n-1)=a-1
$$
whereas
$$
\lim_{n\to\infty}f(c_n)=\lim_{n\to\infty}(5-c_n)=5-a
$$
So, in order the limit exists, it is necessary that
$$
a-1=5-a
$$
that is, $a=3$. If $a\ne3$, the limit $\lim_{x\to a}f(x)$ doesn't exist.

Note that the above is not a proof that the limit exists when $a=3$. However, in this case you know the limit must be $2$ and you can prove it is indeed the limit with an $\varepsilon$-$\delta$ proof.
A: Think of it this way, when $x\rightarrow a$, you have $a-1$ and $5-a$. If the limit exists, then $a-1=5-a$ and thus $a=3$. So the limit exists only when $a=3$.
A: I will assume that you have already seen proofs of the facts that (i) every non-empty interval contains a rational number and (ii) every non-empty interval contains an irrational number.
We show that if $a\ne 3$ then the limit does not exist. Let $a\ne 3$, and suppose to the contrary that $\lim_{x\to a} f(x)=L$. 
Let $\epsilon$ be small in comparison to the distance between $a$ and $3$. For definiteness we pick  $\epsilon=\frac{|a-3|}{10}$. We will show that there is no $\delta$ such that for all $x$ with $0\lt |x-a|\lt \delta$, we have $|f(x)-L|\lt \epsilon$. For suppose there is such a $\delta$.  
In the interval $0\lt |x-a|\lt \delta$, there is a rational number $u$ and an irrational number $v$ such that $|u-v|\lt\epsilon$.
Since $u$ is rational, we have $f(u)=u-1$, and therefore  $|u-1-L|\lt \epsilon$, so
$$L+1-\epsilon \lt u\lt L+1+\epsilon\tag{1}.$$
Since  $v$ is irrational, we have $f(v)=5-v$, and therefore 
$$5-L-\epsilon \lt v \lt 5-L+ \epsilon.\tag{2}$$
From (1) and (2), by adding, we get
$$6-2\epsilon \lt u+v\lt 6+2\epsilon.\tag{3}$$
But since $|u-v|\lt \epsilon$, we have 
$$-\epsilon\lt u-v\lt \epsilon.$$
Adding, we get $6-3\epsilon\lt 2u\lt 6+3\epsilon$,
and therefore 
$$-\frac{3}{2}\epsilon \lt u-3\lt \frac{3}{2}\epsilon.\tag{4}$$ 
However, $u-3=(a-3)+(u-a)$, and therefore 
$$|u-3|\ge |a-3|-|u-a|\ge 10\epsilon-\epsilon=9\epsilon,$$
which contradicts (4). 
