In my post, I had found an elegant integral $$\int_{0}^{\frac{\pi}{4}} \ln (\tan x)~ d x=-G. $$ I then try to generalise the integral $$ I_{n}=\int_{0}^{\frac{\pi}{4}} \ln ^{n}(\tan \theta) d \theta, ~~~~\textrm{ where }n\in N, $$ by letting $e^{-x}=\tan \theta$. Consequently $-e^{-x} d x=\left(1+e^{-2 x}\right) d \theta$ converts the integral to

$$ \begin{aligned} I_{n} &=\int_{\infty}^{0} \frac{\ln ^{n}\left(e^{-x}\right)\left(-e^{-x}\right)}{1+e^{-2 x}} d x =\int_{0}^{\infty} \frac{(-x)^{n} e^{-x}}{1+e^{-2 x}} d x \end{aligned} $$

Expanding the integrand into a power series yields $$ \begin{aligned} I_{n} &=(-1)^{n} \int_{0}^{\infty} \sum_{k=0}^{\infty}(-1)^{k} x^{n} e^{-(2 k+1) x} d x\\&=(-1)^{n} \sum_{k=0}^{\infty}(-1)^{k} \int_{0}^{\infty} x^{n} e^{-(2 k+1) x} d x \end{aligned} $$ Letting $(2k+1)x\mapsto x$ transforms the integral into a Gamma function. $$ \\ \boxed{\int_{0}^{\frac{\pi}{4}} \ln ^{n}(\tan \theta) d \theta =(-1)^{n} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{\left({2 k+1}\right)^{n+1}} \int_{0}^{\infty}x^ne^{-x} d x=(-1)^{n} \beta(n+1) \Gamma(n+1)} $$

where $\beta(s)$ is the Dirichlet beta function.

For examples, $$ \begin{array}{l} \displaystyle I_{1}=\int_{0}^{\frac{\pi}{4}} \ln (\tan \theta)d\theta=-\beta(2) \Gamma(2)=-G \\ \displaystyle I_{2}=\int_{0}^{\frac{\pi}{4}} \ln ^{2}(\tan \theta) d\theta =\beta(3) \Gamma(3)=\frac{\pi^{3}}{32} \cdot 2=\frac{\pi^{3}}{16} \\ \displaystyle I_{10}=\int_{0}^{\frac{\pi}{4}} \ln ^{10}(\tan \theta) d\theta =\beta(11) \Gamma(11)=\frac{50521\pi^{11}}{14863564800}\times 10!= \frac{50521 \pi^{11}}{4096} \approx 3.62878 \times 10^{6} \end{array} $$

Looking forwards to getting more alternate solutions and opinions from you!


2 Answers 2


Let $J(s)=\int_0^{\pi/4} \tan^s(\theta)d\theta$


Let $t=\tan(\theta)$

$$J(s)=\int_0^1 \frac{t^s}{1+t^2}dt=\sum_{k=0}^\infty (-1)^k \int_0^1 t^{2k+s}dt=\sum_{k=0}^\infty \frac{(-1)^k}{2k+1+s} $$

$$\frac{d^n}{ds^n}J(s)=(-1)^n~n!~\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1+s)^{n+1}}$$

$$I_n=(-1)^n~n!~\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^{n+1}}$$

  • $\begingroup$ iirc that last alternating sum is known in general, for even $n$ $\endgroup$
    – FShrike
    Jul 28, 2022 at 17:02
  • $\begingroup$ Yes, we knew it. $\endgroup$
    – MathFail
    Jul 28, 2022 at 17:13
  • $\begingroup$ Simple and nice! $\endgroup$
    – Lai
    Jul 28, 2022 at 22:46
  • $\begingroup$ Thank you! @Lai $\endgroup$
    – MathFail
    Jul 28, 2022 at 22:49

In general $$\int_{0}^{\frac{\pi}{4}} \ln ^{n}( \tan \theta ) d\theta \overset{x=\tan \theta}=\int_0^1\frac{\ln^nx}{1+x^2}dx =(-1)^n n!\ \Im \text{Li}_{n+1}(i) $$ and, in particular, $\Im \text{Li}_{2}(i)=G, \>\>\> \Im \text{Li}_{3}(i)=\frac{\pi^3}{32}, \>\>\> \Im \text{Li}_{5}(i)=\frac{5\pi^5}{1536},\>\>\>\cdots $


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .