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:
- 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.
- If S is closed, we can set f as follows: defined $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.
- 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?