# The integral $\int_0^{\frac{\pi}{2}}\left(\frac{x}{\sin x}\right)^2\text{d}x$

How to evaluate : $$\int_0^{\frac{\pi}{2}}\left(\frac{x}{\sin x}\right)^2\text{d}x$$ I was wondering how would you use a series expansion?

• For it is worth, the answer from wolframalpha is $\pi \ln(2)$ – user17762 Feb 18 '13 at 1:10

Integrate $x^2 \csc^2(x)$ by parts and you get $$2\int_0^{\pi \over 2} x\cot(x)$$ Do it again and you get $$-2\int_0^{\pi \over 2} \ln(\sin x)$$ This is a famous integral (see the first answer in Computing the integral of $\log(\sin x)$) The result is $$\pi \ln 2$$

Use Bernoulli's form of integration by parts formula $$\int udv = uv - u'v_1 + u''v_2 - ...$$

where $u',u''..$ are successive differentiation of the function $u(x)$ and $v_1, v_2 ..$ are successive integrals of the function $v(x)$.

We get $$\int_0^{\frac{\pi}{2}}\left(\frac{x}{\sin x}\right)^2\text{d}x = [-(x^2 \cot x)]_0^{\pi/2} + [2x \log(\sin x)]_0^{\pi/2} - 2 \int_0^{\frac{\pi}{2}} \log(\sin x) = \pi \log(2)$$

The first two integrals give 0 and the last integral is already computed in the post: Computing the integral of $\log(\sin x)$

$$\int_0^{\frac{\pi}{2}} \frac{x^2}{\sin^2 x}\, dx=\left[x^2\, (-\cot x)\right]_0^{\frac{\pi}{2}}+\int_0^{\frac{\pi}{2}} 2x\cot x\, dx = \Big[2x\log\sin x\Big]_0^{\frac{\pi}{2}}-\int_0^{\frac{\pi}{2}} 2\log \sin x\, dx=\pi \log 2$$

Maple seems to get the answer using the Fundamental Theorem of Calculus, using the antiderivative $${\frac {-2\,i{x}^{2}}{{{\rm e}^{2\,ix}}-1}}+2\,x\ln \left( 1-{{\rm e} ^{ix}} \right) +2\,x\ln \left( 1+{{\rm e}^{ix}} \right) -2\,i{x}^{2}- 2\,i\,{\rm polylog} \left( 2,{{\rm e}^{ix}} \right) -2\,i\,{\rm polylog} \left( 2,-{{\rm e}^{ix}} \right)$$

• Of course! Why didn't I see that? – marty cohen Feb 18 '13 at 4:46

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\bbox[10px,#ffd]{\ds{\int_{0}^{\pi/2}\bracks{x \over \sin\pars{x}}^{2}\dd x}} = \left.\Re\int_{x\ =\ 0}^{x\ =\ \pi/2}{\bracks{-\ic\ln\pars{z}}^{\, 2} \over \bracks{\pars{z - 1/z}/\pars{2\ic}}^{\, 2}}\,{\dd z \over \ic z} \,\right\vert_{\ z\ =\ \exp\pars{\ic x}} \\[5mm] = &\ \left.4\,\Im\int_{x\ =\ 0}^{x\ =\ \pi/2}{z\ln^{2}\pars{z} \over \pars{1 - z^{2}}^{\, 2}}\,\dd z \,\right\vert_{\ z\ =\ \exp\pars{\ic x}}\label{1}\tag{1} \end{align}

I'll evaluate the last expression by 'closing a contour' in the upper complex plane first quadrant. Namely, a quarter of an unit circle. \eqref{1} is the 'contribution' along $\ds{\expo{\ic\pars{0,\pi/2}}}$.

Then, \begin{align} &\bbox[10px,#ffd]{\ds{\int_{0}^{\pi/2}\bracks{x \over \sin\pars{x}}^{2}\dd x}} = \overbrace{-4\,\Im\int_{1}^{0}{\ic y\,\bracks{\ln\pars{y} + \pi\ic/2}^{\,2} \over \pars{1 + y^{2}}^{\, 2}}\,\ic\,\dd y} ^{\ds{\mbox{over the}\ y\mbox{-axis}: \pars{1,0}}}\ -\ \underbrace{4\,\ \overbrace{\Im\int_{0}^{1}{x\,\ln^{2}\pars{x} \over \pars{1 - x^{2}}^{\, 2}}\,\dd x}^{\ds{=\ 0}}} _{\ds{\mbox{over the}\ x\mbox{-axis}: \pars{0,1}}} \\[5mm] & = -4\pi\int_{0}^{1}{y\ln\pars{y} \over \pars{1 + y^{2}}^{\, 2}}\,\dd y \,\,\,\stackrel{y^{2}\ \mapsto\ y}{=}\,\,\, -\pi\int_{0}^{1}{\ln\pars{y} \over \pars{1 + y}^{\, 2}}\,\dd y \\[5mm] & = -\pi\sum_{n = 1}^{\infty}{-2 \choose n - 1}\ \underbrace{\int_{0}^{1}\ln\pars{y}\, y^{n - 1}\,\dd y} _{\ds{-\,{1 \over n^{2}}}}\ =\ \pi\sum_{n = 1}^{\infty}{n \choose n - 1}\pars{-1}^{n - 1}\,{1 \over n^{2}} = -\pi\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over n} \\[5mm] & = \bbx{\pi\ln\pars{2}} \approx 2.1776 \end{align}