# Calculate:$\int_{0}^{\infty}\frac{\ln x}{(x+1)^{3}}\mathrm{d}x$ with contour integration

Calculate: $$\int_{0}^{\infty}\frac{\ln x}{(x+1)^{3}}\mathrm{d}x$$

My try:

Keyhole integration:

$$\displaystyle \frac{\pi i\ln R\cdot e}{(Re^{\theta i}+1)^{3}}\rightarrow 0$$ (we take $$r$$ as large as we want) and here is the confusion : around the circle the residue is $$0$$: as $$\displaystyle \frac{x\ln x}{(1+x)^{3}}\rightarrow0$$ when we approach to $$0$$. Therefore, the residue is $$0$$, and the whole integration of the keyhole is $$0$$. which leads that the result is $$0$$. but if we take the pole in the keyhole, $$x=-1$$ this is $$3$$rd order pole, and its residue is $$\displaystyle \left. -\frac{1}{x^{2}}\right|_{x=-1}=-1$$ meaning that the whole integral is $$-2\pi i$$ which means that that the result should be $$-\pi i$$.

Both of the results are incorrect. Can you spot my mistakes?

• First of all, pay attention to what you get when integrating along the keyhole contour. If you don't change the integrand, you get cancellation of logarithmic parts of the integrals along the branch cut. For this reason, the integrand is modified (by squaring the logarithm). – metamorphy Aug 7 '20 at 10:03
• @metamorphy why it cancels out? – user771550 Aug 7 '20 at 10:04
• Suppose the branch cut is the positive real axis. Then the integral along the keyhole contour is equal (in the limit) to your given integral + $\int_{+\infty}^0\frac{\ln x+2\pi i}{(x+1)^3}\,dx$ (+ integrals along the circles which vanish). Now the integrals with $\ln x$ cancel, and all you get out of it is the value of $\int_0^\infty\frac{dx}{(x+1)^3}$. – metamorphy Aug 7 '20 at 10:08
• @MrPink Did you place the OP integral into some sort of computer algebra software? – Hyperkähler Aug 7 '20 at 11:09
• @Kevin Integrate by parts once and use partial fraction decomposition. You should get $\int \frac{\ln x}{(x+1)^3}\, dx=-\frac{\ln x}{2(x+1)^2}-\frac{1}{2}\int\frac{dx}{x+1}-\frac{1}{2}\int\frac{dx}{(x+1)^2}+\frac{1}{2}\int\frac{dx}{x}$. Then it's easy to take it from there. – Mr Pink Aug 7 '20 at 11:13

$$J = \int_0^\infty \frac{ \log x \, dx} {(1+x)^3}.$$

Consider $$\oint_C \frac{(\log z)^2 \, dz}{(1+z)^3}$$ around a suitable keyhole contour $$C$$ that starts at $$\epsilon$$ goes to $$R$$, a large (almost) circle of radius $$R$$, back (below the branch cut) to $$\epsilon$$ and then clockwise around the origin.

There is a third order pole inside at $$z_0 = -1$$. The residue there is $$\text{Residue}_{z=-1} \left[\frac{ (\log z)^2}{(1+z)^3}\right] = 1-i\pi.$$

\begin{aligned} \oint_C \frac{(\log z)^2 \, dz}{(1+z)^3} &= \int_\epsilon^\infty \frac{(\log x)^2 \, dx}{(1+x)^3} -\int_\epsilon^\infty \frac{(\log x+2i\pi)^2 \, dx}{(1+x)^3}+\int_0^{2\pi} \frac{(\log (Re^{i\theta}))^2 \, Rie^{i\theta} }{(1+Re^{i\theta})^3}\, d\theta -~\int_0^{2\pi} \frac{(\log (\epsilon e^{i\theta}))^2 \, \epsilon i \, e^{i\theta} }{(1+\epsilon e^{i\theta})^3}\, d\theta \end{aligned}

Let $$R\to\infty$$ and $$\epsilon\to 0$$. The integrals along the "circles" go to zero.

Also, $$\displaystyle \int_0^\infty \frac{dx}{(1+x)^3}=\int_1^\infty \frac{dp}{p^3} = \left. -\frac{p^{-2}}{2} \right|_1^\infty = \frac{1}{2}.$$

So, we have $$-4i\pi J + 4\pi^2 \left( \frac{1}{2}\right) = 2\pi i (1-i\pi).$$

$$J=-\frac{1}{2}$$

• can you write a full solution? that is what I look for – user771550 Aug 7 '20 at 13:23
• Sure. ${}{}{}{}{}{}{}{}$ – mjw Aug 7 '20 at 15:15
• Hope it is clear now. Please let me know if you need some more details filled in. – mjw Aug 7 '20 at 15:54
• can you explain why $-4i\pi J + 4\pi^2 \left( \frac{1}{2}\right) = 2\pi i (1-i\pi).$? what is the left side? – user771550 Aug 7 '20 at 18:06
• $(\log x)^2 - (\log x + 2i \pi )^2 = (\log x)^2 - (\log x)^2 -4i\pi \log x + (2i \pi)^2 = -4i\pi\log x +4\pi^2.$ Now $J= \int_0^\infty \frac{\log x \, dx}{(1+x)^3}$ and $\int_0^\infty \frac{dx}{(1+x)^3} = \frac{1}{2}.$ – mjw Aug 7 '20 at 19:16

I agree with Mr Pink's comments and want to use them to expand the OP's intuition. Often, when you are presented with an ugly looking definite rather than indefinite integral, your first instinct is to not look for a closed form antiderivative. I regard this as a healthy instinct.

However, at the same time, if you look at this particular integration problem, you should notice that:
(1) $$\frac{1}{(x+1)^3}$$ can be routinely integrated.
(2) $$\ln(x)$$ can be routinely differentiated.

Therefore, it is reasonable that if you try integration by parts, the result should be routinely manageable. So in this case, what the OP did wrong was (arguably) let the fact that the problem is a definite integral lead him down the wrong path.

The slow & steady way (without contour integration) is integration by parts, then partial fractions, to find an antiderivative; then, taking limits to evaluate the improper integrals.

Integration by parts:

\begin{align*} \text{Let } u = \ln(x), &\text{ and } dv = (x+1)^{-3}; \\ \text{Then } du = x^{-1}, &\text{ and } v = -(x+1)^{-2}/2. \ \end{align*}

We get $$\int \frac{\ln(x)}{(x+1)^3} dx = \frac{-\ln(x)}{2(x+1)^2} - \int \frac{-dx}{2x(x+1)^2} = \frac{-\ln(x)}{2(x+1)^2} + \int \frac{dx}{2x(x+1)^2}.$$

Partial fractions:

$$\int \frac{dx}{2x(x+1)^2} = \int \left[ \frac{A}{x} + \frac{B}{x+1} + \frac{C}{(x+1)^2} \right]dx,$$

and clearing denominators, we find $$1 = 2A(x+1)^2 + 2Bx(x+1) + 2Cx.$$ Plugging in $$x = 0$$ gives us $$A = 1/2$$, plugging in $$x = -1$$ gives us $$C = -1/2$$, and plugging in the numerical values of $$A, C,$$ we find $$1 = (x+1)^2 + 2Bx(x+1) - x = x^2 + x + 1 + 2Bx^2 + 2Bx,$$ which implies $$B = -1/2$$ as well. So $$\int \frac{dx}{2x(x+1)^2} = \int \left[ \frac{1}{2x} - \frac{1}{2(x+1)} - \frac{1}{2(x+1)^2} \right]dx = \frac{1}{2} \left[\ln(x) - \ln(x+1) + \frac{1}{x+1} \right],$$ therefore

\begin{align*} \int \frac{\ln(x)}{(x+1)^3} dx &= \frac{1}{2} \left [\frac{-\ln(x)}{(x+1)^2} + \ln(x) - \ln(x+1) + \frac{1}{x+1} \right] \\ &= \frac{1}{2} \left [\frac{-\ln(x)}{(x+1)^2} + \ln \left(\frac{x}{x+1}\right) + \frac{1}{x+1} \right] + C. \ \end{align*}

Improper integrals:

We evaluate

\begin{align*} \int_0^\infty \frac{\ln(x)}{(x+1)^3} dx &= \lim_{a \rightarrow 0^+} \left( \lim_{N \rightarrow \infty} \int_a^N \frac{\ln(x)}{(x+1)^3} dx \right) \\ &= \frac{1}{2} \lim_{a \rightarrow 0^+} \left( \lim_{N \rightarrow \infty} \left [\frac{-\ln(x)}{(x+1)^2} + \ln \left(\frac{x}{x+1}\right) + \frac{1}{x+1} \right]_a^N \right) \\ &= \frac{1}{2} \lim_{a \rightarrow 0^+} \left [\frac{\ln(a)}{(a+1)^2} - \ln \left(\frac{a}{a+1}\right) - \frac{1}{a+1} \right] \\ &= \frac{-1}{2} + \frac{1}{2} \lim_{a \rightarrow 0^+} \left [\frac{\ln(a)}{(a+1)^2} - \ln \left(\frac{a}{a+1}\right) \right] \\ &= \frac{-1}{2} + \frac{1}{2} \lim_{a \rightarrow 0^+} \left [\frac{\ln(a)}{(a+1)^2} - \ln(a) + \ln(a+1) \right] \\ &= \frac{-1}{2} + \frac{1}{2} \lim_{a \rightarrow 0^+} \left [\frac{\ln(a)}{(a+1)^2} - \ln(a) \right], \\ \end{align*}

and by L'Hopital's Rule,

\begin{align*} \lim_{a \rightarrow 0^+} \ln(a) \left[ \frac{1}{(a+1)^2} - 1 \right] &= \left( \lim_{a \rightarrow 0^+} \frac{1}{(a+1)^2} \right) \lim_{a \rightarrow 0^+} \left[ \frac{\ln(a)}{1/(-2a - a^2)} \right] \\ &= 1 * \lim_{a \rightarrow 0^+} \frac{1/a * (-2a - a^2)^2}{-(-2 - 2a)} \\ &= 0, \ \end{align*}

and we finally get $$\int_0^\infty \frac{\ln(x)}{(x+1)^3} dx = \frac{-1}{2} + \frac{1}{2} (0) = \frac{-1}{2}.$$

Also OP, the "obvious" contour won't give you the answer you want. Let's try to evaluate $$\int_0^\infty \frac{\ln(x) dx}{(x+1)^3}$$ using the pictured contour $$\gamma$$, traversed in the counterclockwise direction:

Pick the branch of $$\ln(z)$$ inside this contour which satisfies $$\ln(-1) = \pi i$$. As we let $$R \to \infty$$ and $$\epsilon \to 0$$, the two circular pieces of the contour vanish, and we get

\begin{align*} \oint_\gamma \frac{\ln(z) dz}{(z+1)^3} &= -\int_0^\infty \frac{\ln(x) dx}{(x+1)^3} + \int_0^\infty \frac{\ln(x) + 2\pi i}{(x+1)^3} dx \\ &= \int_0^\infty \frac{2 \pi i}{(x+1)^3} dx, \ \end{align*}

so that the integral we wanted to evaluate actually cancelled out entirely! So even if you found the residue at $$z = -1$$ correctly, you wouldn't be able to compute $$\int_0^\infty \frac{\ln(x) dx}{(x+1)^3}$$ using this contour.

• so how can I calculate with complex analysis tools? – user771550 Aug 7 '20 at 12:20
• It should be clear that you would use $$\oint_C dz \frac{\log^2{z}}{(z+1)^3}$$; this produces the real integral you are looking for. – Ron Gordon Aug 7 '20 at 16:55
• @RonGordon Why is that "clear"? – Rivers McForge Aug 7 '20 at 17:37
• @RiversMcForge: Think about what happened to the log piece in your derivation. – Ron Gordon Aug 7 '20 at 17:39
• I don't know if there is a "theory" for this. I guess we could think about it ... From experience, $\int_0^\infty \frac{dx}{P(x)}$ with $P(x)$ a polynomial with poles off of the positive axis, can be handled with this contour and $\oint \frac{\log z\, dz}{P(z)}$. Similarly, $\int_0^\infty \frac{ \log^k x \, dx }{P(x)}$ is handled with $\oint \frac{\log^{k+1} z \, dz}{P(z)}$. – mjw Aug 7 '20 at 19:22