I am trying to evaluate $$J(n)=\int_{-\infty}^{\infty} \frac{\mathrm dx}{\cosh(x)^n}=2\int_{0}^{\infty} \frac{\mathrm dx}{\cosh(x)^n}$$ for $n\in\Bbb N$. I started with $t=\tanh\frac{x}2$: $$J(n)=4\int_0^1\frac{(1-t^2)^{n-1}}{(1+t^2)^n}\mathrm dt$$ then I used the binomial theorem to get $$J(n)=4\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_0^1\frac{t^{2k}}{(1+t^2)^n}\mathrm dt$$ Then I used $t=\tan x$: $$J(n)=4\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_0^{\pi/4}\frac{\tan(x)^{2k}}{\sec(x)^{2n}}\sec(x)^2\mathrm dx$$ $$J(n)=4\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_0^{\pi/4}\sin(x)^{2k}(1-\sin(x)^2)^{n-k-1}\mathrm dx$$ Then I use the binomial formula again: $$J(n)=4\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_0^{\pi/4}\sin(x)^{2k}\sum_{r=0}^{n-k-1}(-1)^r {n-k-1\choose r}\sin(x)^{2r}\mathrm dx$$ $$J(n)=4\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\sum_{r=0}^{n-k-1}(-1)^r {n-k-1\choose r}\int_0^{\pi/4}\sin(x)^{2k+2r}\mathrm dx$$ Then I used $u=2x$: $$J(n)=2\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\sum_{r=0}^{n-k-1}(-1)^r {n-k-1\choose r}\int_0^{\pi/2}\left(\frac{1-\cos u}2\right)^{k+r}\mathrm du$$ Yup, you guessed it, I used the binomial formula next: $$J(n)=2\sum_{k=0}^{n-1}\sum_{r=0}^{n-k-1}\frac{(-1)^{k+r}}{2^{k+r}}{n-1\choose k}{n-k-1\choose r}\sum_{v=0}^{k+r}(-1)^v{k+r\choose v}\int_0^{\pi/2}\cos(x)^{v(k+r)}\mathrm dx$$ This final integral is easily calculated with the beta function, and we have $$J(n)=\sqrt{\pi}\sum_{k=0}^{n-1}\sum_{r=0}^{n-k-1}\sum_{v=0}^{k+r}\frac{(-1)^{k+r+v}}{2^{k+r}}{n-1\choose k}{n-k-1\choose r}{k+r\choose v}\frac{\Gamma\left(\frac{v(k+r)+1}2\right)}{\Gamma\left(\frac{v(k+r)}2+1\right)}$$ Is this correct? Is there any other (preferably quicker) way of computing this?
2 Answers
For a quicker way, substitute $e^x = \tan(\theta/2)$ to obtain
$$ \int_{-\infty}^{\infty} \frac{\mathrm{d}x}{\cosh^n x} = \int_{0}^{\pi} \sin^{n-1}\theta \, \mathrm{d}\theta = \frac{\Gamma(\frac{n}{2})\Gamma(\frac{1}{2})}{\Gamma(\frac{n+1}{2})}. $$
The second step follows from the beta function identity, although a much more elementary solution is also available.
For your computation, you made a mistake when expanding the integral of cosine power. Specifically, the correct expansion would be
$$ \int_{0}^{\frac{\pi}{2}} \left( \frac{1 - \cos u}{2} \right)^{k+r} \, \mathrm{d}u = \frac{1}{2^{k+r}} \sum_{v=0}^{k+r} (-1)^v \binom{k+r}{v} \int_{0}^{\frac{\pi}{2}} \cos^v u \, \mathrm{d}u. $$
Compare this with your expansion
$$ \int_{0}^{\frac{\pi}{2}} \left( \frac{1 - \cos u}{2} \right)^{k+r} \, \mathrm{d}u \stackrel{?}= \frac{1}{2^{k+r}} \sum_{v=0}^{k+r} (-1)^v \binom{k+r}{v} \int_{0}^{\frac{\pi}{2}} \color{red}{\boxed{\cos^{v(k+r)} u}} \, \mathrm{d}u. $$

- 167,468
-
-
@clathratus, No. You made some mistake near the end. Please see my edit. – Sangchul Lee Feb 07 '19 at 00:48
-
Wow: that was one of the more thoughtless errors I've ever made... Thanks! – clathratus Feb 07 '19 at 00:56
-
3First time seeing the $e^x = \tan(\theta/2)$ substitution - thanks for post (+1) – Feb 07 '19 at 06:31
$$J(n)=2\int_0^\infty \frac{dx}{\cosh^n(x)}$$Using the sub: $u=\frac{1}{\cosh(x)}$, $dx=\frac{-du}{u\sqrt{1-u^2}}$, it is easy to convert the integral into the one @Zacky provided in the comments. $$J(n)=2\int_0^1 \frac{u^{n-1}}{\sqrt{1-u^2}}du$$ From there we can make another sub $u=\sqrt{x}$, $du=\frac{dx}{2\sqrt{x}}$. $$J(n)=\int_0^1\frac{x^{\frac{n}{2}-1}}{\sqrt{1-x}}dx$$ Using the Beta Function one can then easily deduce that $$J(n)=B\left(\frac{n}{2},\frac{1}{2}\right)=\frac{\Gamma(\frac{n}{2})\Gamma(\frac{1}{2})}{\Gamma(\frac{n+1}{2})}$$

- 2,156
- 2
- 19
- 30

- 4,007
$$ \int_{-\infty}^{\infty} \ln^{p}\left|\frac{1}{\cosh(x)} \right|:dx = \lim_{n \rightarrow 0^+} \frac{d^p}{dn^p}\left[J(n) \right] = \lim_{n \rightarrow 0^+} \frac{d^p}{dn^p}\left[\frac{\Gamma\left(\frac{n}{2} \right)\Gamma\left(\frac{1}{2} \right)}{\Gamma\left(\frac{n + 1}{2} \right)} \right]$$
– Feb 07 '19 at 07:15