# Why is $\int \sec x\,dx$ equal to $\ln | \sec x + \tan x |$? [duplicate]

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?

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$$

• Really interesting @thomas-andrews ! Why not to finish? – sidneimv Mar 19 '14 at 0:30
• @sidneimv Completed – Thomas Andrews Mar 19 '14 at 0:39
• There's actually a general trick for solving integrals of rational functions of $\sin x$ and $\cos x$ using a substitution $v=\tan(x/2)$. I don't think it helps much in understanding, but it is a worthwhile trick to know. www-math.mit.edu/~djk/18_01/chapter24/section03.html – Thomas Andrews Mar 19 '14 at 1:17
• Thomas, thanks a lot. – sidneimv Mar 19 '14 at 1:32

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|$