# How to prove $\int^{\pi}_0 \cos(x)\log(\tan(\frac{x}{4}))\,\mathrm dx = -2$

How to prove $$\int^{\pi}_0 \cos(x)\log(\tan(\frac{x}{4}))\,\mathrm dx = -2$$?

Or $$\int^1_0 \log(u)\frac{(u^4-6u^2+1)}{(u^2+1)^3} \,\mathrm du = -1/2$$.

(I substituted $$\tan(x/4) = u$$.)

\begin{align*} \int_0^\pi\cos x\log\left(\tan \frac x4\right)dx&=\left[\sin x\log\left(\tan\frac x4\right)\right]_0^\pi-\int_0^\pi\sin x\cdot\frac{\frac14\sec^2\frac x4}{\tan\frac x4}dx\\ &=0-\int_0^\pi\frac{\sin x}{4\sin\frac x4\cos\frac x4}dx\\ &=-\int_0^\pi\frac{\sin x}{2\sin\frac x2}dx\\ &=-\int_0^\pi\cos\frac x2dx\\ &=-\left[2\sin\frac x2\right]_0^\pi\\ &=-2 \end{align*}

Note that

\begin{align*} \lim_{x\to0^+}\sin x\log\left(\tan\frac x4\right)&=\lim_{x\to0^+}\frac{\log\left(\tan\frac x4\right)}{\csc x}\\ &=\lim_{x\to0^+}\frac{\frac{\sec^2\frac x4}{4\tan\frac x4}}{-\cot x\csc x}\\ &=\lim_{x\to0^+}\left(-\sin x\tan x\cos\frac x2\right)\\ &=0 \end{align*}

• @PeterForeman Yes, this is necessary. – CY Aries Jul 7 at 10:06

$$\int_{0}^{\pi} \cos{x}\log(\tan(x/4)) dx$$

$$= \int_{0}^{\pi/4} \cos{4z}\log(\tan(z)) dz$$ (where $$z = x/4$$)

$$= [\sin{4z}\log(\tan(z))]_0^{\pi/4} - \int_{0}^{\pi/4} \frac{\sin{4z}\sec^2{z}}{\tan{z}} dz$$

$$= -\int_{0}^{\pi/4} \frac{\sin{4z}}{\sin{z}\cos{z}} dz$$

$$=-4\int_{0}^{\pi/4} \cos{2z}dz = -2$$

The integral you got after the substitution can be solved using integration by parts. That is, $$\int_0^1 f(u) g'(u)du=f(u)g(u)|_0^1 - \int_0^1 f'(u) g(u) du,$$ where $$f(u)=\log(u)$$ and $$g'(u)=\frac{u^4-6u^2+1}{(u^2+1)^3}.$$ In this case, $$f'(u)=\frac1u$$ and $$g(u)$$ can be obtained integrating $$g'(u)$$ using simple fractions. I'm not saying it will be fast nor nice to do it; just that it can be done.

NOTE: I haven't tried it, but it could be that after the substitution $$u=\frac x4$$, and after replacing $$\cos(4u)=\cos^2(2u)-\sin^2(2u)=$$$$=(\cos^2(u)-\sin^2(u))^2-(2\sin(u)\cos(u))^2=$$$$=\cos^4(u)-6\sin(u)\cos(u)+\sin^4(u),$$ and separating into the sum of three integrals, each one of them can be solved integrating by parts, where the $$\log$$ part will be $$f$$, that is, the function you'll take the derivative to. But again, I don't really know if this will work.