# Generalised Integral $I_n=\int_0^{\pi/2} \frac{x^n}{\sin ^n x} \ \mathrm{d}x, \quad n\in \mathbb{Z}^+.$

I have this integral, $$I_n=\displaystyle \int_0^{\pi/2} \frac{x^n}{\sin ^n x} \ \mathrm{d}x, \qquad n\in \mathbb{Z}^+.$$ We have the results \begin{align} I_1 & = 2C, \\ I_2 &= \pi\log 2, \\ I_4 & = -\frac{\pi^3}{12} + 2\pi\log 2 + \frac{\pi^3}{3}\log 2-\frac{3\pi}{2}\zeta(3), \end{align} where $C$ is Catalan's constant. Can we prove any of these results, or make any progress on $I_3$, or the general case?

• I think your best chance is a recurrence relationship of $I(n)$ in terms of $I(n-2)$ and/or $I(n-1)$. Commented May 8, 2014 at 13:12
• $\displaystyle{\large I_{4}}$ must be $\displaystyle{\large\color{#c00000}{-\,{\pi^{3} \over 12}} + 2\pi\ln\left(2\right) + {\pi^{3} \over 3}\,\ln\left(2\right) - {3\pi \over 2}\,\zeta\left(3\right)}$. Commented Jul 28, 2014 at 2:55
• I have changed the formatting of the title so as to make it take up less vertical space -- this is a policy to ensure that the scarce space on the main page is distributed evenly over the questions. See here for more information. Please take this into consideration for future questions. Thanks in advance. Commented Mar 12, 2018 at 16:59

For $$n\in\mathbb{N}$$ we have:

$$\int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^ndx=\sum\limits_{j=0}^{n-1}2^{n-j}\begin{bmatrix}n\\j+1\end{bmatrix}\sum\limits_{v=0}^j\binom{j}{v}(-n)^{j-v+1}\sum\limits_{l=1}^{\big\lfloor\frac{n+1}{2}\big\rfloor}\frac{(-1)^l\Big(\tfrac{\pi}{2}\Big)^{n-2l+1}}{(n-2l+1)!}f_n(2l-v),$$

with the Stirling numbers of the first kind $$\begin{bmatrix}n\\k\end{bmatrix}$$ defined by $$\displaystyle\sum\limits_{k=0}^n\begin{bmatrix}n\\k\end{bmatrix}x^k:=\prod\limits_{k=0}^{n-1}(x+k),$$

with $$f_{2m-1}(s):=(-1)^{m-1}\beta(s),$$ where $$\beta(s)$$ := Dirichlet $$\beta$$ function,

and $$f_{2m}(s):=(-1)^{m-1}2^{-s}\eta(s),$$ where $$\eta(s)$$ := Dirichlet $$\eta$$ function,

for $$m\in\mathbb{N}$$, with the analytical extensions $$(s\in\mathbb{C})$$

$$B_n(x)$$ are here the Bernoulli Polynomials.

\begin{align} \beta(1-s)&=\bigg(\dfrac{2}{\pi}\bigg)^s\sin\bigg(\dfrac{\pi s}{2}\bigg)~\Gamma(s)~\beta(s) \\\\ \eta(1-s)&=\dfrac{2^s-1}{1-2^{s-1}}~\pi^{-s}\cos\bigg(\dfrac{\pi s}{2}\bigg)~\Gamma(s)~\eta(s) \end{align}

and with the simplifications $$(k\in\mathbb{N}_0)$$

\begin{align} \beta(-2k-1)~&=~0 \\\\ \beta(-2k)~&=~-\frac{2^{4k+1}}{2k+1}~B_{2k+1}\bigg(\frac{1}{4}\bigg) \\\\ \beta(2k+1)~&=~(-1)^{k-1}~\frac{(2\pi)^{2k+1}}{2(2k+1)!}~B_{2k+1}\bigg(\frac{1}{4}\bigg) \\\\ \eta(1-k)~&=~\frac{2^k-1}{k}~B_k \\\\ \eta(2k)~&=~(-1)^{k-1}~\frac{2^{2k-1}-1}{(2k)!}~B_{2k}~\pi^{2k} \\\\ \eta(2k+1)~&=~\bigg(1-\frac{1}{2^{2k}}\bigg)\zeta(2k+1) \end{align}

Examples include:

\begin{align} \int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^1dx~&=~2\beta(2)\approx1.83 \\\\ \int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^2dx~&=~\pi\ln2\approx2.178 \\\\ \int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^3dx~&=~-6\beta(4)+\bigg(\frac{3}{4}\pi^2+6\bigg)\beta(2)-\frac{3}{8}\pi^2\approx2.64 \\\\ \int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^4dx~&=~-\frac{3}{2}\pi\zeta(3)+\bigg(\frac{\pi^3}{3}+2\pi\bigg)\ln2-\frac{\pi^3}{12}\approx3.27 \\\\ \int\limits_0^{\pi/2}\bigg(\frac{x}{\sin x}\bigg)^5dx~&=~90\beta(6)-\bigg(\frac{45}{4}\pi^2+100\bigg)\beta(4)+\bigg(\frac{45}{192}\pi^4+\frac{25}{4}\pi^2+10\bigg)\beta(2)- \\ &-\bigg(\frac{55}{384}\pi^4+\frac{5}{8}\pi^2\bigg)\approx4.135 \end{align}

• Fantastic and underrated answer. Commented Aug 14, 2017 at 2:04
• @BrevanEllefsen : Very kind of you, thanks ! (But: for a better rating I should explain more of course ... :-) ) Commented Aug 14, 2017 at 8:27
• How do we know your initial claim? Commented Mar 3, 2019 at 2:33
• @clathratus : I have to explain more, of course, but it's a lot, I need too much time for it. And my answer came 2 years too late. Therefore I wrote only the answer for interested people, not the whole explanation. If you like to do busywork, you should start with $\sin x = (e^{ix}-e^{-ix})/(i2)$, the rest comes on its own. By the way: You can also look at here for similar ideas. Commented Mar 3, 2019 at 16:11

Integrating by parts 3 times,

\begin{align} \int_{0}^{\pi /2} \frac{x^{4}}{\sin^{4} x} \ dx &= - \frac{x^{4}}{3} \cot(x) \left(\csc^{2} (x) +2 \right) \Bigg|^{\pi/2}_{0} + \frac{4}{3} \int_{0}^{\pi /2} x^{3} \cot (x) \left(\csc^{2} (x) +2 \right) \ dx \\ &= \frac{4}{3} \int_{0}^{\pi /2} x^{3} \cot (x) \left(\csc^{2} (x) +2 \right) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx + \frac{4}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \csc^{2}(x) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx - \frac{2}{3}x^{3} \cot^{2}(x) \Bigg|^{\pi/2}_{0} + 2 \int_{0}^{\pi /2} x^{2} \cot^{2}(x) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx + 2 \int_{0}^{\pi /2} x^{2} \cot^{2} (x) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx -2x^{2} \Big( x + \cot(x) \Big) \Bigg|^{\pi/2}_{0} +4 \int_{0}^{\pi /2} x\Big(x+ \cot(x) \Big) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx - \frac{\pi^{3}}{4} + 4 \int_{0}^{\pi /2} x^{2} \ dx + 4 \int_{0}^{\pi /2} x \cot(x) \ dx \\ &= \frac{8}{3} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx - \frac{\pi^{3}}{12} + 4 \int_{0}^{\pi /2} x \cot(x) \ dx . \end{align}

In general, $$\int_{a}^{b} f(x) \cot(x) \ dx = 2 \sum_{n=1}^{\infty} \int_{a}^{b} f(x) \sin (2nx) \ dx .$$

See here.

So \begin{align} \int_{0}^{\pi /2} x^{3} \cot(x) \ dx &= 2 \sum_{n=1}^{\infty} \int_{0}^{\pi /2} x^{3} \sin (2nx) \ dx \\ &= 2 \sum_{n=1}^{\infty} \left(\frac{(-1)^{n-1} \pi^{3}}{16n} - \frac{(-1)^{n-1} 3\pi}{8n^{3}} \right) \\ &= \frac{\pi^{3}}{8} \ln (2) - \frac{3 \pi}{4} \eta(3) \\ &= \frac{\pi^{3}}{8} \ln (2) - \frac{9 \pi }{16} \zeta(3). \end{align}

And

\begin{align} \int^{\pi /2}_{0} x \cot(x) \ dx &= 2 \sum_{n=1}^{\infty} \int_{0}^{\pi /2} x \sin(2nx) \ dx \\ &= -\frac{\pi}{2} \sum_{n=1}^{\infty} \frac{(-1)^{n}}{n} \\ &= \frac{\pi \ln 2}{2} . \end{align}

Therefore,

\begin{align} \int_{0}^{\pi /2} \frac{x^{4}}{\sin^{4} x} \ dx &= \frac{8}{3} \left( \frac{\pi^{3}}{8} \ln (2) - \frac{9 \pi }{16} \zeta(3) \right) - \frac{\pi^{3}}{12} + 4 \left(\frac{\pi \ln 2}{2} \right) \\ &= - \frac{\pi^{3}}{12} + 2 \pi \ln(2) + \frac{\pi^{3}}{3} \ln (2) - \frac{3 \pi}{2} \zeta(3) . \end{align}

Integrating by parts, we have $$\int \frac{x^2}{\sin^2 x} \, dx= -x^2 \cot x +\int 2x \cot x \, dx\\= -x^2 \cot x + 2x \ln \sin x - \int 2 \ln \sin x \, dx$$ Evaluating this between $0$ and $\pi/2$, we find that the boundary terms vanish (by taking the appropriate limits), so we are left with the well-known integral $$-2 \int_0^{\pi/2} \ln \sin x \, dx =\pi \ln 2$$

Edit: I have found a way to do $I_1$. Integrating by parts, $$\int \frac{x}{\sin x} \, dx= x \ln \tan \frac{x}{2} - \int \ln \tan \frac{x}{2} \, dx$$ Evaluating between $0$ and $\pi/2$ yields $$I_1 = -2 \int_0^{\pi/4} \ln \tan x \, dx\\ = -2 \int_{-\infty}^{0} x \frac{e^x}{1+e^{2x}} \, dx\\ = 2 \sum_{k \geq 0} (-1)^k\int_{0}^{\infty} x e^{-(2k+1)x} \, dx \\ = 2 \sum_{k \geq 0} (-1)^k \frac{1}{(2k+1)^2} \\ = 2C$$ as was to be proved.

Using a CAS, I obtained $$I_3=\frac{1}{256} \left(192 \left(8+\pi ^2\right) C-96 \pi ^2-\psi ^{(3)}\left(\frac{1}{4}\right)+\psi ^{(3)}\left(\frac{3}{4}\right)\right)$$ $$I_6=\frac{1}{320} \pi \left(40 \pi ^2 (-12 \zeta (3)-1+20 \log (2))+240 (15 (\zeta (5)-\zeta (3))+\log (16))+\pi ^4 (32 \log (2)-11)\right)$$

• Are you will to share the name of the CAS? My old Maple give solutions only in terms of $\mathrm{polylog}(n,\pm i)$ and Wolfram Alpha shows only numerical values? Commented May 8, 2014 at 12:28
• It is a modiied version of Maxima. I must say that I got a lot of trouble with $I_5$. Commented May 8, 2014 at 12:31
• @ClaudeLeibovici : The maxima which I've installed (v5.24.0) can't integrate even when n=1. Is that modified version available online?
– gar
Commented May 9, 2014 at 10:38
• @gar. No, it is a version we have modified in my research team many years ago precisely for integration of very nasty functions we worked on at that time. If life is not too short, it is part of my plans to clean it up and propose it to whoever could be interested. Commented May 9, 2014 at 10:51
• @ClaudeLeibovici : Oh, I see. That would be a great thing to do! Thanks for your time and work.
– gar
Commented May 9, 2014 at 10:56

In general, we can deal with the integral

$$I(m,n)=\int_0^{\frac{\pi}{2}} \frac{x^m}{\sin^n x} d x$$ by establishing a reduction formula via integration by parts.

\begin{aligned} I(m, n)=&\int_0^{\frac{\pi}{2}} \frac{x^m}{\sin ^n x} d x -\int_0^{\frac{\pi}{2}} x^m \csc ^{n-2} x d(\cot x)\\=& m \int_0^\pi \frac{x^{m-1} \cos x}{\sin ^{n-1} x} d x-(n-2) \int_0^\pi x^m \csc ^{n-2} x\left(\csc ^2 x-1\right) d x\\=& -\frac{m}{n-2} \int_0^{\frac{\pi}{2}} x^{m-1} d\left(\frac{1}{\sin ^{n-2} x}\right)-(n-2) I(m, n)+(n-2) I(m, n-2) \end{aligned}

Rearranging and simplifying yields

$$\boxed{I(m, n)=-\frac{m \pi^{m-1}}{(n-1)(n-2) 2^{m-1}}+\frac{m(m-1)}{(n-1)(n-2)} I(m-2, n-2)+ \frac{n-2}{n-1} I(m, n-2)}$$ where $$m\ge n\ge 3$$. Applying the formula repeatedly, we can find $$I(m,n)$$ with two initial integrals.

For odd integer $$n$$, we need to evaluate

$$\int_0^{\frac{\pi}{2}} \frac{x^m}{\sin x} d x$$ which was already solved in the post which states that \begin{align} \int_0^{\frac{\pi}{2}} \frac{x^m}{\sin x} d x =\>(2-2^{-m})m!\zeta(m+1)\Re(i^m) - \sum_{k=1}^{[\frac{m+1}2]} (\frac{\pi}2)^{m+1-2k}\>\frac{2(-1)^k m!}{(m+1-2k)!} \>\beta(2k) \end{align} For example, \begin{aligned}I(1,1)&= -\left(\frac{\pi}{2}\right)^0 2(-1) \beta(2) = 2 G \\I(3,1)&=-\left(\frac{\pi^2}{4} \cdot \frac{-12}{2} \beta(2)+12 \beta(4)\right) =\frac{3 \pi^2}{2} G-12 \beta(4) \\I(5,1)&=\frac{5 \pi^4}{8} G-30 \pi^2 \beta(4)+240 \beta(6)\end{aligned} Coming back to our integral, $$I(3,3)=-\frac{3 \pi^2}{8}+3 I(1,1)+\frac{1}{2} I(3,1)= -\frac{3 \pi^2}{8}+\frac{3\left(8+\pi^2\right) }{4}G-6\beta(4)$$ \begin{aligned}I(5,3)&=-\frac{5 \pi^4}{8}+10 I(3,1)+I(5,1)\\&= \frac{5 \pi^4}{32}+\left(15 \pi^2+\frac{5 \pi^4}{16}\right) G-\left(120+15 \pi^2\right) \beta(4) +120 \beta(6)\end{aligned}

\begin{aligned} I(5,5)& = -\frac{5 \pi^4}{192}+\frac{5}{3} I(3,3)+\frac{3}{4} I(5,3)\\&=-\frac{5 \pi^4}{192}+\frac{5}{3}\left(-\frac{3 \pi^2}{8}+\frac{3\left(8+\pi^4\right)}{4} G-6 \beta(4)\right)\\ \quad &+\frac{3}{4}\left[ \frac{5 \pi^4}{32}+\left(15 \pi^2+\frac{5 \pi^4}{16}\right) G-\left(120+15 \pi^2\right) \beta(4) +120 \beta(6) \right]\\&= - \frac{5 \pi^2}{8}-\frac{35 \pi^4}{384}+\left(10+\frac{45 \pi^2}{4}+\frac{35 \pi^4}{64}\right) G -\left(100+ \frac{45\pi^2}{4}\right) \beta(4)+90 \beta(6) \end{aligned}

For even integers $$n$$, we need to evaluate $$\int_0^{\frac{\pi}{2}} \frac{x^m}{\sin^2 x} d x ,$$ which is difficult to tackle.

Let’s try the third one, \begin{aligned} I_3 & =\int_0^{\frac{\pi}{2}} \frac{x^3}{\sin ^3 x} d x\\&=-\int_0^{\frac{\pi}{2}} \frac{x^3}{\sin x} d(\cot x) \\ & =-\left[\frac{x^3}{\sin x} \cot x\right]_0^{\frac{\pi}{2}}+\int_0^{\frac{\pi}{2}} \frac{3 x^2 \sin x-x^3 \cos x}{\sin ^2 x} \cot x d x \\ & =\int_0^{\frac{\pi}{2}}\left(3 x^2 \cot x \csc x-\frac{x^3 \cos ^2 x}{\sin ^3 x}\right) d x \\ & =3 \int_0^{\frac{\pi}{2}} x^2 d(-\csc x)-\int_0^{\frac{\pi}{2}} \frac{x^3\left(1-\sin ^2 x\right)}{\sin ^3 x} d x \\ & =3\left[-x^2 \csc x\right]_0^{\frac{\pi}{2}} +6 I_1-I_3+\int_0^{\frac{\pi}{2}} \frac{x^3}{\sin x} d x \end{aligned}

Rearranging gives$$I_3=-\frac{3 \pi^2}{8}+6G+ \frac{1}{2} \int_0^{\frac{\pi}{2}} \frac{x^3}{\sin x} d x$$ For the last integral, we need Euler’s identity $$e^{xi}=\cos x+i\sin x$$ to transform it into \begin{aligned} \int_0^{\frac{\pi}{2}} \frac{x^3}{\sin x} d x&=2 i \int_0^{\frac{\pi}{2}} \frac{x^3}{e^{x i}-e^{-x i}} d x \\ = & 2 i \int_0^{\frac{\pi}{2}} \frac{x^3 e^{-x i}}{1-e^{-2 x i}} d x \\ = & 2 i \sum_{n=0}^{\infty} \int_0^{\frac{\pi}{2}} x^3 e^{-(2 n+1) x i} d x \end{aligned} Integrating by parts thrice on the last integral yields \begin{aligned}&\int_0^{\frac{\pi}{2}} x^3 e^{-(2 n+1) x i} d x \\ =&\frac{(-1)^n}{8(2 n+1)^4}[\pi(2 n+1)\left[-24+\pi(2 n+1)(2 \pi n+\pi-6 i)]+48(-1)^n+48 i \right]\end{aligned}

Plugging back gives \begin{aligned} \int_0^{\frac{\pi}{2}} \frac{x^3}{\sin x} d x & =\frac{3 \pi^2}{2} \sum_{n=0}^{\infty} \frac{(-1)^n}{(2 n+1)^2}-12 \sum_{n=0}^{\infty} \frac{(-1)^n}{(2 n+1)^4} \\ & =\frac{3 \pi^2}{2} G-12\beta(4)\\ \end{aligned}

where $$G$$ is the Catalan’s constant and $$\beta(.)$$ is the Dirichlet_beta_function.

Hence we may conclude that $$\boxed{I_3=-\frac{3 \pi^2}{8}+\frac{3\left(8+\pi^2\right) G}{4}-\beta(4)}$$