# Possible subsets of reals that equal the set of continuity of a function

This should be an easy question, but I don't quite know how to approach it. It may be somewhat related to the concepts mentioned in the context of this past question, though it was motivated mainly by the college calculus course I am teaching.

Question: Characterize those subsets S of the reals for which there exists a function f defined on the reals such that the set of points in the reals where f is continuous is precisely S.

Variant(s): Same as above, but we require f to be Borel (inverse images of Borel sets are Borel) or Lebesgue measurable (inverse images of Borel sets are measurable).

What I know:

1. If S is open, we can set f as the function that is 0 on S, 1 on the rationals outside S and -1 on the irrationals outside S. This is continuous only on S.
2. If S is closed, we can set f as follows. Define $d(x,S)$ as the distance from x to S. Define $f(x) = 0$ if $d(x,S)$ is rational and $f(x) = d(x,S)$ if $d(x,S)$ is irrational. Since $d(x,S)$ is continuous and is zero precisely on S, our f works.
3. We can combine the above two tricks to handle S locally closed, i.e., the intersection of an open and a closed set.

I suspect that the set of possible Ses that arise as the sets of continuity form a $\sigma$-algebra. Is this true? If it is (or perhaps through some other method) we could probably show that all Borel sets are of this form.

[ADDED: For instance, there is the famous example of the function that is $1/n$ on all rationals with denominator $n$ in simplified form and $0$ on all irrationals -- that is an example of a function that is continuous only on the irrationals.]

Assuming the axiom of choice, and allowing non-measurable functions, can we get every possible subset of the reals?

The sets which arise as the points of continuity of a real-to-real function are precisely the $G_{\delta}$ sets.

I think the constructive direction only makes use of Borel sets, so the answer to the variant should be the same.

• Could you give a proof or reference? Also, is your statement true for real-valued functions on any domain, or only in the case that the domain is the reals or something realistic? – Vipul Naik Oct 2 '10 at 17:17
• I learned this fact in basic measure theory,but Gerald Itzkowitz,the instructor,used his own notes. I'd bet it's discussed in Angus Taylor's GENERAL THEORY OF FUNCTIONS AND INTEGRATION-my favorite reference for all-things real variables. – The Mathemagician Oct 2 '10 at 23:50

From the wikipedia page for $G_{\delta}$ sets:

A key property of $G_{\delta}$ sets is that they are the possible sets at which a function from a topological space to a metric space is continuous. Formally: The set of points where a function $f$ is continuous is a $G_{\delta}$ set. This is because continuity at a point $p$ can be defined by a $\Pi_2^0$ formula, namely:

For all positive integers $n$, there is an open set $U$ containing $p$ such that $d(f(x),f(y)) < 1 / n$ for all $x,y$ in $U$.

If a value of $n$ is fixed, the set of $p$ for which there is such a corresponding open $U$ is itself an open set (being a union of open sets), and the universal quantifier on $n$ corresponds to the (countable) intersection of these sets.

In the real line, the converse holds as well; for any $G_{\delta}$ subset $A$ of the real line, there is a function $f: \mathbb{R} \to \mathbb{R}$ which is continuous exactly at the points in $A$.

As a consequence, while it is possible for the irrationals to be the set of continuity points of a function (see the popcorn function), it is impossible to construct a function which is continuous only on the rational numbers.