# Another method to integrate $\int\sec x dx?$ [duplicate]

$$\int\sec x dx?$$

This is the method I used: $$\int\sec x\times\frac{\sec x +\tan x}{\sec x +\tan x}dx=\int\frac{\sec^2x+\sec x\tan x}{\sec x +\tan x}=\ln(\sec x +\tan x)+c$$

I would like to see another method to solve this integral.

$$\int \sec x\mathrm dx=\int\frac{\mathrm dx}{\cos x}=\int\frac{\cos x}{\cos^2x}\mathrm dx=\int\frac{\cos x}{1-\sin^2x}\mathrm dx\stackrel{\sin x=x}=\int \frac{\mathrm du}{1-u^2}=\frac12\log\frac{1+u}{1-u}+k$$

$$\therefore~\int \sec x\mathrm dx~=~\frac12\log\frac{1+\sin x}{1-\sin x}+k$$

Even more interesting is now to show that

$$\frac12\log\frac{1+\sin x}{1-\sin x}+k=\log(\sec x+\tan x)+c$$

Concerning the last equality one could take at look at my post here stating the following

\begin{align*} &\color{red}{\frac12\log\left(\frac{1+\sin x}{1-\sin x}\right)}=\log\left(\sqrt{\frac{1+\cos \left(x-\frac\pi2\right)}{1-\cos\left(x-\frac\pi2\right)}}\right)=\log\left(\cot\left(\frac{x-\frac\pi2}{2}\right)\right)\\&=\log\left(\cot\left(\frac x2-\frac\pi4\right)\right) =\log\left(\frac{1+\cot\frac x2}{1-\cot \frac x2}\right)=\log\left(\frac{\left(\cos\frac x2+\sin\frac x2\right)^2}{\cos^2 \frac x2-\sin^2\frac x2}\right)\\&=\log\left(\frac{1+2\sin\frac x2\cos\frac x2}{\cos x}\right)=\log\left(\frac{1+\sin x}{\cos x}\right)=\color{red}{\log(\sec x+\tan x)} \end{align*}

Wrie $$\frac{1}{\cos(x)}=\frac{\sin^2(x)+\cos^2(x)}{\cos(x)}=\cos(x)+\frac{\sin^2(x)}{\cos(x)}$$

Substitute $$u=\sin x$$ to get $$\int\frac{du}{1-u^2}$$.

Let $$f(x)=\sec x$$ and $$g(x)=\tan x$$. Observe the derivatives of $$f(x)$$ and $$g(x)$$

\begin{align*} & f'(x)=\sec x\tan x\\ & g'(x)=\sec^2x\end{align*}

Thus, their sum is$$f'(x)+g'(x)=\sec x(\sec x+\tan x)=\sec x\left(f(x)+g(x)\right)$$

Dividing and integrating gives\begin{align*}\int\mathrm dx\,\sec x & =\int\mathrm dx\,\frac {f'(x)+g'(x)}{f(x)+g(x)}=\log(\sec x+\tan x)+C\end{align*}

$$\int\sec x\,dx=\int\frac{1}{\cos x}\cdot\frac{\cos x}{\cos x}\,dx =\int\frac{\cos x}{1-\sin^2x}\,dx= \begin{bmatrix}\sin x=t\\ \cos xdx=dt\end{bmatrix} =\int \frac{1}{1-t^2}dt =$$ $$=-\frac{1}{2}\int\left(\frac{1}{t-1}-\frac{1}{t+1}\right)dt = -\frac{1}{2} \left(\ln|t-1|-\ln|t+1|\right)=\ln\sqrt{\left|\frac{t+1}{t-1}\right|}+C=$$ $$=\ln\sqrt{\left|\frac{\sin x+1}{\sin x-1}\right|}+C$$