# A tough definite integral using contour integration

For some reason, I am guessing that for any fixed $$s_1,s_2>0$$ and $$\varepsilon >0$$ being small, we have \begin{align}&\quad-\int_0^\infty \frac{1}{2\pi} \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx\\&= \log\left(\frac{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})+2s_1\cos(\frac{\varepsilon}{2})}{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})-2s_1\cos(\frac{\varepsilon}{2})}\right), \end{align} and I believe this can be shown by some clever contour integration. However, I really didn't figure out the contour that should be used to evaluate the integral... Any help or suggestions would be greatly appreciated!

• Can you bring some context to this question? Like how did you guess that answer or where did the integral appear? Jul 15, 2020 at 21:32
• Hi, I guess the answer from a known result in a research paper, and I indeed tried Mathematica with some specific values of $s_1,s_2 >0$ and $\varepsilon>0$ (and the formula worked in these particular cases), these lead to my conjecture here. Jul 15, 2020 at 22:53
• I see, I would suggest to expand the terms inside the logarithm, add a new parameter near the $x$ term and differentiate with respect to it. Afterwards a nasty rational integral, but solvable, should appear (given that the bounds are nice, contour integration should work there). In the end you'll just have to integrate back. Jul 16, 2020 at 0:02
• Something like this (I've used $a=s_1,b=s_2$ and added the additional term $\cos t$ in order to differentiate w.r.t. it - it will also look similar to the other term after it's differentiated): $$I(t)=\int_0^\infty \ln\left(\frac{x^2-2ax\cos t+a^2+b^2}{x^2+2ax\cos t+a^2+b^2}\right)\frac{x\sin y}{x^4-2x^2\cos y +1}dx$$ $$\Rightarrow I'(t)=\int_0^\infty \left(\frac{2a x\sin t}{x^2-2ax\cos t+a^2+b^2}+\frac{2a x\sin t}{x^2+2ax\cos t+a^2+b^2}\right)\frac{x\sin y}{x^4-2x^2\cos y +1}dx$$ Expanding into partial fraction would be also really useful here, but it doesn't look like a pleasant task. Jul 16, 2020 at 0:04
• Interesting strategy, so you add a "$cos(t)$" factor inside the log, and my integral becomes $I(0)$ (up to a multiplicative constant)? Jul 16, 2020 at 0:09

As suggested, a contour integration technique can be used to evaluate this integral. Notice first that the integrand is an even function of $$x$$, then \begin{align} I&=- \frac{1}{2\pi}\int_0^\infty \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx\\ &=- \frac{1}{4\pi}\int_{-\infty}^\infty \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx \end{align}

Considering the integral $$\begin{equation} J=- \frac{1}{2\pi}\int_{-\infty}^\infty \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx \end{equation}$$ where the log function is defined with a branch cut between the points $$−s_1−is_2$$ and $$s_1−is_2$$ with $$s_2>0$$. One can show that it is purely real (see (**)). By expressing the real part (see (*)), we find $$J=I$$.

The function is holomorphic for $$\Im x>0$$ except at the poles $$x_k$$ of the rational fraction with $$\Im (x_k)>0$$. If the real axis is closed by the upper half-circle $$C_R$$, the integral can then be evaluated by the residue method. The $$C_R$$ contribution vanishes as $$R\to\infty$$.

Assuming $$0<\varepsilon<2\pi$$, the poles of interest are simple : $$x_+=e^{i\varepsilon/2}$$ and $$x_-=-e^{-i\varepsilon/2}$$. The residues are then evaluated as \begin{align} R_{\pm}&=\operatorname{Res}\left[ \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1},x_\pm\right]\\ &= \log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right)\frac{4x_\pm\sin\varepsilon}{\left.\frac{d}{dx}\left[x^4-2x^2\cos\varepsilon +1\right]\right|_{x=x_\pm}}\\ &=\log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right)\frac{\sin\varepsilon}{x_\pm^2-\cos\varepsilon}\\ &=\mp i\log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right) \end{align} and thus \begin{align} I&=-\frac{1}{2\pi}2i\pi \sum_{\pm} R_{\pm}\\ &=-\log\left(\frac{\cos\left(\frac{\varepsilon}{2}\right)-s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}{\cos\left(\frac{\varepsilon}{2}\right)+s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}\right)+\log\left(\frac{-\cos\left(\frac{\varepsilon}{2}\right)-s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}{-\cos\left(\frac{\varepsilon}{2}\right)+s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}\right)\\ &=-\log\left(\frac{(\cos\left(\frac{\varepsilon}{2}\right)-s_1)^2+(s_2+\sin\left(\frac{\varepsilon}{2}\right))^2}{(\cos\left(\frac{\varepsilon}{2}\right)+s_1)^2+(s_2+\sin\left(\frac{\varepsilon}{2}\right))^2}\right) \end{align} Finally, $$\begin{equation} I= \log\left(\frac{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})+2s_1\cos(\frac{\varepsilon}{2})}{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})-2s_1\cos(\frac{\varepsilon}{2})}\right) \end{equation}$$ as proposed.

(*): using $$\log\left( Z \right)=\frac{1}{2}\log\left|Z\right|^2+i\operatorname{Arg}(Z)$$

(**): If $$\begin{equation} J=\int_{-\infty}^\infty \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)f(x)\,dx \end{equation}$$ where $$f(-x)=-f(x)$$ and $$s_{1,2}$$ are real, then the complex conjugate \begin{align} J^*&=\int_{-\infty}^\infty \log\left(\frac{x-s_1-is_2}{x+s_1-is_2}\right)f(x)\,dx\\ &=\int_{-\infty}^\infty \log\left(\frac{-x+s_1+is_2}{-x-s_1+is_2}\right)f(x)\,dx\\ &=\int_{-\infty}^\infty \log\left(\frac{y+s_1+is_2}{y-s_1+is_2}\right)f(-y)\,dy\\ &=J \end{align} The integral is thus real.

• Fantastic answer! I will examine your answer as soon as I can and I am going to accept this answer if it is correct. Thank you very very very much! Jul 19, 2020 at 1:12
• Hi Paul, if you don't mind, may I ask a quick question? Actually, I am not sure why we have \begin{align} &- \frac{1}{4\pi}\int_{-\infty}^\infty \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx\\ &=- \frac{1}{2\pi}\int_{-\infty}^\infty \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx \end{align} Also, I do not understand when you said " We used symmetry to show that the imaginary part of the integral vanishes". A minor suggestion is to use $z$ instead of $x$ for complex #s. Jul 19, 2020 at 2:14
• @FeiCao You are welcome! I added notes to explain the details. Jul 19, 2020 at 6:15
• Hi Paul, thanks for the details. However, I still have one confusion. To justify (*) you used $\log\left( Z \right)=\frac{1}{2}\log\left|Z\right|^2+i\operatorname{Arg}(Z)$ with $Z = \frac{x-s_1+is_2}{x+s_1+is_2}$. But I did not see why $\operatorname{Arg}(Z) = 0$, because we should have $\operatorname{Arg}\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right) = \operatorname{Arg}(x^2-s^2_1+s^2_1+2is_1s_2)$, which is clearly not zero... Thank you very much! Jul 19, 2020 at 17:04
• The explanation was rather unclear. I reprased it, hoping it is more natural that way. Jul 19, 2020 at 17:29

Following Zacky's comments, the biggest challenge is the evaluation of $$\int_{-\infty}^\infty \left(\frac{x^2}{x^2-2ax\cos t+a^2+b^2}+\frac{x^2}{x^2+2ax\cos t+a^2+b^2}\right)\frac{2a\sin t \sin y}{x^4-2x^2\cos y +1}dx,$$ note that the integrand is even in $$x$$ and we can restrict the domain of $$t$$ to be $$[0,\frac{\pi}{2}]$$. To calculate the above integral we let $$f(z)$$ to the integrand with $$x$$ being replaced by $$z$$, and integrate along a large upper semi-circle of radius $$R$$, call this path $$\gamma_R$$, then $$f$$ has four simple poles located at $$\pm a\cos(t)+i\sqrt{(a\sin(t))^2+b^2}$$, $$e^{\frac{iy}{2}}$$ and $$-e^{-\frac{iy}{2}}$$, respectively. However, the residue calculations at these points are very sophisticated and I didn't see any simplifications that can be made to make things clear...

• A CAS solved the integral you wrote. The only qualifier for the result is $\color{red}{\text{monster}}$ Jul 16, 2020 at 5:55

Without contour integration.

I changed notations and focused on $$\int \frac{ x }{x^4-2 x^2 \cos (t)+1}\log \left(\frac{(x-a)^2+b^2}{(a+x)^2+b^2}\right)$$ Surprising or not, a CAS is able to compute the antiderivative which is a monster.

What I should do first is partial fraction decomposition to get $$\frac x{x^4-2 x^2 \cos(t)+1}=\frac 1{r-s} \left(\frac x {x^2-r}-\frac x {x^2-s} \right)$$ where $$r$$ and $$s$$ are the roots of the quadratic equation in $$x^2$$; they are $$r=e^{it}$$ and $$s=e^{-it}$$.

I should decompose the logarithm too and integrate; each of the four required integrals has a closed form (not the most pleasant but perfectly workable).

Integrate from $$0$$ to $$p$$ and take the limit when $$p\to \infty$$.

• Thank you for your comment, without contour integration I really didn't see how simple partial fraction decomposition will work... Also, may I know does the "monster" you got via the so-called "CAS" confirms my original guess for the result of the definite integral I want to compute at the very beginning? Jul 16, 2020 at 6:01