Integral with $\ln$ and rational function
\begin{align*} I=\int_0^\infty \frac{x \ln(1+x)}{(1+x)(2x^2+2x+1)} dx=\frac{5\pi^2}{96}-\frac{\ln^2 2} 8. \end{align*}
Here are some alternative ways to evaluate it. (I prefer method 2)
Method 1: Series + Residue
Substitute $x=\frac 1t$,
\begin{align*} I &= \int_0^\infty \frac{\ln(1+t)}{(1+t)(t^2+2t+2)} dt-\int_0^\infty \frac{\ln t}{(1+t)(t^2+2t+2)} dt \\ &= I_1-I_2. \end{align*}
Claim 1: \begin{align*} I_1=\int_0^\infty \frac{\ln(1+t)}{(1+t)(t^2+2t+2)} dt=\frac{\pi^2}{48}. \end{align*}
Put $t=-1+\frac 1u$ in $I_1$, \begin{align*} I_1 &= \int_0^1 -\frac{u\ln u}{1+u^2}du=- \int_0^1 \sum_{k=0}^\infty (-1)^k u^{2k+1}\ln u\,du\\ &=- \sum_{k=0}^\infty (-1)^k \left[\frac{u^{2k+2}\ln u}{2k+2}-\frac{u^{2k+2}}{(2k+2)^2}\right]_0^1\\ &=\frac 14 \sum_{k=0}^\infty \frac{(-1)^k}{(k+1)^2} \tag {1.1}\\ &=\frac 14\cdot\frac{\pi^2}{12}=\frac{\pi^2}{48}. \end{align*}
Comment:
- For evaluating series in $(1.1)$, see $\sum_{n=1}^{\infty} \frac{(-1)^n}{n^2}=-\frac{\pi^2}{12}$.
Claim 2: \begin{align*} I_2=\int_0^\infty \frac{\ln t}{(1+t)(t^2+2t+2)} dt=\frac{\ln^2 2}{8}-\frac{\pi^2}{32}. \end{align*}
Consider the key-hole contour as shown:
Because $\frac{\partial}{\partial\alpha}t^\alpha=t^\alpha\ln t$, one uses the function
\begin{align*} f(z)=\frac{z^\alpha}{(1+z)(z^2+2z+2)},\qquad\forall -1<\alpha<1. \end{align*}
The poles of $f$ are at $-1$ and $-1\pm i$.
Set
\begin{align*} I_2(\alpha) =\int_0^\infty f(t)\,dt=\int_0^\infty \frac{t^\alpha}{(1+t)(t^2+2t+2)}\,dt. \end{align*}
Then,
\begin{align*} 2\pi i\sum \text{Res } f&=\oint f(z) dz\\ &=\int_\gamma+\int_\epsilon^R\frac{z^\alpha}{(1+z)(z^2+2z+2)}\,dz+\int_\Gamma+\int_R^\epsilon\frac{\left(ze^{2\pi i}\right)^\alpha}{(1+z)(z^2+2z+2)}\,dz\\ &=\left(1-e^{2\pi\alpha i}\right)\int_\epsilon^R\frac{z^\alpha}{(1+z)(z^2+2z+2)}\,dz+\left(\int_\gamma+\int_\Gamma\right)\\ &=\left(1-e^{2\pi\alpha i}\right)I_2(\alpha). \end{align*}
And,
\begin{align*} I_2&=\left.\frac{\partial}{\partial \alpha}\right|_{\alpha=0}I_2(\alpha)\\ &=\left.\frac{\partial}{\partial \alpha}\right|_{\alpha=0}\frac{\pi\left(2^{\frac {\alpha}2}\cos\left(\frac{\pi \alpha}4\right)-1\right)}{\sin(\pi \alpha)}\\ &=\frac{\ln^2 2}{8}-\frac{\pi^2}{32}. \end{align*}
OR
Use the same contour and consider function $g$:
\begin{align*} g(z)=\frac{\ln^2 z}{(1+z)(z^2+2z+2)}. \end{align*}
The poles of $g$ are at $-1$ and $-1\pm i$.
Use $0\le\arg z<2\pi$ as the branch of the logarithm corresponding to.
\begin{align*} 2\pi i\sum \text{Res } g&=\oint g(z) dz\\ &=\int_\gamma+\int_\epsilon^R\frac{(\ln z)^2}{(1+z)(z^2+2z+2)}\,dz+\int_\Gamma+\int_R^\epsilon\frac{(\ln z+2\pi i)^2}{(1+z)(z^2+2z+2)}\,dz\\ &=\int_\epsilon^R\frac{(\ln z)^2-(\ln z+2\pi i)^2}{(1+z)(z^2+2z+2)}\,dz+\left(\int_\gamma+\int_\Gamma\right)\\ &=-4\pi i\int_0^\infty\frac{\ln z}{(1+z)(z^2+2z+2)}\,dz+\int_0^\infty\frac{4\pi^2}{(1+z)(z^2+2z+2)}\,dz\\ &=-4\pi iI_2+\int_0^\infty\frac{4\pi^2}{(1+z)(z^2+2z+2)}\,dz. \end{align*}
Method 2: Differentiation under $\int$
Substitute $x=\frac{u}{1-u}$,
\begin{align*} I&=-\int_0^1 \frac{u\ln(1-u)}{u^2+1}\,du. \end{align*}
Write
\begin{align*} J(\beta)&=-\int_0^1 \frac{u\ln(1-\beta u)}{u^2+1}\,du,\qquad \forall\beta\in[0,1]. \end{align*}
Then $J(0)=0$ and
\begin{align*} J_\beta (\beta)&=\frac{\partial}{\partial \beta}J(\beta)=\int_0^1 \frac{u^2}{(1-\beta u)\left(u^2+1\right)}\,du\\ &=\frac 1{1+\beta^2}\left(\color{red}{-\int_0^1\frac{1+\beta u}{1+u^2}\,du}\color{green}{+\int_0^1 \frac{1}{1-\beta u}\,du}\right)\\ &=\color{red}{-\frac{\pi+2\beta \ln 2}{4(1+\beta^2)}}\color{green}{-\frac{\ln(1-\beta)}{\beta}+\frac{\beta\ln(1-\beta)}{1+\beta^2}}. \end{align*}
\begin{align*} I&=J(1)=\int_0^1 J_\beta (\beta)\,d\beta\\ &=\color{red}{-\int_0^1\frac{\pi+2\beta \ln 2}{4(1+\beta^2)}\,d\beta}\color{blue}{-\int_0^1\frac{\ln(1-\beta)}{\beta}\,d\beta}+\int_0^1\frac{\beta\ln(1-\beta)}{1+\beta^2}\,d\beta\\ &=\color{red}{-\frac{\pi^2}{16}-\frac 14\ln^2 2}\color{blue}{+\frac{\pi^2}{6}}-I. \end{align*}
\begin{align*} \therefore 2I=\frac{5\pi^2}{48}-\frac 14\ln^2 2. \end{align*}
Method 3 : Series
Inspired by $\sum_{k=1}^{\infty} \frac{(-1)^{k+1} H_k}{k} = \frac{1}{2} \zeta(2) - \frac{1}{2} \log^2 2$.
Claim 3: \begin{align*} I=-\frac 12 \sum_{n=1}^\infty\frac{(-1)^n} n H_{2n},\qquad\qquad\text{where }H_m=\sum_{n=1}^m\frac 1 n,\quad m\in\mathbb N. \end{align*}
Substitute $x=\frac{u}{1-u}$,
\begin{align*} I&=-\int_0^1 \frac{u\ln(1-u)}{u^2+1}\,du. \end{align*}
Integrate by parts,
\begin{align*} I&=-\frac 12\int_0^1 \ln(1-u)\,d\left(\ln \frac {1+u^2}{2}\right)\\ &=\underbrace{\left.-\frac 12\ln(1-u)\left(\ln \frac {1+u^2}{2}\right)\right|_0^1}_0+\frac 12 \int_0^1\frac{\color{red}{\ln\left(1+u^2\right)}-\color{green}{\ln 2}}{u-1}\,du\\ &=\frac 12 \int_0^1 \frac 1{u-1}\left(\color{red}{\sum_{n=1}^\infty\frac{(-1)^{n-1}} n u^{2n}}-\color{green}{\sum_{n=1}^\infty\frac{(-1)^{n-1}} n }\right)\,du\\ &=-\frac 12 \sum_{n=1}^\infty\frac{(-1)^n} n\int_0^1\frac {u^{2n}-1}{u-1}\,du\\ &=-\frac 12 \sum_{n=1}^\infty\frac{(-1)^n} n\int_0^1\sum_{k=1}^{2n} u^{k-1}\,du\\ &=-\frac 12 \sum_{n=1}^\infty\frac{(-1)^n} n H_{2n}. \end{align*}
The claim is established.
Let $S(N)=\sum_{n=1}^N\frac{(-1)^n} n H_{2n},\forall N\in\mathbb N$.
\begin{align*} S(N)&=\sum_{n=1}^N\frac{(-1)^n} n \cdot \frac 1{2n}+\sum_{n=1}^N\frac{(-1)^n} n H_{2n-1}\tag{3.1}\\ &=\frac 12\sum_{n=1}^N\frac{(-1)^n}{n^2}+\frac 12\sum_{n=1}^N\sum_{k=1}^{2n-1}\frac{(-1)^n} n\left(\frac 1k+\frac 1{2n-k}\right)\tag{3.2}\\ &=\frac 12\sum_{n=1}^N\frac{(-1)^n}{n^2}+\sum_{n=1}^N\sum_{k=1}^{2n-1}\frac{(-1)^n}{k(2n-k)}\tag{3.3}\\ &=\frac 12\sum_{n=1}^N\frac{(-1)^n}{n^2}+\Re\left\{\sum_{k=1}^{2N-1}\sum_{m=k+1}^{2N}\frac{(-1)^{m/2}}{k(m-k)}\right\}\tag{3.4}\\ &=\frac 12\sum_{n=1}^N\frac{(-1)^n}{n^2}+\Re\left\{\sum_{k=1}^{2N-1}\sum_{l=1}^{2N-k}\frac{i^{k+l}}{kl}\right\}\tag{3.5}\\ &=\color{purple}{\frac 12\sum_{n=1}^N\frac{(-1)^n}{n^2}}+\color{blue}{\Re\left\{\sum_{k=1}^{2N-1}\frac{i^k}k\sum_{l=1}^{2N-1}\frac{i^l}l\right\}}-\color{orange}{\Re\left\{\sum_{k=1}^{2N-1}\frac{i^k}k\sum_{l=2N-k-1}^{2N-1}\frac{i^l}l\right\}}\tag{3.6}\\ &=\color{purple}{S_1(N)}+\color{blue}{S_2(N)}-\color{orange}{S_3(N)}. \end{align*}
Comment:
In $(3.1)$ we break $H_{2n}$ into $\frac 1{2n}+H_{2n-1}$.
In $(3.2)$ we use $\sum_{k=1}^{m-1}f(k)=\sum_{k=1}^{m-1}f(m-k)$.
In $(3.4)$ we swap two summation signs and set $m=2n$.
In $(3.5)$ we set $l=m-k$.
In $(3.6)$ we use $\sum_{l=1}^{2N-k}=\sum_{l=1}^{2N-1}-\sum_{l=2N-k-1}^{2N-1}$.
To prove $\color{orange}{S_3(\infty)}=0$, use the Alternating Series Test, one has
\begin{align*} \left|\color{orange}{S_3(N)}\right|&=\left|\Re\left\{\sum_{k=1}^{2N-1}\left(\frac{i^{2k}}{2k}+\frac{i^{2k-1}}{2k-1}\right)\sum_{l=2N-k-1}^{2N-1}\left(\frac{i^{2l}}{2l}+\frac{i^{2l-1}}{2l-1}\right)\right\}\right|\tag{3.7}\\ &=\left|\Re\left\{\sum_{k=1}^{2N-1}\left(\frac{(-1)^k}{2k}-i\frac{(-1)^k}{2k-1}\right)\sum_{l=2N-k-1}^{2N-1}\left(\frac{(-1)^l}{2l}-i\frac{(-1)^l}{2l-1}\right)\right\}\right|\tag{3.8}\\ &=\left|\sum_{k=1}^{2N-1}\frac{(-1)^k}{2k}\sum_{l=2N-k+1}^{2N-1}\frac{(-1)^l}{2l}+\sum_{k=1}^{2N-1}\frac{(-1)^k}{2k-1}\sum_{l=2N-k-1}^{2N-1}\frac{(-1)^l}{2l-1}\right|\tag{3.9}\\ &\le\left|\sum_{k=1}^{2N-1}\frac{(-1)^k}{k}\sum_{l=2N-k-1}^{2N-1}\frac{(-1)^l}{l}\right|\le\left|\sum_{k=1}^{2N-1}\frac{(-1)^k}{k}\sum_{l=N}^{2N-1}\frac{(-1)^l}{l}\right|\\ &\le\left|2\sum_{l=N}^{2N-1}\frac1{N(N-1)}\right|= \frac 2{N-1}. \end{align*}
Comment:
- In $(3.7)$ we break indices into odd and even parts.
Therefore, as $N\to\infty$, \begin{align*} \lim_{N\to\infty} S(N)&=\color{purple}{S_1(\infty)}+\color{blue}{S_2(\infty)}-\color{orange}{S_3(\infty)}\\ &=\color{purple}{\frac 12\left(-\frac{\pi^2}{12}\right)}+\color{blue}{\Re\left\{\ln(1-i)\ln(1-i)\right\}}-\color{orange}{0}\\ &=\color{purple}{-\frac{\pi^2}{24}}+\color{blue}{\left(\frac{\ln 2}{2}\right)^2+\left(\frac{-\pi i}{4}\right)^2}-\color{orange}{0}\\ &=-\frac{5\pi^2}{48}+\frac{\ln^2 2} 4. \end{align*}