In calculus, the integral of the secant function can be evaluated using a variety of methods and there are multiple ways of expressing the antiderivative, all of which can be shown to be equivalent via trigonometric identities,

$\int \sec \theta \,d\theta ={\begin{cases}{\dfrac {1}{2))\ln \left|{\dfrac {1+\sin \theta }{1-\sin \theta ))\right|+C\\[15pt]\ln \left|\sec \theta +\tan \theta \right|+C\\[15pt]\ln \left|\tan \left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right)\right|+C\\[15pt]\end{cases))$ This formula is useful for evaluating various trigonometric integrals. In particular, it can be used to evaluate the integral of the secant cubed, which, though seemingly special, comes up rather frequently in applications.

## Proof that the different antiderivatives are equivalent

### Trigonometric forms

$\int \sec \theta \,d\theta =\left\((\begin{array}{l}{\dfrac {1}{2))\ln \left|{\dfrac {1+\sin \theta }{1-\sin \theta ))\right|+C\\[15pt]\ln \left|\sec \theta +\tan \theta \right|+C\\[15pt]\ln \left|\tan \left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right)\right|+C\end{array))\right\}{\text{ (equivalent forms)))$ The second of these follows by first multiplying top and bottom of the interior fraction by $(1+\sin \theta )$ . This gives $1-\sin ^{2}\theta =\cos ^{2}\theta$ in the denominator and the result follows by moving the factor of 1/2 into the logarithm as a square root. Leaving out the constant of integration for now,

{\begin{aligned}{\dfrac {1}{2))\ln \left|{\dfrac {1+\sin \theta }{1-\sin \theta ))\right|&={\dfrac {1}{2))\ln \left|{\dfrac {1+\sin \theta }{1-\sin \theta ))\cdot {\dfrac {1+\sin \theta }{1+\sin \theta ))\right|={\dfrac {1}{2))\ln \left|{\dfrac {(1+\sin \theta )^{2)){1-\sin ^{2}\theta ))\right|={\dfrac {1}{2))\ln \left|{\dfrac {(1+\sin \theta )^{2)){\cos ^{2}\theta ))\right|\\[6pt]&={\dfrac {1}{2))\ln \left({\dfrac {1+\sin \theta }{\cos \theta ))\right)^{2}=\ln {\sqrt {\left({\dfrac {1+\sin \theta }{\cos \theta ))\right)^{2))}=\ln \left|{\dfrac {1+\sin \theta }{\cos \theta ))\right|=\ln |\sec \theta +\tan \theta |.\end{aligned)) The third form follows by replacing $\sin \theta$ by $-\cos(\theta +\pi /2)$ and expanding using the identities for $\cos 2x$ . It may also be obtained directly by means of the following substitutions:

{\begin{aligned}\sec \theta ={\frac {1}{\sin \left(\theta +{\dfrac {\pi }{2))\right)))={\frac {1}{2\sin \left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right)\cos \left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right)))={\frac {\sec ^{2}\left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right)}{2\tan \left({\dfrac {\theta }{2))+{\dfrac {\pi }{4))\right))).\end{aligned)) The conventional solution for the Mercator projection ordinate may be written without the modulus signs since the latitude $\varphi$ lies between $-{\frac {\pi }{2))$ and ${\frac {\pi }{2))$ ,

$y=\ln \tan \!\left({\frac {\varphi }{2))+{\frac {\pi }{4))\right).$ ### Hyperbolic forms

Let

{\begin{aligned}\psi &=\ln(\sec \theta +\tan \theta ),\\e^{\psi }&=\sec \theta +\tan \theta ,\\\sinh \psi &={\frac {1}{2))(e^{\psi }-e^{-\psi })=\tan \theta ,\\\cosh \psi &={\sqrt {1+\sinh ^{2}\psi ))=\sec \theta ,\\\tanh \psi &=\sin \theta .\end{aligned)) Therefore,

{\begin{aligned}\int \sec \theta \,d\theta &=\psi =\tanh ^{-1}\!\left(\sin \theta \right)=\sinh ^{-1}\!\left(\tan \theta \right)=\cosh ^{-1}\!\left(\sec \theta \right).\end{aligned)) ## History

The integral of the secant function was one of the "outstanding open problems of the mid-seventeenth century", solved in 1668 by James Gregory. He applied his result to a problem concerning nautical tables. In 1599, Edward Wright evaluated the integral by numerical methods – what today we would call Riemann sums. He wanted the solution for the purposes of cartography – specifically for constructing an accurate Mercator projection. In the 1640s, Henry Bond, a teacher of navigation, surveying, and other mathematical topics, compared Wright's numerically computed table of values of the integral of the secant with a table of logarithms of the tangent function, and consequently conjectured that

$\int _{0}^{\theta }\sec \theta \,d\theta =\ln \left|\tan \left({\frac {\theta }{2))+{\frac {\pi }{4))\right)\right|.$ This conjecture became widely known, and in 1665, Isaac Newton was aware of it.

## Evaluations

### By a standard substitution (Gregory's approach)

A standard method of evaluating the secant integral presented in various references involves multiplying the numerator and denominator by $\sec \theta +\tan \theta$ and then substituting the following to the resulting expression: $u=\sec \theta +\tan \theta$ and $du=(\sec \theta \tan \theta +\sec ^{2}\theta )\,d\theta$ . This substitution can be obtained from the derivatives of secant and tangent added together, which have secant as a common factor.

Starting with

${\frac {d}{d\theta ))\sec \theta =\sec \theta \tan \theta \quad {\text{and))\quad {\frac {d}{d\theta ))\tan \theta =\sec ^{2}\theta ,$ ${\frac {d}{d\theta ))(\sec \theta +\tan \theta )=\sec \theta \tan \theta +\sec ^{2}\theta =\sec \theta (\tan \theta +\sec \theta ).$ The derivative of the sum is thus equal to the sum multiplied by $\sec \theta$ . This enables multiplying $\sec \theta$ by $\sec \theta +\tan \theta$ in the numerator and denominator and performing the following substitutions: $u=\sec \theta +\tan \theta$ and $du=(\sec \theta \tan \theta +\sec ^{2}\theta )\,d\theta$ .

The integral is evaluated as follows:

{\begin{aligned}\int \sec \theta \,d\theta &=\int {\frac {\sec \theta (\sec \theta +\tan \theta )}{\sec \theta +\tan \theta ))\,d\theta \\[6pt]&=\int {\frac {(\sec ^{2}\theta +\sec \theta \tan \theta )\,d\theta }{\sec \theta +\tan \theta ))&&u=\sec \theta +\tan \theta \\[6pt]&=\int {\frac {du}{u))&&du=(\sec \theta \tan \theta +\sec ^{2}\theta )\,d\theta \\[6pt]&=\ln |u|+C=\ln |\sec \theta +\tan \theta |+C,\end{aligned)) as claimed. This was the formula discovered by James Gregory.

### By partial fractions and a substitution (Barrow's approach)

Although Gregory proved the conjecture in 1668 in his Exercitationes Geometricae, the proof was presented in a form that renders it nearly impossible for modern readers to comprehend; Isaac Barrow, in his Geometrical Lectures of 1670, gave the first "intelligible" proof, though even that was "couched in the geometric idiom of the day." Barrow's proof of the result was the earliest use of partial fractions in integration. Adapted to modern notation, Barrow's proof began as follows:

$\int \sec \theta \,d\theta =\int {\frac {d\theta }{\cos \theta ))=\int {\frac {\cos \theta \,d\theta }{\cos ^{2}\theta ))=\int {\frac {\cos \theta \,d\theta }{1-\sin ^{2}\theta ))$ Substituting $u$ for $\sin \theta$ reduces the integral to

{\begin{aligned}\int {\frac {du}{1-u^{2))}&=\int {\frac {du}{(1+u)(1-u)))={\dfrac {1}{2))\int \left({\frac {1}{1+u))+{\frac {1}{1-u))\right)\,du\\[10pt]&={\frac {1}{2))\left(\ln \left|1+u\right|-\ln \left|1-u\right|\right)+C={\frac {1}{2))\ln \left|{\frac {1+u}{1-u))\right|+C\end{aligned)) Therefore,

$\int \sec \theta \,d\theta ={\frac {1}{2))\ln \left|{\frac {1+\sin \theta }{1-\sin \theta ))\right|+C,$ as expected.

### By the Weierstrass substitution

#### Standard

The formulas for the Weierstrass substitution are as follows. Let $t=\tan(\theta /2)$ , where $-\pi <\theta <\pi$ . Then

$\sin \left({\frac {\theta }{2))\right)={\frac {t}{\sqrt {1+t^{2))))\qquad {\text{and))\qquad \cos \left({\frac {\theta }{2))\right)={\frac {1}{\sqrt {1+t^{2)))).$ Hence,

$\sin \theta ={\frac {2t}{1+t^{2))},\qquad \cos \theta ={\frac {1-t^{2)){1+t^{2))},\qquad {\text{and))\qquad d\theta ={\frac {2}{1+t^{2))}\,dt,$ by the double-angle formulas. As for the integral of the secant function,

{\begin{aligned}\int \sec \theta \,d\theta &=\int {\frac {d\theta }{\cos \theta ))=\int {\frac {1+t^{2)){1-t^{2))}{\frac {2}{1+t^{2))}dt&&t=\tan {\frac {\theta }{2))\\[6pt]&=\int {\frac {2\,dt}{1-t^{2))}=\int {\frac {2\,dt}{(1-t)(1+t)))\\[6pt]&=\int 2\left[{\frac {1}{2(1+t)))+{\frac {1}{2(1-t)))\right]dt&&{\text{partial fraction decomposition))\\[6pt]&=\int \left({\frac {1}{t+1))-{\frac {1}{t-1))\right)dt\\[6pt]&=\ln |t+1|-\ln |t-1|+C=\ln \left|{\frac {t+1}{t-1))\right|+C\\[6pt]&=\ln \left|{\frac {t+1}{t-1))\cdot {\frac {t+1}{t+1))\right|+C=\ln \left|{\frac {t^{2}+2t+1}{t^{2}-1))\right|+C\\[6pt]&=\ln \left|{\frac {t^{2}+1}{t^{2}-1))+{\frac {2t}{t^{2}-1))\right|+C=\ln \left|{\frac {t^{2}+1}{t^{2}-1))+{\frac {2t}{t^{2}-1))\cdot {\frac {t^{2}+1}{t^{2}+1))\right|+C\\[6pt]&=\ln \left|{\frac {t^{2}+1}{t^{2}-1))+{\frac {2t}{t^{2}+1))\cdot {\frac {t^{2}+1}{t^{2}-1))\right|+C\\[6pt]&=\ln \left|{\frac {1}{\cos \theta ))+\sin \theta \cdot {\frac {1}{\cos \theta ))\right|+C=\ln |\sec \theta +\tan \theta |+C,\end{aligned)) as before.

#### Non-standard

The integral can also be derived by using the a somewhat non-standard version of the Weierstrass substitution, which is simpler in the case of this particular integral, published in 2013, is as follows:

{\begin{aligned}&x=\tan \left({\frac {\pi }{4))+{\frac {\theta }{2))\right)\\[10pt]&{\frac {2x}{1+x^{2))}=2\sin \left({\frac {\pi }{4))+{\frac {\theta }{2))\right)\cos \left({\frac {\pi }{4))+{\frac {\theta }{2))\right)=\sin \left({\frac {\pi }{2))+\theta \right)=\cos \theta \\[10pt]&dx={\frac {1}{2))\sec ^{2}\left({\frac {\pi }{4))+{\frac {\theta }{2))\right)d\theta ={\frac {1}{2))(1+x^{2})d\theta \\[10pt]&{\frac {2\,dx}{1+x^{2))}=d\theta \\[10pt]\int \sec \theta \,d\theta &=\int \left({\frac {1+x^{2)){2x))\right)\left({\frac {2}{1+x^{2))}\right)\,dx=\int {\frac {dx}{x))=\ln |x|+C=\ln \left|\tan \left({\frac {\pi }{4))+{\frac {\theta }{2))\right)\right|+C.\end{aligned)) ### By two successive substitutions

The integral can also be solved by manipulating the integrand and substituting twice. Using the definition $\sec x={\frac {1}{\cos x))$ , the integral can be rewritten as

$\int \sec xdx=\int {\frac {1}{\cos x))dx=\int {\frac {\cos x}{\cos ^{2}x))dx$ Using the identity $\cos ^{2}x+\sin ^{2}x=1$ , the integrand can be written as

$\int {\frac {\cos x}{\cos ^{2}x))dx=\int {\frac {\cos x}{1-\sin ^{2}x))dx$ Substituting $u$ for $\sin x$ reduces the integral to

$\int {\frac {1}{1-u^{2))}du$ The reduced integral can be evaluated by substituting $u$ for $\tanh t$ and using the identity $1-\tanh ^{2}t=\operatorname {sech} ^{2}t$ .

$\int {\frac {\operatorname {sech} ^{2}t}{1-\tanh ^{2}t))dt=\int {\frac {\operatorname {sech} ^{2}t}{\operatorname {sech} ^{2}t))dt=\int dt$ The integral is now reduced to a simple integral and back-substituting gives

$\int dt=t+C=\operatorname {artanh} u+C=\operatorname {artanh} (\sin x)+C$ which is one of the hyperbolic forms of the integral.

A similar strategy can be used to integrate the cosecant, hyperbolic secant, and hyperbolic cosecant functions.

## Gudermannian and Lambertian

The integral of the secant function defines the Lambertian function, which is the inverse of the Gudermannian function:

$\int \sec \theta \,d\theta =\operatorname {lam} (\theta )=\operatorname {gd} ^{-1}(\theta ).$ This is encountered in the theory of map projections: the Mercator projection of a point with longitude θ and latitude φ may be written as:

$(x,y)=(\theta ,\operatorname {lam} (\varphi )).$ 