Consider $f(x)=\begin{cases} x, & \text{if $x$ is rational} \\ \frac{1}{x}, & \text{if $x$ is irrational} \end{cases}$

I proved that $f$ is continuous only at $1$ and $-1$ as follows:

Case $1$: $c=0$.

Case $2$: $c$ is rational number that is different than $0,1$ and $-1$.

Case $3$: $c$ is irrational number.

And in each case I assumed that $f$ is continuous and manged to arrive to a contradiction by constructing a sequence say $\{x_n\}$ that converges to $c$, but $\{f(x_n) \}$ either diverges or it converges to a number different than $f(c)$.

And for the case of $1,-1$, I proved that f is continuous by the definition of continuity.

Is my result correct or did I miss something ? And is there a shortcut or faster method than what I did ?


The approach is sound. Without checking the individual steps, it's difficult to verify the proof beyond this point, or to recommend shortcuts.

I don't see to much to shortcut here anyway. You could find most of the points of discontinuity by using the density of the rationals and the irrationals. For any point $x \in \Bbb{R}$, you know that there is a sequence of rationals $a_n \to x$ and a sequence of irrationals $b_n \to x$. Since $x$ is continuous, $f(a_n) = a_n \to x$. Since $\frac{1}{x}$ is continuous (for $x \neq 0$), $f(b_n) \to \frac{1}{x}$.

If $x \neq \frac{1}{x}$ (and $x \neq 0$), then you have two sequences converging to $x$, that map to sequences converging to different limits. This would contradict $f$ being continuous at $x$.

This doesn't establish that $f$ is continuous at $x = \pm 1$, so more individual verification is needed. The $x = 0$ case needs to be dealt with separately too.

So, I wouldn't consider it much of a shortcut! But it might cut down your argument a little.

  • $\begingroup$ Why would you check $x=0$ separately ? $x=\frac1x$ cannot be fulfilled. $\endgroup$ – Yves Daoust Jun 10 '19 at 16:17
  • $\begingroup$ @YvesDaoust That is what I'm worried about ... do I have to check that case since your argument dose not account for a separate case fo x=0 $\endgroup$ – I0_0I Jun 10 '19 at 16:19
  • $\begingroup$ @YvesDaoust Because it doesn't work with the argument used for $x \neq 0$. The argument used the continuity of $\frac{1}{x}$ at the given $x$. This is not true (or meaningful) at $x = 0$. $\endgroup$ – Theo Bendit Jun 10 '19 at 16:20
  • $\begingroup$ @TheoBendit: ok. Anyway it is pretty immediate, as $1/x$ diverges. $\endgroup$ – Yves Daoust Jun 10 '19 at 16:21

The limit of $f(x)$ by the rationals is $x$. The limit of $f(x)$ by the irrationals is $\dfrac1x$. So for the limit of $f(x)$ to exist, one must fulfill


In a neighborhood of $x=1$, $|x-1|$ and $|\frac1x-1|=\frac{|x-1|}x$ are virtually equal, so that a $\delta-\epsilon$ argument is easy. Same around $-1$.

  • $\begingroup$ How to make this argument precise ( I mean using the definition ) ? $\endgroup$ – I0_0I Jun 10 '19 at 16:01
  • $\begingroup$ @yousefmagableh: $x=1/x$ is an obvious necessary condition (convergent subsequences). You can show that it is sufficient by computing the limits at $\pm1$. $\endgroup$ – Yves Daoust Jun 10 '19 at 16:04
  • $\begingroup$ You mean using Bolzano theorem ? $\endgroup$ – I0_0I Jun 10 '19 at 16:07
  • $\begingroup$ @yousefmagableh: nope. If two subsequences converge to different limits, the limit does not exist. $\endgroup$ – Yves Daoust Jun 10 '19 at 16:09
  • $\begingroup$ @yousefmagableh: no, it doesn't require BW. $\endgroup$ – Yves Daoust Jun 10 '19 at 16:19

You method (if you did it correctly) is sound and solid.

An alternative that is perhaps more direct but not shorter or easier would be an $\epsilon$ delta proof.

Rough argument For any $c$ not equal to $\pm 1$ and any $\delta$ you can find rational $x < c$ and irrational $y> c$ so that $x,y \in (c-\delta, c+\delta)$ so that also; either $1<x<c < y$ if $c > 1$; or $0 < x < c < y < 1$ if $0<c < 1$; or $1 < x < 0 < y < 1$ if $c = 0$; or $-1 < x < c <y$ if $-1 < c < 0$; or $x < c < y < 1$ if $c< -1$.

If we compare the values of $f(x)$ to $f(y)$ to $f(c)$... well, if $c =0$ then $|f(y)-f(c)| = |\frac 1y - 0| = \frac 1y > 1$. Otherwise $f(c)$ will be on "one side" of $\pm 1$ whereas one or the other of $f(x)$ or $f(y)$ will be on the other so that will be a $|f(x|y) - f(c)| > |c -(\pm 1)|$.

So for any $\epsilon$ less than $|c-(\pm 1)|$ there is no $\delta$ that can guarantee that $|w - c|< \delta \implies |f(w) - f(c)|< \epsilon$.

So $f$ is not continuous at $c$.

Of course there are cases to be made. ($c$ rational vs. $c$ irrational and $c= 0$ vs. $0< |c| < 1$ vs. $|c| > 1$ ) But the argument is the same: you can always find an irrational or rational $w$ so that $f(w) >:< \pm 1$ while rational or irrational $c$ is such that $f(c) <:> \pm 1$.


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.