For any closed set $A$ of $\mathbb R$ , does there exists a function $f:\mathbb R \to \mathbb R$ such that, $f$ is discontinuous at every point in $A$ but, is continuous at all other points ?
-
9What about $f(x)=0$ for $x\in\mathbb{R}\setminus A$ and $f(x)=1$ if $x\in\mathbb{Q}\cap{A}$ and $f(x)=2$ if $x\in\mathbb{I}\cap{A}$. It will be continuous at each point $x_0$ outside of $A$ as it will be $0$ at an environment of $x_0$ (As $\mathbb{R}\setminus A$ is open), and obviously not continuous at $A$. – Nescio Jun 17 '15 at 13:55
-
1In my humble opinion that's worth an answer instead of a comment. – Alberto Debernardi Jun 17 '15 at 14:32
-
Sorry if I wind up stealing your thunder, Nescio, because that is a really nice, clean example. – Ian Jun 17 '15 at 14:55
-
For the opposite - continuous on a closed set $A$ - let $d_A(x)=\min{\vert x-a\vert: a\in A}$, and let $f(x)=0$ of $x\in A$ or $x\in\mathbb{I}$ and $d_A(x)$ if $x\in\mathbb{Q}\cap\overline{A}$. – Noah Schweber Jun 17 '15 at 16:46
-
@NoahSchweber I'm skeptical, because the minimum needn't be attained if $A$ is not compact. (But I think that does indeed work if $A$ is compact.) – Ian Jun 17 '15 at 17:02
-
@NoahSchweber Your justification is at least sloppy, if not incorrect, but your statement is true. Cf. http://math.stackexchange.com/questions/317479/a-closed-set-in-a-metric-space-is-g-delta and my answer. – Ian Jun 17 '15 at 17:15
-
@Ian I think for $\mathbb{R}$, which is the context of the question, my statement is correct - for $x\not \in A$ and $i=\inf{\vert x−a\vert:a\in A}$, we can find a sequence of points from $A$ approaching either $x−i$ or $x+i$; since $A$ is closed, this means $x−i\in A$ or $x+i\in A$, and either way the minimum is attained. Am I missing something? (I might be, I'm under-caffeinated at the moment.) I believe in general this works for metric spaces which are locally compact, by essentially the same argument. – Noah Schweber Jun 17 '15 at 19:59
-
@NoahSchweber I mean my answer to this question. That question shows that any closed set is a $G_\delta$, and my answer shows that any $G_\delta$ is a set of continuity points, so between the two of them we get that any closed set is a set of continuity points. – Ian Jun 17 '15 at 23:05
-
Ah, I see. But I believe my construction is still an example - or am I missing something? – Noah Schweber Jun 17 '15 at 23:07
-
@NoahSchweber I think you may be right; these "distance to a set" issues always make me a little bit uneasy, though, so I'm more comfortable with an argument like the one I gave. – Ian Jun 17 '15 at 23:09
3 Answers
In general, if $X$ is a topological space, $Y$ is a metric space, and $f : X \to Y$ is a function, then the set of continuity points of $f$ must be a $G_\delta$ set in $X$, meaning a countable intersection of open sets. If $Y=\mathbb{R}$ and $X$ is a metric space with no isolated points (for instance, $\mathbb{R}$) then the converse is true, i.e. for any $G_\delta$ set $A \subset X$, there exists $f : X \to \mathbb{R}$ such that the set of continuity points of $X$ is $A$. A proof of this converse is given here: http://alpha.math.uga.edu/~pete/Kim99.pdf The construction is very similar to Nescio's comment; it is based on the construction of a dense set whose complement is dense, which in $\mathbb{R}$ is naturally given by $\mathbb{Q}$.
Your result follows from this, because an open set is certainly a $G_\delta$ set.
The proof of the first result is not difficult, but it is a little bit tricky. You first introduce the set $A_n$ of "$1/n$-continuity points", i.e. the points $x$ where there exists a neighborhood $U_x$ such that if $y \in U_x$ then $d(f(x),f(y))<1/n$. Then you prove that $A_n$ is open, and that the set of continuity points of $f$ is $\bigcap_{n=1}^\infty A_n$. In a somewhat less general context, this is an exercise in Royden and Fitzpatrick.
The "dual" problem, asking whether there is a function continuous on any given closed set, has the same answer. This follows from the second result above in concert with this: A closed set in a metric space is $G_\delta$ But the trend ends here, because there are $F_\sigma$ sets such as $\mathbb{Q}$ which cannot be a set of continuity points. You can prove this by assuming that $\mathbb{Q}$ is a $G_\delta$ and then using the Baire category theorem to conclude that $\mathbb{Q} \cap \mathbb{I} = \emptyset$ is dense in $\mathbb{R}$, which is an obvious contradiction.
It seemed to be popular enough in the comments so, You can consider a function defined as $f(x)=0$ for $x\in\mathbb{R}\setminus A$ and $f(x)=1$ if $x\in\mathbb{Q}\cap{A}$ and $f(x)=2$ if $x\in\mathbb{I}\cap{A}$. It will be continuous at each point $x_0$ outside of $A$ as it will be $0$ at an environment of $x_0$ (As $\mathbb{R}\setminus A$ is open), and obviously not continuous at $A$.

- 2,426
-
Your last remark might be true, but its justification is not (at least not as is). Because a function can be continuous exactly on the irrationals (indeed Thomae's "popcorn function" is the classic example). – Ian Jun 17 '15 at 17:10
-
In fact your last remark is simply not true at all. Cf. http://math.stackexchange.com/questions/317479/a-closed-set-in-a-metric-space-is-g-delta and my answer. – Ian Jun 17 '15 at 17:15
-
If we take the Cantor's set C and and take its complement E and take the characteristic function f of E then f is continuous on E(being a countable disjoint union of intervals) and it is discontinuous on C since it is perfect and nowhere dense in R and since f is 0 on C.

- 1,275
-
To clarify a little bit, a convergent sequence in $C$ converges to a point in $C$. This does no harm to continuity. A convergent sequence in $E$ could converge to a point in $E$ or to a point in $C$. If it converges to a point in $E$, again no harm is done to continuity. The harm occurs when a sequence in $E$ converges to a point in $C$; since this is possible, the characteristic function of $E$ (or of $C$, of course) is discontinuous on $C$. – Ian Jun 18 '15 at 00:16