# How can I find $\int_0^{\pi/2}x\cot x\,dx$? [duplicate]

This question already has an answer here:

Can $\displaystyle\int_0^{\pi/2}x\cot x\,dx$ be found using elementary functions? If so how could I possibly do it? Is there any other way to calculate above definite integral?

## marked as duplicate by Hans Lundmark, Nosrati, José Carlos Santos, levap, erfinkSep 21 '17 at 23:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Have you tried integration by parts? – ajd Mar 4 '14 at 5:04

## 4 Answers

Using integration by parts, we find that

\begin{align}I = \int_0^{\pi/2} dx \, x \, \cot{x} &= \left [x \log{\sin{x}} \right ]_0^{\pi/2} - \int_0^{\pi/2} dx \, \log{\sin{x}} \\ &= - \int_0^{\pi/2} dx \, \log{\sin{x}} \end{align}

Note that

$$I = - \int_0^{\pi/2} dx \, \log{\cos{x}}$$

so that

\begin{align} 2 I &= -\int_0^{\pi/2} dx \, \log{\sin{x}} -\int_0^{\pi/2} dx \, \log{\cos{x}}\\ &= -\int_0^{\pi/2} dx \, \log{(\sin{x} \cos{x})} \\ &= -\int_0^{\pi/2} dx \, \log{\frac{\sin{2x}}{2}} \\ &= \frac{\pi}{2} \log{2} - \int_0^{\pi/2} dx \, \log{\sin{2 x}}\\ &= \frac{\pi}{2} \log{2} - \frac12 \int_0^{\pi} du \, \log{\sin{u}}\\ &= \frac{\pi}{2} \log{2} + I\end{align}

Therefore,

$$I = \int_0^{\pi/2} dx \, x \, \cot{x} = \frac{\pi}{2} \log{2}$$

Using the Riemann-Lebesgue lemma, one can show that $$\int_{a}^{b} f(x) \cot (x) \ dx = 2 \sum_{n=1}^{\infty} \int_{a}^{b} f(x) \sin(2nx) \ dx$$

Then $$\int^{\pi /2}_{0} x \cot(x) \ dx = 2 \sum_{n=1}^{\infty} \int_{0}^{\pi /2} x \sin(2nx) \ dx$$

$$= 2 \sum_{n=1}^{\infty} \Big( \frac{\sin(2nx)}{4n^{2}} - \frac{x}{2n} \cos(2nx) \Big|^{\pi/2}_{0} \Big)$$

$$= -\frac{\pi}{2} \sum_{n=1}^{\infty} \frac{(-1)^{n}}{n} = \frac{\pi \ln 2}{2}$$


$$\color{#00f}{\large\int_{0}^{\pi/2}x\cot\pars{x}\,\dd x = \half\,\pi\ln\pars{2}}$$

$$\int_0^\frac{\pi}{2}x\cot xdx=\int_0^\frac{\pi}{2}xd\ln(\sin(x))=xd\ln(\sin(x))\bigg|^\frac{\pi}{2}_0-\int_0^\frac{\pi}{2}\ln(\sin(x))dx\\ =\frac{\pi}{2}\ln2$$ For the last step, see Last Step.