# Evaluate $\int_0^{\frac{1}{2}}(1-2 x) \ln (\tan (x)) d x$

Evaluate $$\int_0^{\frac{1}{2}}(1-2 x) \ln (\tan (x)) d x$$

My try is using Feyman's Trick:

\begin{aligned} & f(a)=\int_0^{\frac{1}{2}}(1-2 x) \ln (\tan a x) d x \\ & f^{\prime}(a)=\int_0^{\frac{1}{2}} \frac{(1-2 x)}{\tan (ax)} x \sec ^2(ax) d x \\ & \Rightarrow f^{\prime}(a)=2 \int_0^{\frac{1}{2}} \frac{x(1-2 x)}{\sin (2 ax)} d x=\frac{1}{2} \int_0^1 \frac{(1-x) x d x}{\sin (a x)} \end{aligned} Any help?

• 1/2 isn't really a nice bound value. afaik the best you can get is an expression of polylog spam Commented Feb 1, 2023 at 3:50
• and the problem is the same with or without Feynman's trick Commented Feb 1, 2023 at 4:11
• $\int_0^{1/2}(1-2x)\log\tan\color{red}{\pi}x\,dx$ would have a nice closed form. Commented Feb 1, 2023 at 6:20
• FWIW, you can also use the Fourier series for $\ln\tan x$, namely $$\ln\tan x = -2\sum_{k=1}^{\infty}\frac{\cos(2x(2k-1))}{2k-1}$$ which holds in the interval you are integrating on. Commented Feb 1, 2023 at 8:25

$$I=\int_0^{\frac{1}{2}}(1-2 x) \ln (\tan (x)) d x = {\color{red}{\int_0^{\frac{1}{2}} \log(\tan(x)) d x}} -2 {\color{blue}{\int_0^{\frac{1}{2}} x \log(\tan(x)) d x}}$$ The bounds aren't nice, so afaik we will have to brute force with an antiderivative and whatnot.

For red, we can do $$u=\tan(x)$$ $$\implies \int \log(\tan(x)) d x = \int \frac{\log(u)}{u^2+1}du=\int \frac{\log(u)}{(u+i)(u-i)}du$$ Perform partial fractions, some linear substitutions, and using the definition of the polylogarithm, it should trivially follow that $$R(x)=\int \log(\tan(x)) d x = -\frac12 i\operatorname{Li}_2(-i\tan x) + \frac12 i\operatorname{Li}_2(i\tan x) + \arctan(\tan (x) \log(\tan x))+C$$ $$\implies {\color{red}{\int_0^{\frac{1}{2}} \log(\tan(x)) d x}} = R(1/2)-R(0) = R(1/2) = {\color{red}{-\frac12 i\operatorname{Li}_2(-i\tan(1/2)) + \frac12 i\operatorname{Li}_2(i\tan (1/2))+ \frac12\log(\tan(1/2))}}$$

For the blue integral, we will integrate by parts $$\int {\color{purple}{x}}\,{\color{orange}{\log(\tan x)}}dx$$ Integrate by parts with $$u$$(ie the derivative) being the log expression and $$v$$(ie the integral) being the $$x$$. Write the remaining integral in exponential form. We get $$\frac{x^2}2\cdot \log(\tan x) - 2i \int \frac{x^2 e^{2ix}}{(e^{2ix}-1)(e^{2ix}+1)}dx$$ Use the subtitution $$u=e^{2ix}-1$$ to recover an integral with a log squared, which can be solved by using PFD, parts, and the definintion of the trilogarithm. In the end, we have $$B(x) = \int x \log(\tan(x)) d x = \frac i2 \operatorname{Li}_2(e^{2ix}) - \frac12 \operatorname{Li}_3(e^{2ix}) + \frac1{16}\operatorname{Li}_3(e^{4ix}) + \frac{x^2}2\log(1+e^{2ix}) + \frac12 x^2\log(\tan x) - \frac i2 x\log(1-e^{2ix})$$

$$-2 {\color{blue}{\int_0^{\frac{1}{2}} x \log(\tan(x)) d x}} = -2 (B(1/2) -B(0))$$ Unfortunately, I had to use Mathematica here, as the limits were impossible to manually solve for me at least. Indeed, $$-2 ({\color{green}{B(1/2)}} -{\color{cyan}{B(0)}}) = -2\left({\color{green}{\frac14\operatorname{arctanh}(e^i) + \frac18 \log(\tan(1/2)) + \frac i2 \operatorname{Li}_2(e^i) - \frac i8 \operatorname{Li}_2(e^{2i}) - \frac12 \operatorname{Li}_3(e^i) + \frac1{16}\operatorname{Li}_3(e^{2i})}}-{\color{cyan}{-\frac7{16}\zeta(3)}}\right)$$ Yes, that is the reimann zeta function. I suppose it's not much of a suprise given the amount of polylogs in this expression lol.

Adding up the two expressions give $${\color{red}{-\frac12 i\operatorname{Li}_2(-i\tan(1/2)) + \frac12 i\operatorname{Li}_2(i\tan (1/2)) + \frac12\log(\tan(1/2))}} + {\color{blue}{-\frac i8\left(\pi + 8 \operatorname{Li}_2(e^i) - 2 \operatorname{Li}_2(e^{2i}) + 8i \operatorname{Li}_3(e^i) - i \operatorname{Li}_3(e^{2i}) - 7i\zeta(3)\right)}}$$ I ran a FullSimplify command on this in mathematica and the final answer seems to be $$I=\boxed{-\frac{i\pi}{8} + \frac12 \log\left(\tan\left(\frac12\right)\right) - i\operatorname{Li}_2\left(e^i\right) + \frac i4 \operatorname{Li}_2\left(e^{2i}\right) - \frac i2 \operatorname{Li}_2\left(-i\tan\left(\frac12\right)\right) + \frac i2\operatorname{Li}_2\left(i\tan\left(\frac12\right)\right) + \operatorname{Li}_3\left(e^i\right) - \frac18 \operatorname{Li}_3\left(e^{2i}\right) - \frac78 \zeta(3)}$$ I have numerically verified the expression equivalence $$I\approx -0.544730348974...$$

This honestly wasn't really clean, as I consider an independent/good solution to an integral to be one that does not rely on any CAS to do any computation, but in this one I basically didn't have a choice. Furthermore, I do realize how cumbersome finding an antiderivative is, and I will admit that this may not be the best method. Nevertheless, this is the best I can do, and hopefully it satisfies your question :)

• Well done for your effort. Thnaku Commented Feb 1, 2023 at 5:24
• @EkaveeraGouribhatla glad to help :) Commented Feb 1, 2023 at 6:39
• Congratulations for the $1,000$ reputation Commented Feb 1, 2023 at 6:58
• @ClaudeLeibovici thank you! Commented Feb 1, 2023 at 11:57

Using the same kind of steps as @Captain Chicky is his/her good answer but separating the sine and cosine function, a shorter result is $$\color{blue}{I=\frac{(\pi-1)(\pi-2)}{24} i-\frac 7 8 \zeta(3)+\frac{1}{2} \left(\text{Li}_3\left(+e^{-i}\right)-\text{Li}_3\left(-e^{+i} \right)\right)}$$ that is to say $$\color{blue}{I=\frac 12 \Re\Big[\text{Li}_3\left(+e^{-i}\right)-\text{Li}_3\left(-e^{+i} \right)\Big]-\frac 7 8 \zeta(3)}$$

Edit

We can also try a series solution writing $$(1-2x)\log(\tan(x))=(1-2 x) \log (x)+(1-2 x) \log \left(\frac{\tan (x)}{x}\right)$$ making $$I=-\frac{1}{8} (3+2 \log (2))+\int_0^{\frac12}\Big[(1-2x)\sum_{n=1}^\infty \frac{a_n}{b_n} x^n \Big]\,dx$$

Coefficients $$a_n$$ and $$b_n$$ respectively correspond to sequences $$A047685$$ and $$A047686$$ in $$OEIS$$.

The integral should converge quite fast because of the range of integration and because $$(1-2x)\sum_{n=1}^\infty \frac{a_n}{b_n} x^n=\frac{x^2}{3}-\frac{2 x^3}{3}+\frac{7 x^4}{90}-\frac{7 x^5}{45}+\frac{62 x^6}{2835}+O\left(x^7\right)$$

Truncating to some order $$n$$, the decimal represntation of the remaining integral $$\left( \begin{array}{cc} n & \text{integral} \\ 5 & 0.003553240741 \\ 10 & 0.003556534536 \\ 15 & 0.003556446164 \\ 20 & 0.003556446166 \\ \end{array} \right)$$

• Oh wow that actually simplifies pretty nicely. Commented Feb 1, 2023 at 12:01
• @CaptainChicky. I, for sure, have the same result as you but ... I just tried ! Pure luck !! Commented Feb 1, 2023 at 12:13