Proof of formula for the antiderivative of $\sec x$ 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.
 A: $$\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|.$$
A: 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
A: It's typically very easy to verify whether a function $F(x)$ is an antiderivative of a function $f(x)$; by definition, you need only check that
$$F'(x) = f(x).$$
In this case, on, say, $\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$,
$$\frac{d}{dx} \log(\sec x + \tan x) = \frac{\frac{d}{dx}(\sec x + \tan x)}{\sec x + \tan x} = \frac{\sec x \tan x + \sec^2 x}{\sec x + \tan x} = \frac{(\sec x + \tan x) \sec x}{\sec x + \tan x} = \sec x,$$
and so (by definition)
$$\int \sec x \, dx = \log |\sec x + \tan x| + C.$$
(Here the absolute value signs simply account for the possibility that you're integrating over an interval on which $\sec x + \tan x < 0$, and you can justify this formula by using the identities $\sec(x + \pi) = -\sec x$ and $\tan (x + \pi) = \tan x$.)
A: Hint: Write $$\sec x = \sec x \left(\frac{\sec x + \tan x}{\sec x + \tan x}\right)$$ and remember what the derivatives of $\sec x$ and $\tan x$  are.
