What we are trying to find is:
\[ \int \operatorname{arcsec}(x) \ dx \]
If \(y = \operatorname{arcsec}(x)\), then \(\sec(x) = y\). So:
\[ \frac{dx}{dy} = \sec(y) \tan(y) \]
This means:
\[ \int \operatorname{arcsec}(x) \ dx = \int y \sec(y) \tan(y) \ dy \]
To evaluate this, we can use integration by parts:
\[ \int u \ dv = uv - \int v \ du\]
Let's define \(u\) and \(v\):
\[\begin{gathered} u = y,\ du= dy \\ v = \sec(y) ,\ dv = \sec(y) \tan(y) dy \end{gathered}\]
This means:
\[ \int y \sec(y) \tan(y) \ dy = y \sec(y) - \int \sec(y) \ dy\]
The integral of \(\sec(y)\) is derived here:
\[ \int y \sec(y) \tan(y) \ dy = y \sec(y) - \ln |\sec(y) + \tan(y)| +C\]
Since \(y = \operatorname{arcsec}(x)\):
\[\int y \sec(y) \tan(y) \ dy =\int \operatorname{arcsec}(x) \ dx = \operatorname{arcsec}(x) x - \ln |x + \tan(y)| +C\]
Using the Pythagorean theorem, we can say:
\[ \begin{align} \tan^2(y) &= \sec^2(y) -1 \\ \tan(y) &= ±\sqrt{x^2 -1} \end{align} \]
Therefore:
\[\int \operatorname{arcsec}(x) \ dx = \operatorname{arcsec}(x) x - \ln |x ±\sqrt{x^2 -1}| +C\]
The range of \(y=\operatorname{arcsec}(x)\) is \([0, \frac{\pi}{2}) \cup (\frac{\pi}{2}, \pi] \). In a unit circle, \(\tan(y)\) and \(x=\sec(y)\) are either both positive (when \(y \in [0,\frac{\pi}{2})\)) or both negative (when \(y \in (\frac{\pi}{2},\pi] \)).
If \(x\), is negative, then \(\tan(y)\) is also negative:
\[\begin{align} \int \operatorname{arcsec}(x) \ dx &= \operatorname{arcsec}(x) x - \ln (-|x| -|\sqrt{x^2 -1}|) +C \\ &= \operatorname{arcsec}(x) x - \ln (|x| + |\sqrt{x^2 -1}|) +C \end{align}\]
If \(x\), is positive, then \(\tan(y)\) is also positive:
\[ \int \operatorname{arcsec}(x) \ dx = \operatorname{arcsec}(x) x - \ln (|x| + |\sqrt{x^2 -1}|) +C\]
So for the entire domain:
\[ \int \operatorname{arcsec}(x) \ dx = \operatorname{arcsec}(x) x - \ln (|x| + |\sqrt{x^2 -1}|) +C\]