Close-form for integral $T(n)=\int_0^{\pi/2}\frac{1}{1+\sin^n(x)}dx$

Solution 1:

The close-form result, valid for both odd and even $n$, is $$T(n) = \frac{1-(-1)^n}{2n}+ \frac1n \sum_{k=1}^{[\frac n2]}\beta_{k}^+(\frac\pi2+\tan^{-1}\beta_k^-)- \beta_k^- \coth^{-1} \beta_k^+ \tag1$$ with $$\beta_k^{\pm }= \frac1{\sqrt2}\left(\sqrt{\cot\frac{(2k-1)\pi}{2n}} \pm \sqrt{\tan\frac{(2k-1)\pi}{2n}} \right) $$


Proof: Note

$$\frac1{1+y^n}=-\frac1n\sum_{k=1}^n \frac{e^{i\theta_k}}{y-e^{i\theta_k}}, \>\>\>\>\> \theta_ k = \frac{(2k-1)\pi}n$$ and combine conjugate pairs

$$\frac1{1+y^n}=\frac{1-(-1)^n}{2n(1+y)} + \frac2n \sum_{k=1}^{[\frac n2]} \frac{1-y \cos\theta_k }{y^2-2y\cos\theta_k+1} $$ Set $y = \cos x$ to integrate

\begin{align} T(n)&=\int_0^{\pi/2}\frac{dx}{1+\sin^n x} = \int_0^{\pi/2}\frac{dx}{1+\cos^n x} \\ &= \frac1{2n}\int_0^{\frac\pi2}\frac{1-(-1)^n}{1+\cos x}dx + \frac2n \sum_{k=1}^{[\frac n2]} \int_0^{\frac\pi2} \frac{1-\cos x \cos\theta_k }{\cos^2x-2\cos x\cos\theta_k+1}dx\\ &= \frac{1-(-1)^n}{2n} + \frac2n \sum_{k=1}^{[\frac n2]} \int_0^{1} \frac{\tan^2\frac{\theta_k}2-t^2}{\tan^2\frac{\theta_k}2 +t^4}dt \end{align} where the half-angle substitution $t=\tan\frac x2$ is applied. Then, integrate over $t$ to arrive at the close-form expression (1). Note that the general result (1) simplifies considerably for even $n$ as the summation over the inverse trig functions vanishes. Explicitly, for $n =2m$ $$T(2m)= \frac\pi{4m} \sum_{k=1}^{m} \sqrt{\csc\theta_k+1}\tag2 $$ where $\beta_k^+ = \sqrt{\csc\theta_k+1}$ is recognized.


Listed below are some actual results per the close-form (1) or (2).

Even $n$: \begin{align} T(2) &= \frac\pi4 \sqrt{\csc\frac\pi2+1}=\frac{\pi}{2\sqrt2}\\ T(4) &= \frac\pi8 \left(\sqrt{\csc\frac\pi4+1} + \sqrt{\csc\frac{3\pi}4+1} \right)=\frac{\pi}{4}\sqrt{\sqrt2+1}\\ T(6) &= \frac\pi{12} \left(\sqrt2+\sqrt{\csc\frac\pi6+1} + \sqrt{\csc\frac{5\pi}6+1} \right)=\frac{\pi}{12}(\sqrt2+2\sqrt3)\\ T(8) &= \frac\pi8 \left(\sqrt{\csc\frac\pi8+1} + \sqrt{\csc\frac{3\pi}8+1} \right)\\ &=\frac{\pi}{8}\left(\sqrt{\sqrt{2(2+\sqrt2)}+1} + \sqrt{\sqrt{2(2-\sqrt2)}+1}\right)\\ T(10) &= \frac\pi{10} \left(\frac1{\sqrt2}+\sqrt{\csc\frac\pi{10}+1} + \sqrt{\csc\frac{3\pi}{10}+1} \right)\\ &=\frac{\pi}{10}\left(\frac1{\sqrt2}+ \sqrt[4]5+\sqrt{2+\sqrt5}\right)\\ T(12) &= \frac{\pi}{12} \sqrt{1+\sqrt2}\left(1+ \sqrt{2+2\sqrt3}\right) \end{align}

Odd $n$: \begin{align} T(3) &=\frac13 +\frac{\sqrt[4]3+\frac1{\sqrt[4]3}}{3\sqrt2} \left(\frac\pi2+ \tan^{-1} \frac{\sqrt[4]3-\frac1{\sqrt[4]3}}{\sqrt2} \right) - \frac{\sqrt[4]3-\frac1{\sqrt[4]3}}{3\sqrt2} \coth^{-1} \frac{\sqrt[4]3+\frac1{\sqrt[4]3}}{\sqrt2} \\ T(5) &=\frac15 +\frac15\sqrt{ \sqrt{2+\frac2{\sqrt5}}+1} \left(\frac\pi2+ \tan^{-1} \sqrt{ \sqrt{2+\frac2{\sqrt5}}-1}\right) \\ &\hspace{10mm} +\frac15\sqrt{ \sqrt{2-\frac2{\sqrt5}}+1} \left(\frac\pi2- \tan^{-1} \sqrt{ \sqrt{2-\frac2{\sqrt5}}-1}\right) \\ &\hspace{10mm} -\frac15\sqrt{ \sqrt{2+\frac2{\sqrt5}}-1} \coth^{-1} \sqrt{ \sqrt{2+\frac2{\sqrt5}}+1} \\ &\hspace{10mm} +\frac15\sqrt{ \sqrt{2-\frac2{\sqrt5}}-1} \coth^{-1} \sqrt{ \sqrt{2-\frac2{\sqrt5}}+1} \\ T(7) &=\frac17 +\frac17\sqrt{ \csc\frac\pi7+1} \left(\frac\pi2+ \tan^{-1} \sqrt{ \csc\frac\pi7-1}\right) \\ &\hspace{10mm} +\frac17\sqrt{ \csc\frac{3\pi}7+1} \left(\frac\pi2+ \tan^{-1} \sqrt{ \csc\frac{3\pi}7-1}\right) \\ &\hspace{10mm} +\frac17\sqrt{ \csc\frac{5\pi}7+1} \left(\frac\pi2- \tan^{-1} \sqrt{ \csc\frac{5\pi}7-1}\right) \\ &\hspace{10mm} -\frac17\sqrt{ \csc\frac{\pi}7-1} \coth^{-1} \sqrt{ \csc\frac{\pi}7+1} \\ &\hspace{10mm} -\frac17\sqrt{ \csc\frac{3\pi}7-1} \coth^{-1} \sqrt{ \csc\frac{3\pi}7+1} \\ &\hspace{10mm} +\frac17\sqrt{ \csc\frac{5\pi}7-1} \coth^{-1} \sqrt{ \csc\frac{5\pi}7+1} \\ \end{align}

Solution 2:

As a suggestion, use $\tan\left(\frac{x}{2}\right)=t$ whenever the trig function is raised to an odd power, but use $x=\tan t$ when the trig is raised to an even power, that is since there will be no square roots left.

For even $n$, using the above, $T(6)$ can be simplified to: $$T(6)=\int_0^\frac{\pi}{2} \frac{dx}{1+\sin^6x}= \int_0^\infty \frac{(1+x^2)^2}{(2+x^2)(1+x+x^2)(1-x+x^2)}dx$$$$=\frac13\int_0^\infty\frac{dx}{2+x^2}+\frac16\int_0^\infty \left(\frac{1+x}{1-x+x^2}+\frac{1-x}{1+x+x^2}\right)dx $$ And one can see now easier how that nice result appears.

Similary, for $T(8)$ we have: $$T(8)=\int_0^\frac{\pi}{2}\frac{dx}{1+\sin^8 x}\overset{x\to \frac{\pi}{2}-x}=\int_0^\frac{\pi}{2}\frac{dx}{1+\cos^8 x}\overset{x\to \tan^{-1} x}=\int_0^\infty \frac{(1+x^2)^3}{(1+x^2)^4+1}dx$$ $$=\frac{1}{2}\int_0^\infty \frac{x^2+1+\frac{1}{\sqrt 2}}{(x^2+1)^2+\sqrt 2 (x^2+1)+1}dx+\frac12\int_0^\infty\frac{x^2+1-\frac{1}{\sqrt 2}}{(x^2+1)^2-\sqrt 2 (x^2+1)+1}dx$$ $$=\frac{\pi}{8}\left(\sqrt{1+\sqrt{2(2+\sqrt 2)}}+\sqrt{1+\sqrt{2(2-\sqrt 2)}}\right)$$


For odd $n$, with the Weierstrass substitution after putting $x\to \frac{\pi}{2}-x$ we have: $$T(3)=\int_0^\frac{\pi}{2}\frac{dx}{1+\cos ^3 x}=\int_0^1 \frac{(1+x^2)^2}{1+3x^4}dx=\frac13+\frac23\int_0^1\frac{\frac13+x^2}{\frac13+x^4}dx=\frac13+\frac23f\left(\frac13\right)$$

And at the very least, what is $T(5)$? It seems to be very nasty.

$$T(5)=\int_0^\frac{\pi}{2}\frac{1}{1+\sin^5 x}dx\overset{x\to\frac{\pi}{2}-x}=\int_0^\frac{\pi}{2}\frac{1}{1+\cos^5 x}dx\overset{\tan\frac{x}{2}\to x}=\int_0^1 \frac{(1+x^2)^4}{1+10x^4+5x^8}dx$$ $$=\frac15\int_0^1 dx+\frac25\int_0^1\frac{1+\frac{2}{\sqrt 5}+x^2}{1+\frac{2}{\sqrt 5}+x^4}dx+\frac25\int_0^1\frac{1-\frac{2}{\sqrt 5}+x^2}{1-\frac{2}{\sqrt 5}+x^4}dx$$ $$=\frac15+\frac25f\left(1+\frac{2}{\sqrt 5}\right)+\frac25f\left(1-\frac{2}{\sqrt 5}\right)$$


$$f(t)=\int_0^1 \frac{t+x^2}{t+x^4}dx\overset{x=\sqrt[4]t y}=\sqrt[4] t\int_0^{\frac{1}{\sqrt[4]t}}\frac{1}{1+y^4}dy+\frac{1}{\sqrt[4] t}\int_0^{\frac{1}{\sqrt[4]t}}\frac{y^2}{1+y^4}dy$$ $$=\frac12\left(\sqrt[4] t+\frac{1}{\sqrt[4] t}\right)\int_0^{\frac{1}{\sqrt[4]t}}\frac{1+y^2}{1+y^4}dy+\frac12\left(\sqrt[4] t-\frac{1}{\sqrt[4] t}\right)\int_0^{\frac{1}{\sqrt[4]t}}\frac{1-y^2}{1+y^4}dy$$ $$=\frac12\left(\sqrt[4] t+\frac{1}{\sqrt[4] t}\right)\int_0^{\frac{1}{\sqrt[4]t}}\frac{\left(y-\frac1y \right)'}{\left(y-\frac1y \right)^2+2}dy-\frac12\left(\sqrt[4] t-\frac{1}{\sqrt[4] t}\right)\int_0^{\frac{1}{\sqrt[4]t}}\frac{\left(y+\frac1y \right)'}{\left(y+\frac1y \right)^2-2}dy$$ $$\small =\frac{1}{2\sqrt 2}\left(\sqrt[4] t+\frac{1}{\sqrt[4] t}\right)\left(\arctan\left(\frac{\sqrt[4]t-\frac{1}{\sqrt[4] t}}{\sqrt 2}\right)+\frac{\pi}{2}\right)+\frac1{4\sqrt 2}\left(\sqrt[4] t-\frac{1}{\sqrt[4] t}\right)\ln\left(\frac{\sqrt[4] t+\frac{1}{\sqrt[4] t}+\sqrt 2}{\sqrt[4] t+\frac{1}{\sqrt[4] t}-\sqrt 2}\right)$$

Solution 3:

Another approach might be exploiting $$\frac1{y^n+1}=\frac1n\sum^n_{k=1}\frac1{1-\omega_k y}$$ where $\omega_1,\cdots,\omega_n$ are the roots of $y^n+1=0$.

Hence, $$T(n)= \frac1n\sum^n_{k=1}\int^{\pi/2}_0\frac1{1-\omega_k \sin x}dx$$

Integral calculator says that $$\int^{\pi/2}_0\frac1{1-a\sin x}dx=\frac1{\sqrt{a^2-1}}\ln \frac{1+A^-}{1-A^+}$$ where $$A^\pm=\sqrt{a^2-1}\pm a$$

Therefore, $$T(n)= \frac1n\sum^n_{k=1}\Re \frac1{\sqrt{\omega_k^2-1}}\ln \frac{1+\Omega_k^-}{1-\Omega_k^+} $$

This approach avoids complicated integration manipulations, at the price of doing tedious but basic complex analysis.

NB: I haven’t checked which branch of square root and logarithm should be taken.