# Determining discontinuity on a set

For the following set, construct $f:\mathbb{R} \to \mathbb{R}$ such that it is discontinuous at every point in the set and continuous on the complement.

This is the set I am given:

Let $X$= $(0,1)$.

Here is my proposed answer, but I am not sure how to prove it works.

Suppose $f(x) = \begin{cases} 0&\text{if$x\leq 0$}\\ 1 &\text{if$x \in (0,1)$and rational,} \\ 2 &\text{if$x \in (0,1)$and irrational, and} \\ 0 &\text{if$x\geq 1$} \\ \end{cases}$

Does this work?

Your function won't be continuous at $0$ and $1$. (For $0$, the right-hand limit does not exist and for $1$, the left-hand limit does not exist.) You can rectify this by defining \begin{aligned} f(x):= \begin{cases} \ \ \ \ \ 0 &\text{ if } \ \ x\notin X\cap\mathbb{Q}\\ x^{2}-x &\text{ if } \ \ x\in X\cap \mathbb{Q} \end{cases}. \end{aligned}

This function will still be discontinuous on all of $X$. But, it will now be continuous on all of $X^{c}$, including $0$ and $1$. You should check the details here, but it's basically because $0$ and $1$ are zeros of $x^{2}-x$.

• Why would the function not be continuous at $0$ and $1$? Wouldn't the function equal $0$ at those points? Nov 12 '17 at 21:34
• For your function to be continuous at $0$ say you would need $\lim_{x\to 0} f(x)=0$. But the right-hand limit $\lim_{x\to 0^{+}}f(x)$ does not exist, since as $x$ approaches $0$ from the right, your function oscillates between $1$ and $2$.
– ervx
Nov 12 '17 at 21:39
• No. You would need both the rational and irrational points converging to the same value. If you are using two distinct horizontal lines, this cannot happen. And, if the horizontal lines are not distinct, then the function would be continuous on $X$.
– ervx
Nov 12 '17 at 21:48
• I am not sure I follow your reasoning. I got why the fact that the right and left limits do not exist for either 0 or 1 respectively contradictions the function being continuous at these points. I do not understand how having jumps between 1 and 2 would not give us discontinuity in the interval. Nov 12 '17 at 22:00
• It would. That's not what I meant. Maybe I misunderstood what you said. The function you constructed is discontinuous at all points in $X$. It just happens that it's also discontinuous at $0$ and $1$.
– ervx
Nov 12 '17 at 22:06