TITLE: Evaluate $\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx$
QUESTION [15 upvotes]: I want to evaluate $$\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx$$
First,I tried to evaluate like this:
$$\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx=\int_{0}^{\frac{\pi}{2}}x^2\left(\frac{1+\cos x}{\sin x}\right)\frac{dx}{1+\cos x}=\int_{0}^{\frac{\pi}{2}}x^2\left(\frac{1+\cos x}{\sin x}\right)d\left(\frac{\sin x}{1+\cos x}\right)$$
$$=\int_{0}^{\frac{\pi}{2}}x^2d\log\left(\frac{\sin x}{1+\cos x}\right)=x^2\log\left(\frac{\sin x}{1+\cos x}\right)|_{0}^{\frac{\pi}{2}}-2\int_{0}^{\frac{\pi}{2}}x\log\left(\frac{\sin x}{1+\cos x}\right)dx$$
$$=0+2\int_{0}^{\frac{\pi}{2}}x\log\left(\frac{1+\cos x}{\sin x}\right)dx=2\int_{0}^{\frac{\pi}{2}}x\log\left(1+\cos x\right)dx-2\int_{0}^{\frac{\pi}{2}}x\log\left(\sin x\right)dx$$
$$=2\int_{0}^{\frac{\pi}{2}}x\log\cot \left(\frac{x}{2}\right)dx=8\int_{0}^{\frac{\pi}{4}}x\log\cot xdx$$
but I can't proceed next step,help me,thanks.

REPLY [3 votes]: Another contour integration approach:
Let's integrate the function $$f(z) = \frac{z^{2}}{\sin z}$$ around a tall rectangular contour with vertices at $z=0$, $z=\frac{\pi}{2}$, $z= \frac{\pi}{2}+ i R$, and $z= i R$.
There are no singularities inside contour, and the singularity at $z=0$ is removable.
Also, since the magnitude of $\frac{1}{\sin z}$ decays exponentially to zero as $\Im(z) \to \infty$, the integral vanishes on the top of the contour as $R \to \infty$.
Therefore, integrating around the contour and then letting $R \to \infty$, we get $$\int_{0}^{\pi/2} \frac{x^{2}}{\sin x} \, \mathrm dx + \int_{0}^{\infty} \frac{(\pi /2 + it)^{2}}{\cosh t} \, i \, \mathrm dt + \int_{\infty}^{0} \frac{(it)^{2}}{i \sinh t} \, i \, \mathrm dt = 0.  $$
And equating the real parts on both sides the equation, we get $$\int_{0}^{\pi/2} \frac{x^{2}}{\sin x} \, \mathrm dx = \pi \int_{0}^{\infty} \frac{t}{\cosh t} \, \mathrm dt - \int_{0}^{\infty} \frac{t^{2}}{\sinh t} \, \mathrm dt. $$
An integral representation of the Dirichlet beta function is $$\beta(s) = \frac{1}{2 \Gamma(s)}\int_{0}^{\infty} \frac{t^{s-1}}{\cosh t} \, \mathrm dt, \quad \Re(s) >0.$$
And an integral representation of the  Dirichlet lambda function is $$\lambda(s) = \frac{1}{2 \Gamma(s)} \int_{0}^{\infty} \frac{t^{s-1}}{\sinh t} \, \mathrm dt, \quad \Re(s) >1.$$
Therefore, $$\begin{align} \int_{0}^{\pi/2} \frac{x^{2}}{\sin x} \, \mathrm dx &= 2 \pi  \Gamma(2) \beta(2) - 2 \Gamma(3) \lambda(3)  \\ &= 2 \pi \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2}} -4 \sum_{n=0}^{\infty} \frac{1}{(2n+1)^{3}} \\ &= 2 \pi G - 4 \left(1-2^{-3} \right) \zeta(3) \\ &= 2 \pi G - \frac{7}{2} \zeta(3). \end{align}$$

The same approach also shows that $$ \int_{0}^{\pi/2} \frac{x}{\sin x} \, \mathrm dx = \int_{0}^{\infty} \frac{t}{\cosh t} \, \mathrm dt  =2 \Gamma(2) \beta(2) =2G $$ and
$$\begin{align} \int_{0}^{\pi/2} \frac{x^{3}}{\sin x} \, \mathrm dx &= \frac{3 \pi^{2}}{4} \int_{0}^{\infty} \frac{t}{\cosh t} \, \mathrm dt - \int_{0}^{\infty} \frac{t^{3}}{\cosh t} \, \mathrm dt \\ &= \frac{3 \pi^{2}}{2} \Gamma(2) \beta(2) -  2 \Gamma(4) \beta(4) \\ &= \frac{3 \pi^{2}G}{2} - 12 \beta(4). \end{align}$$