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!

  • $\begingroup$ I'm not sure I understand what "almost" means, mathematically. $\endgroup$ Sep 17, 2011 at 15:44
  • 8
    $\begingroup$ @Peter, "P is true almost everywhere" is the same as saying "The set of points where P is false is a measure-zero set". $\endgroup$
    – Srivatsan
    Sep 17, 2011 at 16:18

2 Answers 2


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)

  • 2
    $\begingroup$ Very nice (and also natural) example. Thanks! Unfortunately, I already ran out of my votes; I cannot upvote this today. :-) [Added: Yes, I saw the full solution inadvertently, but I guess your hint would have worked for me as well. I know how to construct the requisite $C$.] $\endgroup$
    – Srivatsan
    Sep 17, 2011 at 4:24
  • 1
    $\begingroup$ @Mathemagician1234: I do not understand what "intersection of all subsets of R where m ({ x: f(x) = 0}" means. It is incorrect that you need to find open balls. Every open interval in $\mathbb R$ contains rational numbers, so every open interval will contain points where $f$ is positive. $\endgroup$ Dec 4, 2011 at 5:29
  • 3
    $\begingroup$ @Mathemagician1234: That is incorrect, and is confusing a correct statement with its incorrect converse. If a set is open, or contains an open subset, then it has positive measure. The converse is false. For example, there are dense sets with measure 0. Observe that $\mathbb R\setminus \mathbb Q$ contains no open set, but has positive measure. Also, please take a look at fat Cantor sets, for examples of sets of positive measure that do not differ from an open set by merely a null set. Here, however, the point is that there are closed subsets of irrationals with positive measure. $\endgroup$ Dec 4, 2011 at 18:15
  • 2
    $\begingroup$ @Mathemagician1234 : $\mathbb{R} \setminus \mathbb{Q}$ is the set-theoretic difference, not the quotient space. In other words, $\mathbb{R} \setminus \mathbb{Q}$ is the set of irrational numbers, not the result of squashing all the rational numbers in $\mathbb{R}$ to a single point. $\endgroup$
    – Adam Smith
    Dec 4, 2011 at 21:44
  • 2
    $\begingroup$ @Math: Here is some standard notation: $\mathbb R/\mathbb Q$ is a quotient, while $\mathbb R\setminus \mathbb Q=\{x\in\mathbb R:x\not\in\mathbb Q\}$, the latter being the same thing you denoted "$\mathbb R-\mathbb Q$" or "$\mathrm{comp}(\mathbb Q)$ in $\mathbb R$". I used a backslash, meaning the set difference, rather than a forward slash, which would mean a quotient. $\endgroup$ Dec 5, 2011 at 2:58

Here's another approach to the question, in hint form:

(1) Construct a function $f(x)$ that is continuous, nonnegative, positive at $x=0$, bounded above by 1, and supported on an interval of length at most 1.

(2) Deduce that if $a,b>0$ and $c$ are real numbers, then $a f(b(x-c))$ is continuous, nonnegative, positive at $x=c$, bounded above by $a$, and supported on an interval of length at most $1/b$.

(3) Let $q_1,q_2,q_3,\dots$ be an enumeration of the rationals. Show that the function $$\sum_{j=1}^\infty 2^{-j} f\big( 2^j(x-q_j) \big)$$ is continuous, nonnegative, positive at every rational number, but equal to zero on a set of infinite measure.

  • 1
    $\begingroup$ +1 for this "complementary" solution to the approaches suggested above. $\endgroup$ Dec 4, 2011 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.