Find the value of $\int_{-\pi}^{\pi}\left(4\arctan\left(e^{x}\right)-\pi\right)dx$ I need to find the value of $$\int_{-\pi}^{\pi}\left(4\arctan\left(e^{x}\right)-\pi\right)\mathrm dx$$
I've tried to show this is an odd function in order to show the answer is $0$, but I wasn't able to do that.
How can I prove this is an odd function?
 A: Let $f(x)=4\arctan\left(e^{x}\right)-\pi$. Then since $\arctan u + \arctan 1/u = \frac{\pi}{2} \ (*)$:
$$-f(-x) = -4 \arctan e^{-x} + \pi = -4\left(\frac{\pi}{2}-\arctan e^x\right) + \pi =4 \arctan e^x-\pi = f(x).$$
$(*)$ can be proved geometrically: $\arctan u$ is the angle with opposite side $u$ and adjacent side $1$, and $\arctan 1/u$ is the other acute angle in the right triangle. Their sum must thus be $\frac{\pi}{2}$. Alternatively, differentiate the left-hand side and show it is constant, then choose a convenient value for $u$ since any $u$ works, say $u=1$.
A: Write the integral as
$$
I=\int_{-\pi}^{0}4\arctan(e^x)-\pi \, dx + \int_{0}^{\pi}4\arctan(e^x)-\pi \, dx \, .
$$
Upon making the substitution $u=-x$, we find that
\begin{align}
I &= -\int_{\pi}^{0}4\arctan(e^{-u})-\pi \, du + \int_{0}^{\pi}4\arctan(e^x)-\pi \, dx \\[5pt]
&= \int_{0}^{\pi}4\arctan(e^{-x})-\pi \, dx + \int_{0}^{\pi}4\arctan(e^x)-\pi \, dx \\[5pt]
&= \int_{0}^{\pi}4\left(\arctan(e^x)+\arctan(e^{-x})\right)-2\pi \, dx
\end{align}
Note that
$$
\arctan(u)+\arctan\left(\frac{1}{u}\right)=\begin{cases}\dfrac{\pi}{2} &\text{ if $u>0$}\\ -\dfrac{\pi}{2} &\text{ if $u<0$} \, .\end{cases}
$$
In this case, $x\in[0,\pi]$, so $u=e^x>0$ and $\arctan(u)+\arctan(1/u)=\pi/2$, meaning that the integrand is the zero function. Hence, $I=0$.
A: The answer expands on my comment, which remarked that the integrand of the given integral is twice the Gudermannian function, $\operatorname{gd}$, which appears most famously in the equation governing the Mercator projection in cartography.
Differentiating the integrand gives
$$\frac{d}{dx} \left[ 4 \arctan (e^x) - \pi \right] = 4 \cdot \frac{1}{1 + (e^x)^2} \cdot e^x = \frac{4}{e^x + e^{-x}} = 2 \operatorname{sech} x .$$ In particular, this derivative is even. Since evaluating the integrand at $x = 0$ gives $4 \arctan (e^0) - \pi = 0$ the integrand is odd; since the integral is taken over an interval symmetric around $0$, by symmetry
$$\int_{-a}^a \left[ 4 \arctan (e^x) - \pi \right]\,dx = 0$$ for any $a$: In particular, the occurrence of $\pi$ in the limits of the integral is something of a red herring.
