Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I integrate $$\int_{0}^{\large\pi}\ln (\tan x)\,\text{dx}\;\;\;?$$

share|cite|improve this question
Is your function defined on the interval $[0,\pi]$ ? – Lubin Jan 24 '13 at 15:29
$\ln(\tan(x))$ isn't defined for $x \in [\pi/2,\pi]$. – Raskolnikov Jan 24 '13 at 15:29
What do you guys mean, $\ln(\tan(x))$ is defined for $ \frac{\pi}{2} < x< \pi$, but it is not real-valued there. – Sasha Jan 24 '13 at 15:31
the value is roughly 4.93i and the indefinite integral is possible but very difficult. It involves the polylogarithmic function. I am looking for an easier way. – kaine Jan 24 '13 at 15:37
I wonder if the integration limits are correct. – user 1618033 Jan 24 '13 at 15:49
up vote 6 down vote accepted

Since $\tan\left(\pi -x\right) = - \tan(x)$, and $\tan(x)$ is positive for $0<x<\frac{\pi}{2}$ we have: $$ \int_0^\pi \ln\left(\tan x\right) \mathrm{d}x = i \pi \int_0^{\pi/2} \mathrm{d} x + 2 \int_0^{\pi/2} \ln\left(\tan x\right) \mathrm{d}x $$ Furthermore, using $\tan\left(\frac{\pi}{2}-x\right) = \frac{1}{\tan(x)}$ we see that $$\begin{eqnarray} 2 \int_0^{\pi/2} \ln\left(\tan x\right) \mathrm{d}x &=& \int_0^{\pi/2} \log\left(\tan x \right) \mathrm{d} x + \int_0^{\pi/2} \log\left(\tan y \right) \mathrm{d} y \\ &\stackrel{y=\pi/2 - x}{=}& \int_0^{\pi/2} \log\left(\tan x \right) \mathrm{d} x + \int_0^{\pi/2} \log\left(\frac{1}{\tan x} \right) \mathrm{d} x = 0 \end{eqnarray} $$ Thus $$ \int_0^\pi \ln\left(\tan x\right) \mathrm{d}x = i \frac{\pi^2}{2} $$

share|cite|improve this answer
just curious, is it correct to solve it by noticing that $\log(\tan(x)) =\log ( \sin(x)) - \log( \cos(x)) = \Im(\log e^{ix})- \Re(\log e^{ix})= \Im(ix)- \Re(ix)$ and then integrating over $x \in [0, \pi]$? – Alex Jan 24 '13 at 15:48
@Alex No, because $\log(\sin(x)) = \log(\Im \mathrm{e}^{ix}) \not= \Im\left(\log \mathrm{e}^{i x}\right)$. – Sasha Jan 24 '13 at 15:58
Thanks, now I see. – Alex Jan 24 '13 at 16:03
Thanks Sasha but i did not understand the line $\displaystyle\int_0^\pi \ln\left(\tan x\right) \mathrm{d}x = i \pi \int_0^{\pi/2} \mathrm{d} x + 2 \int_0^{\pi/2} \ln\left(\tan x\right) \mathrm{d}x$ – juantheron Jan 25 '13 at 18:44
@juantheron $ \int_0^\pi \ln(\tan(x)) \mathrm{d}x = \int_0^{\pi/2} \ln(\tan(x)) \mathrm{d}x + \int_{\pi/2}^\pi \ln(\tan(y)) \mathrm{d}y$. Then change variables $y=\pi - x$, use $\tan\left(\pi - x\right) = -\tan(x)$. Now, since $\tan(x)>0$ for $0<x<\pi/2$, use $\ln(-\tan(x)) = i \pi + \ln(\tan(x))$. – Sasha Jan 25 '13 at 19:14

If looking for the real value only, it's enough to consider

$$I=\int_{0}^{\pi/2}\ln (\tan x)dx$$ and let $x=\pi/2-y$ $$I=\int_{0}^{\pi/2}\ln (\tan x)dx=\int_{0}^{\pi/2}\ln (\cot x)dx$$ $$2I=\int_{0}^{\pi/2}\ln (1)dx$$ $$I=0$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.