# Example $f$ Riemann-integrable, $g$ bounded and $g=f$ almost everywhere.

I'm facing this problem,

Let $g:[a,b]\rightarrow \mathbb{R}$ be Riemann-integrable, $f:[a,b]\rightarrow \mathbb{R}$ a bounded function, $(x_n)$ a sequence of points in $[a,b]$ such that $f(x)=g(x)$ for all $x$ in $[a,b]$ other than the $x_n$. $\textbf{Give an example}$ to show that $f$ need not be Riemann-integrable.

Before this, the book ("A First Course in Real Analysis by Sterling Berberian",Page 164) says that for $f:[a,b]\rightarrow \mathbb{R}$ and $g:[a,b]\rightarrow \mathbb{R}$ Riemann integrable, and $f=g$ almost everywhere we can conclude that $f$ is Riemann-integrable.

Checking the examples they give on non riemann integrability, I found $f(x):[0,1]\rightarrow \mathbb{R}$, $f(x)=1$ for rationals and $f(x)=0$ for irrationals. From this I can build a function $g:[0,1]\rightarrow \mathbb{R}$, that can be equal to $f$ over the irrationals, and something different than $f$ for rationals, However, how could I build a sequence such as the one they ask me to, but over the rationals?

• $\mathbb Q$ is countable and you can write $\mathbb Q$ as a sequence – user99914 Jul 13 '18 at 4:57

You can list the rationals in $[0, 1]$ like so: $$0, 1, \frac{1}{2}, \frac{1}{3}, \frac{2}{3}, \frac{1}{4}, \frac{3}{4}, \frac{1}{5}, \frac{2}{5}, \frac{3}{5}, \frac{4}{5}, \frac{1}{6}, \frac{5}{6} \ldots$$ Essentially, I'm listing the points in the graph of the ruler function in lexicographic order. It's not a sequence with a "nice" formula, but it is a sequence.
$$0, 1, \frac{1}{2}, \frac{1}{3}, \frac{2}{3}, \frac{1}{4}, \frac{2}{4}, \frac{3}{4}, \frac{1}{5}, \frac{2}{5}, \frac{3}{5}, \frac{4}{5}, \frac{1}{6}, \frac{2}{6}, \frac{3}{6}, \frac{4}{6}, \frac{5}{6}, \ldots,$$
$$1, \frac{1}{2}, \frac{1}{4}, \frac{3}{4}, \frac{1}{8}, \frac{3}{8}, \frac{5}{8}, \frac{7}{8}, \ldots.$$