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?
 A: 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.
A: $$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}$$
A: 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}.$$
A: 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.
