Let \(y= \operatorname{sech}(x)\):
\[ y = \frac{2}{e^x + e^{-x}}\]
In order to find the formula for the inverse of \(\operatorname{sech}\) we need to make \(x\) the subject of the above formula.
\[ y(e^x) + y(e^{-x}) - 2 = 0\]
If we multiply both sides by \(e^x\):
\[\begin{gathered} y(e^x)^2 + y - 2e^x = 0 \end{gathered}\]
Let \(v = e^x\):
\[ yv^2 -2v + y = 0 \]
We can use the quadratic formula here:
\[v=\frac{-(-2) ± \sqrt{(-2)^2 - 4(y)(y)}}{2(y)} = \frac{2 ± \sqrt{4 - 4y^2}}{2y} \]
Simplifying:
\[v = \frac{1}{y} ± \sqrt{\frac{4-4y^2}{4y^2}} = \frac{1}{y} ± \sqrt{\frac{1}{y^2} - 1} \]
Since \(v=e^x\):
\[x = \ln \left( \frac{1}{y} ± \sqrt{\frac{1}{y^2} - 1} \right) \]
Keep in mind the input for \(\ln\) cannot be negative.
\[\frac{1}{\frac{1}{y} + \sqrt{\frac{1}{y^2} - 1}} = \frac{ \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1}}{\left( \frac{1}{y} + \sqrt{\frac{1}{y^2} - 1} \right) \left( \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1} \right)} = \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1} \]
The above shows that:
\[\begin{gathered} \left( \frac{1}{y} + \sqrt{\frac{1}{y^2} - 1} \right) ^{-1}= \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1} \\ \frac{1}{y} + \sqrt{\frac{1}{y^2} - 1} = \left( \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1}\right) ^{-1} \end{gathered}\]
This means:
\[ - \ln \left( \frac{1}{y} + \sqrt{\frac{1}{y^2} - 1} \right) = \ln \left( \frac{1}{y} - \sqrt{\frac{1}{y^2} - 1}\right) \]
The function \(y=\operatorname{sech}(x)\) has the range \(y \in (0,1]\) and the domain \(x \in (-\infty, \infty)\). Since \(\operatorname{sech}\) is an even function, it's inverse will fail the vertical line test, so \(\operatorname{arsech}(y)\) is only defined for \(x \in [0,\infty)\). This means \(\sqrt{1/(y^2) - 1}\) will always be positive:
\[\operatorname{arsech}(y) = \ln \left( \frac{1}{y} + \left| \sqrt{\frac{1}{y^2} - 1} \right| \right) \]