Evaluate $\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx$ 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.
 A: $\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}
\int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x & =
\left.\Re\int_{x\ =\ 0}^{x\ =\ \pi/2}{\bracks{-\ic\ln\pars{z}}^{2} \over
\pars{z - 1/z}/\pars{2\ic}}\,{\dd z \over \ic z}
\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\\[5mm] & =
\left.2\,\Re\int_{x\ =\ 0}^{x\ =\ \pi/2}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z
\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\end{align}

$\ds{\ln}$ is the $\ds{\log}$-principal branch. Integration of $\ds{{\ln^{2}\pars{z} \over 1 - z^{2}}}$ along the path
$\ds{C_{x}\cup C_{R}\cup C_{y}}$ vanishes out such that

$\ds{\int_{\large C_{R}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z =
-\int_{\large C_{y}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z -
\int_{\large C_{x}}{\ln^{2}\pars{z} \over 1 - z^{2}}\,\dd z}$

Then,
\begin{align}
\int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x &\ =\
\overbrace{-2\,\Re\int_{1}^{0}{\bracks{\ln\pars{y} + \pi\ic/2}^{\, 2} \over
1 + y^{2}}\,\ic\,\dd y}^{\ds{\mbox{along}\ C_{y}}}\ -\
\overbrace{2\,\Re\int_{0}^{1}{\ln^{2}\pars{x} \over 1 - x^{2}}\,\dd x}
^{\ds{\mbox{along}\ C_{x}}}
\\[5mm] & =
-2\pi\,\int_{0}^{1}{\ln\pars{y} \over 1 + y^{2}}\,\dd y -
2\int_{0}^{1}{\ln^{2}\pars{x} \over 1 - x^{2}}\,\dd x
\end{align}

However, $\ds{\int_{0}^{1}{\ln\pars{y} \over 1 + y^{2}}\,\dd y = -G}$ where
$\ds{G}$ is the Catalan Constant such that

\begin{align}
\int_{0}^{\pi/2}{x^{2} \over \sin\pars{x}}\,\dd x & =
2\pi G - 2\sum_{n = 0}^{\infty}\
\overbrace{\int_{0}^{1}\ln^{2}\pars{x}x^{2n}\,\dd x}
^{\ds{2 \over \pars{2n + 1}^{3}}}
\\[5mm] & =
2\pi G - 4\bracks{\sum_{n = 1}^{\infty}{1 \over n^{3}} -
\sum_{n = 1}^{\infty}{1 \over \pars{2n}^{3}}} =
2\pi G - {7 \over 2}\sum_{n = 1}^{\infty}{1 \over n^{3}}
\\[5mm] & = \bbx{2\pi G - {7 \over 2}\,\zeta\pars{3}} \approx 1.5480
\\ &
\end{align}
A: $$\mathcal{J}=\int_{0}^{\pi/2}\frac{x^2}{\sin x}\,dx = \int_{0}^{1}\frac{\arcsin^2(x)}{x\sqrt{1-x^2}}\,dx=\sum_{n\geq 1}\frac{2^{2n-1}}{n^2\binom{2n}{n}}\int_{0}^{1}\frac{x^{2n-1}}{\sqrt{1-x^2}}\,dx \tag{1}$$
by the Maclaurin series of $\arcsin^2(x)$. Euler's Beta function then leads to
$$ \mathcal{J}=\sum_{n\geq 1}\frac{16^n}{4n^3 \binom{2n}{n}^2}=\phantom{}_4 F_3\left(1,1,1,1;\tfrac{3}{2},\tfrac{3}{2},2;1\right)\tag{2} $$
where the RHS is a manageable hypergeometric function (similar objects are evaluated both here and here) and as already shown by Claude Leibovici, $\mathcal{J}=4\int_{0}^{1}\frac{\arctan^2(u)}{u}\,du $ is simply given by a combination of a dilogarithm and a trilogarithm. Indeed
$$ \int_{0}^{\pi/2}\int_{0}^{\theta}\frac{u}{\sin u}\,du\,d\theta =-\pi G+\frac{7}{2}\zeta(3)\tag{3}$$
leading to $\mathcal{J}=2\pi G-\frac{7}{2}\zeta(3)$, has already been a key lemma in this historical thread.
An alternative way for proving this identity is just to write $\frac{x}{\sin x}$ and $|x|$ as Fourier cosine series.
The Shafer-Fink inequality leads to
$$ \int_{0}^{\pi/2}\frac{x^2}{\sin x}\,dx = 4 \int_{0}^{1}\frac{\arctan^2(u)}{u}\,du \approx \frac{6}{7}(3\sqrt{2}-5)+9\log\left(\frac{2\sqrt{2}+1}{3}\right)\approx 1.54.\tag{4}$$
A: I will present an evaluation that makes use of the following two Euler sums:
$$\sum_{n = 1}^\infty \frac{(-1)^n H_n}{n^2} = -\frac{5}{8} \zeta (3) \qquad \text{and} \qquad \sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{n^2} = \frac{23}{16} \zeta (3) - \pi \mathbf{G}.$$
Here $\mathbf{G}$ is Catalan's constant. For a proof of the first, see either here or Eq. (646) in this link. For a proof of the second, see Eq. (659) of this link.
Begin by enforcing a substitution of $x \mapsto 2 \arctan x$. Then
$$\int_0^{\frac{\pi}{2}} \frac{x^2}{\sin x} \, dx = 4 \int_0^1 \frac{\arctan^2 x}{x} \, dx.\tag1$$
Since $\displaystyle{\arctan x = \sum_{n = 0}^\infty \frac{(-1)^n x^{2n + 1}}{2n + 1}}$ for $|x| < 1$, applying the Cauchy product to the product between the two inverse tangent functions one obtains the following Maclaurin series expansion for $\arctan^2 x$ of:
$$\arctan^2 x = \sum_{n = 1}^\infty \frac{(-1)^{n + 1}}{n} \left (H_{2n} - \frac{1}{2} H_n \right ) x^{2n},$$
where $H_n$ is the $n$th Harmonic number. 
Substituting the Maclaurin series expansion for $\arctan^2 x$ into (1), after changing the order of the summation with the integration one obtains
\begin{align}
\int_0^{\frac{\pi}{2}} \frac{x^2}{\sin x} \, dx &= 4 \sum_{n = 1}^\infty \frac{(-1)^{n + 1}}{n} \left (H_{2n} - \frac{1}{2} H_n \right ) \int_0^1 x^{2n - 1} \, dx\\
&= -2 \sum_{n = 1}^\infty \frac{(-1)^n H_{2n}}{n^2} + \sum_{n = 1}^\infty \frac{(-1)^n H_n}{n^2}\\
&= -2 \left (\frac{23}{16} \zeta (3) - \pi \mathbf{G} \right ) - \frac{5}{8} \zeta (3)\\
&= 2 \pi \mathbf{G} - \frac{7}{2} \zeta (3),
\end{align}
as required. 
A: As pointed out within the other answers we want to prove that

$$\mathfrak{I}=\int_0^{\pi/2}\frac{x^2}{\sin x}~dx=2\pi G-\frac72\zeta(3)$$

As the OP showed $\mathfrak{I}$ can be reduced to a linear combination of $x$ and the function $\log(\cot x)$
$$\mathfrak{I}=\int_0^{\pi/2}\frac{x^2}{\sin x}~dx=8\int_0^{\pi/4}x\log(\cot x)~dx$$
By applying the definition of the cotangent function followed up by the usage of the well-known Fourier series expansions of $\log(\cos x)$ and $\log(\sin x)$ this can be further simplified. Therefore we get
$$\small\begin{align}
\mathfrak{I}=8\int_0^{\pi/4}x\log(\cot x)~dx&=8\left[\int_0^{\pi/4}x\log(\cos x)~dx-\int_0^{\pi/4}x\log(\sin x)~dx\right]\\
&=8\left[\int_0^{\pi/4}x\left(-\log(2)-\sum_{n=1}^{\infty}(-1)^n\frac{\cos(2nx)}{n}\right)~dx-\int_0^{\pi/4}x\left(-\log(2)-\sum_{n=1}^{\infty}\frac{\cos(2nx)}{n}\right)~dx\right]\\
&=8\left[-\sum_{n=1}^{\infty}\frac{(-1)^n}{n}\underbrace{\int_0^{\pi/4}x\cos(2nx)~dx}_I+\sum_{n=1}^{\infty}\frac{1}{n}\underbrace{\int_0^{\pi/4}x\cos(2nx)~dx}_I\right]\\
\end{align}$$
The inner integral $I$ can be easily evaluated using IBP which leads to
$$I=\int_0^{\pi/4}x\cos(2nx)~dx=\frac{\pi}{8n}\sin\left(n\frac{\pi}2\right)-\frac1{(2n)^2}$$
Plugging this into our original formula and followed by a little bit of algebraic manipulation we get
$$\small\begin{align}
\mathfrak{I}&=8\left[-\sum_{n=1}^{\infty}\frac{(-1)^n}{n}\left(\frac{\pi}{8n}\sin\left(n\frac{\pi}2\right)-\frac1{(2n)^2}\right)+\sum_{n=1}^{\infty}\frac{1}{n}\left(\frac{\pi}{8n}\sin\left(n\frac{\pi}2\right)-\frac1{(2n)^2}\right)\right]\\
&=2\left[\sum_{n=1}^{\infty}\frac{(-1)^n}{n^3}-\sum_{n=1}^{\infty}\frac{1}{n^3}\right]+\pi\left[\sum_{n=1}^{\infty}\frac{1}{n^2}\sin\left(n\frac{\pi}2\right)-\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\sin\left(n\frac{\pi}2\right)\right]
\end{align}$$
The first terms can be evaluated in terms of the Riemann Zeta Function $\zeta(s)$ and the Dirichlet Eta Function $\eta(s)$ whereas for the second term we have to consider some basic properties of the Sine function. For $n\in\mathbb{N}>0$ the function $\sin\left(n\frac{\pi}2\right)$ will be zero for all even $n$ and $-1$ and $1$ respectively for odd $n$ starting with $\sin\left(\frac{\pi}2\right)=1$ for $n=1$. Therefore all even terms vanish while the odd ones will remain with a oscillating negative sign. This leads to
$$\small\begin{align}
\mathfrak{I}&=2\left[\sum_{n=1}^{\infty}\frac{(-1)^n}{n^3}-\sum_{n=1}^{\infty}\frac{1}{n^3}\right]+\pi\left[\sum_{n=1}^{\infty}\frac{1}{n^2}\sin\left(n\frac{\pi}2\right)-\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\sin\left(n\frac{\pi}2\right)\right]\\
&=2[-\eta(3)-\zeta(3)]+\pi\left[\sum_{n=0}^{\infty}\frac{1}{(2n+1)^2}(-1)^n-\sum_{n=0}^{\infty}\frac{(-1)^{2n+1}}{(2n+1)^2}(-1)^n\right]\\
&=-2[(1-2^{-2})\zeta(3)+\zeta(3)]+2\pi\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)^2}\\
\Leftrightarrow\mathfrak{I}&=-\frac72\zeta(3)+2\pi G
\end{align}$$
where within the last step the functional relation between the Riemann Zeta Function and the Dirichlet Eta Function aswell as the series defintions of Catalan's Constant $G$ where used.
A: 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}$$
A: Observe we have
\begin{align}
I=\int^{\pi/2}_0 \frac{x^2}{\sin x}\ dx = \int^{\pi/2}_0 \frac{x^2}{\cos\left(\frac{\pi}{2}-x \right)}\ dx = \int^{\pi/2}_0 \frac{(\frac{\pi}{2}-u)^2}{\cos u}\ du.
\end{align}
Then using integration by parts, we see that
\begin{align}
I&=\left(\frac{\pi}{2}-u\right)^2\left\{\log\left|1 + \sin u\right|-\log|\cos u|\right\}\bigg|^{\pi/2}_0 + 2\int^{\pi/2}_0\left(\frac{\pi}{2}-u \right)\log|\sec u + \tan u|\ du\\
&= 2\pi \left(\frac{1}{2}\int_{0}^{\pi/2}\log|\sec u+\tan u|\ du \right)-\frac{7}{2}\left(\frac{4}{7}\int^{\pi/2}_0 u \log|\sec u+\tan u|\ du \right)\\
&= 2\pi G - \frac{7}{2}\zeta(3).
\end{align}
Here, I have used the facts that
\begin{align}
G= \frac{1}{2}\int_{0}^{\pi/2}\log|\sec u+\tan u|\ du
\end{align}
and
\begin{align}
\zeta(3) = \frac{4}{7}\int^{\pi/2}_0 u \log|\sec u+\tan u|\ du. 
\end{align}
See here for reference.
A: $$since\ I=\int_{0}^{\frac{\pi }{2}}\frac{x^2}{sinx}dx=-2\int_{0}^{\frac{\pi }{2}}xln(tan(\frac{x}{2}))dx=-8\int_{0}^{\frac{\pi }{2}}t \ln(tan(t))dt\\
\\
=-8\int_{0}^{1}\frac{lnt\arctan(t)}{1+t^2}dt=-4\pi \int_{0}^{1}\frac{ln(t)}{1+t^2}dt+8\int_{0}^{1}\frac{ln(t)arctan(t)}{1+t^2}dt\\
\\
=4\pi G-8\int_{1}^{\infty }\frac{ln(t)arctan(t)}{1+t^2}dt\\\
\therefore 2I=4\pi G-8\int_{0}^{\infty }\frac{ln(t)arctan(t)}{1+t^2}dt\  ,  let\ Q=\int_{0}^{\infty }\frac{ln(t)arctan(t)}{1+t^2}dt\\
\\
\therefore Q(a)=\int_{0}^{\infty }\frac{ln(t)arctan(at)}{1+t^2}dt\  \therefore Q'(a)=\frac{1}{4}\int_{0}^{\infty }\frac{ln(t)dt}{(1+t)(1+a^2t)}=\frac{1}{4(1-a^2)}\int_{0}^{\infty }[\frac{1}{1+t}-\frac{a^2}{1+a^2t}]lntdt\\
\\
\therefore Q'(a)=-\frac{\pi }{4(1-a^2)}\frac{d}{da}(\frac{1-a^-2a}{sin(\pi a)})_{a}^{=0}=\frac{\pi }{8(1-a^2)}lim[\frac{-2a.a^{-2a}ln^{2}a}{a^2}]=\frac{lna^{2}}{2(1-a^2)}\ \therefore Q=\frac{1}{4}\int_{0}^{1}\frac{(lna)^{2}}{1-a}da+\int_{0}^{1}\frac{(lna)^{2}}{1+a}da=\frac{7}{8}\zeta 3\\
\\
\therefore I=2\pi G-\frac{7}{2}\zeta(3)\\
\\
ahmed hegazi$$
A: We can adapt the formula derived in $(2)$ of this answer:
$$
\log(2\cos(x/2))=\sum_{k=1}^\infty\frac{(-1)^{k-1}}k\cos(kx)\tag{1a}
$$
Substituting $x\mapsto\pi-x$ in $\text{(1a)}$, we get
$$
\log(2\sin(x/2))=\sum_{k=1}^\infty\frac{-1}k\cos(kx)\tag{1b}
$$
Subtracting $\text{(1a)}$ from $\text{(1b)}$, the even terms cancel and we get
$$
\bbox[5px,border:2px solid #C0A000]{\log(\tan(x/2))=\sum_{k=0}^\infty\frac{-2}{2k+1}\cos((2k+1)x)}\tag2
$$

Therefore,
$$
\begin{align}
\int_0^{\pi/2}\frac{x^2}{\sin(x)}\,\mathrm{d}x
&=\int_0^{\pi/2}x^2\,\mathrm{d}\log(\tan(x/2))\tag3\\
&=-2\int_0^{\pi/2}x\log(\tan(x/2))\,\mathrm{d}x\tag4\\
&=\sum_{k=0}^\infty\frac4{2k+1}\int_0^{\pi/2}x\cos((2k+1)x)\,\mathrm{d}x\tag5\\
&=\sum_{k=0}^\infty\frac4{(2k+1)^2}\int_0^{\pi/2}x\,\mathrm{d}\sin((2k+1)x)\tag6\\
&=\sum_{k=0}^\infty\frac4{(2k+1)^2}\left[x\sin((2k+1)x)+\frac{\cos((2k+1)x)}{2k+1}\right]_0^{\pi/2}\tag7\\
&=\sum_{k=0}^\infty\frac4{(2k+1)^2}\left[\frac\pi2(-1)^k-\frac1{2k+1}\right]\tag8\\
&=\bbox[5px,border:2px solid #C0A000]{2\pi\mathrm{G}-\frac72\zeta(3)}\tag9
\end{align}
$$
Explanation:
$(3)$: prepare to integrate by parts
$(4)$: integrate by parts
$(5)$: apply $(2)$
$(6)$: prepare to integrate by parts
$(7)$: integrate by parts
$(8)$: apply the limits of integration
$(9)$: evaluate, where $\mathrm{G}$ is Catalan's Constant
A: $$
\begin{aligned}
 \int_{0}^{\frac{\pi}{2}} \frac{x^{2}}{\sin x} d x 
=& \int_{0}^{\frac{\pi}{2}} x^{2} d\left[\ln \left(\tan \frac{x}{2}\right)\right] \\
=& {\left[x^{2} \ln \left(\tan \frac{x}{2}\right)\right]_{0}^{\frac{\pi}{2}}-2 \int_{0}^{\frac{\pi}{2}} x \ln \left(\tan \frac{x}{2}\right) d x } \\
=&-8 \int_{0}^{\frac{\pi}{4}} y \ln (\tan y) d y \textrm{, where }y=2x\\
=&-8\left[-\frac{\pi}{4} G+\frac{7}{16} \zeta(3)\right] \\
=& 2 \pi G-\frac{7}{2} \zeta(3)
\end{aligned}
$$
where $
\int_{0}^{\frac{\pi}{4}} x \ln (\tan x) d x= -\frac{\pi}{4} G+\frac{7}{16} \zeta(3)
$ from my post .
Can we go further with the integral
$\displaystyle \int_{0}^{\frac{\pi}{2}} \frac{x^{n}}{\sin x} d x ?\tag*{} $
