Why is $\int \sec x\,dx$ equal to $\ln | \sec x + \tan x |$? Everyone knows that $\int \sec x\,dx = \ln | \sec x + \tan x |$?
But how to reach it through a conscious deduction, through a clear and objective way?
 A: It's almost always correct to revert any trig function in an integral to its definition in terms of $\sin x$ and $\cos x$. 
So write $$\sec x = \frac{1}{\cos x} = \frac{\cos x}{\cos^2 x} = \frac{\cos x}{1-\sin^2 x}$$ Then substitute $u=\sin x$ and $du=\cos x\,dx$. That leads to $$\int \frac{du}{1-u^2}$$ which you then apply partial fractions to get an expression in terms of $\ln$. $$\frac{1}{1-u^2}=\frac{1}{2}\left(\frac 1{1-u} + \frac{1}{1+u}\right)$$
So this gives you $$\frac{1}{2}\left(\ln\left|1+u\right|-\ln\left|1-u\right|\right)=\frac{1}{2}\ln\left|\frac{1+u}{1-u}\right|$$
Substituting $u=\sin x$ into $\frac{1+u}{1-u}$ and multiply numerator by denominator by $1+\sin x$ we get:
$$\frac{1+u}{1-u} = \frac{(1+\sin x)^2}{1-\sin^2 x} = \left(\frac{1+\sin x}{\cos x}\right)^2=\left(\sec x +\tan x\right)^2$$
A: We can notice closed relations between ($\tan x$)' and ($\sec x$)'
($\tan x$)' = $\sec^{2} x$
($\sec x$)' = $\sec x$.$\tan$x
So ($\tan x$)' + ($\sec x$)' = ($\tan x$ + $\sec x$)' = $\sec x$
($\sec x$ + $\tan x$)
$$ \longrightarrow \sec x = \frac{(\sec x+\tan x)'}{\sec x+\tan x} $$
Finally $\int\sec xdx$ = $\ln|\sec x+\tan x|$ 
