Is there a formula for the area under $\tanh(x)$?

The hyperbolic tangent can be integrated. First we simplify the formula, which can easily be derived using the definitions of the hyperbolic cosine and the hyperbolic sine and their relation:

$\tanh x = \frac{\sinh x}{\cosh x} = \frac{e^x - e^{-x}}{e^x + e^{-x}}=\frac{e^{2x}-1}{e^{2x}+1}=1-\frac{2}{e^{2x}+1}$

When you integrate, you will get

$$\int \tanh(x) dx = \log(\cosh(x))+c$$

PS: Wolfram knows very well!


Notice, we know $\sinh(x)=\frac{e^x-e^{-x}}{2}$ & $\sinh(x)=\frac{e^x+e^{-x}}{2}$, hence the area under $\tanh(x)$ is
$$\int \tanh(x)\ dx=\int \frac{\sinh(x)}{\cosh (x)}\ dx$$ $$=\int \frac{e^x-e^{-x}}{e^x+e^{-x}}\ dx$$ $$=\int \frac{d(e^x+e^{-x})}{e^x+e^{-x}}$$ let $e^x+e^{-x}=t\implies d(e^x+e^{-x})=dt $, $$=\int \frac{dt}{t}=\ln|t|+C$$ $$=\color{red}{\ln(e^x+e^{-x})+C}$$


Why all those difficult substitutions and jabbers? Just observe that we can use the logarithm derivative formula:

$$\int\frac{f'(x)}{f(x)}\ \text{d} x = \ln(f(x)) + C$$

thence, having $\tanh(x) = \frac{\sinh(x)}{\cosh(x)} = \frac{f'(x)}{f(x)}$ it comes easy to get the result

$$\int\frac{\sinh(x)}{\cosh(x)}\ \text{d}x = \ln(\cosh(x)) + C$$