The following question was in a high school teacher's guide:

Let $f\colon\mathbb{R}\rightarrow\mathbb{R}$ defined by $$f(x)=\begin{cases} x & x\in\mathbb{R}\setminus\mathbb{Q}\\ 2x & x\in\mathbb{Q} \end{cases}$$ Is $f$ Riemann integrable in $\mathbb{R}?$ A student claims that this function is (Riemann) integrable in $\mathbb{R}$. Which Theorem would you use to check the validity of such a claim?

My question is:

How would you explain to (high school) students (i suppose intuitively) that this function is not Riemann integrable?

  • 5
    $\begingroup$ What is the wording of the definition of Riemann integrability known to the students? $\endgroup$
    – Jasper
    Commented Sep 28, 2019 at 16:24
  • 10
    $\begingroup$ Is there a list of theorems which I can apply? What do the students know? Personally, I would just refer to the definition of the Riemann integral... if we attempt to evaluate $$\int_{0}^{1} f(x)\,\mathrm{d}x, $$ we will quickly realize that the upper sum will always significantly greater than the lower sum. $\endgroup$
    – Xander Henderson
    Commented Sep 28, 2019 at 17:47
  • 4
    $\begingroup$ Ya, I agree that this is best proven directly from the definition of Riemann integrability. The only theorem I know which would be useful here characterizes the Riemann integrable functions as those whose set of discontinuities are measure zero. That does immediately give the result, since $f$ is discontinuous everywhere except for at $x=0$, but I don't know any state which requires high school teachers to know about measure theory. $\endgroup$ Commented Sep 28, 2019 at 21:17
  • 5
    $\begingroup$ (I have to say that I think it's mildly perverse to pose this as any sort of mainstream question to kids just learning calculus...) $\endgroup$ Commented Sep 29, 2019 at 3:54
  • $\begingroup$ What does the student claim to be the value of the integral in, say, $[0,1]$? $\endgroup$
    – David
    Commented Oct 7, 2019 at 10:39

3 Answers 3


As @Adam noted, a function is Riemann integrable if and only if it is almost everywhere continuous. Giving a proof in terms of the Darboux integral (upper and lower sums) would also be rigorous. However, all of these might be a bit mysterious to a high school calculus student. The main pedagogical point to make with a problem like this would be along the lines of noting that not every function is integrable and that we need to pay attention to hypotheses and definitions.

Personally, I would take the following approach when trying to explain intuitively why this function isn't Riemann integrable—citing a theorem from measure theory feels a bit unsatisfying. Basically, if we're going to move into the weird word of measure theory, let's start by just dipping in a toe (the indicator function on the rationals), gaining some intuition, and then building towards the function given in the problem.

  1. Show that between any two rational numbers there is an irrational number and vice versa. If you're comfortable with measure theory, you could discuss the measures of the rationals and irrationals.

  2. Analyze the indicator function of the rationals: $$\chi_\mathbb{Q} (x) := \begin{cases} 1 & x \in \mathbb{Q}, \\ 0 & x \in \mathbb{R}\setminus \mathbb{Q}. \end{cases}$$ Discuss that it is indeed a well-defined function, that it is nowhere continuous, and is not Riemann integrable. The numbers here are much easier to deal with than the original function! You could even show how to create a sequence of Riemann sums on the interval $[0,1]$ such that the limit is any number between $0$ and $1$.

  3. Repeat for the function $g(x) = x\cdot \chi_\mathbb{Q}(x)$. Be sure to note that this function is continuous at only a single point! Alternatively, see if they can come up with this one on their own--ask for a well-defined function $g:\mathbb{R} \to \mathbb{R}$ that is continuous at only a single point.

  4. Finally we can analyze the given function $f(x) = x+ x\cdot\chi_\mathbb{Q}(x)$, observing that it has many of the same properties as the previous two functions.

  5. As a coda, note that "infinitely many disconintuities" is not the same concept as "almost everywhere (dis)continuous". The canonical example would be Thomae's function, defined by $$f(x) := \begin{cases} \frac{1}{q} & x=\frac{p}{q}\in\mathbb{Q} \text{ in lowest terms, with $p \in \mathbb{Z}$ and $q \in \mathbb{N}$,} \\ 0 & x \in \mathbb{R}\setminus \mathbb{Q}. \end{cases}.$$ This function has the following curious properties:

    • It is indeed a well-defined function.
    • It is discontinuous at every rational number and continuous at every irrational number (straightforward $\epsilon$-$\delta$ proof).
    • It is Riemann integrable! It's easiest to just draw boxes, but a rigorous proof is reasonably straightforward as well. Intuitively, there are only so many spikes in the function over any given height and these get contained in narrower and narrower rectangles.
  6. If you introduce Thomae's function, you will invariably be asked if there is a function that is instead continuous at all the rationals and discontinuous at all the irrationals. It can be worth having them think about it for a few days, but the answer is no as this would contradict the Baire Category Theorem.


I would ask a student to justify their claim. How did they arrive at the conclusion that the function is integrable.

There are a couple of problems that the student should have notices, given that usually they only know the fundamental theorem of calculus (and then they look for an antiderivative)

  1. Infinite domain of integration (Riemann definition does not apply)
  2. Lack of antiderivative (so they could not have applied the FTC)

Hence they would have been forced to evaluate upper and lower sums. But again there is the problem of infinite domain. Did they use the definition of improper integral? Or consider the integral over a closed interval. What were their lower/upper sums?


As for theorems: Riemann integrable functions need to be almost everywhere continuous. This function is only continuous at zero.

As for explanations for a high school students, I would do two Riemann sums one using the maximum over intervals and the other using minimums. They plainly have different limits, so the integral is not well defined.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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