<s>[INST] 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?
 [/INST] 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}.$$
</s>