Riemann integrable function which is discontinuous at an uncountable number of points on every open set

real-analysisriemann-integration

Let $n$ be some positive integer. Does there exist a Riemann integrable function
$$f: [0,1]^n \to \mathbb{R} $$
with the following property: for every non-empty open subset of $U \subset (0,1)^n$, the set
$$ \{x \in U \ \mid \ f \text{ is discontinuous at } x \} $$
is uncountable?

I don't really know how to approach this. I know that a function is Riemann integrable if and only if it is bounded and continuous almost everywhere.

I tried to see if, for instance, I can somehow construct a function like this, such as the characteristic function on the Cantor set in $[0,1]$ (which does not satisfy the above property) and extend it to $[0,1]^n$, but I did not succeed.

Best Answer

Here is an example for $n=1$:

It is known that if $S$ is a $F_\sigma$ set (a countable union of closed sets) in $\Bbb R$, then there is a function $f:\Bbb R \rightarrow\Bbb R$ whose set of discontinuities is $S$. See this post for a reference to a proof.

So, it suffices to find an $F_\sigma$ in $\Bbb R$ of measure zero with the property that its intersection with any non-degenerate open interval is uncountable. Towards this end, for each pair of distinct rationals, construct a Cantor set between them; then take the (countable) union over all such sets. It is easily verified that this gives what's required.

Also, see Dave Renfro's comments above.