Integral of $\sec (x)$? I was wondering why can't you apply the following when dealing with $\sec (x)$
$1$- convert $$\sec (x) = \frac{1}{\cos (x)}$$
2- Integrate $$\int \frac{1}{\cos (x)} d(\cos x)= \ln \left\lvert \cos x \right\rvert.$$
I know the standard process of finding the integral of $\sec (x)$. I know that the aforementioned steps are incorrect. But, I want a mathematical reason as to why we don't proceed in that way.
 A: Tangent half-angle substitution is also a simple way to solve the problem $t=\tan(\frac x2)$, $dx=2\frac{dt}{1+t^2}$, $\cos(t)=\frac{1-t^2}{1+t^2}$. Using all of that $$I=\int \frac{dx}{\cos(x)}=\int \frac{1+t^2}{1-t^2}\frac{2}{1+t^2}dt=2\int \frac{dt}{1-t^2}=\int \Big(\frac 1{1+t}+\frac 1{1-t}\Big)\,dt$$ $$I=\log\Big(\frac {1+t}{1-t}\Big)=\log\Big(\frac {1+\tan \left(\frac{x}{2}\right)}{1-\tan \left(\frac{x}{2}\right)}\Big)=\log\Big(\frac {\cos \left(\frac{x}{2}\right)+\sin \left(\frac{x}{2}\right)} {\cos \left(\frac{x}{2}\right)-\sin \left(\frac{x}{2}\right)}\Big)$$
A: Note,
$$\frac{d}{dx} \sec (x)=\sec (x) \tan (x)$$
And,
$$\frac{d}{dx} \tan x=\sec^2 (x)$$
So adding results and factoring gives,
$$\frac{d}{dx}(\sec x+ \tan x)=\sec x(\sec x+\tan x)$$
Which means,
$$\frac{\frac{d}{dx}(\sec x + \tan x)}{\sec x + \tan x}=\sec x$$
But $\frac{1}{u}\frac{du}{dx}$ is the logarithmic derivative, it is equal to $\frac{d}{dx}\ln u$ by the chain rule. So we have,
$$\frac{d}{dx}(\ln (\sec x+\tan x))=\sec x$$
A: The derivative of $\ln|\cos x|$ is $\frac{-\sin x}{\cos x}=-\tan x$. More generally, it's $\frac{f'(x)}{f(x)}$ that integrates to $\ln|f(x)|$, not $\frac1{f(x)}$. This is due to the chain rule.
A: 1) Multiply top and bottom by $$\sec(x) + \tan(x)$$
2) Let $u ~=~ \sec(x) + \tan(x)$
3) Notice that $\sec(x) \cdot (\sec(x) + \tan(x)) ~\mathrm d~x ~=~ \mathrm d~u$
4) You end up having to integrate $\frac{\mathrm d~u}u = \ln\lvert u\rvert$
Overall, you obtain $\ln \lvert\sec(x) + \tan(x)\rvert + C$
The reason why your process is incorrect is because you are using a wrong identity. 
$$\int \frac{1}{x} dx = ln(x)$$
only holds in that form and no other form. You can't do
$$\int \frac{1}{f(x)} dx = ln\left\lvert f(x)\right\rvert$$
That is simply wrong.
A: here is my totally different approach to your integral:
Verify $\int\sec x\ dx=\frac12 \ln \left\lvert\frac{1+\sin x}{1-\sin x}\right\rvert + C$
Just another way of looking at it. There are actually many ways to do this integral. Another nice way of looking at it , is to multiply top and bottom by $\cos{x}$ and use $\cos^2{x}=1-\sin^2{x}$ in the denominator. Then perform a u-sub. Can you see which one?
