# Example of Riemann integrable function which their composition is not Riemann integrable

I already know that there is a univariate real-valued function $f, g$ such that $f, g$ are Riemann integrable but $\ g \circ f$ is not Riemann integrable.

But I wonder the existence of the univariate real-valued function $f$ which is Riemann integrable but $f\circ f$ is not Riemann integrable

I know that Riemann integrable function is continuous almost everywhere on its domain, but i cannot think of the function which is continuous almost everywhere but its composition with itself is not continuous almost everywhere

Second, I thought about the example using improper integral such as

$f :[1, \infty) \rightarrow \boldsymbol R$ $s.t$ $f(x) = 1/x^2$

But this function did not work, since $Im(f) = (0,1]$, thus $f \circ f$ is defined only on $x = 1$

I intuitively think such an $f$ exists. Please give me an example of this function.

• You should stick to the proper case first, where things are cleanly defined. The improper case will be more delicate. – Ian Dec 16 '16 at 6:56

Cardinality of the set of points of discontinuity of $(f\circ f)\le$ cardinality of the set of points of discontinuity of $f$ because suppose that $f\circ f$ is discontinuous at $a$ then $f$ is discontinuous at $f(a)$
Now set of points of discontinuity of $f$ has measure $0$ and hence so Set of all points of discontinuity of $(f\circ f)$ has measure $0$.