If $\psi=x\sin(\frac{1}{x})$, and $f$ is integrable, is then $f\circ \psi$ also integrable? Let
$$
\psi(x)=
\left\{
\begin{array}{cll}
x \sin\Big(\dfrac{1}{x}\Big) & \text{if} & x\in (0,1],\, \\
0 & \text{if} & x=0,
\end{array}
\right.
$$
and let $f:[-1,1]\rightarrow \mathbb{R}$ be Riemann integrable.
How can I show that $f\circ \psi$ is Riemann integrable?
I have several theorems in my book that could work if $\psi$ were a $C^1$ diffeomorphism or a homeomorphism with inverse satisfying Lipschitz condition. But $\psi$ is clearly neither of those. Any help with a zero set argument or reverting to definitions?
 A: Note. If $f$ is Riemann integrable and $\varphi$ continuous, then their composition $f\circ\varphi$ is NOT necessarily Riemann integrable. (See here.)
Sketch of proof.
Claim 1. If $f$ is Riemann integrable and $\varphi$ is differentiable and $\varphi'(x)\ge \eta>0$, then $f\circ\varphi$ is Riemann integrable.
Proof. Let $P=\{a=t_0<\cdots<t_n=b\}$ be a partition of $[a,b]$, then
$$
U(f\circ\varphi,P)-L(f\circ\varphi,P)=
\sum_{i=1}^n\big(M_i(f\circ\varphi)-m_i(f\circ\varphi)\big)(t_i-t_{i-1})
$$
where
$$
m_i(f\circ\varphi)=\inf_{t\in [t_{i-1},t_i]}(f\circ\varphi)(t)=
\inf_{x\in [\varphi(t_{i-1}),\varphi(t_i)]}f(t) \quad\text{and}\quad
M_i(f\circ\varphi)=\sup_{t\in [t_{i-1},t_i]}(f\circ\varphi)(t)=
\sup_{x\in [\varphi(t_{i-1}),\varphi(t_i)]}f(t)
$$
since $\varphi$ is increasing and hence
$$
U(f\circ\varphi,P)-L(f\circ\varphi,P)=
\sum_{i=1}^n\big(M_i(f\circ\varphi)-m_i(f\circ\varphi)\big)(t_i-t_{i-1})
\\=
\sum_{i=1}^n\big(M_i(f\circ\varphi)-m_i(f\circ\varphi)\big)
\big(\varphi(t_{i})-\varphi(t_{i-1})\big)
\frac{t_i-t_{i-1}}{\varphi(t_{i})-\varphi(t_{i-1})}
\\=
\sum_{i=1}^n\big(M_i(f\circ\varphi)-m_i(f\circ\varphi)\big)
\big(\varphi(t_{i})-\varphi(t_{i-1})\big)
\frac{1}{\varphi'(\tau_{i})}\le \frac{1}{\eta}\sum_{i=1}^n\big(M_i(f\circ\varphi)-m_i(f\circ\varphi)\big)=\frac{1}{\eta}\big(U(f,\tilde P)-L(f,\tilde P)\big)
$$
where $\tau_i\in(t_{i-1},t_i)$ and $\,\tilde P=\{\varphi(a)=\tilde t_0<\cdots<\tilde t_n=\varphi(b)\}$.
Clearly, for suitable choice of $\tilde P$, and subsequently of $P$, the $\frac{1}{\eta}\big(U(f,\tilde P)-L(f,\tilde P)\big)$ can become smaller than any given $\varepsilon$, and hence $f\circ\varphi$ is Riemann integrable.
Claim 2. If $g:[a,b]\to\mathbb R$ is bounded and for every $\delta_1,\delta_2>0$, the function $g$ is Riemann integrable on $[a+\delta_1,b-\delta_2]$. Then $g$ is Riemann integrable on $[a,b]$.
Proof. Simple application of the integrability criterion, which was used above.
Therefore, due to Claim 1, if $\varphi(x)=x\sin(1/x)$, then $\varphi'(x)\ge \eta>0$ or
$\varphi'(x)\le -\eta<0$, for some $\eta>0$ is any interval of the form
$$
\Big[\frac{1}{\frac{\pi}{2}+k\pi}+\delta,\frac{1}{-\frac{\pi}{2}+k\pi}-\delta\Big], \quad \delta>0,\,\,k\in\mathbb Z^+
$$
and hence, $f\circ \varphi$ is integrable in $\big[\frac{1}{\frac{\pi}{2}+k\pi}+\delta,\frac{1}{-\frac{\pi}{2}+k\pi}-\delta\big]$. Due to Claim 2,
$f\circ \varphi$ is integrable in $J_k=\big[\frac{1}{\frac{\pi}{2}+k\pi},\frac{1}{-\frac{\pi}{2}+k\pi}\big]$, and consequently in $I_n=\big[\frac{1}{\frac{\pi}{2}+k\pi},1\big]$, for all $n\in\mathbb N$, which is a finite union of $J_k$'s.
Applying Claim 2 once more we obtain that $f\circ \varphi$ is integrable in $[0,1]$.
A: i) If $\psi:[\alpha,\beta]\to [a,b]$ is $C^1$ and $\psi'$ has only finitely many zeros, then $f\circ \psi$ is RI on $[\alpha,\beta]$ for every $f$ RI on $[a,b].$ I'll take this one as known.
ii) Let's generalize: Now suppose $\psi:[\alpha,\beta]\to [a,b]$ is $C^1$ and $\psi'$ has finitely many zeros in every closed interval contained in $(\alpha,\beta).$ Then $f\circ \psi$ is RI on $[\alpha,\beta]$ for every $f$ RI on $[a,b].$ To prove this, let $f$ be RI 0n $[a,b].$ Let $\epsilon>0$ be small. Then from i) we have $f\circ \psi$ RI on $[\alpha+\epsilon,\beta-\epsilon].$ Letting $\epsilon\to 0^+,$ we get $f\circ \psi$ is RI on $[\alpha,\beta]$ for every $f$ RI on $[a,b].$
Corollary: Suppose $\psi:[\alpha,\beta]\to [a,b]$ is real analytic on $(a,b).$ Then $f\circ \psi$ is RI on $[a,b]$ for all $f$ RI on $[a,b].$ Proof: If $\psi$ is constant there is nothing to prove. If $\psi$ is nonconstant, then $f'$ is real analytic and not $\equiv 0$ on $(a,b).$ By the identity principle, $\psi$ has finitely many zeros in every closed interval contained in $(\alpha,\beta).$ From ii) we then have the desired result.
The corollary gives a quick non computational proof of the problem at hand, since $x\sin(1/x)$ is real analytic on $(0,1).$
