# Integral $\int_0^{\infty} \arctan{\left(\frac{n}{\cosh{(x)}}\right)} \mathop{dx}$

I want to evaluate the integral

$$\int_0^{\infty} \arctan{\left(\frac{n}{\cosh{(x)}}\right)} \mathop{dx}$$ I think the integral evaluates to $$\frac{\pi}{2} \ln{\left(\sqrt{n^2+1}+n\right)}$$ but I dont know how really! I think $$n$$ is any number but I dont know for sure! The answer reminds me of $$\int \frac{\pi}{2} \sec{x} \mathop{dx}$$ and $$n=\tan{x}$$.

I got to $$\int_0^{\infty} \arctan{\left(\frac{e^{x} n}{e^{2x}+1}\right)} \mathop{dx}$$ $$\int_0^{\infty} \arctan{\left(\frac{n}{2}\frac{e^{x} +e^x}{e^{x}\cdot e^x+1}\right)} \mathop{dx}$$ Reminds me of $$\tan{a-b}$$ but the $$n/2$$ factor?

Unfortunately, standard integration techniques will not help you solve this integral. The actual anti-derivative of this function is huge (according to Wolfram alpha at least, see: https://www.wolframalpha.com/input/?i=integral+arctan%281%2F%28cosh%28x%29%29%29 ). To combat this, will we use a method called Feynman Integration (named after the Physicist Richard Feynman. Although the actual rule was discovered by Leibniz - who independently discovered Calculus).

Let

$${I(t)=\int_{0}^{\infty}\arctan\left(\frac{t}{\cosh(x)}\right)dx}$$

So we have defined a function in terms of our integral. Using the Leibniz rule for integration we get

$${I'(t)=\int_{0}^{\infty}\frac{\text{sech}(x)}{t^2\text{sech}^2(x) + 1}dx}$$

(to take the derivative, you take take the partial derivative of the inside :D). The inner function now has an elementary anti-derivative; namely

$${\int\frac{\text{sech}(x)}{1+t^2\text{sech}^2(x)}dx=\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}} + C}$$

Hence the integral for $${I'(t)}$$ can be found by taking limits:

$${\int_{0}^{\infty}\frac{\text{sech}(x)}{t^2\text{sech}^2(x) + 1}dx=\lim_{x\rightarrow \infty}\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}} - \lim_{x\rightarrow 0}\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}}}$$

$${\Rightarrow I'(t) = \frac{\pi}{2}\frac{1}{\sqrt{1+t^2}}}$$

So to find $${I(t)}$$ we now simply integrate with respect to $${t}$$ and find the constant. This gives us

$${I(t)=\frac{\pi}{2}\int\frac{1}{\sqrt{t^2 + 1}}dt=\frac{\pi}{2}\sinh^{-1}(t) + C}$$

($${\int\frac{1}{\sqrt{1+t^2}}dt}$$ is just a known integral).

But $${I(0)=0\Rightarrow C=0}$$ (since $${\sinh^{-1}(0)=0}$$), hence

$${\int_{0}^{\infty}\arctan\left(\frac{n}{\cosh(x)}\right)dx=\frac{\pi}{2}\sinh^{-1}(n)}$$, but

$${\sinh^{-1}(n)=\ln\left(\sqrt{n^2 + 1} + n\right)}$$

and so indeed

$${\int_{0}^{\infty}\arctan\left(\frac{n}{\cosh(x)}\right)dx=\frac{\pi}{2}\ln\left(\sqrt{n^2 + 1} + n\right)}$$

• Thank you, looks good. One question is how exactly would you integrate $I'(t)$?
– user799519
Jul 4, 2020 at 20:49
• @Saelee at the time of posting the answer, I simply did a quick #Wolframalpha of that integral to check whether the answer seemed nice enough to give a solution to save time (if the answer was horrible, I would have included full steps). You can multiply the top and bottom by ${\cosh^2(x)}$, getting ${\frac{\cosh(x)}{t^2 + \cosh^2(x)}}$. Then, use ${\cosh^2(x) = 1 + \sinh^2(x)}$, giving ${\frac{\cosh(x)}{\sinh^2(x) + (t^2 + 1)}}$ and then substitute ${u=\sinh(x)}$ :) Jul 4, 2020 at 20:55
• @Saelee substitute $t=\sinh u$ ....and $dt=\cosh u du$ The integral becomes simply $I=\int du =u+c=\sinh^{-1} t +C$ Jul 4, 2020 at 20:58
• Oh wait yeah ${I'(t)}$ has two forms in the answer. I gave you the answer to evaluate ${\int\frac{\text{sech}(x)}{t^2\text{sech}^2(x) + 1}dx}$, and @Aryadeva has given you the answer to evaluate ${\int\frac{1}{\sqrt{1+t^2}}dt}$ Jul 4, 2020 at 21:04
• Yes @Riemann'sPointyNose I was talking about that integral $I=\int \dfrac {dt}{\sqrt {t^2+1}}$ Jul 4, 2020 at 21:06

If $$|n| \le 1$$, we can use the Maclaurin series for $$\arctan x$$.

\begin{align}\int_{0}^{\infty} \arctan \left( \frac{n}{\cosh x}\right) \, \mathrm dx &= \int_{0}^{\infty} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{2k+1} \left(\frac{n}{\cosh x} \right)^{2k+1} \mathrm dx \\ &= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \int_{0}^{\infty} \frac{1}{\cosh^{2k+1}(x)} \, \mathrm dx \\ &\stackrel{(1)}= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \frac{\sqrt{\pi}}{2} \frac{\Gamma (k+1/2)}{\Gamma(k+1)} \\ &\stackrel{(2)}= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \frac{\sqrt{\pi}}{2} \frac{1}{\Gamma(k+1)} \frac{\Gamma(2k) \sqrt{\pi}}{2^{2k-1} \Gamma(k)} \frac{k}{k} \\ &= \frac{\pi}{2} \sum_{k=0}^{\infty}\frac{(-1)^{k} (2k)!}{2^{2k}(k!)^2} \frac{n^{2k+1}}{2k+1} \\&\stackrel{(3)}= \frac{\pi}{2} \operatorname{arsinh}(n) \end{align}

$$(1)$$ https://math.stackexchange.com/a/1379526/

$$(2)$$ https://mathworld.wolfram.com/LegendreDuplicationFormula.html

$$(3)$$ https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Series_expansions

• Awesome solution! Jul 5, 2020 at 14:20