$g:\Bbb R\to \Bbb R$ is defined by: $$g(x)= \begin{cases} x &\text{if $x\in \mathbb{Q}$}\\ -x &\text{if $x\notin \mathbb{Q}$} \end{cases} $$

Prove that $\lim\limits_{x\to0} g(x) = 0$ using $\delta/\epsilon$.

I'm not sure how to tackle this question. Usually delta epsilon proofs are done with functions and numbers, but here it is element of rational or not element of rational, and I have no idea how to do this question. Any hints/suggestions would be nice.

  • 2
    $\begingroup$ $g$ is still a function, and $x$ and $g(x)$ are still numbers. The $\epsilon$-$\delta$ proof works exactly the same way it always does. $\endgroup$
    – Arthur
    Jan 3, 2017 at 1:48

4 Answers 4


Consider $\epsilon>0$ and take $\delta=\epsilon$. It follows that if $|x-0|=|x|<\delta$ then $|g(x)-0|=|x|<\epsilon$. The whole point is that $|g(x)|=|x|$ regardless of the (ir)rationality of $x$.

  • 7
    $\begingroup$ Why all these downvotes? Am I missing something obvious? $\endgroup$
    – Momo
    Jan 3, 2017 at 1:50
  • 1
    $\begingroup$ Don't worry about nefarious down voters. Here is my +1 to compensate $\endgroup$
    – Paramanand Singh
    Jan 3, 2017 at 11:34

This proof is done with functions and numbers, just like other delta-epsilon proofs. The function is $g(x)$, and every $x$ is a number.

Try writing a complete delta-epsilon proof showing that the function $f$ defined by $f(x) = x$ satisfies $\lim_{x\to0} f(x) = 0.$ If you do that proof correctly, it should translate almost$^*$ word-for-word into a proof for your function $g(x)$. The trick is to do the first proof correctly, of course.

$^*$ You may end up wanting to use a few extra words to explain why $\lvert g(x) - 0 \rvert < \epsilon$ for $x\not\in\mathbb Q$ as well as for $x\in\mathbb Q$, depending on how you worded the proof for $f$.


Hint Try to prove that in general for a function you have $\lim\limits_{x \to a} f(x)=0$ if and only if $\lim\limits_{x \to a} |f(x) |=0$.


It's still a function. Not a continuous function but still a function.

Do it as you normally would. If $|g(x) - c| < \epsilon$ what does that say about $|x - a|$? If you can find some way that for all $\epsilon$ there is a $\delta$ so that $|x-a| < \delta \implies |g(x) - c| < \epsilon$ then $\lim\limits_{x\rightarrow a} g(x) = c$.

Just do it the same way.

$|g(x) - c| = |g(x) - 0| = |\pm x - 0| < \epsilon \implies$

$|x| < \epsilon \implies$

$|x - 0| < \epsilon$.

So..... set $\delta = \epsilon$

$|x - 0| < \delta \implies |x| < \delta$

Either $g(x) =x$ or $g(x) = -x$. Either way $|g(x) - 0| = |g(x)| = |x| $.

So $|g(x) - 0| =|x| < \delta =\epsilon$

.... and we are done! $\lim\limits_{x\rightarrow 0} g(x) = 0$.


If you try to picture this function the graph will be two lines, both "blurry" with disjoint holes, making an X. As x goes toward 0, g(x) bounces around to x and -x like a flea. But at $x = 0$ both the $-x$ and $x$ lines "converge" at 0.


It's interesting to note $\lim\limits_{x \rightarrow a, a \ne 0} g(x)$ is not defined. (If $x \in (a-\delta, a+\delta)$ and $x$ is rational then $g(x) \in (a - \delta, a + \delta)$ but if $x$ is not rational $g(x) \in (- a - \delta, - a + \delta)$ so they don't "hone in" on anything.

If you have had the definition of continuous then it's interesting that $g(x)$ is continuous at $x = 0$ but nowhere else. If you haven't had the definiton of continuous ... well, you have something to look forward to.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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