Spurred on by a question posed on MSE, I was hoping to resolve the following definite integral: \begin{equation} I_n = \int_0^\frac{\pi}{4} \frac{\ln\left| 1 + \tan(x)\right|}{\left( 1 + \tan(x)\right)^n}\:dx \end{equation} Where $n \in \mathbb{N},\: n\geq 2$. The approach I've taken is valid (I believe), but the final solution seems invalid. Here I used employ Feynman's Trick by introducing the following function: \begin{equation} J(p) = \int_0^\frac{\pi}{4} \frac{\ln\left|1 + \tan(x)\right|}{p + \tan(x)}\:dx \end{equation} Where $p \in \mathbb{R}$, $ 0\leq p \leq 1$. We observe that: \begin{equation} I_n = \frac{(-1)^{n - 1} J^{n - 1}(1)}{(n - 1)!} \end{equation} Where $J^m(p)$ is the $m$-th derivative of $J(p)$. To resolve $J(p)$ we first let $u = \tan(x)$ to yield: \begin{align} J(p) &= \int_0^1 \frac{\ln\left|1 + u\right|}{\left(u + p\right)\left(u^2 + 1\right)}\:du = \int_0^1 \frac{\ln\left|1 + u\right|}{p^2 + 1}\left[ \frac{1}{u + p} + \frac{p}{u^2 + 1} - \frac{u}{u^2 + 1} \right]\:du \nonumber \\ &=\frac{1}{p^2 + 1}\left[A(p) + pB - C \right] \end{align} Now $B$ and $C$ can be resolved without non-elementary functions using the self-similar substitution: \begin{equation} B = \int_0^1 \frac{\ln\left| u + 1\right|}{u^2 + 1}\:du = \frac{\pi}{8}\ln(2), \qquad C = \int_0^1 \frac{u}{u^2 + 1}\ln\left| u + 1\right|\:du = \frac{\pi^2}{96} + \frac{\ln^2(2)}{8} \end{equation} $A(p)$ can be resolved into the Dilogarithm with some simple substitions and repositioning. We first let $w = u + p$ to yield: \begin{align} A(p) &= \int_0^1 \frac{\ln\left|1 + u\right|}{u + p}\:du = \int_p^{p + 1} \frac{\ln\left| 1 + w - p \right|}{w}\:dw = \int_p^{p + 1} \frac{\ln\left|\left(1 - p\right)\left( \frac{w}{1 - p} + 1\right) \right|}{w}\:dw \nonumber \\ &= \ln\left|1 - p\right|\int_p^{p + 1} \frac{1}{w}\:dw + \int_p^{p + 1} \frac{\ln\left|\frac{w}{1 - p} + 1\right|}{w}\:dw \nonumber \\ &= \ln\left|1 - p\right|\ln\left| \frac{1 + p}{p} \right| + \int_p^{p + 1} \frac{\ln\left|\frac{w}{1 - p} + 1\right|}{w}\:dw \end{align} For the final integral, let $u = \frac{w}{1 - p}$: \begin{align} A(p) &= \ln\left|1 - p\right|\ln\left| \frac{1 + p}{p} \right| + \int_{\frac{p}{1 - p}}^{\frac{1 + p}{1 - p}} \frac{\ln\left|u + 1\right|}{u}\:du \nonumber \\ &= \ln\left|1 - p\right|\ln\left| \frac{1 + p}{p} \right| + \bigg[ -\operatorname{Li}_{2}(-u)\bigg]_{\frac{p}{1 - p}}^{\frac{ 1 + p}{1 - p}} \nonumber \\ &= \ln\left|1 - p\right|\ln\left| \frac{1 + p}{p} \right| + \left[ \operatorname{Li}_{2}\left(\frac{p}{p - 1}\right) - \operatorname{Li}_{2}\left(\frac{p + 1}{p - 1}\right) \right] \end{align} Thus $J(p)$ becomes: \begin{align} J(p) &= \frac{1}{p^2 + 1}\bigg[\ln\left|1 - p\right|\ln\left| \frac{1 + p}{p} \right| + \left[ \operatorname{Li}_{2}\left(\frac{p}{p - 1}\right) - \operatorname{Li}_{2}\left(\frac{p + 1}{p - 1}\right) \right] \nonumber \\ &\quad + \frac{\pi}{8}\ln(2)p- \left(\frac{\pi^2}{96} + \frac{\ln^2(2)}{8}\right) \bigg] \end{align}
My concern is evaluating this at $p = 1$. Have I fallen prey to an invalid use of the Linearity property of continuous functions? Is my method valid?
This is not an answer but a different method to find a closed form of ${{I}_{n}}$
For $x={{\tan }^{-1}}\left( u \right)$ we have: $$ {{I}_{n}}=\int_{0}^{1}{\frac{\ln \left( 1+u \right)}{{{\left( 1+u \right)}^{n}}\left( 1+{{u}^{2}} \right)}du} $$ Now using this result (thanks to Sangchul Lee) : $$ \frac{1}{{{(1+x)}^{n}}(1+{{x}^{2}})}=\left( \sum\limits_{k=1}^{n}{\frac{\sin (k\pi /4)}{{{2}^{k/2}}}}\frac{1}{{{(x+1)}^{n+1-k}}} \right)+\frac{\cos (n\pi /4)-x\sin (n\pi /4)}{{{2}^{n/2}}(1+{{x}^{2}})} $$ Multiply both sides by $\ln \left( 1+x \right)$ and integrate from $0$ to $1$ you get (separate the last term in the sum): $$ \begin{align} & {{I}_{n}}=\frac{\sin (n\pi /4)}{{{2}^{n/2}}}\int_{0}^{1}{\frac{\ln \left( 1+x \right)dx}{(x+1)}}+\sum\limits_{k=1}^{n-1}{\left[ \frac{\sin (k\pi /4)}{{{2}^{k/2}}}\int_{0}^{1}{\frac{\ln \left( 1+x \right)dx}{{{(x+1)}^{n+1-k}}}} \right]} \\ & \quad +\frac{\cos (n\pi /4)}{{{2}^{n/2}}}\int_{0}^{1}{\frac{\ln \left( 1+x \right)dx}{(1+{{x}^{2}})}}-\frac{\sin (n\pi /4)}{{{2}^{n/2}}}\int_{0}^{1}{\frac{x\ln \left( 1+x \right)dx}{(1+{{x}^{2}})}} \\ & \\ \end{align} $$
at this point we have every thing except: $$ \int_{0}^{1}{\frac{\ln \left( 1+x \right)dx}{{{(x+1)}^{n+1-k}}}}=\frac{1+{{2}^{k-n}}\left( k-n \right)\ln 2-{{2}^{k-n}}}{{{\left( k-n \right)}^{2}}},\quad k<n$$ Finally $$ \begin{align} & {{I}_{n}}={{\ln }^{2}}2\frac{\sin (n\pi /4)}{{{2}^{n/2+1}}}+\sum\nolimits_{k=0}^{n-1}{\left[ \frac{\sin (k\pi /4)}{{{2}^{k/2}}}\frac{1+{{2}^{k-n}}\left( k-n \right)\ln 2-{{2}^{k-n}}}{{{\left( k-n \right)}^{2}}} \right]} \\ & \quad +\pi \ln 2\frac{\cos (n\pi /4)}{{{2}^{n/2+3}}}-\frac{\sin (n\pi /4)}{{{2}^{n/2}}}\left( \frac{{{\pi }^{2}}}{96}+\frac{{{\ln }^{2}}2}{8} \right) \\ \end{align} $$