# Closed form of $\int_0^\infty \left(\frac{\arctan x}{x}\right)^ndx$

I know that for $$n=1$$ the integral is divergent and that for $$n=2$$ the integral has a closed form. However, I wonder if the general expression has a closed form.

My attempt: $$\int_0^\infty \left(\frac{\arctan(x)}{x}\right)^ndx=\frac{n}{1-n}\int_0^\infty\frac{\arctan^{n-1}(x)}{x^{n-1}(x^2+1)}dx=\frac{n}{1-n}\int_0^{(\frac{\pi}{2})^{n-1}} u^{n-1}\cot^{n-1}\left(u^{1/(n-1)}\right)du$$

I don't know if I'm on the right track here or not but I do not know through what methods to evaluate the last integral. Any help is appreciated.

• What is the closed form for $n=2$? – Carl Schildkraut Sep 27 '18 at 17:34
• @CarlSchildkraut $\pi\log(2)$ – aleden Sep 27 '18 at 17:35
• WolframAlpha seems to be able to evaluate these integrals at specific $n$ in terms of values of the Riemann zeta function at integers. See for example here. – Carl Schildkraut Sep 27 '18 at 17:37
• @CarlSchildkraut: via a terrible indefinite integral. – Yves Daoust Sep 27 '18 at 17:54
• Use the calculations of Jack D'Aurizio below and the formula for $\int_0^{\pi/2}\left(\frac{x}{\sin x}\right)^n dx$ in link . – user90369 Sep 28 '18 at 8:46

Used formulas and definitions:

$$\displaystyle\Re(i^n)=\cos\left(\frac{\pi n}{2}\right)\enspace$$ for integer $$~n\enspace$$ ; $$\enspace\displaystyle\tan x = -i\frac{1-e^{-i2x}}{1+e^{-i2x}}$$

$$\displaystyle \sum\limits_{j=0}^{-1} a_j := \sum\limits_{j=0}^0 a_j - a_0 = 0\enspace$$ ; $$\enspace\displaystyle \left(\sum\limits_{k=0}^{\infty} a_k\right) \left(\sum\limits_{k=0}^{\infty} b_k\right) = \left(\sum\limits_{k=0}^{\infty} \sum\limits_{v=0}^k a_v b_{k-v}\right)$$

$$\displaystyle \int\limits_0^a x^m e^{zx} dx = \frac{m!}{(-z)^{m+1}} - e^{az}\sum\limits_{v=0}^m\frac{m!a^{m-v}}{(m-v)!(-z)^{v+1}} \enspace$$ for $$\enspace m\in\mathbb{N}_0 , \, a\in\mathbb{R} , \, z\in\mathbb{C}\setminus\{0\}$$

Stirling numbers of the first kind $$\displaystyle \begin{bmatrix}n\\k\end{bmatrix}$$ defined by

$$\hspace{4cm}\displaystyle\sum\limits_{j=0}^n\begin{bmatrix}n\\j\end{bmatrix}x^j:=\prod\limits_{k=0}^{n-1}(x+k) \enspace$$ for $$\enspace n\in\mathbb{N}_0 , \, x\in\mathbb{C}$$

$$\displaystyle \sum\limits_{j=0}^n f(j) \sum\limits_{l=0}^j g(j,l) k^l = \sum\limits_{j=0}^n k^j \sum\limits_{l=j}^n f(l)g(l,j) \enspace\enspace$$ formal summation permutation

$$\displaystyle \sum\limits_{v=-1}^k {\binom {n+1} {k-v}}{\binom {n+v} v} = \displaystyle \sum\limits_{v=0}^{n+1} {\binom {n+1} v}{\binom {n+k-v} n}\enspace$$ for $$\enspace k,n\geq 0$$

$$\displaystyle c_{n,j} := \frac{1}{n!} \sum\limits_{v=0}^{n+1} {\binom {n+1} {v}} \sum\limits_{l=j}^m \begin{bmatrix}n+1\\l+1\end{bmatrix} {\binom l j} (-v)^{l-j} \enspace$$ for $$\enspace 0\leq j\leq n\enspace$$ with $$\enspace 0^0:=1$$

$$\displaystyle b_{n,k} := \sum\limits_{v=0}^k {\binom {n+1} {k-v}} {\binom {n+v} v} = -0^{n+k} +\sum\limits_{j=0}^n k^j c_{n,j} \enspace$$ for $$\enspace k,n \geq 0 \,~~ ; \enspace b_{n,0 }=1$$

It follows:

$$\displaystyle\sum\limits_{k=1}^\infty \frac{b_{n,k}~x^k}{k^s} = \sum\limits_{j=0}^n c_{n,j}~\text{Li}_{s-j}(x) \enspace$$ for $$\enspace s\in\mathbb{C}\enspace$$ where $$\enspace \text{Li}_s(x)\enspace$$ is the Polylogarithm

with the special cases $$\enspace \text{Li}_s(1)\equiv \zeta(s)\,$$ and

$$\hspace{4.1cm}\text{Li}_s(-1)\equiv -\eta(s) = \left(2^{1-s}-1\right)\zeta(s) \enspace$$ with $$\enspace\eta(1)=\ln 2$$

$$\underline{\text{Solution:}}$$

Let $$\enspace\displaystyle |a| \leq \frac{\pi}{2} \, , \enspace 0\leq n\leq m \,$$ .

$$\displaystyle \int\limits_0^{\tan a} \frac{\arctan^m x}{x^n} dx = \int\limits_0^a \frac{x^m}{\tan^n x} dx + \int\limits_0^a \frac{x^m}{\tan^{n-2} x} dx \enspace$$ for $$\enspace n\geq 2$$

$$\int\limits_0^a \frac{x^m}{\tan^n x}dx = i^n\frac{a^{m+1}}{m+1} + \frac{i^{n-m-1}m!}{2^{m+1}}\sum\limits_{j=0}^{n-1}~c_{n-1,j}~\text{Li}_{m+1-j}~(1)$$

$$\hspace{2.5cm} -\sum\limits_{v=0}^m \frac{i^{n-v-1}m!a^{m-v}}{(m-v)!2^{v+1}} \sum\limits_{j=0}^{n-1}~c_{n-1,j}~\text{Li}_{v+1-j}~(e^{-i2a})$$

$$\displaystyle a:=\frac{\pi}{2}\,$$ :

$$\int\limits_0^{\pi/2} \frac{x^m}{\tan^n x}dx =$$

$$\cos\left(\frac{\pi n}{2}\right)\frac{(\pi/2)^{m+1}}{m+1} +\cos\left(\frac{\pi (n-m-1)}{2}\right) \frac{m!}{2^{m+1}}\sum\limits_{j=0}^{n-1}~c_{n-1,j}~\zeta(m+1-j)$$

$$\hspace{2.5cm} +\sum\limits_{v=0}^m \cos\left(\frac{\pi (n-v-1)}{2}\right)\frac{m!(\pi/2)^{m-v}}{(m-v)!2^{v+1}} \sum\limits_{j=0}^{n-1}~c_{n-1,j}~\eta(v+1-j)\hspace{1cm}$$

Finally we get:

$$\int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^n dx =$$

$$\frac{1}{2^{n+1}} \sum\limits_{v=0}^n \left(\cos\frac{\pi(n-v-1)}{2}\right) \frac{n!\pi^{n-v}}{(n-v)!}~\cdot$$

$$\cdot~\left( \sum\limits_{j=0}^{n-1} c_{n-1,j}~\eta(v-j+1) - \sum\limits_{j=0}^{n-3} c_{n-3,j}~\eta(v-j+1) \right)$$

Analytical continuations $$(s\in\mathbb{C})$$ :

\begin{align} \zeta(1-s)&=\dfrac{2}{(2\pi)^s}\cos\bigg(\dfrac{\pi s}{2}\bigg)~\Gamma(s)~\zeta(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}

Simplifications $$(k\in\mathbb{N}_0)$$ :

\begin{align} \eta(1)=\ln 2 \enspace ; \enspace \eta(1-k)~&=~\frac{2^k-1}{k}~B_k \end{align}

\begin{align} \eta(2k)~&=~(-1)^{k-1}~\frac{2^{2k-1}-1}{(2k)!}~B_{2k}~\pi^{2k} \end{align}

\begin{align} \eta(2k+1)~&=~\bigg(1-\frac{1}{2^{2k}}\bigg)\zeta(2k+1) \end{align}

Examples:

$$\displaystyle c_{0,0} = \frac{2}{0!}(1)$$

$$\displaystyle (c_{1,0}~;~ c_{1,1}) = \frac{2}{1!} \left(0~;~2\right)$$

$$\displaystyle (c_{2,0}~;~c_{2,1}~;~c_{2,2}) = \frac{2}{2!} \left(2~;~0~;~4\right)$$

$$\displaystyle (c_{3,0}~;~c_{3,1}~;~c_{3,2}~;~c_{3,3}) = \frac{2}{3!} \left(0~;~16~;~0~;~8\right)$$

$$\displaystyle (c_{4,0}~;~c_{4,1}~;~c_{4,2}~;~c_{4,3}~;~c_{4,4}) = \frac{2}{4!} \left(24~;~0~;~80~;~0~;~16\right)$$

$$\displaystyle (c_{5,0}~;~c_{5,1}~;~c_{5,2}~;~c_{5,3}~;~c_{5,4}~;~c_{5,5}) = \frac{2}{5!} \left(0~;~368~;~0~;~320~;~0~;~32\right)$$

$$\displaystyle (c_{6,0}~;~c_{6,1}~;~c_{6,2}~;~c_{6,3}~;~c_{6,4}~;~c_{6,5}~;~c_{6,6}) = \frac{2}{6!} \left(720~;~0~;~3136~;~0~;~1120~;~0~;~64\right)$$

$$\displaystyle (c_{7,0}~;~c_{7,1}~;~c_{7,2}~;~c_{7,3}~;~c_{7,4}~;~c_{7,5}~;~ c_{7,6}~;~ c_{7,7})$$

$$\hspace{7cm}\displaystyle =\frac{2}{7!} \left(0~;~16896~;~0~;~19712~;~0~;~3584~;~0~;~128\right)$$

...

$$\displaystyle \int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^2 dx = \pi\ln 2$$

$$\displaystyle \int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^3 dx = -\frac{\pi^3}{16} + \frac{3\pi}{2}\ln 2$$

$$\displaystyle \int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^4 dx = -\frac{\pi^3}{12}(2\ln 2 + 1) + \frac{\pi}{4}(3\zeta(3) + 8\ln 2)$$

$$\displaystyle \int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^5 dx = \frac{\pi^5}{128} - \frac{5\pi^3}{48}(8\ln 2 + 1) + \frac{5\pi}{4}(3\zeta(3) + 2\ln 2)$$

$$\displaystyle \int\limits_0^\infty \left(\frac{\arctan x}{x}\right)^6 dx =$$

$$\displaystyle\hspace{8mm} =\frac{3\pi^5}{320}(4\ln 2 + 3) - \frac{\pi^3}{16}(9\zeta(3) + 40\ln 2 + 2) + \frac{3\pi}{32}(45\zeta(5) + 120\zeta(3) + 32\ln 2)$$

...

• How would one evaluate that for negative values of $n$? – aleden Oct 2 '18 at 15:37
• Can you maybe add a derivation? Thanks – Diger Oct 3 '18 at 10:24
• @Diger: I have updated my answer, so the comments above are perhaps not necessary any more. – user90369 Oct 16 '18 at 17:00
• Just found this answer, really thorough thanks – Henry Lee Jun 7 at 19:06
• @HenryLee : You are welcome! It's a pleasure if I can help. ;) – user90369 Jun 7 at 20:34

$$\int_{0}^{+\infty}\left(\frac{\arctan x}{x}\right)^3\,dx \stackrel{x\mapsto\tan\theta}{=}\int_{0}^{\pi/2}\frac{\theta^3\,d\theta}{\tan^3\theta\cos^2\theta}\stackrel{\text{IBP}}{=}-\frac{\pi^3}{16}+\frac{3}{2}\int_{0}^{\pi/2}\frac{\theta^2\,d\theta}{\sin^2\theta}$$ and in general the computation of the wanted integrals boils down to the computation of $$\int_{0}^{\pi/2}\left(\frac{\theta}{\sin\theta}\right)^m\,d\theta$$ or the computation of $$\oint_\gamma \frac{\log^m z}{z\left(z-\frac{1}{z}\right)^m}\,dz$$ where $$\gamma$$ is the quarter circle joining $$1$$ and $$i$$. The integration of $$\frac{\log^m z}{z\left(z-\frac{1}{z}\right)^m}$$ along the segments joining $$0$$ and $$1$$ or $$0$$ and $$i$$ can be simply performed through Maclaurin series; in particular the wanted integrals can be always expressed in terms of standard or alternating Euler sums.

It wasn't requested, but instead of exact representations the OP might want an asymptotic expression for $$n \to \infty.$$ This one works well with the technique of Depoissonization. Make an exponential power series and analyze it asymptotically: $$\sum_{n=0}^\infty \frac{y^n}{n!} C_n = \int_0^\infty \exp{\big(\frac{y}{x} \text{arctan}(x) \big)} dx , \quad C_n=\int_0^\infty \Big(\frac{\text{arctan}(x)}{x}\Big)^n dx$$ Now $$\text{arctan}(x)/x = 1-x^2/3+x^4/5+...$$ and with $$y$$ large and keeping on the first term in the asymptotic expansion $$e^{-y} \sum_{n=0}^\infty \frac{y^n}{n!} C_n \sim \int_0^\infty \exp{\big(-y\,\frac{x^2}{3}\big)} dx = \frac{1}{2} \sqrt{\frac{3\pi}{y}}.$$ By Depoissonization we can conclude that $$C_n \sim \frac{1}{2} \sqrt{\frac{3\pi}{n}} .$$ For $$n=50$$ the asymptotic expression is within 2% of the value from a numerical integration.

• Do you mind putting some more information about how to "depoissonize"? I pressume you are using Cauchy-Integral formula to invert to the $C_n$, but then I'm wondering why the result depends on the circle size $R$ with the path $z=Re^{it}$. Shouldn't it be independent on it? – Diger Oct 5 '18 at 12:52
• Calculating the LHS with $$\oint_{|z|=R} f(z) \, z^{-m} \, \frac{{\rm d}z}{z}$$ one gets the usual result $2\pi i \frac{C_m}{m!}$, but the RHS yields $$\oint_{|z|=R} e^{z} \sqrt{\frac{3\pi}{4z}} \, z^{-m} \, \frac{{\rm d}z}{z} \\ = i R^{-m-\frac{1}{2}} \sqrt{\frac{3\pi}{4}} \int_{0}^{2\pi} e^{Re^{it}} e^{-imt-\frac{it}{2}} \, {\rm d}t \\= -2 \, R^{-m-\frac{1}{2}} \sqrt{\frac{3\pi}{4}} \sum_{k=0}^\infty \frac{R^k}{k!\left(k-m-\frac{1}{2}\right)} \\= -2 \, \left(-1\right)^{m+\frac{1}{2}} \sqrt{\frac{3\pi}{4}}\,\gamma\left(-m-\frac{1}{2},-R\right)$$ where $\gamma(a,z)$ is the incompl. Gamma-Fct. – Diger Oct 5 '18 at 13:32
• I mean the RHS is not holomorph, so it shouldn't be surprising that the result of the RHS depends on the path size, but again the LHS does not, so how did you proceed? – Diger Oct 5 '18 at 13:33
• @Diger What I know of depoissonization can be found in 'Average Case Analysis of Algorithms on Sequences', W. Szpankowski, Chapter 10. Admittedly I'm lazy and didn't check that the next term is small compared to the first -- I just calculated a few integrals and the asymptotic expression and the numerical agreement seems O.K. – skbmoore Oct 5 '18 at 16:01
• delete repeated message – skbmoore Oct 5 '18 at 16:06

Here is a general answer: Let $$m \geq n \geq 2$$ be integers, and define

$$\mathcal{I}(m,n) = \int_{0}^{\infty} \frac{\arctan^m x}{x^n} \, dx.$$

Our aim is to obtain a manageable formula for $$\mathcal{I}(m,n)$$.

Proposition. $$\mathcal{I}(m,n)$$ equlas $$\begin{cases} \displaystyle (-1)^{\frac{m-n,}{2}} \int_{0}^{\infty} \frac{\sinh^{n-2} x}{\cosh^n x} \cdot \operatorname{Im} \left( x + \frac{i\pi}{2} \right)^{m} \, dx, & m+n \ \text{even} \\ \displaystyle (-1)^{\frac{m-n-1}{2}} \int_{0}^{\infty} \frac{\sinh^{n-2} x}{\cosh^n x} \cdot \frac{2 \log \tanh x}{\pi} \cdot \operatorname{Im} \left( x + \frac{i\pi}{2} \right)^{m} \, dx, & m+n \ \text{odd} \end{cases}$$

When $$m+n$$ is even, this integral can be written as a linear combination of values of the Dirichlet $$\eta$$-function using the well-known formula $$\int_{0}^{\infty} x^{s-1}/(e^x + 1) \, dx = \Gamma(s)\eta(s)$$.

Here is a Mathematica code for numerical verification:

{m, n} = {7, 5};
NIntegrate[ArcTan[x]^m/x^n, {x, 0, Infinity}, WorkingPrecision -> 20]
(-1)^((m - n)/2) Im[NIntegrate[ Tanh[x]^(n - 2) Sech[x]^2 (x + (I Pi)/2)^m, {x, 0, Infinity}, WorkingPrecision -> 20]]
Clear[m, n];


Proof. We only prove the case where $$m+n$$ is even. (The proof for the other case goes almost the same.) We begin by noticing that

$$\arctan x = \int_{0}^{1} \frac{x \, ds}{1+x^2s^2} = \lim_{\delta \to 0^+} \int_{i\delta}^{1+i\delta} \frac{x \, ds}{1+x^2s^2}.$$

We temporarily fix $$0 < \delta_1 < \cdots < \delta_m$$ and consider the line segment $$L_k$$ beginning at $$i\delta_k$$ and ending at $$1+i\delta_k$$. Writing $$\vec{\delta} = (\delta_1, \cdots, \delta_k)$$, we consider the following perturbed version of $$\mathcal{I}(m,n)$$.

$$\mathcal{I}_{\vec{\delta}}(m,n) := \int_{0}^{\infty} x^{m-n} \prod_{k=1}^{m} \left( \int_{L_k} \frac{dz_k}{1+x^2 z_k^2} \right) \, dx.$$

As $$\vec{\delta} \to 0$$, this converges to the original integral $$\mathcal{I}(m,n)$$. Now, we invoke the following lemma.

Lemma. If $$\alpha_1, \cdots, \alpha_n$$ are distinct complex numbers and $$m \in \{0, \cdots,n-1\}$$, then $$\frac{x^m}{(1-\alpha_1 x)\cdots (1-\alpha_n x)} = \sum_{k=1}^{n} \frac{\alpha_k^{n-1-m}}{1-\alpha_k x} \prod_{l \neq k} \frac{1}{\alpha_k - \alpha_l}.$$

Since $$0 \leq m-n < 2m$$, we can apply Lemma to write

$$\frac{x^{m-n}}{\prod_{k=1}^{m} (1+z_k^2 x^2)} = \frac{x^{m-n}}{\prod_{k=1}^{m} (1 - i z_k x)(1 + i z_k x)} = (-1)^{\frac{m-n}{2}} \sum_{k=1}^{m} \frac{z_k^{m+n-2}}{1+z_k^2 x^2} \prod_{l \neq k} \frac{1}{z_k^2 - z_l^2}.$$

(At this step the assumption that $$m+n$$ is even is utilized.) Plugging this back to $$\mathcal{I}_{\vec{\delta}}(m,n)$$ and interchanging the order of integration, we obtain

$$\mathcal{I}_{\vec{\delta}}(m,n) := (-1)^{\frac{m-n}{2}} \frac{\pi}{2} \sum_{k=1}^{m} \int_{L_1} dz_1 \cdots \int_{L_n} dz_n \left( z_k^{m+n-3} \prod_{l \neq k} \frac{1}{z_k^2 - z_l^2} \right).$$

Now for $$l \neq k$$, writing $$z_k = s_k + i\delta_k$$ shows

\begin{align*} \int_{L_l} \frac{dz_l}{z_k^2 - z_l^2} &= \frac{1}{2z_k}\left( \log(z_k + 1 + i\delta_l) - \log(z_k + i\delta_l) - \log(z_k - 1 - i\delta_l) + \log(z_k - i\delta_l) \right) \\ &\xrightarrow[\vec{\delta} \to 0]{} \frac{1}{2s_k}\left( \log\left(\frac{1 + s_k}{1 - s_k} \right) + i\pi\operatorname{sign}(l-k) \right) \end{align*}

Plugging this back,

\begin{align*} \mathcal{I}(m,n) &= (-1)^{\frac{m-n}{2}} \frac{\pi}{2} \sum_{k=1}^{m} \int_{0}^{1} s^{n-2} \left( \operatorname{artanh}(s) - \frac{i\pi}{2} \right)^{k-1}\left( \operatorname{artanh}(s) + \frac{i\pi}{2} \right)^{n-k} \, ds \\ &= (-1)^{\frac{m-n}{2}} \operatorname{Im} \int_{0}^{1} s^{n-2} \left( \operatorname{artanh}(s) + \frac{i\pi}{2} \right)^{m} \, ds \\ &= (-1)^{\frac{m-n}{2}} \operatorname{Im} \int_{0}^{\infty} \frac{\sinh^{n-2} x}{\cosh^n x} \left( x + \frac{i\pi}{2} \right)^{m} \, dx, \end{align*}

completing the proof.

As user90369 doesn't have the time apparently I thought I repesent my own solution explicitly for those interested.

Starting with \begin{align} \int_{-\pi/2}^{\pi/2} \frac{x^n \left(\cos x\right)^{n-2}}{\left(\sin x\right)^n} \, {\rm d}x &\stackrel{y=2x}{=} 2^{-n+1} \, i^n \int_{-\pi}^{\pi} y^n \, e^{-iy} \, \frac{\left(1+e^{-iy}\right)^{n-2}}{\left(1-e^{-iy}\right)^n} \, {\rm d}y \\ &\stackrel{z=e^{iy}}{=} -i \, 2^{-n+1} \int_\gamma \left(\log z\right)^n \, \frac{(z+1)^{n-2}}{(z-1)^n} \, {\rm d}z \end{align} where $$\gamma$$ is the unit circle in positive direction. The integrand is holomorph off the negative real line and the contour can be deformed to only enclose the cut $$[-1,0]$$.

Then \begin{align} &=i \, 2^{-n+1} (-1)^n \int_0^1 \frac{(1-z)^{n-2}}{(1+z)^n} \, \left\{ \left(\log z + i\pi\right)^n - \left(\log z - i\pi\right)^n \right\} {\rm d}z \\ &=2^{-n+2} (-1)^{n+1} \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{q=0}^\infty \begin{pmatrix} n \\ k \end{pmatrix} \begin{pmatrix} n-2 \\ p \end{pmatrix} \begin{pmatrix} -n \\ q \end{pmatrix} (-1)^p \pi^{n-k} \sin\left(\frac{\pi}{2}(n-k)\right) \\ &\qquad \times \int_0^1 z^{p+q} \, \left( \log z \right)^k \, {\rm d}z \end{align} and using the two formulas \begin{align} \int_0^1 x^n \, \left(\log x\right)^m \, {\rm d}x &= \frac{(-1)^m \, m!}{(n+1)^{m+1}} \tag{1} \\ \begin{pmatrix} -n \\ q \end{pmatrix} &= (-1)^q \begin{pmatrix} n+q-1 \\ q \end{pmatrix} = (-1)^q \, \frac{(q+1)\cdots(q+n-1)}{(n-1)!} \\ &= \frac{(-1)^q}{(n-1)!} \sum_{m=0}^{n-1} \left[ {n-1 \atop m} \right] (q+1)^m \tag{2} \end{align} with the Stirling numbers of the first kind we arrive at \begin{align} =2^{-n+2} (-1)^{n+1} \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{m=0}^{n-1} \sum_{q=0}^\infty \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \frac{(q+1)^m (-1)^{k+p+q} \pi^{n-k} n! \sin\left(\frac{\pi}{2}(n-k)\right)}{(p+q+1)^{k+1} (n-1)! (n-k)!} \, . \end{align} Next we reverse the summation $$k \rightarrow n-k$$ and decompose another time the factor $$(q+1)^{m}=(p+q+1-p)^{m}$$ in the nominator \begin{align} &=-2^{-n+2}\,n \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{m=0}^{n-1} \sum_{l=0}^m \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} (-p)^{m-l} \\ &\qquad \frac{(-\pi)^{k} \sin\left(\frac{\pi}{2}k\right)}{k!} \sum_{q=0}^\infty \frac{(-1)^{q+p}}{(p+q+1)^{n-k-l+1}} \\ &=-2^{-n+2} \, n \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{l=0}^{n-1} \sum_{m=l}^{n-1} \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} (-p)^{m-l}\\ &\qquad \frac{(-\pi)^{k} \sin\left(\frac{\pi}{2}k\right)}{k!} \left\{ \eta\left(n-k-l+1\right) -\sum_{q=1}^p \frac{(-1)^{q+p}}{(p-q+1)^{n-k-l+1}} \right\} \tag{3} \end{align} where $$\eta(s)$$ is the Dirichlet Eta-Function.

It seems as if \begin{align} &\quad \sum_{p=0}^{n-2} \sum_{q=1}^{p} \sum_{l=0}^{n-1} \sum_{m=l}^{n-1} \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} \frac{(-p)^{m-l} (-1)^{q+p}}{(p-q+1)^{n-k-l+1}} \\ &=\sum_{p=0}^{n-2} \sum_{q=1}^{p} \begin{pmatrix} n-2 \\ p \end{pmatrix} \frac{(-1)^{q+p}}{(p-q+1)^{n-k+1}} \sum_{m=0}^{n-1} \left[ {n-1 \atop m} \right](-q+1)^m \\ &=(-1)^{n-1}(n-1)! \sum_{p=0}^{n-2} \sum_{q=1}^{p} \begin{pmatrix} n-2 \\ p \end{pmatrix} \begin{pmatrix} q-1 \\ n-1 \end{pmatrix} \frac{(-1)^{q+p}}{(p-q+1)^{n-k+1}} \\ &= 0 \, , \end{align} since $$q\leq n-2$$ and $$\begin{pmatrix} n-3 \\ n-1 \end{pmatrix}=0$$, so the second term in the curly bracket does not contribute.

Here is a Maple Code of the result (3) for verification:

restart;
n := 5;
eta := proc (s) options operator, arrow; limit((1-2^(1-S))*Zeta(S), S = s) end proc;
r1 := simplify(-2^(-n+2)*n*add(add(add(add(binomial(n-2, p)*Stirling1(n-1, m)*(-1)^(n-1-m)*binomial(m, l)*(-p)^(m-l)*(-Pi)^k*sin((1/2)*Pi*k)*eta(n-k-l+1)/factorial(k), m = l .. n-1), l = 0 .. n-1), p = 0 .. n-2), k = 0 .. n));
r2 := simplify(int(x^n*cos(x)^(n-2)/sin(x)^n, x = -(1/2)*Pi .. (1/2)*Pi));
evalf([r1, r2])

• Can you add a Mathematica(Maple) code of Last Sum for verification?Thanks. – Mariusz Iwaniuk Oct 4 '18 at 12:00
• Can I attach a Maple Sheet? – Diger Oct 4 '18 at 12:13
• You can add code like user:Sangchul Lee that will be better. – Mariusz Iwaniuk Oct 4 '18 at 12:17
• Thanks a lot. :) – Mariusz Iwaniuk Oct 4 '18 at 12:38