[Math] If a continuous function is positive on the rationals, is it positive almost everywhere

examples-counterexamplesmeasure-theoryreal-analysis

I made up this question, but unable to solve it:

Let $f : \mathbb R \to \mathbb R$ be a continuous function such that $f(x) > 0$ for all $x \in \mathbb Q$. Is it necessary that $f(x) > 0$ almost everywhere?

This is my attempt.

  1. It is easy to show that $f(x) \geq 0$ everywhere, so the real question is whether $f$ can be zero at an "almost all" irrational points.

  2. The function can become $0$ at isolated points, e.g., $f(x) = (x – \sqrt{2})^2$. In particular, the qualification "almost" is necessary for the question to be nontrivial.

  3. Every rational point has an open neighborhood where $f$ is positive. Hence at least know that the set $\{ x \,:\, f(x) > 0 \}$ is not a measure-zero set.

  4. I first mistakenly assumed that Thomae's function provides a counter-example to this. Indeed, it is positive at all rationals and zero at all irrationals, but the function is continuous at only the irrationals, not everywhere.

Then I tried to prove that the question has an affirmative answer, but do not have much progress there. Please suggest some hints!

Best Answer

Here's a hint: If you can think of closed set $C \subset \mathbb{R}$ of positive measure containing no rationals, then the function sending $x$ to its distance from $C$ is an example.

(I changed this because I just realized you were looking for a hint)

Related Question