Is this epsilon-delta proof correct?

Consider the function $f:\mathbb{R}\rightarrow\mathbb{R}$ $$f(x)=\begin{cases}x,\ x\in\mathbb{Q} \\ -x,\ x \notin \mathbb{Q}.\end{cases}$$ I'm trying to prove that for all $a \neq 0$, $\lim_{x \to a}f(x)$ does not exist. I tried to do this by contradiction, so my first step was to suppose that $$\lim_{x \to a}f(x)=A,$$ for some $A \in \mathbb{R}$. Then this implies that $$\forall \varepsilon>0\ \exists\delta:\ 0<|x-a|<\delta\implies|f(x)-A| < \varepsilon.$$ So I said, consider some $p \in \mathbb{Q}:0<|p-a|<\delta$, and therefore $|f(p) - A|=|p-a|<\varepsilon_1$. Also consider a $q \in \mathbb{R}, q \notin \mathbb{Q}:0<|q-a|<\delta$, and therefore $|f(q)-A|=|-q-A|=|q+a|<\varepsilon_2$. Since the epsilon-delta definition allows us to choose whatever $\varepsilon$ we want, I chose to let $\varepsilon_1 = p$ and $\varepsilon_2 = q$. This then implies the following $$|p-A|<\varepsilon_1=p \implies p-A<p \implies A>0,$$ $$|q+A|<\varepsilon_2=q \implies q+A<q \implies A<0.$$

Since we cannot have $A>0$ and $A < 0$, this is a contradiction, and therefore the limit does not exist. $\square$

Does this proof seem correct? In particular I'm concerned that I never made use of the fact $a \neq 0$, so I was hoping someone could review it and let me know if there are any errors. This problem is from Spivak's Calculus, 4th ed., and the proof give in the solution book is quite different than mine, so I wasn't able to check my answer that way.

Thanks.

EDIT: Here's the corrected proof.

Assume for some $a > 0$ that $\lim_{x \to a} f(x) = A$, for some $A > 0$. Then from the epsilon-delta definition there is some delta such that $0 < |x-a| < \delta \implies |f(x) - A| < A$. Choose some irrational $q > 0$ such that $0 < |q - a| < \delta$, which implies that $|f(q) - A) = |-q - A| = |q + A| < A$, but this would mean that $q + A < A \implies q < 0$, a contradiction.

To prove that $f$ does not approach a negative limit either, let $\varepsilon = -A$, and pick some $p \in \mathbb{Q}$ such that $0 < |p - a| < \delta$, so therefore $|f(p) - A| = |p - A| < -A$. This implies that $p - A < -A \implies p < 0$, again a contradiction.

Finally, to prove that $f$ does not approach a $0$ limit, let $\varepsilon = a$, and then pick some $y > a$ such that $0 < |y-a| < \delta$. This would imply that $|f(y)| = y < a$, which is again a contradiction, so $f$ does not approach a limit for $a > 0$, and therefore $a < 0$. $\square$

• The epsilon-delta definition allows you to choose whatever $\epsilon$ you want, but once you've picked $\epsilon$, some $\delta$ is handed to you depending on $\epsilon$ and you only have the implication $|x - a| < \delta \implies |f(x) - A| < \epsilon$ for that particular $\epsilon$-$\delta$ pair. So you can't pick an $x$ ($p$, $q$ in your case) satisfying $|x - a| < \delta$ and then change $\epsilon$. – Magdiragdag Oct 11 '13 at 20:25
• Akk, I shouldn't have missed that! Thanks. – user71641 Oct 11 '13 at 20:33

I'm afraid not. You're supposed to be able to fix some distance $\epsilon>0,$ at which point you can find some distance $\delta>0$ such that $f(x)$ is within $\epsilon$ of $A$ so long as $x\ne a$ is within $\delta$ of $a$. We can of course use that $\delta$ (as you seem to be doing) to come up with a smaller $\epsilon'$, but then we'd in turn find a (probably) smaller $\delta'$ that worked. This is where your argument fails.

To reach a contradiction, then, you'll need to choose your $\epsilon>0$ with some care, depending on what $a$ is. I recommend that you sketch a graph of the function, using dotted lines to give yourself the idea. It should make clear how tight we need to make the vertical window around $A$ so that we can always find $x$ arbitrarily close to $a$ for which $f(x)$ is not in that vertical window. (The fact that $a\ne 0$ will be essential to being able to find such a window.)

• Yes, I see my error now, thanks. – user71641 Oct 11 '13 at 20:35
• So I think I have a new proof now, do you mind checking this one? We know from our definition that $0 < |x-a| < \delta \implies |f(x) - A| < \varepsilon$. Here I'm taking $\varepsilon = A$, and I'm now also taking $a > 0$. So choose some irrational $q > 0$ satisfying $|q - a| < \delta$. It then follows that $|f(q) - A| = |-q - A| = |q + A| < \varepsilon = A$, but this implies that $q + A < A \implies q < 0$, which is a contradiction since $q > 0$. $\square$ – user71641 Oct 11 '13 at 22:43
• That's nearly got it, but how do you know that $A$ is positive? – Cameron Buie Oct 11 '13 at 22:58
• Ahh, good catch. So that proves that it does not approach a positive limit, and then to prove it does not approach a negative limit we let $\varepsilon = -A$. In that case we fix a $p > 0, p \in \mathbb{Q}$ such that $0 < |p - a| < \delta$ so that $|f(p) - A| = |p - A| < \varepsilon = -A$, so $p - A < - A \implies p < 0$, which is again a contradiction. $\square$ – user71641 Oct 11 '13 at 23:06
• Here's a better plan: It's fine to go ahead and assume that $a$ is positive, since $f$ is an even function, so let $\epsilon=\frac12a.$ Show that $A$ can't be $0,$ and then deal with the possibilities that $A$ might be positive or negative separately, using density arguments. – Cameron Buie Oct 11 '13 at 23:14

Here is a 'constructive' proof:

Since $f(-x) = -f(x)$, we may assume that $a>0$.

Choose $x \in \mathbb{Q}$ such that $x \ge a$ and $x' \in \mathbb{Q}^c$ such that $x' \ge a$. Then $f(x)-f(x') = x+x' \ge 2 a$.

Choose $A\in \mathbb{R}$, then $(f(x)-A)+(A-f(x')) \ge 2 a$, and hence $\max(f(x)-A, A-f(x')) \ge a$ (otherwise an immediate contradiction).

Let $\delta>0$, then we can choose the $x,x'$ above so that $|x-a|< \delta$ and $|x'-a|< \delta$. Then either $|f(x)-A| \ge a$ or $|f(x')-A| \ge a$. Hence the limit does not exist.