TITLE: A CMIMC Integration Bee integral: $\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \,dx$
QUESTION [7 upvotes]: 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!

REPLY [3 votes]: 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} $$