# Alternative method of evaluating $\int_0^{\frac{\pi}{2}} \sin ^{2 n} x \ln (\tan x) d x$?

LATEST EDITION

$$\boxed{ \int_0^{\frac\pi2} {\sin^n x} \ln{(\tan x)} \,dx =\frac{\sqrt{\pi}}{4 \Gamma\left(\frac{n}{2}+1\right)} \Gamma\left(\frac{n+1}{2}\right) \left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right]}$$ where $$n\in \mathbb N$$.

After reading the post with the result $$\int_0^{\frac\pi2} {\sin^2{x} \ln{(\tan x)} \,dx}=\frac{\pi}{4}$$ I was attracted by its decency and wanted to generalise it as $$I_n=\int_0^{\frac{\pi}{2}} \sin ^{2 n} x \ln (\tan x) d x \stackrel{x\mapsto\frac \pi 2- x}{=}- \int_0^{\frac{\pi}{2}} \cos ^{2 n} x \ln (\tan x) d x =-J_n,$$ For convenience, I started with the second integral,

$$J_n=\int_0^{\frac{\pi}{2}} \cos ^{2 n} x \ln (\tan x) d x,$$

Letting $$u=\tan x$$ transforms the integral into $$J_n=\int_0^{\infty} \frac{\ln u}{\left(1+u^2\right)^{n+1}} d u$$ Differentiating the following famous result w.r.t. $$a$$ by $$n$$ times $$K(a)=\int_0^{\infty} \frac{\ln u}{a+u^2} d u=\frac{\pi \ln a}{4 \sqrt{a}}, (\textrm{ for }a>0)$$

(refer post for details)

yields \begin{aligned}J_n&=\left.\frac{(-1)^n}{n !} \frac{\partial^n K(a)}{\partial a^n}\right|_{a=1}\\&=\left.\frac{(-1)^n \pi}{4n !} \frac{\partial^n}{\partial a^n}\left(\frac{\ln a}{\sqrt{a}}\right)\right|_{a=1} \\&=\frac{\pi}{4 n !}\left(\frac{1}{2}\right)_n\left[\psi\left(\frac{1}{2}\right)-\psi\left(\frac{1}{2}-n\right)\right] \cdots (*)\end{aligned} We can now conclude that

$$\boxed{J_n= \frac{\pi(2 n) !}{4^{n+1}(n !)^2}\left[\psi\left(\frac{1}{2}\right)-\psi\left(\frac{1}{2}-n\right)\right]=-I_n}$$

For examples, $$J_1=-\frac{\pi}{4} ; \quad J_2=-\frac{\pi}{4}; \quad J_3=-\frac{23 \pi}{96}; \quad J_4=-\frac{11\pi}{48} ; \quad J_5=-\frac{563\pi}{2560} ; \quad J_6=-\frac{1627\pi}{7680};\cdots$$ and $$I_1=\frac{\pi}{4} ; \quad I_2=\frac{\pi}{4}; \quad I_3=\frac{23 \pi}{96}; \quad I_4=\frac{11\pi}{48} ; \quad I_5=\frac{563\pi}{2560} ; \quad I_6=\frac{1627\pi}{7680};\cdots$$

My questions:

1. Any other alternative method of evaluating $$\int_0^{\frac{\pi}{2}} \sin ^{2 n} x \ln (\tan x) d x$$?
2. Can the result (*) found in Wolframalpha be proved?

Alternatively, evaluate with the recursions below \begin{align} & \int_0^{\infty} \frac{\ln x}{\left(1+x^2\right)^{n+1}} d x =I_{n+1} = \frac{2n-1}{2n}I_n-\frac1{2n}J_n\\ & \int_0^{\infty} \frac{1}{\left(1+x^2\right)^{n}} d x =J_{n} = \frac{2n-3}{2(n-1)}J_{n-1}\\ \end{align} along with the initial values $$J_1=\frac\pi2$$ and $$I_1=0$$.

$$J_n=\int_0^{\pi/2}(\cos x)^{2n}\ln(\tan x)\ dx$$

which can be converted to,

$$J_n=\frac{1}{4}\left[\frac{d}{ds}\int_0^1t^{s+1/2-1}(1-t)^{n-s+1/2-1}\ dt\right]_{s=0}$$

Which after the application of Beta Function turns out to be,

$$J_n=\frac{1}{4\Gamma(n+1)}\left[\frac{d}{ds}\Gamma(n-s+1/2)\Gamma(s+1/2)\right]_{s=0}$$

Using the Digamma Function $$\psi(z)\Gamma(z)=\Gamma'(z)$$ we can simplify it as follows,

(I would prefer to write it in terms of Harmonic Number $$H_n$$)

$$J_n=\frac{\pi}{4}\frac{1}{2^{2n}}\binom{2n}{n}(H_n-2H_{2n})$$

where we have used $$H_{n-1/2}=2H_{2n}-H_n-2\ln 2$$

$$\left(\frac{d}{ds}\right)^n\frac{\ln(1+s)}{\sqrt{1+s}}\bigg|_{s=0}=\frac{(-1)^n(2n)!}{2^{2n}n!}(H_n-2H_{2n})$$

which can be rewritten as,

$$\frac{\ln(1-x)}{\sqrt{1-x}}=\sum_{n=0}^{\infty}\frac{1}{2^{2n}}\binom{2n}{n}(H_n-2H_{2n})x^n$$

and is known, but I can't find the post with the derivation.

(there should be one somewhere around the site, if anyone could link it in the comments please)

• Why the downvote? If possible do tell the reason so I may improve the answer. Commented Mar 12 at 12:08
• The derivation of the last result may be found in More (Almost) Impossible Integrals, Sums, and Series (2023), pages $501$-$503$. I'm also curious if the result appeared elsewhere in the literature since I never could find it in other places (despite its simplicity). (I didn't downvote - just to be clear) Commented Mar 14 at 5:33
• @user97357329 Thank you for the reference! It might have been derived earlier but finding it would be difficult. Commented Mar 14 at 10:23

Inspired by Miracle Invoker, I had just found the exact value of

$$\boxed{A_n= \int_0^{\frac\pi2} {\sin^n x} \ln{(\tan x)} \,dx =\frac{\sqrt{\pi}}{4 \Gamma\left(\frac{n}{2}+1\right)} \Gamma\left(\frac{n+1}{2}\right) \left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right]}$$ and $$\boxed{ B_n=\int_0^{\frac\pi2} {\cos^n x} \ln{(\tan x)} \,dx =-\frac{\sqrt{\pi}}{4 \Gamma\left(\frac{n}{2}+1\right)} \Gamma\left(\frac{n+1}{2}\right) \left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right]}$$

where $$n\in \mathbb N.$$

Noticing that

$$A_n=\left.\frac{\partial}{\partial a}\left(A_n(a)\right)\right|_{a=0}$$

where \begin{aligned}A_n (a) & =\int_0^{\frac{\pi}{2}} \sin ^{n} x \tan ^a x d x \\ & =\int_0^{\frac{\pi}{2}} \sin ^{n+a} x \cos ^{-a} x d x \\ & =\frac{1}{2} B\left(\frac{n+a+1}{2}, \frac{1-a}{2}\right) \\ & =\frac{1}{2 \Gamma(\frac n2+1) } \Gamma\left(\frac{n+a+1}{2}\right) \Gamma\left(\frac{1-a}{2}\right) \end{aligned} Using logarithmic differentiation, we have $$\frac{A_n^{\prime}(a)}{A_n(a)}=\frac{1}{2}\left[\psi\left(\frac{n+a+1}{2}\right)-\psi\left(\frac{1-a}{2}\right)\right]$$ Setting $$a=0$$ yields \begin{aligned} A_n^{\prime}(0) & =\frac{1}{2} A_n(0)\left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right] \\ & =\frac{1}{2} \cdot \frac{1}{2\Gamma(\frac n2+1 )} \Gamma\left(\frac{n+1}{2}\right) \Gamma\left(\frac{1}{2}\right)\left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right]\\ \end{aligned} We can now conclude that $$\boxed{ \int_0^{\frac\pi2} {\sin^n x} \ln{(\tan x)} \,dx =\frac{\sqrt{\pi}}{4 \Gamma\left(\frac{n}{2}+1\right)} \Gamma\left(\frac{n+1}{2}\right) \left[\psi\left(\frac{n+1}{2}\right)-\psi\left(\frac{1}{2}\right)\right]=-B_n}$$

For examples,

$$\left\{A_n\right\}_{n=1}^{10}= \left\{\log 2, \frac{\pi}{4}, \frac{1}{3}(1+2\log 2), \frac{\pi}{4}, \frac{2}{15}(3+4\log 2), \frac{23 \pi}{96},\\ \qquad\qquad \qquad\qquad \frac{4}{105}(11+12\log 2), \frac{11 \pi}{48}, \frac{16}{945}(25+24\log 2), \frac{563 \pi}{2560}\right\}$$

and $$\left\{B_n\right\}_{n=1}^{10}= \left\{-\log 2, -\frac{\pi}{4}, -\frac{1}{3}(1+2\log 2), -\frac{\pi}{4}, -\frac{2}{15}(3+4\log 2), -\frac{23 \pi}{96},\\ \qquad\qquad \qquad\qquad - \frac{4}{105}(11+12\log 2), -\frac{11 \pi}{48}, -\frac{16}{945}(25+24\log 2), -\frac{563 \pi}{2560}\right\}$$

• You accepted your own answer? It's the same as mine :( Commented Mar 14 at 10:21