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.

  • $\begingroup$ you mean the first step? Give some thoughts, please. (Although to be fair, it appears we have a doozy wolframalpha.com/input/… ... I'm guessing this means you should try a series approach.) $\endgroup$ Mar 30, 2018 at 3:40
  • $\begingroup$ @FofX Do you want an exact answer, or just a numerical approximation? $\endgroup$
    – Toby Mak
    Mar 30, 2018 at 3:41
  • $\begingroup$ @spaceisdarkgreen I think use integration by parts? $\endgroup$
    – FofX
    Mar 30, 2018 at 3:42
  • $\begingroup$ @TobyMak I want an exact answer,hh,thank you. $\endgroup$
    – FofX
    Mar 30, 2018 at 3:44
  • $\begingroup$ @FofX Don't think so, though I can't say I know it won't simplify things... whatever it is the indefinite integral doesn't seem to come out nice (see my wolfram alpha link). You can use the Taylor series for csc to turn it into an infinite sum that I don't find particularly inviting, but has some features that make the wolfram alpha answer involving the zeta function and Catalan constant plausible, like bernoulli numbers $\endgroup$ Mar 30, 2018 at 3:56

12 Answers 12


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

  • $\begingroup$ I think careful justification of the interchange made between the summation and integration signs is needed in step (5). $\endgroup$
    – omegadot
    Aug 25, 2021 at 10:16
  • 3
    $\begingroup$ Note that $$\begin{align}\left|\int_0^{\pi/2}x\cos((2k+1)x)\,\mathrm{d}x\right| &=\frac1{2k+1}\left|(-1)^k\frac\pi2-\int_0^{\pi/2}\sin((2k+1)x)\,\mathrm{d}x\right|\\ &\le\frac\pi{2k+1}\end{align}$$ So the sum in $(5)$ converges absolutely. Thus, we can approximate as closely as we want with a finite sum, and there should be no problem with a finite sum. $\endgroup$
    – robjohn
    Aug 25, 2021 at 13:14

$\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}$ enter image description here \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}


$\begin{align} J&=\int_{0}^{\pi/2}\frac{x^2}{\sin x}\,dx& \end{align}$

Perform the change of variable,

$\displaystyle y=\tan\left(\frac{x}{2}\right)$,

$\begin{align} J&=4\int_0^1 \frac{\arctan^2 x}{x}\,dx\\ &=4\Big[\ln x\arctan ^2 x\Big]_0^1-8\int_0^1 \frac{\arctan x\ln x}{1+x^2}\,dx\\ &=-8\int_0^1 \frac{\arctan x\ln x}{1+x^2}\,dx\\ \end{align}$

For $x\in [0;1]$, define $F$,

$\begin{align} F(x)&=\int_0^x \frac{\ln t}{1+t^2}\,dt\\ &=\int_0^1 \frac{x\ln(xt)}{1+x^2t^2}\,dt \end{align}$

Observe that,

$\displaystyle F(0)=0$ and, $\displaystyle F(1)=-\text{G}$.

$\text{G}$ is the Catalan constant.

$\begin{align}J&=-8\Big[F(x)\arctan x\Big]_0^1+8\int_0^1 \int_0^1 \frac{x\ln(tx)}{(1+t^2x^2)(1+x^2)}\,dt\,dx\\ &=2G\pi+8\int_0^1 \int_0^1 \frac{x\ln x}{(1+t^2x^2)(1+x^2)}\,dt\,dx+8\int_0^1 \int_0^1 \frac{x\ln t}{(1+t^2x^2)(1+x^2)}\,dt\,dx\\ &=2G\pi+8\int_0^1 \Big[\frac{\arctan(tx)\ln x}{1+x^2}\Big]_{t=0}^{t=1}\,dx+4\int_0^1 \Big[\frac{(\ln(1+t^2x^2)-\ln(1+x^2))\ln t}{t^2-1}\Big]_{x=0}^{x=1}\,dt\\ &=2G\pi+8\int_0^1 \frac{\arctan x\ln x}{1+x^2}\,dx+4\int_0^1 \frac{(\ln(1+t^2)-\ln 2)\ln t }{t^2-1}\,dt\\ &=2G\pi-J+4\int_0^1 \frac{(\ln 2-\ln(1+t^2))\ln t }{1-t^2}\,dt\\ \end{align}$


$\displaystyle J=\text{G}\pi+2\int_0^1 \frac{(\ln 2-\ln(1+x^2))\ln x }{1-x^2}\,dx$

For $x\in[0;1]$, define,

$\begin{align}H(x)&=\int_0^x \frac{\ln t}{1-t^2}\,dt\\ &=\int_0^1 \frac{x\ln(tx)}{1-t^2x^2}\,dt\\ \end{align}$

Observe that,

$\displaystyle H(0)=0$ and $\displaystyle H(1)=-\frac{\pi^2}{8}$.

$\begin{align}J&=\text{G}\pi+2\Big[(\ln 2-\ln(1+x^2))H(x)\Big]_0^1+4\int_0^1\int_0^1\frac{x^2\ln(tx)}{(1+x^2)(1-t^2x^2)}\,dt\,dx\\ &=\text{G}\pi+4\int_0^1\int_0^1\frac{x^2\ln(tx)}{(1+x^2)(1-t^2x^2)}\,dt\,dx\\ &=\text{G}\pi+4\int_0^1\int_0^1\frac{x^2\ln t}{(1+x^2)(1-t^2x^2)}\,dt\,dx+4\int_0^1\int_0^1\frac{x^2\ln x}{(1+x^2)(1-t^2x^2)}\,dt\,dx\\ &=\text{G}\pi+4\int_0^1\Big[\frac{\ln t}{1+t^2}\left(\frac{\ln(1+tx)}{2t}-\frac{\ln(1-tx)}{2t}-\arctan x\right)\Big]_{x=0}^{x=1}\,dt+\\ &2\int_0^1 \Big[\frac{x\ln x}{1+x^2}\ln\left(\frac{1+tx}{1-tx}\right)\Big]_{t=0}^{t=1}\,dx\\ &=\text{G}\pi+2\int_0^1 \frac{\ln t}{t(1+t^2)}\ln\left(\frac{1+t}{1-t}\right)\,dt-\pi\int_0^1 \frac{\ln t}{1+t^2}\,dt+2\int_0^1 \frac{x\ln x}{1+x^2}\ln\left(\frac{1+x}{1-x}\right)\,dx\\ &=2\text{G}\pi+2\int_0^1 \frac{\ln x}{x}\ln\left(\frac{1+x}{1-x}\right)\,dx\\ \end{align}$

But, for $0\leq x<1$,

$\displaystyle \frac{1}{x}\ln\left(\frac{1+x}{1-x}\right)=2\sum_{n=0}^{\infty}\frac{x^{2n}}{2n+1}$


$\begin{align}\int_0^1 \frac{\ln x}{x}\ln\left(\frac{1+x}{1-x}\right)\,dx&=2\int_0^1 \left(\sum_{n=0}^{\infty}\frac{x^{2n}}{2n+1}\right)\ln x\,dx\\ &=2 \sum_{n=0}^{\infty}\int_0^1 \frac{x^{2n}\ln x}{2n+1}\,dx\\ &=-2\sum_{n=0}^{\infty}\frac{1}{(2n+1)^3}\\ &=-2\left(\sum_{n=1}^{\infty} \frac{1}{n^3}-\sum_{n=1}^{\infty} \frac{1}{(2n)^3}\right)\\ &=-2\left(\zeta(3)-\frac{1}{8}\zeta(3)\right)\\ &=-\frac{7}{4}\zeta(3)\\ \end{align}$


$ \boxed{J=2\text{G}\pi-\frac{7}{2}\zeta(3)}$


$$\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}$$


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.


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


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.


At the price of special functions, the antiderivative could be computed $$I=\int\frac{x^2}{ \sin x}\,dx=-4 i x \text{Li}_2\left(e^{i x}\right)+i x \text{Li}_2\left(e^{2 i x}\right)+4 \text{Li}_3\left(e^{i x}\right)-\frac{1}{2} \text{Li}_3\left(e^{2 i x}\right)-2 x^2 \tanh ^{-1}\left(e^{i x}\right)$$ where appear the polylogarithm functions.

$$\lim_{x\to \frac{\pi }{2}} \, I=2 \pi C\qquad \text{and} \qquad\lim_{x\to 0} \, I=\frac{7 }{2}\zeta (3)\implies \int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx=2 \pi C-\frac{7 }{2}\zeta (3)$$ as given by Wolfram Alpha. This evaluates a $\approx 1.54798$.

For a fast approximation, we could use the superb approximation $$\sin(x) \simeq \frac{16 (\pi -x) x}{5 \pi ^2-4 (\pi -x) x}\qquad (0\leq x\leq\pi)$$ which was proposed by Mahabhaskariya of Bhaskara I, a seventh-century Indian mathematician (have a look here). This would make $$I \approx J= - \int \left(\frac{x^2}{4}+\frac{5 \pi ^3}{16 (x-\pi )}+\frac{5 \pi ^2}{16} \right)\,dx=-\frac{x^3}{12}-\frac{5 \pi ^2 x}{16}-\frac{5}{16} \pi ^3 \log (\pi -x)+\frac{19 \pi ^3}{48}$$ $$\lim_{x\to \frac{\pi }{2}} \, J=\frac{\pi ^3}{48} \left(11-15 \log \left(\frac{\pi }{2}\right)\right)\qquad \text{and} \qquad\lim_{x\to 0} \, J =\frac{\pi ^3}{48} (19-15 \log (\pi ))$$ leading to the approximation $$\int_{0}^{\frac{\pi}{2}}\frac{x^2}{ \sin x}dx\approx \frac{\pi ^3}{48} (15 \log (2)-8)\approx 1.54851$$ which is not too bad.

Tha advantage of such approximation is that it allows a fast evaluation of $$K(t)=\int_{0}^{t}\frac{x^2}{ \sin x}dx$$ The table below compares the approximation to the exact result $$\left( \begin{array}{ccc} t & \text{approximation} & \text{exact} \\ \frac{\pi }{20} & 0.01221 & 0.01236 \\ \frac{\pi }{10} & 0.04936 & 0.04976 \\ \frac{3 \pi }{20} & 0.11258 & 0.11312 \\ \frac{\pi }{5} & 0.20358 & 0.20409 \\ \frac{\pi }{4} & 0.32475 & 0.32508 \\ \frac{3 \pi }{10} & 0.47939 & 0.47945 \\ \frac{7 \pi }{20} & 0.67196 & 0.67176 \\ \frac{2 \pi }{5} & 0.90847 & 0.90807 \\ \frac{9 \pi }{20} & 1.19701 & 1.19650 \\ \frac{\pi }{2} & 1.54851 & 1.54798 \\ \frac{11 \pi }{20} & 1.97802 & 1.97746 \\ \frac{3 \pi }{5} & 2.50657 & 2.50583 \\ \frac{13 \pi }{20} & 3.16447 & 3.16315 \\ \frac{7 \pi }{10} & 3.99696 & 3.99445 \\ \frac{3 \pi }{4} & 5.07529 & 5.07091 \\ \frac{4 \pi }{5} & 6.52008 & 6.51359 \\ \frac{17 \pi }{20} & 8.55922 & 8.55230 \\ \frac{9 \pi }{10} & 11.7067 & 11.7077 \\ \frac{19 \pi }{20} & 17.6067 & 17.6510 \end{array} \right)$$

  • 2
    $\begingroup$ One may also accelerate the series $$ \sum_{n\geq 1}\frac{16^n}{4n^3 \binom{2n}{n}^2} $$ to derive accurate numerical approximations of $I$. $\endgroup$ Mar 30, 2018 at 14:30

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}$$


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.


$$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$$


$$ \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*{} $


First of all, we express the integrand as a power series of exponential functions. $$ \begin{aligned} I & =2 i \int_0^{\frac{\pi}{2}} \frac{x^2}{e^{x i}-e^{-x i}} d x \\ & =2 i \int_0^{\frac{\pi}{2}} x^2 e^{-x i} \sum_{k=0}^{\infty} e^{-2 k x i} d x \\ & =2 i \sum_{k=0}^{\infty} \int_0^{\frac{\pi}{2}} x^2 e^{-(2 k+1) x i} d x \\ & =2 i \sum_{k=0}^{\infty}\left[\int_0^{\frac{\pi}{2}} x^2 \cos (2 k+1) x d x-i \int_0^{\frac{\pi}{2}} x^2 \sin (2 k+1) xdx\right] \end{aligned} $$ Comparing their real parts yields $$ I=2 \underbrace{ \sum_{k=0}^{\infty} \int_0^{\frac{\pi}{2}} x^2 \sin (2 k+1) x d x}_{J_k} $$

Using integration by parts twice, we get $$ \begin{aligned} J_k & =-\frac{1}{2k+1}\left[x^2 \cos (2 k+1) x\right]_0^{\frac{\pi}{2}}+\frac{n}{2 k+1} \int_0^{\frac{\pi}{2}} x \cos (2 k+1) x d x \\ & =\frac{2}{(2 k+1)^2}\left[x\sin (2 k+1) x\right]_0^{\frac{\pi}{2}}-\frac{2}{(2 k+1)^3 }\int_0^{\frac{\pi}{2}} \sin (2 k+1) xdx \\ & = \frac{(-1)^k \pi}{(2 k+1)^2}-\frac{2(-1)^k }{(2 k+1)^3}\end{aligned} $$ Plugging back the summation yields $$ \begin{aligned} I & =\pi \sum_{k=0}^{\infty} \frac{(-1)^k}{(2 k+1)^2}-2 \sum_{k=0}^{\infty} \frac{1}{(2 k+1)^3} \\ & =\pi G-2\left(1-\frac{1}{8}\right)\zeta(3)\\&= \pi G-\frac{7}{4}\zeta(3) \end{aligned} $$ where G is the Catalan’s constant.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .