TITLE: Proof of formula for the antiderivative of $\sec x$
QUESTION [5 upvotes]: How do I prove that indefinite integral of $\sec x$ is equal to $\ln(\sec x + \tan x) + C$?
I tried to substitute $t = \cos x$ but that didn't help. I have no idea how to integrate it any other way, and my textbook doesn't offer a derivation.

REPLY [6 votes]: $$\sec x=\frac1{\cos x}=\frac{\cos x}{\cos^2x}=\frac{\cos x}{1-\sin^2x}$$
Substitute $u=\sin x$ and use the method of partial fractions.
Since
$$\frac1{1-u^2}=\frac12\left(\frac1{1+u}+\frac1{1-u}\right)$$
we get
$$\int\sec xdx=\int\frac{du}{1-u^2}=\frac12(\ln(1+u)-\ln(1-u))=\ln\sqrt{\frac{1+u}{1-u}}.$$
Now
$$\frac{1+u}{1-u}=\frac{1+\sin x}{1-\sin x}=\frac{(1+\sin x)^2}{1-\sin^2x}=\frac{(1+\sin x)^2}{\cos^2x}=\left(\frac{1+\sin x}{\cos x}\right)^2=(\sec x+\tan x)^2$$
so
$$\int\sec xdx=\ln\sqrt{\frac{1+u}{1-u}}=\ln\sqrt{(\sec x+\tan x)^2}=\ln|\sec x+\tan x|.$$

REPLY [5 votes]: As Travis noted, differentiation is the best way to do this.
But strangely enough, this very question was an important open question in the mid-17th century (before the invention of Calculus).  See e.g. this web page of mine