# The integral : $\frac{1}{2}\int_0^\infty x^n \operatorname{sech}(x)\mathrm dx$

How can I evaluate

$$\frac{1}{2}\int_0^\infty x^n \operatorname{sech}(x)\mathrm dx?$$

I was trying integration by parts but it seemed like it is getting more complicated. $$\int_0^\infty x^n \operatorname{sech}(x)\mathrm dx=\left.2x^n\arctan\left(\tanh(x/2)\right)\right|_0^\infty-2n\int_0^\infty x^{n-1}\arctan(\tanh(x/2))\mathrm dx$$ Herein, it seems like we have to apply integration by parts $$n$$ times but it is not practically possible.

This question is a more general problem of the integral $$\int_0^\infty \frac{x}{e^x+e^{-x}}\mathrm dx$$, which I was first solving. Let me know if there's any other method for evaluating this integral. It will be highly appreciated.

I have posted my solution employing a method using Geometric series to which this Wikipedia article helped me in finding the solution. Please see my answer below.

• Is there anything wrong with this post? I can see a close vote here. Perhaps 'answer your own question' is controversial in practice as opposed to what was mentioned here. May 25 at 5:58
• Or perhaps you should indicate some alternative approach in the question which had some issue and you later resolved the issue and posted that as an answer. May 25 at 9:15
• @ParamanandSingh One user commented - 'Still the question should have a context' - that's why I added this. This question cannot be solved by integration by parts or if it can, it is going to be extremely tough. May 25 at 9:21
• Also adding context just for the sake of formality is not really the spirit here. If someone asks you for a context you need to honestly describe how you stumbled on the problem and what are your own ideas for a solution and perhaps you need to write in such a way that it motivates other users to think about the problem. May 25 at 9:28

\begin{align}\mathcal{I}&=\frac{1}{2}\int_0^\infty \frac{x^n}{\cosh(x)}\mathrm dx\\&=\int_0^\infty \frac{x^n}{e^x+e^{-x}}\mathrm dx\\&=\int_0^\infty \frac{x^ne^{-x}}{1+e^{-2x}}\mathrm dx.\end{align}

Proposition: $$\int_0^\infty \frac{x^{s-1}e^{-x}}{1+e^{-2x}}\mathrm dx=\beta(s)\Gamma(s),$$ where $$\beta(s)$$ is the Dirichlet beta function defined as $$\beta(s)=\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)^s}$$.

Proof:\begin{align}\int_0^\infty x^{s-1}\left(\frac{e^{-x}}{1-(-e^{-2x})}\right)\mathrm dx&=\int_0^\infty x^{s-1}\left(\sum_{k=0}^\infty (-1)^ke^{-(2k+1)x}\right)\mathrm dx \text{, using geometric series}\\&=\sum_{k=0}^\infty (-1)^k\int_0^\infty x^{s-1} e^{-(2k+1)x}\mathrm dx\\&=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^s}\displaystyle\int_0^\infty x^{s-1}e^{-x}\mathrm dx\text{, substituting (2k+1)x\mapsto x}\\&=\beta(s)\Gamma(s). \end{align}

Therefore, $$\mathcal{I}=\beta(n+1)\Gamma(n+1).$$

We can evaluate for different values of $$n\ge 0$$. For $$n=1$$, $$\frac{1}{2}\int_0^\infty x\operatorname{sech}(x)=\beta(2)\Gamma(2)=G$$, where $$G$$ is Catalan's constant. For $$n=2$$, $$\int_0^\infty x^2\operatorname{sech}(x)=2\beta(3)\Gamma(3)=\frac{\pi^3}{8}$$

• Why did you post your attempt as an answer rather in the main body of the OP? May 25 at 5:33
• @MartinØdegaard Refer here. May 25 at 5:35
• @meta, in my opinion, a self-answer obviates the need for context. May 27 at 2:18
• Another opinion completely opposite to Gerry's one here May 27 at 2:54
• @ArcticChar I've never seen anyone dispute in meta that self-answers should not count toward context. That a self-answer is context-in-a-different-location is sort of a no-brainer. May 27 at 14:11

Alternatively

\begin{align} \frac{1}{2}\int_0^\infty \frac{x^n}{\cosh x}dx \overset{t=e^{-x}}=&\int_0^1 \frac{(-1)^n\ln^n t}{1+t^2}dt\\ =& \>\text{Im}\int_0^1 \frac{(-1)^n i \ln^n t}{1-i t}dt=n!\>\text{Im}\>\text{Li}_{n+1}(i) \end{align}