We will consider the improper definite integral $latex {\int_0^\infty \frac{\log x}{x^2 + ax + b}dx}$ for $latex {a,b > 0}$ (to guarantee convergence). This can be done through in many ways, but the purpose of this brief note is to motivate a particular way of writing integrals to look for symmetries to exploit while evaluating them.

Before we begin, let us note something special about integrals of the form

$$ \int_0^\infty f(x) \frac{dx}{x}. \tag{1}$$

Under the change of variables $latex {x \mapsto \frac{1}{x}}$, we see that

$$ \int_0^\infty f(x) \frac{dx}{x} = \int_0^\infty f(1/x) \frac{dx}{x}. \tag{2}$$

And under the change of variables $latex {x \mapsto \alpha x}$, we see that

$$ \int_0^\infty f(x) \frac{dx}{x} = \int_0^\infty f(\alpha x) \frac{dx}{x}. \tag{3}$$

In other words, the integral is *almost* invariant under these changes of variables — only the integrand $latex {f(x)}$ is affected while the bounds of integration and the measure $latex {\frac{dx}{x}}$ remain unaffected.

In fact, the measure $latex {\frac{dx}{x}}$ is the Haar measure associated to the line $latex {\mathbb{R}_+}$, so this integral property is not random. When working with integrals over the positive real line, it can often be fortuitous to explicitly write the integral against $latex {\frac{dx}{x}}$ before attempting symmetry arguments.

Here, we rewrite our integral as

$$ \int_0^\infty \frac{\log x}{x + a + \frac{b}{x}} \frac{dx}{x}. \tag{4}$$

The denominator is clearly invariant under the map $latex {x \mapsto \frac{b}{x}}$, while $latex {\log x}$ becomes $latex {\log(\frac{b}{x}) = \log b – \log x}$. Along with the special property above, this means that

$$ \int_0^\infty \frac{\log x}{x^2 + ax + b}dx = \int_0^\infty \frac{\log b – \log x}{x^2 + ax + b} dx. \tag{5}$$

Adding our original integral to both sides, we see that

$$ \int_0^\infty \frac{\log x}{x^2 + ax + b} dx = \frac{\log b}{2} \int_0^\infty \frac{1}{x^2 + ax + b}dx. \tag{6}$$

This now becomes a totally routine integral, albeit not entirely pleasant, to evaluate. Generally, one can complete the square and then either perform an argument by partial fractions or an argument through trig substitution (alternately, always use partial fractions and allow some complex numbers; or use hyperbolic trig sub; etc.). Let $latex {c = b – \frac{a^2}{4}}$, which arises naturally when completing the square in the denominator. If $latex {c = 0}$, then the change of variables $latex {x \mapsto x – \frac{a}{2}}$ transforms our integral into

$$ \frac{\log b}{2} \int_{a/2}^\infty \frac{dx}{x^2} = \frac{\log b}{a}. \tag{7}$$

When $latex {c \neq 0}$, performing the change of variables $latex {x \mapsto \sqrt{\lvert c \rvert} x – \frac{a}{2}}$ transforms our integral into

$$ \frac{\log b}{2\sqrt{\lvert c \rvert}} \int_{\frac{a}{2\sqrt{\lvert c \rvert}}}^\infty \frac{dx}{x^2 + 1} = \frac{\log b}{2\sqrt{\lvert c \rvert}} \left(\frac{\pi}{2} – \arctan\left(\frac{a}{2\sqrt{\lvert c \rvert}}\right)\right) \tag{8}$$

when $latex {c > 0}$, or

$$ \frac{\log b}{2\sqrt{\lvert c \rvert}} \int_{\frac{a}{2\sqrt{\lvert c \rvert}}}^\infty \frac{dx}{x^2 – 1} = \frac{\log b}{4\sqrt{\lvert c \rvert}} \log\frac{a + 2\sqrt{\lvert c \rvert}}{a – 2\sqrt{\lvert c \rvert}} \tag{9}$$

when $latex {c < 0}$.