Calculating contour integral with keyhole contour [duplicate]

Evaluate the integral $$\int_0^{\infty}\frac{\log(x)}{(x+a)(x+b)}dx$$ with $$a,b>0, a\neq b$$ by using the keyhole contour.

My attempt- I drew the keyhole contour (obviously it's supposed to say $$-a,-b$$ on the left side of the $$x$$ axis):

And we have the following as we let $$\varepsilon\to 0$$ and $$R\to\infty$$: $$\int_{\Gamma}f(z)dz=2\pi i(Res(f,-a)+Res(f,-b))$$ $$\int_{\gamma_{R}}\frac{\log(z)}{(z+a)(z+b)}dz\to 0$$ $$\int_{\gamma_{\varepsilon}}\frac{\log(z)}{(z+a)(z+b)}dz\to 0$$ $$\int_{\gamma_{1}}\frac{\log(z)}{(z+a)(z+b)}dz\underset{\underset{\varepsilon\to0}{R\to\infty}}{\to}\int_{0}^{\infty}\frac{\log(x)}{(x+a)(x+b)}dx$$

The only thing I'm having trouble calculating is: $$\int_{\gamma_{2}}\frac{\log(z)}{(z+a)(z+b)}dz$$ as $$\varepsilon\to 0$$ and $$R\to\infty$$. I assume it's: $$\int_{\gamma_{2}}\frac{\log(z)}{(z+a)(z+b)}dz=-\int_{0}^{\infty}\frac{\log(x)+2\pi i}{(x+a)(x+b)}dz$$ and if I denote $$I=\int_{0}^{\infty}\frac{\log(x)}{(x+a)(x+b)}dx$$ then $$\int_{\gamma_{2}}\frac{\log(z)}{(z+a)(z+b)}dx=I+2\pi i\frac{\ln(a)-\ln(b)}{a-b}$$ and when summing everything $$I$$ cancels. What am I doing wrong here?

• Try integrate with integrand $\log^2$ instead, this is a common idea for logarithmic integrals May 29 at 16:56
• @FShrike Is there any way to continue the way I did it? I saw in a few places that the integrate wrt to $\log^2$ instead but don't understand why my way doesn't work
– GBA
May 29 at 16:56
• Your way doesn’t work because of this cancellation issue. With integrand of log^2, the log^2 terms cancel but your desired integral survives May 29 at 17:01
• Also related: math.stackexchange.com/questions/1780039/… May 30 at 3:47

1 Answer

Actually you do not need Complex Analysis for this: $$\frac{1}{(x+a)(x+b)}=\frac{1}{b-a}\left(\frac{1}{x+a}-\frac{1}{x+b}\right)$$ and

$$\begin{eqnarray*}\int_{0}^{M}\frac{\log x}{x+c}\,dx&\stackrel{x\mapsto cz}{=}& \int_{0}^{M/c}\frac{\log(c)+\log(z)}{z+1}\,dz=\log(c)\log(1+M/c)+\int_{0}^{M/c}\frac{\log z}{z+1}\,dz\\&\stackrel{z\mapsto 1/u}{=}&\log(c)\log(1+M/c)-\int_{c/M}^{+\infty}\frac{\log u}{u(u+1)}\\&\stackrel{u\mapsto v/M}{=}&\log(c)\log(1+M/c)-\int_{c}^{+\infty}\frac{\log(v)-\log(M)}{v(v/M+1)}\,dv\\&=&\log(Mc)\log(1+M/c)-\int_{c}^{+\infty}\frac{\log v}{v(v/M+1)}\,dv\tag{1}\end{eqnarray*}$$ from which it follows that

$$\int_{0}^{+\infty}\frac{\log x}{(x+a)(x+b)}\,dx =\\= \frac{1}{b-a}\lim_{M\to +\infty}\left(\log(Ma)\log(1+M/a)-\log(Mb)\log(1+M/b)-\int_{a}^{b}\frac{\log v}{v(v/M+1)}\,dv\right).\tag{2}$$

By the dominated convergence theorem the integral term inside the parenthesis converges to $$-\frac{\log^2(b)-\log^2(a)}{2}$$ while it is simple to check (for instance, through Lagrange's theorem) that $$\lim_{M\to +\infty}\left(\log(Ma)\log(1+M/a)-\log(Mb)\log(1+M/b)\right)=\log^2(b)-\log^2(a),\tag{3}$$ leading to $$\int_{0}^{+\infty}\frac{\log(x)}{(x+a)(x+b)}\,dx = \frac{\log^2(b)-\log^2(a)}{2(b-a)}\tag{3}$$ as wanted. An alternative is to use Feynman's trick.

• How do I use Feynman's trick here? I was able to solve it using $f(z)=\frac{\log^2(z)}{(z+a)(z+b)}$
– GBA
May 30 at 10:29
• @GBA: you may exploit it by noticing that $\log(x)$ is the derivative (with respect to $s$) of $x^s$ evaluated at $s=0^+$. The integrals of $x^s/(x+1)$ can be computed from Euler's Beta function. May 30 at 10:37