<s>[INST] Verify $\int\sec x\ dx=\frac12 \ln \left\lvert\frac{1+\sin x}{1-\sin x}\right\rvert + C$ Question says it all, how can I verify the following? 
$$\int\sec x\ dx=\frac12 \ln \left|\frac{1+\sin x}{1-\sin x}\right| + C$$
 [/INST] We have
$$\begin{array}{lll}
\sec^2 x&=& \tan^2 x + 1\\
\sec^2 - \tan^2x&=&  1\\
(\sec x + \tan x)(\sec x - \tan x)&=&1\\
(\sec x + \tan x)^2(\sec x - \tan x)&=&\sec x + \tan x\\
(\sec x + \tan x)^2&=&\frac{\sec x + \tan x}{\sec x - \tan x}\\
\mid\sec x + \tan x\mid&=&\bigg(\frac{\sec x + \tan x}{\sec x - \tan x}\bigg)^\frac{1}{2}\\
\ln\mid\sec x + \tan x\mid&=&\ln\bigg(\frac{\sec x + \tan x}{\sec x - \tan x}\bigg)^\frac{1}{2}\\
\ln\mid\sec x + \tan x\mid&=&\frac{1}{2}\ln\bigg(\frac{\sec x + \tan x}{\sec x - \tan x}\bigg)\\
\end{array}$$
Now all that needs to be done is to show that 
$$\int\sec x dx = \ln\mid\sec x + \tan x\mid+C$$
Hint
$$\frac{\sec x + \tan x}{\sec x + \tan x}=1\implies \sec x = \frac{\sec^2 x+\sec x\tan x}{\sec x+\tan x}$$
</s>