Single Point Continuity - Spivak Ch.6 Q5 I'm having a tough time with this question. Here are my thoughts so far.
$$ $$
Let $f(x) =
\begin{cases}
a, & x\text{ rational}\\
x, & x\text{ irrational}
\end{cases}$
$\hspace{1cm}$
Show that $f(x)$ is discontinuous at all points not $a$, i.e, when $y \neq a$ 
$$ $$
Suppose otherwise, i.e., $\lim \limits_{x \to y} f(x) = f(y)$
Suppose $y$ is rational ($y_r$)
$$\begin{array}
\f \forall \delta \hspace{1cm} |x - y_r| < \delta &\Rightarrow |a - f(y_r)| < \epsilon &&\wedge \qquad |x_i - f(y_r)| < \epsilon \\
&\Rightarrow |a - a| < \epsilon &&\wedge \qquad |x_i - a| < \epsilon \\
\end{array}$$
$$ $$
So as I see it, I need to find an $\epsilon$-$\delta$ to make this statement contradict itself: $|x - y_r| < \delta \Rightarrow|x_i - a| < \epsilon$
But I'm having no luck doing so. Any ideas?
P.S. I tried an alternative version of this method, by supposing $y$ to be irrational. But I reached the same dead end.  
Progress Edit
$$\begin{array}
\forall \forall \delta \ \exists x_i \hspace{1cm} |x_i - y_r| < \delta &\Rightarrow |x_i - a| < \epsilon
\end{array}$$
However, I cannot seem to find contradiction.
$$\begin{array}
.|x_i| > |y_r| - \delta &\Rightarrow |x_i| < \epsilon + |a| \\
&\Rightarrow |y_r| - \delta < \epsilon + |a| 
\end{array}$$
 A: In Particular
Suppose $a = 1$
Suppose $f(x)$ continuous 
\begin{align}
    \forall \delta \hspace{0.5cm} |x - y| < \delta  & \quad \Rightarrow | 1 - f(y) | < \epsilon \quad &&\wedge \quad x_i - f(y) < \epsilon
\end{align} 
Suppose irrational $y_i$, where $y_i > 1 + \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow |1 - y_i| < \epsilon \\
    &\Rightarrow |y_i| < \epsilon + 1 \\
    &\Rightarrow y_i < 1 + \epsilon \\
    \end{split}
\end{equation*}
a contradiction 
Consider rational $y_r$, where $y_i > y_r > 1 + \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow y_i < 1 + \epsilon \\
    &\Rightarrow y_r < 1 + \epsilon \\
    \end{split}
\end{equation*}
a contradiction 
In other words, $f(x)$ is discontinuous for all $y > 1 + \epsilon$ 
Suppose $y_i$, where $y_i < 1 - \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow |1 - y_i| < \epsilon \\
    &\Rightarrow |y_i - 1| < \epsilon \\
    &\Rightarrow 1 - \epsilon < y_i 
    \end{split}
\end{equation*}
a contradiction 
Consider $y_r$, where $y_i < y_r < 1 - \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow 1 - \epsilon < y_i \\
    &\Rightarrow 1 - \epsilon < y_r 
    \end{split}
\end{equation*}
a contradiction 
In other words,  $f(x)$ is discontinuous for all $y < 1 - \epsilon$ 
Generally
Suppose $f(x)$ continuous
\begin{align}
    \forall \delta \hspace{0.5cm} |x - y| < \delta  & \quad \Rightarrow | a - f(y) | < \epsilon \quad &&\wedge \quad x_i - f(y) < \epsilon
\end{align} 
Suppose $y_i$, where $y_i > |a| + \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow |a - y_i| < \epsilon \\
    &\Rightarrow |y_i| < \epsilon + |a| \\
    &\Rightarrow y_i < \epsilon + |a| \\
    \end{split}
\end{equation*}
a contradiction 
Consider $y_r$, where $y_i > y_r > |a| + \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow y_i < |a| + \epsilon \\
    &\Rightarrow y_r < |a| + \epsilon \\
    \end{split}
\end{equation*}
a contradiction 
In other words, $f(x)$ is discontinuous for all $y > |a| + \epsilon$, 
and therefore discontinuous for all $y > a + \epsilon$ 
Suppose $y_i$, where $y_i < a - \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow |a - y_i| < \epsilon \\
    &\Rightarrow |y_i - a| < \epsilon \\
    &\Rightarrow a - \epsilon < y_i 
    \end{split}
\end{equation*}
a contradiction 
Consider $y_r$, where $y_i < y_r < a - \epsilon$
\begin{equation*}
    \begin{split}
        \forall \delta \hspace{0.5cm} |x - y| < \delta  &\Rightarrow | 1 - f(y_i) | < \epsilon \\
    &\Rightarrow a - \epsilon < y_i \\
    &\Rightarrow a - \epsilon < y_r 
    \end{split}
\end{equation*}
a contradiction 
In other words,  $f(x)$ is discontinuous for all $y < 1 - \epsilon$ 
A: Between any two distinct rational numbers, there is an irrational number, and vice versa.
A: hint
Let $b\ne a$ be a rationnal.
then $x_n=b+\frac{\pi}{n}$ is a sequence of irrationals which converges to $b$.
$$f(x_n)=x_n\to b\ne f(b)$$
By the same if $b\ne a$ is irrational, put $y_n=\frac{\lfloor 10^n b\rfloor}{10^n}$ is a sequence of rationals which converges to $b$. but
$$f(y_n)=a\ne f(b).$$
Continuity at $x=a$.
let $(z_n)$ a sequence which goes to $a$.
then
$$f(z_n)=a \text{ or } z_n$$
thus
$$f(z_n)\to a=f(a)$$
A: Let's assume that a limit exists at $x_0$(call it $l$).
In any neighborhood of $x_0$ we can find rational number, so $f(x) = a$, for some $x$.
Choose $\epsilon$ smaller than $|l - a|$. 
This argument doesn't work only if $l$ is $a$. The the limit if exists at any point, it should be $a$.
The only point where it can be the limit is $x_0 = a (= f(x_0))$.
At other points choose $\epsilon$ less than  $|\frac{x_0 - a}{2}|$.
Now choose an irrational $x$ sufficiently close to $x_0$ so that $|x-a|$ is greater than $\epsilon$. 
So that proves not only that it is continuous at only one point, but also that limit doesn't exist at others. 
A: Since $y\ne a$, we know $x$ is irrational and $x\ne a$. 
Let $\epsilon_0=|x-a|>0$. For any $\delta>0$, there exists a rational $r$ such that $|x-r|<\delta$, but $|f(x)-f(r)|=|x-a|=\epsilon_0$. That is, $f(x)$ is discontinuous at $x$.
A: Without loss of generality, fix $a=1$. For $\varepsilon=\dfrac12$ consider the cases:


*

*$x,y\not\in(1-\varepsilon,1+\varepsilon)$. For every $\delta>0$, $|x-y|<\delta\implies |f(x)-f(y)|=|1-y|\geq\dfrac12$
(This is true if either $x\in\mathbb{Q}$ and $y\in\mathbb{I}$ or otherwise.)


*

*If either $x$ or $y\in(1-\varepsilon,1+\varepsilon)$, it follows as above.


For continuity at $x=a$, choose $\delta=\varepsilon$.
