TITLE: Composition of two Riemann integrable functions
QUESTION [29 upvotes]: Suppose $f,g$ are two Riemann  Integrable functions .Is it true that $f\circ g$ is also Riemann  Integrable?
Trying this for a long time but not getting the answer

REPLY [67 votes]: A function on a bounded interval is Riemann-integrable iff it is bounded and almost everywhere continuous. So the functions
$$
f(x) = \begin{cases} 1 & \text{ for }x \ne 0 \\ 0 & \text{ for } x = 0  \end{cases}
\quad \text{ and } \quad
g(x) = \begin{cases} 1/q & \text{ for }x=p/q \\ 0 & \text{ for } x \notin \mathbb{Q}  \end{cases}
$$
are Riemann-integrable over any bounded interval, since $f$ is continuous everywhere except at $0$, and $g$ is continuous at every irrational $x$. (In the definition $x=p/q$ is the unique representation of rational $x$ with $p$ and $q$ relatively prime integers and $q>0$.)
The composition of these functions is
$$
f(g(x)) = \begin{cases} 1 & \text{ for }x \in \mathbb{Q} \\ 0 & \text{ for } x \notin \mathbb{Q}  \end{cases}
$$
which is nowhere continuous, so not Riemann-integrable over any interval.