# Cauchy Residue Theorem with Logarithms

I've been trying to use Cauchy's Residue Theorem to calculate the following integral, but I am getting stuck with the logarithm and not sure how to proceed.

Q: Evaluate $$\int_{-\infty}^{\infty} \frac{\ln|x|}{(x^2 + 1)(x + 1)} dx$$

First, let $$I = \int_{-\infty}^{\infty} \frac{\ln|x|}{(x^2 + 1)(x + 1)} dx$$. We can rewrite the integrand so that $$\begin{equation*} I = \int_{-\infty}^{\infty} \frac{\ln|x|}{(x^2 + 1)(x + 1)} dx = \frac{1}{2} \int_{-\infty}^{\infty} \frac{2\ln|x|}{(x^2 + 1)(x + 1)} dx \Rightarrow 2I = \int_{-\infty}^{\infty} \frac{\ln(x^2)}{(x^2 + 1)(x + 1)} dx \end{equation*}$$ So we first find what $$J = 2I$$ is. Let $$f(z) = \frac{\ln(z^2)}{(z^2 + 1)(z + 1)}$$. Note that $$f(z)$$ has simple poles located at $$z_0 = i$$, $$z_1 = -i$$ and $$z_2 = -1$$. Furthermore, note that $$z \neq 0$$ from $$\ln(z^2)$$. Then for $$\epsilon$$ "small" and $$\rho$$ "large", define $$\Gamma_{\rho, \epsilon} = [-\rho, -\epsilon] + C_{\epsilon}^+ + [\epsilon, \rho] + C_{\rho}^+$$ to be the contour that is oriented once in the counterclockwise direction. Note that only $$z_0$$ and $$z_2$$ are only inside this contour. Then by using Cauchy's Residue Theorem, we have \begin{align*} \lim_{\rho \to \infty, \epsilon \to 0} \int_{\Gamma_{\rho, \epsilon}} f(z) dz &= \lim_{\rho \to \infty, \epsilon \to 0} \int_{[-\rho, -\epsilon]} f(z) dz + \lim_{\epsilon \to 0} \int_{C_{\epsilon}^+} f(z) dz + \lim_{\rho \to \infty, \epsilon \to 0} \int_{[\epsilon, \rho]} f(z) dz + \lim_{\rho \to \infty} \int_{C_{\rho}^+} f(z) dz \\ &= 2\pi i [Res(f, z_0) + Res(f, z_2)] \end{align*} Computing the residues we have \begin{align*} Res(f, z_0) = \lim_{z \to i} (z - i)f(z) = \lim_{z \to i} \frac{\ln(z^2)}{(z + i)(z + 1)} = \frac{\ln(-1)}{2i(1 + i)} = \frac{i\pi}{2i(1 + i)} = \frac{\pi(1 - i)}{4} \\ Res(f, z_2) = \lim_{z \to -1} (z + 1)f(z) = \lim_{z \to -1} \frac{\ln(z^2)}{(z + i)(z - i)} = 0 \end{align*} I am not sure if this is the correct way to approach this problem and this is where I am getting stuck. I am not sure if I have used the log correctly in this sense.

• It seems that you should consider the point $z=0$, which is also a singularity. This post may be useful.
– Feng
Sep 1, 2023 at 4:41

TL;DR You made two definite mistakes in your approach, though you are lucky that neither mistake had an impact on the outcome for this particular function. You also didn't examine several things that should have been examined, though possibly you just didn't get to them yet before you decided to ask this question.

First, let's discuss the exact statement of the Cauchy Residue Theorem. Note that the closed curve $$\gamma$$ lies within $$U_0$$, the domain where the function $$f$$ is holomorphic. Remember that:

For the Residue theorem to apply, the function has to be holomorphic at all points on the contour, and at all but finitely many points inside the contour.

Let's start with the problem that you are concerned about. Where is $$f(z) = \frac{\ln z^2}{(z^2 + 1)(z+1)}$$ holomophic? You identified the isolated singularities at $$i, -i, -1$$. And further, you recognize that $$f$$ is not holomorphic at $$z = 0$$ either, which is not an isolated singularity, as even through $$\ln z$$ can be considered holomorphic at any point other than $$0$$, over domains that completely surrounds $$0$$, it is not holomorphic, as it picks up $$2\pi i$$ when circling around $$0$$. So you have to pick a branch cut from $$0$$ to $$\infty$$ somewhere.

If you pick a branch cut for $$\ln z$$, this leads to a problem with $$\ln z^2$$, which then has two branch cuts heading off in opposite directions, one of which has to be into the upper half-plane exactly where you do not want it. Fortunately, instead you can pick a single branch cut directly for $$\ln z^2$$. $$\ln z^2$$ picks up $$4\pi i$$ as you circle $$0$$, and you just need a single place for this discontinuity to occur, such as along the negative imaginary axis, avoiding the region of interest.

But the next part is a definite mistake: You claimed that $$i$$ and $$-1$$ are in the contour. $$i$$ is in the contour. $$-1$$ is on your contour. This is verboten. $$f$$ has to be holomorphic at all points on the contour, and it is not holomorphic at $$z = -1$$.

So just like you circled around $$0$$, you also have to circle around $$-1$$. You didn't explain your $$C_\epsilon^+$$ notation, but presumably you mean the portion of the circle of radius $$\epsilon$$ about $$0$$ that lies in the upper-half plane. We are going to have to extend this notation to describe a half-circle about $$-1$$, not just $$0$$. I'll refer to it at $$C_\epsilon^+(-1)$$.

Which brings us to your definition of $$\Gamma$$ (i'll leave the dependence on $$\rho, \epsilon$$ as understood). There is another mistake here. Making the correction for $$-1$$, your definition becomes:

$$\Gamma = [-\rho,-1-\delta] + C_\delta^+(-1) + [-1+\delta,-\epsilon] + C_\epsilon^+ + [\epsilon,\rho] + C_\rho^+$$ But that is wrong. It should be $$\Gamma = [-\rho,-1-\delta] - C_\delta^+(-1) + [-1+\delta,-\epsilon] - C_\epsilon^+ + [\epsilon,\rho] + C_\rho^+$$

$$C_\delta^+(-1), C_\epsilon^+$$ are counter-clockwise half-circles, but $$\Gamma$$ is navigating them in the clockwise direction. The subtractions indicate that the curves are being navigated in reverse. This is a detail that has consequences later on. You cannot overlook it.

So finally we have a closed contour $$\Gamma$$ such that for sufficiently large $$\rho$$ and small $$\delta,\epsilon$$ satisfies all the conditions for the Residue theorem, with only the singularity at $$i$$ inside with residue $$\frac{\pi(1-i)}4$$, so $$\int_\Gamma f(z)\,dz = \frac{\pi^2(1+i)}2$$

That takes care of the Residue theorem. Now you have to fight back to the original integral. This is where the direction of the circles becomes important: $$\int_\Gamma f = \int_{-\rho}^{-1-\delta}f - \int_{C_\delta^+(-1)}f + \int_{-1+\delta}^{-\epsilon}f - \int_{C_\epsilon^+}f + \int_\epsilon^\rho f + \int_{C_\rho^+}f$$ The integrations around the curves navigated in reverse are subtracted instead of added. Reorganizing and taking the limits: $$(\text{CPV})\int_{-\infty}^\infty f = \frac{\pi^2(1+i)}2 + \lim_{\delta\to 0}\int_{C_\delta^+(-1)}f + \lim_{\epsilon\to 0}\int_{C_\epsilon^+}f - \lim_{\rho \to \infty}\int_{C_\rho^+}f$$ Where the CPV indicates we get the Cauchy Principle Value integral, rather than the improper Riemann integral. The latter actually diverges at $$x = 0$$.

So what remains is the evaluation of the limits of the integrals about the three half-circles. Maybe you just hadn't gotten to that part when you felt the need to ask this question. But just in case, let me reiterate that these must be handled with care. One cannot just assume they will be $$0$$.

First, look at $$\lim_{\delta\to 0}\int_{C_\delta^+(-1)}f$$. This is the easy one. This is half of a closed circle about an isolated singularity. If it were a complete circle, it would just be $$2\pi i$$ times the residue. But it turns out that in the limit, the integration over the half-circle goes to half the integration over the whole circle. So isolated singularities on the contour contribute half of their residue to the integration. For this particular function, the residue is $$0$$, so $$\lim_{\delta\to 0}\int_{C_\delta^+(-1)}f = 0$$.

Next, look at $$\lim_{\epsilon\to 0}\int_{C_\epsilon^+}f$$. When $$\epsilon$$ is small enough, the denominator is $$\approx 1$$ and the integral approximates $$\int_0^\pi \ln(\epsilon^2 e^{2i\theta})\epsilon ie^{i\theta}\,d\theta=2\epsilon i\int_0^\pi(\ln(\epsilon) + i\theta)e^{i\theta}\,d\theta \to 0$$

And finally, $$\left|\int_{C_\rho^+}f\right| \le \pi\rho\max\frac{|2\ln z|}{\rho^3} = O\left(\frac 1\rho\right)$$ And so it also goes to $$0$$ at $$\rho \to \infty$$.