[Math] How to integrate $\int e^{-x}\arctan(e^x) \, dx$

calculusindefinite-integralsintegration

After trying this multiple ways, I give up. Here's the integral:

$$\int e^{-x}\arctan(e^x)\,dx$$

I have set

$u=\arctan(e^x)$ and $dv=e^{-x}d\,x$

and have obtained $du=\dfrac{e^x \, dx}{1+e^{2x}}$ and $v=-e^{-x}$

Using the integration by parts formula,

$$\int u\, dv = uv – \int v\,du$$

I got $-e^{-x}\arctan(e^x)+\int \dfrac{1}{1+e^{2x}}\,dx$

How would I solve $\int \dfrac{1}{1+e^{2x}}\,dx$ ? That's the part I'm stuck on.

Best Answer

$$\int \frac{dx}{1+e^{2 x}} = \int dx \frac{e^{-x}}{e^x+e^{-x}} = - \int du \frac{1}{u+u^{-1}}$$

which is

$$-\int du \frac{u}{1+u^2} = -\frac12 \log{(1+u^2)} + C = -\frac12 \log{\left (1+e^{-2 x}\right)} + C$$