Evaluate the integral $\int_{0}^{+\infty}\frac{\arctan \pi x-\arctan x}{x}dx$

$$I(a)=\int\limits_{0}^{+\infty}\dfrac{\arctan (a x)-\arctan x}{x}dx$$

$$I'(a) = \int^{\infty}_0 \frac{1}{1+a^2x^2}\, dx$$

$$I'(a) =\frac{\pi}{2 a}\, $$

Hence by integrating

$$I(a) =\frac{\pi}{2} \log(a) +C $$

by $a=1$ we have $C=0$

$$I(a) = \frac{\pi}{2} \log(a) $$

$$I(\pi)=\int\limits_{0}^{+\infty}\dfrac{\arctan (\pi x)-\arctan x}{x}dx = \frac{\pi}{2} \log(\pi) $$


You can write $$I=\int_0^\infty dx\int_1^\pi dy\ \frac{1}{1+x^2y^2}.$$ Change the order of integration: $$I=\int_1^\pi dy\int_0^\infty dx\ \frac{1}{1+x^2y^2}=\int_1^\pi dy\ \frac{\pi}{2y}=\frac{\pi}{2}\ln\pi.$$ If memory serves, this is an old Putnam problem.

Addendum:

Eric Auld correctly points out that the change in the order of integration should be justified. By thm. 6.3 of these notes, we can change the order of integration if $$\int_0^\infty dx\ \frac{1}{1+x^2y^2}$$ converges uniformly for $y\in[1,\pi]$. That is, we want to show that for any $\epsilon>0$ there exists $x_0\in[0,\infty)$ with $$\epsilon>\left|\int_0^\infty dx\ \frac{1}{1+x^2y^2}-\int_0^\xi dx\ \frac{1}{1+x^2y^2}\right|=\left|\int_\xi^\infty dx\ \frac{1}{1+x^2y^2}\right|$$ ("convergence") for all $\xi\ge x_0$ and $y\in[1,\pi]$ ("uniform"). In other words, the unbounded region of the integral can be made arbitrarily small for all values of $y$ simultaneously.

In this case, $$\int_\xi^\infty dx\ \frac{1}{1+x^2y^2}\le\int_\xi^\infty dx\ \frac{1}{1+x^2}=\frac{\pi}{2}-\tan^{-1}\xi$$ so if we choose $$x_0>\tan\left(\frac{\pi}{2}-\epsilon\right)$$ then we are done.


We have $$\int_a^b \dfrac{\arctan \pi x-\arctan x}{x}dx=\int_{\pi a}^{\pi b}\dfrac{\arctan x}{x}dx-\int_{ a}^{ b}\dfrac{\arctan x}{x}dx\\=\int_{ b}^{\pi b}\dfrac{\arctan x}{x}dx-\int_{ a}^{ \pi a}\dfrac{\arctan x}{x}dx$$ and since the function $\arctan$ is increasing so $$\arctan( b)\log\pi=\arctan( b)\int_b^{\pi b}\frac{dx}{x}\leq\int_{ b}^{\pi b}\dfrac{\arctan x}{x}dx\\ \leq\arctan(\pi b)\int_b^{\pi b}\frac{dx}{x}=\arctan(\pi b)\log\pi$$ so if $b\to\infty$ we have $$\int_{ b}^{\pi b}\dfrac{\arctan x}{x}dx\to\frac{1}{2}\pi\log\pi$$ and by a similar method we prove that $$\int_{ a}^{ \pi a}\dfrac{\arctan x}{x}dx\to 0,\quad a\to0$$ hence we conclude $$\displaystyle I=\int\limits_{0}^{+\infty}\dfrac{\arctan \pi x-\arctan x}{x}dx=\frac{1}{2}\pi\log\pi$$