A CMIMC Integration Bee integral: $\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \,dx$ At the 2020 CMIMC Integration Bee, the following integral was one of the qualifying problems:
$$\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \,dx.$$
I attempted to use differentiation under the integral sign:
$$f(t) = \int_0^\infty \left( \sin(t/x) - \frac{\sin(\pi t/x)}{\pi} \right) \,dx$$
$$f'(t) = \int_0^\infty \left( \frac{\cos(t/x) - \cos(\pi t/x)}{x}\right) \,dx.$$
We are very close to being able to use the Frullani integral, that is,
$$\int_0^\infty \frac{f(ax)-f(bx)}{x} \, dx = \ln \left( \frac{b}{a} \right) \cdot \left( f(0) - \lim_{x \to \infty} f(x) \right)$$
for $f$ continuously differentiable on the nonnegative reals. However, if we try to use it with $f(x)=\cos(1/x)$, we obtain
$$f'(t) = (\ln \pi) \left( \cos(1/0) - \lim_{x \to \infty} \cos(1/x) \right),$$
which is nonsensical. This happens, of course, because $f$ is not continuously differentiable or even defined at $0$. But if we were able to show that
$$\int_0^\infty \left( \frac{\cos(t/x) - \cos(\pi t/x)}{x}\right) \,dx = (\ln \pi) \left(\lim_{x \to \infty} \cos(1/x) \right) = \ln \pi,$$
(which is true according to Wolfram Alpha,) then we would have
$$f(1) = f(0) + \int_0^1 f'(x) \, dx = \int_0^1 \ln \pi \, dx = \ln \pi,$$
which is the correct answer.
Any hints or solutions for how to complete my solution or for an entirely different solution are appreciated!
 A: If you consider that
$$\int \sin \left(\frac{1}{x}\right)\,dx =x \sin \left(\frac{1}{x}\right)-\text{Ci}\left(\frac{1}{x}\right)$$ then
$$\int\left(\sin \left(\frac{1}{x}\right)-\frac{1}{\pi }\sin \left(\frac{\pi
   }{x}\right)\right) \,dx=\text{Ci}\left(\frac{\pi }{x}\right)-\text{Ci}\left(\frac{1}{x}\right)+x \sin
   \left(\frac{1}{x}\right)-\frac{x }{\pi }\sin \left(\frac{\pi }{x}\right)$$ Now, using asymptotics for large values of $x$
$$\frac{x }{a}\sin \left(\frac{a}{x}\right)-\text{Ci}\left(\frac{a}{x}\right)=-\left(\log (a)+\gamma -1\right)+\log \left({x}\right)+\frac{a^2}{12
   x^2}-\frac{a^4}{480 x^4}+O\left(\frac{1}{x^6}\right)$$
$$\int_0^t \left(\sin \left(\frac{1}{x}\right)-\frac{1}{\pi }\sin \left(\frac{\pi
   }{x}\right)\right) \,dx=\log (\pi )-\frac{\pi ^2-1}{12 t^2}+\frac{\pi ^4-1}{480 t^4}+O\left(\frac{1}{t^6}\right)$$
A: Random Variable's comment outlines what is almost certainly the intended (and most elegant!) method. The finished solution is as follows:
Let $u=\frac{1}{x}$. Now,
$$\begin{align}
\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \, dx &= \int_0^\infty \frac{\frac{\sin u}{u} - \frac{\sin \pi u}{\pi u}}{u} \, du \\ &= (\ln \pi) \left( \lim_{x \to 0^+} \frac{\sin x}{x} - \lim_{x \to \infty} \frac{\sin x}{x} \right) \\ &= \ln \pi. \end{align} $$
