How can I show that $\int_0^\infty \frac{\tan^{-1} ax-\tan^{-1} x}{x}~dx = \frac{1}{2}\pi \ln(a)$?
I tried by using $\tan^{-1} ax-\tan^{-1} x = \int_1^a\frac{1}{1+(ux)^2}~du$ and incorporate this in the original expression: $$\int_0^\infty \frac{1}{x}\left[ \int_1^a \frac{1}{1+(ux)^2}~du\right] dx$$
and then switching the order of integration: $$\int_0^a \left[~ \int_1^\infty \frac{1}{x}~\frac{1}{1+(ux)^2}~dx\right] du$$ $$\\$$
which doesn't seem to lead anywhere. But I somehow want to use $\int_0^\infty \frac{\sin x}{x}~dx=\frac{1}{2}\pi$, because the arctan function is involved in the process of showing this by differentiating $\int_0^\infty e^{-ux}\frac{\sin x}{x}~dx$ with respect to u (aka Feynman's method). The lower bond here is $0$ though, and in the integral above the lower bond is $1$, so I don't know if that's the right way to go either. Or is there possibly a different way to try here? $$\\$$ $$\\$$ (The choice of the Fourier-tags is because this is from a book on the subject)
I like the answers given, but your approach works too, and is arguably (conceptually) simpler.
First, a small correction $$ \int \frac{1}{1 + (ux)^2} \mathrm{d}u = \frac{1}{x}\arctan(ux), $$ not just $\arctan(ux)$. This means that the inner integral should be multiplied with a factor of $x$. This, of course, is very convenient, since it will cancel with the $1/x$ sitting outside.
Calling the original integral $I$, and making the correction, we have $$ I = \int_0^\infty \frac{1}{x} \int_1^a \frac{x}{1 + (ux)^2} \mathrm{d}u \mathrm{d}x.$$ Hitting this with Tonelli's theorem gives $$ I = \int_{1}^a \int_0^\infty \frac{1}{1+ (ux)^2} \mathrm{d}x \mathrm{d}u = \int_1^a \left.\frac{1}{u} \arctan(ux)\right|_{0}^\infty \mathrm{d}u\\ = \int_1^a \frac{\pi/2}{u} \mathrm{d}u = \frac{\pi}{2} \ln(a).$$
One nice thing about this argument is that it generalises completely to the Frullani integral mentioned in the comments.
Let $f$ be a function differentiable on $(0,\infty)$. Denote $f(\infty) = \lim_{x \to \infty} f(x)$ If $a,b > 0,$ (and if $f$ is nice enough for Fubini's theorem to apply below), then $$ \int_0^\infty \frac{f(ax) -f(bx)}{x}\mathrm{d}x = \int_0^\infty \frac{1}{x} \int_b^a xf'(ux)\mathrm{d}u \mathrm{d}x = \int_b^a \int_0^\infty f'(ux) \mathrm{d}x\mathrm{d}u\\ = \int_b^a \frac{1}{u} (f(\infty) - f(0))\mathrm{d}u = (f(\infty) - f(0)) \ln\frac{a}{b}. $$