Evaluating $\int_{0}^{\frac{\pi}{2}} x^n \csc(x) dx$

definite integralsintegrationtrigonometric-integrals

Just from messing around on WolframAlpha, I've come across an interesting integral. For the integral
$$
\operatorname{I}\left(n\right) =
\int_{0}^{\frac{\pi}{2}}x^{n}\csc\left(x\right)\,{\rm d}x\,,
$$

there are some pretty interesting answers when evaluating them at certain values. For example:
\begin{align}
\operatorname{I}\left(1\right) & = 2C
\\[2mm]
\operatorname{I}\left(2\right) & =
2\pi C – {7 \over 2}\,\zeta\left(3\right)
\\[2mm]
\operatorname{I}\left(3\right) & =
\frac{1}{128}\left[192\,\pi^{2}\,C -\psi^{\left(3\right)}
\left(\frac{1}{4}\right) +\psi^{\left(3\right)}\left(\frac{3}{4}\right)\right]
\\[2mm]
\operatorname{I}\left(4\right) & =
\pi^{3}\,C –
24\pi\,{\rm i}\operatorname{Li}_{4}\left(-{\rm i}\right) + \frac{93}{2}\,\zeta(5) – \frac{7}{480}\,{\rm i}\pi^{5}
\end{align}

  • With each step up, we introduce a new family of functions.
  • I cannot for the life of me distinguish a pattern to try to come up with what $\operatorname{I}\left(n\right)$ might be.
  • The only thing that I can discern, is obviously
    $\operatorname{I}\left(n\right)$ includes a term including $\pi^{n-1}\, C$.

Can someone give me some kind of idea as to how I might evaluate these $?$.

Best Answer

We find an explicit closed form for all $n\in \mathbb{N}$. Using $\sin(x)=\dfrac{e^{ix}-e^{-ix}}{2i}$ and the geometric series (in the distributional sense, e.g. see the last remark of this answer) we obtain $$\int_0^{\pi/2} x^n \csc(x)~dx=2i \int_0^{\pi/2} x^n \frac{e^{-ix}}{1-e^{-2ix}}~dx=2i\sum_{k=0}^{\infty} \int_0^{\pi/2} x^n e^{-(2k+1)ix}~dx. \tag{1}$$ We have the indefinite integral (eq. 2.321 in Gradshteyn and Ryzhik 7th ed.) for any $a\in \mathbb{C}$ $$\int x^n e^{ax}~dx=e^{ax}\left(\sum_{j=0}^n \frac{(-1)^j j! \binom{n}{j}}{a^{j+1}}x^{n-j}\right)+C,$$ which results in the definite integral $$\int_0^{\pi/2} x^n e^{ax}~dx=e^{a\pi/2} \left(\sum_{j=0}^{n} \frac{(-1)^j j! \binom{n}{j}}{a^{j+1}}\left(\frac{\pi}{2}\right)^{n-j}\right)-\frac{(-1)^n n!}{a^{n+1}}.$$ Hence for $a=-(2k+1)i$ we have $$\int_0^{\pi/2} x^n e^{-(2k+1)ix}~dx=i\cdot (-1)^k \left(\sum_{j=0}^{n} \frac{j! \binom{n}{j}}{i^{j+1} (2k+1)^{j+1}}\left(\frac{\pi}{2}\right)^{n-j}\right)+\frac{n!}{i^{n+1} (2k+1)^{n+1}}.$$ With this result, one can express $(1)$ in terms of Dirichlet beta functions $$\beta(s):=\sum_{k=0}^{\infty} \frac{(-1)^k}{(2k+1)^s},$$ and Dirichlet lambda functions $$\lambda(s):=\sum_{k=0}^{\infty} \frac{1}{(2k+1)^s}=(1-2^{-s})\zeta(s),$$ where the final equality is valid for all $\Re(s)>1$.


Thus, the integral is given by the following if $n$ is even (we use that $i^l=i^{-l}$ if $l$ is even): $$\scriptsize \begin{align*}\int_0^{\pi/2} x^n \csc(x)~dx&=2 i^n\cdot n!\lambda(n+1)-2 \sum\limits_{\substack{0\leq j\leq n \\ j~\mathrm{odd}}} \left(\frac{\pi}{2}\right)^{n-j} i^{j+1} j! \binom{n}{j}\beta(j+1)\\&=\frac{(-1)^{n/2}\cdot n! (2^{n+1}-1)}{2^n}\zeta(n+1)-2 \sum\limits_{\substack{0\leq j\leq n \\ j~\mathrm{odd}}} \left(\frac{\pi}{2}\right)^{n-j} i^{j+1} j! \binom{n}{j}\beta(j+1)\\&=\frac{(-1)^{n/2} \cdot n! (2^{n+1}-1)}{2^n}\zeta(n+1)+2\sum_{m=1}^{\lfloor (n+1)/2\rfloor} \left(\frac{\pi}{2}\right)^{n+1-2m} (-1)^{m-1} (2m-1)! \binom{n}{2m-1}\beta(2m). \end{align*}$$ Otherwise, if $n$ is odd $$\begin{align*}\int_0^{\pi/2} x^n \csc(x)~dx&=-2 \sum\limits_{\substack{0\leq j\leq n \\ j~\mathrm{odd}}} \left(\frac{\pi}{2}\right)^{n-j} i^{j+1} j! \binom{n}{j}\beta(j+1)\\&=2\sum_{m=1}^{\lfloor (n+1)/2\rfloor} \left(\frac{\pi}{2}\right)^{n+1-2m} (-1)^{m-1} (2m-1)! \binom{n}{2m-1}\beta(2m). \end{align*}$$ This agrees with @metamorphy's results (and yours). Note that we only sum over odd $j$ since the summands for even $j$ only contribute to the imaginary part of the integral, which we know is $0$ since the integrand is real on the domain of integration.