Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I prove that the function $$ f(x) = \left\{\begin{array}{l l} x &\text{if }x \in \mathbb{Q} \\ -x & \text{if } x \notin \mathbb{Q} \end{array} \right. $$ is discontinuous for $x \neq 0$, using $\epsilon$'s and $\delta$'s?

I see that is truth. But I cannot prove using only $\epsilon$'s and $\delta$'s.

share|cite|improve this question
Fix $x\ne0$. Set $\epsilon=|x|$. Then show no matter how small $\delta>0$ is, there is a $y$ (depending on $\delta$) with $|y-x|<\delta$ and $|f(x)-f(y)|>\epsilon$. (Drawing a picture will help.) – David Mitra Mar 23 '12 at 19:07
up vote 10 down vote accepted

Let $x_0\ne 0$ be fixed. Informally, $f$ is continuous at $x_0$ would mean that $f(x)$ can be made as close to $f(x_0)$ as desired by taking $x$ sufficiently close to $x_0$. With the epsilon business, this means that $\color{maroon}{ \text{for every}}$ $\epsilon>0$, there is a $\delta>0$ such that $$\tag{1} \underbrace{|f(x_0)-f(x)|<\epsilon}_{f(x)\text{ is close to }f(x_0)} \quad\text{ whenever }\quad \underbrace{|x-x_0|<\delta\phantom{f}}_{x\text{ is close to }x_0}.$$

If $f$ were not continuous at $x_0$, this would mean that there $\color{maroon}{ \text{is some}}$ $\epsilon>0$ such that no matter what $\delta$ you choose, equation $(1)$ is not true. Informally, this means that no matter how close you take $x$ to $x_0$, you are not guaranteed that $f(x)$ is close to $f(x_0)$ and, in fact, you can find an $x$ as close to $x_0$ as you wish with $f(x)$ "far" away from $f(x_0)$.

So you need to show the following is true:

S: There is some $\epsilon>0$ such that for every $\delta>0$, there is a $x_1$ such that both $|x_1- x_0|<\delta$ and $|f(x_1)-f(x_0)|\ge \epsilon$.

Well, how to accomplish this? Let's consider the graph of our function (as far as we can; of course, it's impossible to actually draw the graph of $f$ but we'll use our imaginations) and try to get some intuition as to what the required $\epsilon$ should be. The graph of your function resembles the graphs of the lines $y=\pm x$; or, if you will, an X shape. For rational values of $x$, the point $\bigl(x,f(x)\bigr)$ is on the graph of $y=x$; and for irrational values of $x$, the point $\bigl(x,f(x)\bigr)$ is on the graph of $y=-x$.

I suggest you draw the picture now (when I have time, I'll provide one though).

Now if you take any open interval $I$ containing $x_0$, you can find both a rational number and an irrational number in $I$. (Why? This is the gist of the whole argument, so it's worthwhile that you convince yourself that you can.) Thus, you can find a point $x_1$ in $I$ that is irrational if $x_0$ is rational and which is rational if $x_0$ is irrational. It will follow then that $f(x_0)$ and $f(x_1)$ are far apart. In fact, they are approximately $2|x_0|$ away from each other when $I$ has small length, since, if you'll allow a sloppy and vague statement, $f(x_0)$ and $f(x_1)$ are on different arms of the X.

This leads us to suspect that $|x_0|$ would serve for the $\epsilon$ needed in statement S. And now it's a matter to formalize things. We need to show that statement S holds.

Let $0 < \epsilon < |x_0|$.

Let $\delta>0$ be arbitrary.

We need to show that there is an $x_1$ with $|x_0-x_1|<\delta$ such that $|f(x_0)-f(x_1)|\ge\epsilon $.

The preceding discussion points to a way towards finding $x_1$. Choose $x_1$ to be an irrational number with $|x_0-x_1|<\delta$ if $x_0$ is rational. If $x_0$ is irrational, choose $x_1$ to be an rational number with $|x_0-x_1|<\delta$.

Now we show this choice of $x_1$ "works":


$\ \ \ \ \ f(x_0)=x_0$ and $f(x_1)=-x_1$


$\ \ \ \ \ f(x_0)=-x_0$ and $f(x_1)= x_1$.

In either case $|f(x_0)-f(x_1)| = |x_0|+|x_1|\ge |x_0|>\epsilon. $

And that's it...

share|cite|improve this answer
Sorry, just found something may be unintentionally neglected, please mind not that I slightly modified your nice answer. :) I replaced "Let $\varepsilon = |x_{0}|$" by "Let $0 < \varepsilon < |x_{0}|$" so that the whole argument is consistent. – Gudson Chou Mar 26 '15 at 5:27

Let $x>0$, and assume that we can find a $\delta>0$ such that if $|y-x|\leq\delta$ then $|f(x)-f(y)|<x/2$. If $x$ is rational, it means $|x-f(y)|<x/2$ so $x/2<f(y)<3x/2$ for all $y\in (x-\delta,x+\delta)$. In particular, $y\in\mathbb Q$ for all $y\in (x-\delta,x+\delta)$. If $x$ i irrational, then $|x+f(y)|<x+2$ so $x/2<-f(y)<3x+2$ and $y$ has to be irrational if it is in $(x-\delta,x+\delta)$.

Do you see why it leads to a contradiction?

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.