Prove a limit does not exist I was given this function:
$$
f(x)=
\begin{cases}
x+x^2, & x\in\Bbb Q\\
x, & x\notin \Bbb Q
\end{cases}
$$
I first proved that it is continuous at $x=0$.
Now I need to prove that that for every $x_0 \in \mathbb R\setminus\{0\}$ the limit $\lim \limits_{x \to x_0}f(x)$ does not exist.
I know that I need to start by assuming that the limit does exist but I don't know how to reach a contradiction.
 A: 
I know that I need to start by assuming that the limit does exist but I don't know how to reach a contradiction.

That's not necessary. It is sufficient to simply prove that the limit doesn't exist.
And the easiest way to do that is to consider a limit along rational values tending to $x_0$ and compare it with the limit along irrational values tending to $x_0$. That these are different amounts to saying that $x^2 + x \neq x$ when $x \neq 0$.
A: For $x\ne0,$ first note that $x\ne x^2 +x,$ and then let $\varepsilon$ be half the distance between $x$ and $x^2+x.$
Suppose there is a limit $L.$ What value of $\delta$ is small enough to assure  you that if $x-\delta <w<x+\delta$ and $w\ne x$ then $L-\varepsilon < f(w) < L+\varepsilon\text{?}$ Some such values of $w$ are rational so that $f(w)$ will differ from $x+x^2$ by less than $\varepsilon;$ others are irrational so that $f(w)$ will differ from $x$ by less than $\varepsilon.$ Show that that implies that no matter what number $L$ is, they cannot both differ from $L$ by less than $\varepsilon.$
A: Suppose $x_0\ne0$ and there is a limit:
$$
L = \lim_{x\,\to\, x_0} f(x).
$$
Let $\varepsilon = x_0^2/4.$ Then:


*

*There is some number $\delta_1>0$ such that for all values of $x$ between $x_0\pm\delta_1$ we have $|f(x)-L|<\varepsilon.$

*There is some number $\delta_2>0$ such that for all values of $x$ between $x_0\pm\delta_2,$ we have $|(x+x^2)-(x_0+x_0^2)|<\varepsilon.$
Let $\delta=\min\{\delta_1,\delta_2,\varepsilon\}.$
A crucial fact is that no matter how small $\delta$ is, there are both rational and irrational numbers between $x_0\pm\delta.$ So let $x_1$ be a rational number in that interval and let $x_2$ be an irrational number in that interval.
\begin{align}
& |f(x_1)-L|< \varepsilon, \\[8pt]
\text{which means } & |(x_1+x_1^2) - L| < \varepsilon. \tag 1 \\[8pt] 
& |(x_1+x_1^2)-(x_0+x_0^2)| < \varepsilon. \tag 2 \\[8pt]
\text{The triangle } & \text{inequality applied to $(1)$ and $(2)$ yields:} \\
& |L-(x_0+x_0^2)|<2\varepsilon. \tag 3 \\[8pt]
\text{We also have } & |f(x_2)-L|< \varepsilon, \\[8pt]
\text{which means } & |x_2-L|<\varepsilon. \tag 4 \\[8pt]
\text{And we have } & |x_0-x_2| < \delta\le\varepsilon. \tag 5 \\[8pt]
\text{The triangle } & \text{inequality applied to $(4)$ and $(5)$ yields:} \\
& |x_0-L|<2\varepsilon. \tag 6 \\[8pt]
\text{Now the triangle } & \text{inequality applied to $(3)$ and $(6)$ gives us:} \\
& |x_0 - (x_0+x_0^2)|<4\varepsilon. \\[10pt]
\text{So } & x_0^2 < 4\varepsilon \\
\text{and we have } & \text{a contradiction.} 
\end{align}
A: If $\lim_{x\to x_0}f(x)$ exists, then for any sequence of numbers $x_1,x_2,\ldots$ converging to $x_0$, we must have that $f(x_1),f(x_2),\ldots$ converges to $f(x_0)$. In particular we can consider two sequences converging to $x_0$: the first uses only rational numbers, and the second uses only irrational numbers. (This is possible since both $\mathbb Q$ and $\mathbb R\setminus \mathbb Q$ are dense.) Then, since both the function $x\mapsto x^2+x$ and the identity function are continuous, the limit of the rational sequence will be $x_0^2+x_0$ and that of the irrational sequence will be $x_0$. However if $x_0\not=0$ these quantities differ, forming a contradiction.
