Evaluating $\int^{\frac\pi2}_{\frac\pi4}(2\csc(x))^{17}dx$ I saw this question in JEE Advanced. But in that we had to simplify it to $$\int^{\log(1+\sqrt2)}_{0}2(e^u+e^{-u})^{16}du$$
But I pose the following question as to evaluate this integral in closed form.  My Attempt:
$$\int^{\frac\pi2}_{\frac\pi4}(2\csc(x))^{17}dx$$
$$=\int^{\frac\pi2}_{\frac\pi4}\frac{(2.2i)^{17}}{(e^{ix}-e^{-ix})^{17}}dx$$
(Bit of a cheeky attempt! I know. :D)
$$4^{17}i\int^{\frac\pi2}_{\frac\pi4}\frac{e^{17ix}}{e^{2ix}-1}dx$$
If we put $u=e^{ix};du=i.e^{ix}dx$, then $$-4^{17}\int^{i}_{\frac{1+i}{\sqrt2}}\frac{u^{16}}{u^2-1}du$$
(Huh??!!)
$$4^{17}\int_i^{\frac{1+i}{\sqrt2}}\frac{u^{16}}{u^2-1}du$$ 
And $$\int\frac{u^{16}}{u^2-1}=\frac{u^{15}}{15}+\frac{u^{13}}{13}+\frac{u^{11}}{11}+\frac{u^{9}}{9}+\frac{u^{7}}{7}+\frac{u^{5}}{5}+\frac{u^{3}}{3}+u+\frac12\log(1-u)-\frac12\log(u+1)+C$$
But at this point I am stuck. Please can someone help?
 A: By applying the Weierstrass substitution $x=2\arctan t$ we have:
$$\color{red}{I}=\int_{\pi/4}^{\pi/2}\left(\frac{2}{\sin x}\right)^{17}\,dx = \int_{\pi/4}^{\pi/2}\left(\frac{1}{\sin\frac{x}{2}\,\cos\frac{x}{2}}\right)^{17}=2\int_{\sqrt{2}-1}^{1}\left(\frac{1+t^2}{t}\right)^{17}\frac{dt}{1+t^2}$$
then by setting $t=e^{-u}$ and applying the binomial theorem it follows that:
$$ \color{red}{I} = 2\int_{0}^{\log(1+\sqrt{2})}(e^u+e^{-u})^{16}\,du=\color{red}{\frac{16037316\,\sqrt{2}}{7}+25740\log\left(1+\sqrt{2}\right)}.$$
A: How about substituting $\displaystyle \csc x + \cot x = e^{u}.$
Also recall that $\csc^2 x - \cot^2 x = 1 \implies \csc x - \cot x = 
\dfrac{1}{\csc x + \cot x}$
Therefore $\displaystyle \csc x - \cot x = \frac{1}{\csc x + \cot x} = e^{-u} $
Adding the two equations we have,
$\displaystyle 2\csc x = e^{u} + e^{-u} $
Subtracting the two equations we obtain,
$\displaystyle 2\cot x = e^{u} - e^{-u}$
Since we had $\displaystyle 2\csc x = e^{u} + e^{-u}$, differentiating both sides,
$\displaystyle -2\csc x \cot x~ \mathrm{d}x = (e^{u} - e^{-u})\mathrm{d}u$
Substituting $\displaystyle 2\cot x = e^{u} - e^{-u}$
$\implies  \displaystyle -\csc x (e^{u} - e^{-u})\mathrm{d}x = (e^{u} - e^{-u})\mathrm{d}u$
Cancelling $\displaystyle (e^{u} - e^{-u})$ on both sides and substituting $\displaystyle 2\csc x = e^{u} + e^{-u} $
$\implies \displaystyle \mathrm{d}x = \frac{-2\mathrm{d}u}{e^{u} + e^{-u}}$
Now let’s examine the limits of the integral using our substitution $\displaystyle \csc x + \cot x = e^{u},$
At $\displaystyle x = \frac{\pi}{4}$
$\displaystyle \csc\left(\frac{\pi}{4}\right) + \cot\left(\frac{\pi}{4}\right) = e^{u}$
$\implies \displaystyle \sqrt2 + 1 = e^{u} $
$\implies \displaystyle u = \ln(1 + \sqrt2)$
At $\displaystyle x = \frac{\pi}{2}$
$\displaystyle \csc\left(\frac{\pi}{2}\right) + \cot\left(\frac{\pi}{2}\right) = e^{u}$
$\implies \displaystyle  1 = e^{u}  $
$\implies \displaystyle u = 0$
We obtain our new limits as $\displaystyle u = \ln(1 + \sqrt2)$ and $u = 0$ , just like in the options!
Hence $\displaystyle \csc x + \cot x = e^{u}$ was a smart guess!
So the given integral gets simplified to:
$\displaystyle \int_{\frac{\pi}{4}}^{\frac{\pi}{2}}(2\csc x)^{17}\mathrm{d}x = \int_{\ln(1+\sqrt2)}^{0}(e^{u}+e^{-u})^{17}\frac{-2\mathrm{d}u}{e^{u} + e^{-u}} $
$= \displaystyle \boxed{\int_{0}^{\ln(1+\sqrt2)}2(e^{u}+e^{-u})^{16}\mathrm{d}u}$
