# Calculating the following definite integral

How may I approach and compute the following integral? Could polylogarithm functions and complex numbers be avoided?

$$\int_0^{\frac{\pi}{2}} \frac{x}{\tan x} dx$$

-
there should be a $dx$ inside the integral. – Aang Jul 3 '12 at 18:18

Integrate by parts with $u=x$ and $\displaystyle dv=\frac{dx}{\tan x}$ so $$\int^{\pi/2}_0 \frac{x}{\tan x} dx = x \log (\sin x) \biggr|^{\pi/2}_0 - \int^{\pi/2}_0 \log (\sin x) dx=- \int^{\pi/2}_0 \log (\sin x) dx.$$

Let $x=\pi/2 - u$ into $\displaystyle I= \int^{\pi/2}_0 \log(\sin x) dx$ to get $\displaystyle I=\int^{\pi/2}_0 \log(\cos x) dx.$ Adding gives $$2I =\int^{\pi/2}_0 \log( \sin x \cos x) dx = \int^{\pi/2}_0 \log(\sin 2x) dx - \frac{\pi \log 2}{2}.$$

Now by $u=2x$ we have $$\int^{\pi/2}_0 \log (\sin 2x) dx = \int^{\pi}_0 \log(\sin u) \frac{du}{2} = I$$

so $$\int^{\pi/2}_0 \frac{x}{\tan x} dx = \frac{\pi \log 2}{2}.$$

-

Let's take $t=\tan x$ Then

$$I= \int_0^{\frac{\pi}{2}} \frac{x}{\tan x} dx=\int_{0}^{\infty}\frac{\arctan t}{t(1+t^2)}dt$$ Consider

$$I(a)= \int_{0}^{\infty}\frac{\arctan (at)}{t(1+t^2)}dt$$ Then

$$\frac{dI}{da}=\int_{0}^{\infty}\frac{1}{(1+a^2t^2)(1+t^2)}dt =\frac{\pi}{2(1+a)}$$ and

$$I(a)=\frac{\pi}{2}\ln (1+a)+const$$ $const=0$ because $I(0)=0$

Thus

$$I(a)=\frac{\pi}{2}\ln (1+a)$$ and $I=I(1)=\frac{\pi}{2}\ln (2)$

-

$$\int_0^{\frac {\pi}2} \frac x{\tan x}\, dx=\left[x\log(\sin (x))\right]_0^{\frac{\pi}2}-\int_0^{\frac {\pi}2} \log(\sin (x))\,dx$$ (the first term is $0$ at the limit, let's evaluate the integral) $$\int_0^{\frac {\pi}2} \log(\sin (x))\,dx=\int_0^{\frac {\pi}2} \log(2\sin (\frac x2)\cos (\frac x2)))\,dx$$ $$=\frac {\pi}2\log(2)+2\int_0^{\frac{\pi}4} \log(\sin (y))+\log(\cos (y))\,dy$$ $$=\frac {\pi}2\log(2)+2\int_0^{\frac{\pi}4} \log(\sin (y))dy+2\int_0^{\frac{\pi}4}\log(\cos (y))\,dy$$ setting $z=\frac {\pi}2-y$ at the right : $$=\frac {\pi}2\log(2)+2\int_0^{\frac{\pi}4} \log(\sin (y))dy-2\int_{\frac {\pi}2}^{\frac{\pi}4}\log(\sin (z))\,dz$$ $$\int_0^{\frac {\pi}2} \log(\sin (x))\,dx=\frac {\pi}2\log(2)+2\int_0^{\frac{\pi}2} \log(\sin (y))dy$$

so that $$\int_0^{\frac {\pi}2} \log(\sin (x))\,dx=-\frac {\pi}2\log(2)$$ and your initial integral should be :

$$\boxed{\displaystyle\int_0^{\frac {\pi}2} \frac x{\tan x}\, dx=\frac {\pi}2\log 2}$$

-