I am trying to understand the solution to the following question.

At which $c\in\mathbb{R}$ is the function $f:\mathbb{R}\rightarrow\mathbb{R}$ defined by $$f(x)=\begin{cases}x&\text{if $x$ is rational,}\\1-x&\text{if $x$ is irrational,}\end{cases}$$ continuous?

The solution states that the only answer is $c=1/2$, but am not sure why this is so.

I have thought about what might happen if we suppose (for a contradiction) that $f$ is continuous at some $c\neq1/2$. To arrive at a contradiction, I am trying to use the fact that $\exists$ an irrational number between any two numbers. However, I have not yet managed to arrive at a contradiction.

Could I have some suggestions as to how to progress, please?


For my feeling the whole question is a bit hypothetical. It helps understanding the distribution of rational and irrational numbers and the definition of continuous functions, though.

Per definition, for a continuous function $f(x)$, you can provide a $\delta$ for any given $\varepsilon$, so that $f(x-d)-f(x)<\varepsilon$ for all $d \in [-\delta...\delta]$. More simple, you can add little random deviations to $x$ and you will only get litte random deviations in $f(x)$.

The problem with this function definition is: For any given $\delta$, even the smallest, you will find both rational and irrational numbers between $x$ and $x+\delta$. So, for any $\varepsilon$ smaller $|(x) - (1-x)|$, no $\delta$ can be found to fulfill the requirement.

The requirement for continuous functions can only be satisfied where $x$ and $1-x$ converge. As both are linear functions, they converge only once.

  • $\begingroup$ @ philipp Why have you written 'for any $\epsilon$ smaller $|(x)-(1-x)|$? I would have thought that this should read 'for any $\epsilon$ smaller than $|(x)-(1-c)|\ldots$', where $c\in[-\delta, \delta]$. Please could you explain? $\endgroup$ – Caleb Owusu-Yianoma Apr 15 '15 at 13:22
  • $\begingroup$ $x$ and $1-x$ are the two definitions of $f(x)$, so $|f(x_1)-f(x_2)|$, where $x_1$ is rational and $x_2$ irrational, but both are virtually the same, is $|x-(1-x)|$ $\endgroup$ – philipp Apr 15 '15 at 13:49
  • $\begingroup$ @ philipp By 'both are virtually the same', do you mean that $x_1$ and $x_2$ are almost equal to each other? $\endgroup$ – Caleb Owusu-Yianoma Apr 15 '15 at 14:22

This is because at $x = \frac{1}{2}$ we have $f(x) = \frac{1}{2} = 1 - \frac{1}{2} = 1 - x$

  • $\begingroup$ Alright. However, how do we know whether or not $f$ is continuous at some other point $c\neq1/2$? $\endgroup$ – Caleb Owusu-Yianoma Apr 10 '15 at 18:13
  • $\begingroup$ Think of it this way: We know that the real numbers are dense, with the rationals being countably infinite on any interval, and the irrationals being uncountably infinite. At $\frac{1}{2}$, there are an infinitely dense amount of $x$ with corresponding images $1-x$ in the neighborhood of $f(\frac{1}{2})$. When we aren't at $\frac{1}{2}$, we have an infinite dense interval of points mapping onto $1-x$, and a countable set of points mapping onto $x$, therefore not continuos. $\endgroup$ – Addison Apr 10 '15 at 19:26
  • 2
    $\begingroup$ @CKKOY Suppose that your function is continuous at some $c$. Then: $$\begin{align} \lim_{\substack{r\rightarrow c \\ r\in \Bbb Q}} f(r) & = \lim_{\substack{x\rightarrow c \\ x\in \Bbb R -\Bbb Q}} f(x) &= f(c)\\ \lim_{\substack{r\rightarrow c \\ r\in \Bbb Q}} r &= \lim_{\substack{x\rightarrow c \\ x\in \Bbb R -\Bbb Q}} 1-x & \\ c &= 1-c \end{align}$$ So $c=1/2$ $\endgroup$ – Kitegi Apr 10 '15 at 19:27
  • $\begingroup$ @Farnight This was a very helpful response. $\endgroup$ – Caleb Owusu-Yianoma Apr 11 '15 at 18:18

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.